/* ============================================================
   CUADRANTE DE TURNOS — App Stylesheet (v6)
   Paleta sanitaria aragonesa: teal + slate + warm neutrals
   ============================================================ */

:root {
    --bg: #f0f5f4;
    --bg-card: #ffffff;
    --bg-input: #f6f9f8;
    --bg-hover: #e8efed;
    --text: #1a2e2a;
    --text-secondary: #4a6660;
    --text-muted: #8da5a0;
    --border: #d4e0dd;
    --border-focus: #0f766e;
    --accent: #0f766e;
    --accent-hover: #0d6b63;
    --accent-light: #e6f5f3;
    --accent-50: rgba(15,118,110,.08);
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;

    /* Turnos */
    --turno-m: #ea580c;
    --turno-m-bg: #fff7ed;
    --turno-m-border: #fdba74;
    --turno-t: #2563eb;
    --turno-t-bg: #eff6ff;
    --turno-t-border: #93c5fd;
    --turno-n: #7c3aed;
    --turno-n-bg: #f5f3ff;
    --turno-n-border: #c4b5fd;
    --turno-s: #ca8a04;
    --turno-s-bg: #fefce8;
    --turno-s-border: #fde047;
    --turno-l: #059669;
    --turno-l-bg: #ecfdf5;
    --turno-l-border: #6ee7b7;
    --descanso: #e2e8f0;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 5px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 4px rgba(0,0,0,.06), 0 2px 6px rgba(0,0,0,.03);
    --shadow-lg: 0 4px 20px rgba(0,0,0,.08);
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --transition: .2s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.55;
    min-height: 100vh;
}

/* ============ HEADER ============ */
.app-header {
    background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(15,118,110,.2);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand { display: flex; align-items: center; gap: .7rem; }

.brand-icon {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.15);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
}

.brand-icon svg { opacity: .95; }

.brand-name {
    font-size: 1.05rem; font-weight: 700;
    line-height: 1.2; letter-spacing: -.01em; color: #fff;
}

.brand-sub { font-size: .72rem; color: rgba(255,255,255,.7); font-weight: 400; }

.header-actions { display: flex; gap: .4rem; align-items: center; }

.header-actions .btn {
    color: rgba(255,255,255,.9);
    border-color: rgba(255,255,255,.25);
    font-size: .8rem;
    padding: .4rem .8rem;
}

.header-actions .btn:hover {
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.4);
    color: #fff;
}

/* Export dropdown */
.export-wrap { position: relative; }

.export-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    z-index: 200;
    overflow: hidden;
}

.export-dropdown.open { display: block; }

.export-dropdown button {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
    padding: .65rem 1rem;
    font-family: var(--font);
    font-size: .82rem;
    color: var(--text);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.export-dropdown button:hover { background: var(--accent-light); }

.export-dropdown button small { color: var(--text-muted); font-size: .72rem; display: block; }

.export-sep {
    height: 1px;
    background: var(--border);
    margin: 0;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .5rem 1rem;
    font-family: var(--font); font-size: .85rem; font-weight: 500;
    border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
    transition: all var(--transition); white-space: nowrap; line-height: 1.3;
}

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 10px rgba(15,118,110,.3); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-generate {
    padding: .7rem 1.6rem; font-size: .95rem; font-weight: 600;
    border-radius: var(--radius);
}

.btn-sm { padding: .35rem .7rem; font-size: .78rem; }

.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-nav { gap: .3rem; padding: .4rem .6rem; font-size: .8rem; }

/* ============ MAIN ============ */
.app-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* ============ STEPPER ============ */
.stepper {
    display: flex; align-items: center; justify-content: center;
    gap: 0; margin-bottom: 1.75rem; padding: 0 1rem;
}

.step {
    display: flex; align-items: center; gap: .45rem;
    cursor: default; opacity: .35; transition: opacity var(--transition);
}

.step.active, .step.done { opacity: 1; }

.step-num {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--border);
    font-size: .78rem; font-weight: 600; color: var(--text-secondary);
    transition: all var(--transition);
}

.step.active .step-num { background: var(--accent); color: #fff; }
.step.done .step-num { background: var(--success); color: #fff; }

.step-label { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }
.step.active .step-label { color: var(--text); font-weight: 600; }

.step-line { flex: 0 0 36px; height: 2px; background: var(--border); margin: 0 .4rem; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .3rem; letter-spacing: -.01em; color: var(--text); }

.card-desc { color: var(--text-secondary); font-size: .85rem; margin-bottom: 1.25rem; }

/* ============ FORM STEPS ============ */
.form-step { display: none; animation: fadeIn .25s ease; }
.form-step.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ FIELDS ============ */
.field { margin-bottom: 1.2rem; }

.field label {
    display: block; font-size: .78rem; font-weight: 600;
    color: var(--text-secondary); margin-bottom: .35rem;
    text-transform: uppercase; letter-spacing: .04em;
}

.field-hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-muted); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

input[type="date"], input[type="number"], input[type="text"], input[type="time"], select {
    width: 100%; padding: .55rem .7rem;
    font-family: var(--font); font-size: .88rem;
    border: 1px solid var(--border); border-radius: var(--radius-xs);
    background: var(--bg-input); color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus, select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(15,118,110,.1);
}

input.error, select.error { border-color: var(--danger); background: var(--danger-light); }

.field-error {
    display: none; font-size: .76rem; color: var(--danger);
    font-weight: 500; margin-top: .3rem; line-height: 1.3;
}
.field-error.visible { display: block; }

/* ============ WEEKS CONFIGURATOR ============ */
.weeks-config { display: flex; flex-direction: column; gap: .5rem; }
.weeks-input-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.weeks-label { font-size: .83rem; color: var(--text-secondary); }

.weeks-quick { display: flex; gap: .3rem; flex-wrap: wrap; }

.btn-chip {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .25rem .65rem;
    font-family: var(--font); font-size: .75rem; font-weight: 500;
    color: var(--text-secondary); background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 20px;
    cursor: pointer; transition: all var(--transition);
}

.btn-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-chip.active { border-color: var(--accent); color: #fff; background: var(--accent); }

/* ============ RADIO GROUP ============ */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.radio-card { cursor: pointer; }
.radio-card input { display: none; }

.radio-card-inner {
    border: 2px solid var(--border); border-radius: var(--radius);
    padding: .85rem 1rem; transition: all var(--transition);
}

.radio-card-inner strong { display: block; font-size: .9rem; margin-bottom: .1rem; }
.radio-card-inner span { font-size: .78rem; color: var(--text-secondary); }

.radio-card input:checked + .radio-card-inner { border-color: var(--accent); background: var(--accent-light); }

/* ============ WORKER LIST ============ */
.worker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .45rem; }

.worker-input-wrap { display: flex; align-items: center; gap: .4rem; }
.worker-input-wrap .worker-num {
    font-size: .72rem; font-weight: 600; color: var(--text-muted);
    font-family: var(--mono); min-width: 1.6rem; text-align: right;
}
.worker-input-wrap input { flex: 1; }

/* ============ SHIFTS GRID ============ */
.shifts-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .85rem; margin-bottom: 1rem;
}

.shift-card {
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; transition: border-color var(--transition);
}
.shift-card:hover { border-color: var(--text-muted); }

.shift-header { display: flex; align-items: center; gap: .55rem; margin-bottom: .85rem; }

.shift-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius-xs);
    font-weight: 700; font-size: .9rem; font-family: var(--mono);
}

.shift-badge-M { background: var(--turno-m-bg); color: var(--turno-m); border: 1px solid var(--turno-m-border); }
.shift-badge-T { background: var(--turno-t-bg); color: var(--turno-t); border: 1px solid var(--turno-t-border); }
.shift-badge-N { background: var(--turno-n-bg); color: var(--turno-n); border: 1px solid var(--turno-n-border); }

.shift-name { font-weight: 600; font-size: .92rem; }

.shift-times { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .75rem; }
.shift-times .field { margin-bottom: 0; }

.shift-hours-calc {
    font-size: .76rem; color: var(--text-muted); text-align: center;
    margin-bottom: .65rem; font-family: var(--mono);
}

.toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: .5rem .7rem; background: var(--bg-input);
    border-radius: var(--radius-xs); margin-bottom: .35rem;
    transition: opacity var(--transition);
}
.toggle-row:last-child { margin-bottom: 0; }

.toggle-dependent.disabled { opacity: .45; pointer-events: none; }
.toggle-dependent .toggle-label::before { content: '↳ '; color: var(--text-muted); }

.toggle-label { font-size: .8rem; font-weight: 500; color: var(--text-secondary); }

.toggle { position: relative; width: 38px; height: 21px; }
.toggle input { display: none; }

.toggle-slider {
    position: absolute; inset: 0;
    background: var(--border); border-radius: 11px;
    cursor: pointer; transition: background var(--transition);
}
.toggle-slider::after {
    content: ''; position: absolute; top: 2.5px; left: 2.5px;
    width: 16px; height: 16px; background: #fff; border-radius: 50%;
    transition: transform var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::after { transform: translateX(17px); }

/* ============ INFO BOX ============ */
.info-box {
    display: flex; gap: .55rem; align-items: flex-start;
    padding: .75rem .9rem; background: var(--accent-light);
    border: 1px solid rgba(15,118,110,.12);
    border-radius: var(--radius-xs); margin-bottom: 1rem;
}
.info-box p { font-size: .8rem; color: var(--text-secondary); line-height: 1.45; }
.info-box svg { flex-shrink: 0; margin-top: 1px; }

/* ============ RATIOS ============ */
.ratios-section { margin-bottom: 1.25rem; }
.ratios-section-title {
    font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-secondary); margin-bottom: .65rem;
    padding-bottom: .35rem; border-bottom: 1px solid var(--border);
}
.ratios-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .55rem; }
.ratio-field { display: flex; flex-direction: column; gap: .25rem; }
.ratio-field label { font-size: .75rem; font-weight: 500; color: var(--text-muted); }

/* ============ STEP ACTIONS ============ */
.step-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border);
}

/* ============ RESULTS ============ */
.results-summary { margin-bottom: 1.25rem; }

.summary-header { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.summary-title-wrap { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

/* Status badge */
.status-badge {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .2rem .65rem; border-radius: 20px; font-size: .72rem; font-weight: 600;
    letter-spacing: .02em; text-transform: uppercase;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }

.status-optimo { background: var(--success-light); color: var(--success); }
.status-optimo .status-dot { background: var(--success); }
.status-factible { background: var(--warning-light); color: var(--warning); }
.status-factible .status-dot { background: var(--warning); }
.status-inviable { background: var(--danger-light); color: var(--danger); }
.status-inviable .status-dot { background: var(--danger); }

.warnings-box {
    background: var(--warning-light); border: 1px solid #fbbf24;
    border-radius: var(--radius-xs); padding: .7rem .9rem;
    margin: .65rem 0 .85rem; font-size: .8rem; color: #92400e; line-height: 1.45;
}
.warnings-box strong { display: block; margin-bottom: .3rem; font-size: .82rem; }
.warnings-box ul { margin: 0; padding-left: 1.1rem; }
.warnings-box li { margin-bottom: .15rem; }

.warnings-critical {
    background: #fef2f2;
    border: 2px solid var(--danger);
    color: #7f1d1d;
}
.warnings-critical strong { color: var(--danger); font-size: .9rem; }

.warnings-high {
    background: #fff7ed;
    border: 2px solid #ea580c;
    color: #7c2d12;
}
.warnings-high strong { color: #c2410c; font-size: .9rem; }
.warnings-note {
    margin-top: .5rem; font-size: .76rem; font-style: italic;
    color: #9a3412; padding-top: .4rem; border-top: 1px solid #fed7aa;
}

/* Celda con excepción: marcador triangular en esquina */
.cell-exception {
    position: relative;
    box-shadow: inset 0 0 0 2px var(--danger);
}
.exc-badge {
    position: absolute;
    top: 1px;
    right: 3px;
    font-size: .65rem;
    font-weight: 900;
    color: var(--danger);
    line-height: 1;
    pointer-events: none;
}

/* Banner de excepciones en vista individual */
.worker-exceptions-banner {
    background: #fff7ed;
    border: 2px solid #ea580c;
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    margin: .75rem 0 1rem;
    color: #7c2d12;
    font-size: .85rem;
    line-height: 1.5;
}
.worker-exceptions-banner strong { color: #c2410c; display: block; margin-bottom: .4rem; }
.worker-exceptions-banner ul { margin: 0; padding-left: 1.2rem; }
.worker-exceptions-banner li { margin-bottom: .2rem; }
.worker-exceptions-banner .exc-note {
    margin-top: .5rem;
    font-size: .76rem;
    font-style: italic;
    color: #9a3412;
    padding-top: .4rem;
    border-top: 1px solid #fed7aa;
}

/* Fila con excepciones en tabla de equidad */
table.equity tr.eq-row-exception {
    background: #fff7ed;
}
table.equity tr.eq-row-exception td { border-color: #fed7aa; }
table.equity td.exc-cell {
    background: #fed7aa;
    color: #7c2d12;
    font-weight: 700;
}
table.equity td.eq-ok {
    color: var(--text-muted);
}

.coverage-info {
    background: var(--accent-light); border: 1px solid rgba(15,118,110,.15);
    border-radius: var(--radius-xs); padding: .55rem .85rem;
    margin-bottom: .85rem; font-size: .8rem; color: var(--accent);
}

.summary-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: .65rem; margin-top: .85rem;
}

.summary-item {
    text-align: center; padding: .6rem .5rem;
    background: var(--bg-input); border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}

.summary-value { font-size: 1.35rem; font-weight: 700; font-family: var(--mono); color: var(--accent); line-height: 1.2; }
.summary-label { font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .15rem; }

/* ============ TABS ============ */
.results-tabs {
    display: flex; gap: .2rem; margin-bottom: 1rem;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .25rem;
}

.tab {
    flex: 1; padding: .5rem .8rem;
    font-family: var(--font); font-size: .82rem; font-weight: 500;
    color: var(--text-muted); background: transparent;
    border: none; border-radius: var(--radius-sm);
    cursor: pointer; transition: all var(--transition);
}
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.active { color: #fff; background: var(--accent); font-weight: 600; }

.tab-content { display: none; animation: fadeIn .2s ease; }
.tab-content.active { display: block; }

/* ============ SCHEDULE TABLE ============ */
.general-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .85rem; flex-wrap: wrap; }
.section-heading { font-size: 1rem; font-weight: 700; color: var(--text); }

.schedule-table-wrap { overflow-x: auto; margin: .5rem 0; -webkit-overflow-scrolling: touch; }

.week-block { margin-bottom: 1.25rem; padding-bottom: .85rem; border-bottom: 1px solid var(--border); }
.week-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.week-label { font-size: .8rem; font-weight: 700; color: var(--text-secondary); margin-bottom: .4rem; }

table.schedule { width: 100%; border-collapse: collapse; font-size: .8rem; }

table.schedule th, table.schedule td {
    padding: .35rem .45rem; text-align: center;
    border: 1px solid var(--border); white-space: nowrap;
}

table.schedule th {
    background: var(--bg-input); font-weight: 600;
    color: var(--text-secondary); font-size: .7rem;
    text-transform: uppercase; letter-spacing: .02em;
}

table.schedule th.col-worker {
    text-align: left;
    min-width: 110px;
    width: 110px;
}

table.schedule td.cell-worker {
    text-align: left;
    font-weight: 600;
    font-size: .78rem;
    background: var(--bg-input);
    min-width: 110px;
    width: 110px;
    color: var(--text);
}

table.schedule .cell-turno-M { background: var(--turno-m-bg); color: var(--turno-m); font-weight: 700; font-family: var(--mono); font-size: .78rem; }
table.schedule .cell-turno-T { background: var(--turno-t-bg); color: var(--turno-t); font-weight: 700; font-family: var(--mono); font-size: .78rem; }
table.schedule .cell-turno-N { background: var(--turno-n-bg); color: var(--turno-n); font-weight: 700; font-family: var(--mono); font-size: .78rem; }
table.schedule .cell-turno-S { background: var(--turno-s-bg); color: var(--turno-s); font-weight: 600; font-family: var(--mono); font-size: .78rem; }
table.schedule .cell-turno-L { background: var(--turno-l-bg); color: var(--turno-l); font-weight: 600; font-family: var(--mono); font-size: .78rem; }
table.schedule .cell-turno-D { background: var(--descanso); color: var(--text-muted); font-size: .72rem; }
table.schedule .cell-nowork { background: #f8fafb; color: #d1d5db; font-size: .72rem; }

table.schedule th.weekend { background: #fef2f2; color: #b91c1c; }
table.schedule .schedule-individual td { padding: .4rem .5rem; }

/* ============ LEGEND ============ */
.legend { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; font-size: .78rem; }
.legend-label { font-weight: 600; color: var(--text-secondary); }
.legend-item { display: inline-flex; align-items: center; gap: .3rem; }

.legend-box {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 20px; padding: 0 .35rem;
    border-radius: 4px; font-size: .72rem; font-weight: 700; font-family: var(--mono);
}

.legend-box.cell-turno-M { background: var(--turno-m-bg); color: var(--turno-m); border: 1px solid var(--turno-m-border); }
.legend-box.cell-turno-T { background: var(--turno-t-bg); color: var(--turno-t); border: 1px solid var(--turno-t-border); }
.legend-box.cell-turno-N { background: var(--turno-n-bg); color: var(--turno-n); border: 1px solid var(--turno-n-border); }
.legend-box.cell-turno-S { background: var(--turno-s-bg); color: var(--turno-s); border: 1px solid var(--turno-s-border); }
.legend-box.cell-turno-L { background: var(--turno-l-bg); color: var(--turno-l); border: 1px solid var(--turno-l-border); }
.legend-box.cell-turno-D { background: var(--descanso); color: var(--text-muted); }

.legend-text { color: var(--text-secondary); font-size: .75rem; }
.legend-text small { color: var(--text-muted); font-size: .7rem; }

/* ============ INDIVIDUAL VIEW ============ */
.individual-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.individual-selector { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.individual-selector label { font-weight: 600; font-size: .82rem; color: var(--text-secondary); }
.individual-selector select { width: auto; min-width: 180px; }
.worker-counter { font-size: .78rem; color: var(--text-muted); font-family: var(--mono); }

.individual-header { margin-bottom: 1.25rem; }
.worker-name { font-size: 1.05rem; font-weight: 700; margin-bottom: .65rem; }

.worker-stats-grid, .aggregates-panel {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: .45rem;
}

.stat-box {
    text-align: center; padding: .45rem .35rem;
    background: var(--bg-input); border-radius: var(--radius-xs);
    border: 1px solid var(--border);
}
.stat-box-positive { border-color: var(--success); background: var(--success-light); }
.stat-box-negative { border-color: var(--danger); background: var(--danger-light); }
.stat-value { font-size: 1.05rem; font-weight: 700; font-family: var(--mono); color: var(--text); line-height: 1.2; }
.stat-label { font-size: .62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .1rem; }

/* ============ EQUITY TABLE ============ */
table.equity { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.equity th, table.equity td { padding: .4rem .55rem; text-align: center; border: 1px solid var(--border); }
table.equity th { background: var(--bg-input); font-weight: 600; color: var(--text-secondary); font-size: .7rem; text-transform: uppercase; }
table.equity td:first-child { text-align: left; font-weight: 600; }
table.equity .positive { color: var(--success); font-weight: 600; }
table.equity .negative { color: var(--danger); font-weight: 600; }

.empty-state { color: var(--text-muted); text-align: center; padding: 2rem; font-size: .9rem; }

/* ============ LOADING ============ */
.loading-overlay {
    position: fixed; inset: 0;
    background: rgba(240,245,244,.88); backdrop-filter: blur(4px);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: .85rem;
    z-index: 500;
}

.loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay p { font-size: .88rem; font-weight: 500; color: var(--text-secondary); }

/* ============ TOAST ============ */
.toast {
    position: fixed; bottom: 1.25rem; right: 1.25rem;
    background: var(--danger); color: #fff;
    padding: .7rem 1.1rem; border-radius: var(--radius-sm);
    font-size: .83rem; font-weight: 500; max-width: 420px;
    box-shadow: var(--shadow-lg); z-index: 600; animation: slideUp .3s ease;
}
.toast-success { background: var(--success); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ============ PRINT ============ */
.print-section-title { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .header-inner { padding: .55rem .85rem; }
    .app-main { padding: .85rem; }
    .field-row { grid-template-columns: 1fr; }
    .radio-group { grid-template-columns: 1fr; }
    .shifts-grid { grid-template-columns: 1fr; }
    .stepper { flex-wrap: wrap; gap: .2rem; }
    .step-line { flex: 0 0 18px; }
    .step-label { display: none; }
    .card { padding: 1rem; }
    .summary-grid { grid-template-columns: repeat(3, 1fr); }
    .results-tabs { flex-wrap: wrap; }
    .tab { font-size: .78rem; padding: .45rem .5rem; }
    .individual-nav { gap: .35rem; }
    .worker-stats-grid, .aggregates-panel { grid-template-columns: repeat(3, 1fr); }
    .export-dropdown { right: -1rem; min-width: 220px; }
}

@media (max-width: 480px) {
    html { font-size: 14px; }
    .brand-sub { display: none; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .worker-stats-grid, .aggregates-panel { grid-template-columns: repeat(2, 1fr); }
    .header-actions .btn span.btn-text { display: none; }
}

/* ============ SEO CONTENT SECTION ============ */
.seo-content-below-tool {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem 2.5rem;
}

.seo-container {
    max-width: 760px;
    margin: 0 auto;
    color: var(--text-secondary);
    font-size: .92rem;
    line-height: 1.7;
}

.seo-content-below-tool p {
    margin-bottom: 1rem;
}

.seo-content-below-tool h2 {
    font-family: var(--font);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 2rem 0 .75rem;
    letter-spacing: -.01em;
}

.seo-content-below-tool h3 {
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.5rem 0 .5rem;
}

.seo-content-below-tool h2:first-of-type {
    margin-top: 1.5rem;
}

@media (max-width: 768px) {
    .seo-content-below-tool {
        padding: 2rem 1rem 2rem;
    }

    .seo-content-below-tool h2 {
        font-size: 1.12rem;
    }

    .seo-content-below-tool h3 {
        font-size: .98rem;
    }
}