
.crews {
    padding-block: clamp(28px, 5vw, 48px) clamp(40px, 6vw, 64px);
}

.crews :where(h1, p, dl, dd) {
    margin: 0;
}


.crews-header {
    max-width: 46rem;
    margin-bottom: 28px;
}

.crews-header .sheet-tag {
    margin-bottom: 14px;
}

.crews h1 {
    font: 800 clamp(2rem, 5vw, 3rem) / 1.08 var(--font-display);
    letter-spacing: -0.02em;
}

.crews-lede {
    margin-top: 12px;
    font-size: 1.08rem;
}

.crews-note {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.9rem;
}

.crews-project {
    display: inline-block;
    margin-top: 16px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    background: var(--panel);
    font-size: 0.95rem;
}


.crews input:not([type="hidden"]) {
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    background: var(--control-bg);
    color: var(--text);
    font: inherit;
    font-variant-numeric: tabular-nums;
}

.crews input[type="number"] {
    width: 96px;
}

.crews input:hover {
    border-color: var(--amber);
}

.crews input:focus-visible,
.worker-stepper button:focus-visible,
.crew-table-wrap:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}


.crew-fields {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 20px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-top: 3px solid var(--amber);
    background: var(--panel);
}

.crew-fields label {
    display: grid;
    gap: 6px;
}

.crew-fields label span {
    color: var(--muted);
    font: 600 0.72rem/1.2 var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.crew-fields .crew-name {
    flex: 1 1 240px;
    max-width: 360px;
}

.crew-fields .crew-name input {
    width: 100%;
}


/* Keep the table wide enough to scroll on small screens. */
.crew-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    background: var(--panel);
}

.crew-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
}

.crew-table th,
.crew-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.crew-table tbody tr:last-child > * {
    border-bottom: 0;
}

.crew-table thead th {
    background: var(--sheet);
    color: var(--measure);
    font: 600 0.72rem/1.3 var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
}

.crew-table tbody th {
    font-weight: 600;
}

/* Keep role names visible with a solid background while scrolling. */
.crew-table thead th:first-child,
.crew-table tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
}

.crew-table tbody th {
    border-right: 1px solid var(--line);
    background: var(--panel);
}

.crew-table tbody tr:hover th {
    background: linear-gradient(var(--surface-faint), var(--surface-faint)), var(--panel);
}

.crew-table tbody tr:hover {
    background: var(--surface-faint);
}

.crew-table tbody tr.in-crew {
    background: var(--amber-tint);
}

.crew-table tbody tr.in-crew th {
    background: linear-gradient(var(--amber-tint), var(--amber-tint)), var(--panel);
    box-shadow: inset 3px 0 0 var(--amber);
}

.crew-table td:nth-child(2),
.crew-table [data-cost] {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.crew-table td:nth-child(2) {
    color: var(--muted);
}

.crew-table thead th:last-child,
.crew-table [data-cost] {
    text-align: right;
}

.crew-table [data-cost] {
    color: var(--muted);
}

.crew-table tbody tr.in-crew [data-cost] {
    color: var(--text);
    font-weight: 700;
}

.worker-stepper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.worker-stepper button {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--control-border);
    border-radius: var(--radius);
    background: var(--control-bg);
    color: var(--amber);
    font: 700 1.25rem/1 var(--font-body);
    cursor: pointer;
}

.worker-stepper button:hover:not(:disabled) {
    border-color: var(--amber);
    background: var(--amber-tint);
}

.worker-stepper button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.crews .worker-stepper input {
    width: 56px;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.worker-stepper input::-webkit-inner-spin-button,
.worker-stepper input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}


#crew-error {
    margin-top: 16px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--amber);
    background: var(--amber-tint);
    font-size: 0.95rem;
}

.crew-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-top: 20px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    background: var(--panel);
}

.crew-footer .crews-note {
    flex-basis: 100%;
}

.crew-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 36px;
}

.crew-summary dt {
    color: var(--muted);
    font: 600 0.72rem/1.2 var(--font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.crew-summary dd {
    margin-top: 6px;
    font: 700 1.25rem/1.1 var(--font-display);
    font-variant-numeric: tabular-nums;
}

.crew-summary .crew-total dd {
    color: var(--amber-bright);
    font-size: clamp(1.6rem, 3.5vw, 2.1rem);
}

@media (max-width: 600px) {
    .crew-fields .crew-name {
        max-width: none;
    }

    .crew-footer .btn {
        width: 100%;
    }
}
