:root {
    --bg: #F6F7FB;
    --surface: #FFFFFF;
    --surface-soft: #EEF2FF;
    --primary: #4F46E5;
    --primary-dark: #3730A3;
    --secondary: #06B6D4;
    --text: #172033;
    --muted: #667085;
    --line: #E3E7F0;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --shadow: 0 18px 45px rgba(23, 32, 51, 0.08);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 22px;
    background: #FFFFFF;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 34px;
}

.brand,
.nav-item,
.sidebar-note,
.metric-card,
.panel {
    border: 1px solid var(--line);
    background: var(--surface);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--primary);
    color: white;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small,
.metric-card small,
.employee-cell small,
.file-item small,
.eyebrow,
.progress-box p,
.detail-list dt {
    color: var(--muted);
}

.nav-list {
    display: grid;
    gap: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 8px;
    color: var(--muted);
    font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
    color: var(--primary);
    background: var(--surface-soft);
    border-color: #C7D2FE;
}

.icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
}

.icon svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-icon,
.button-icon svg {
    width: 18px;
    height: 18px;
    display: inline-grid;
}

.button-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-note {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.12);
}

.main-content {
    padding: 34px;
    min-width: 0;
    overflow-x: hidden;
}

.standalone-content {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.error-panel {
    width: min(680px, 100%);
}

.error-panel p:not(.eyebrow) {
    color: var(--muted);
    line-height: 1.6;
}

.topbar,
.section-heading,
.action-row,
.export-actions,
.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
}

.topbar {
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 12px;
    font-weight: 800;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.05;
}

h2 {
    font-size: 20px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.metric-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.metric-card strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
}

.metric-icon,
.drop-icon,
.detail-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    color: white;
    font-weight: 900;
}

.metric-icon.cyan { background: var(--secondary); }
.metric-icon.indigo { background: var(--primary); }
.metric-icon.green { background: var(--success); }
.metric-icon.amber { background: var(--warning); }
.metric-icon.red { background: var(--error); }

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.75fr);
    gap: 18px;
    align-items: start;
    min-width: 0;
}

.results-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.65fr);
    align-items: stretch;
}

.overall-panel {
    margin-top: 18px;
}

.panel {
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    min-width: 0;
}

.compact {
    margin-top: 24px;
}

.dropzone {
    min-height: 270px;
    margin-top: 18px;
    border: 2px dashed #B9C1F8;
    border-radius: 8px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F7F8FF 100%);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--secondary);
    background: #ECFEFF;
    transform: translateY(-2px);
}

.dropzone input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.dropzone strong {
    font-size: 24px;
}

.dropzone span:not(.drop-icon) {
    color: var(--muted);
}

.drop-icon {
    width: 74px;
    height: 74px;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--primary);
    font-size: 34px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 14px;
    margin-top: 14px;
}

.filter-control {
    max-width: 340px;
    margin-top: 18px;
}

.inline-filter {
    min-width: 260px;
    color: var(--muted);
    font-size: 13px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-weight: 700;
}

select,
input[type="number"] {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    color: var(--text);
    background: #FFFFFF;
    outline: none;
}

select:focus,
input[type="number"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.action-row {
    justify-content: flex-start;
    margin-top: 20px;
}

.primary-button,
.secondary-button,
.ghost-button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
    white-space: nowrap;
}

.primary-button {
    background: var(--primary);
    color: white;
    box-shadow: 0 14px 24px rgba(79, 70, 229, 0.22);
}

.secondary-button,
.ghost-button {
    background: #FFFFFF;
    color: var(--primary);
    border: 1px solid #C7D2FE;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.file-list {
    list-style: none;
    padding: 0;
    margin: 18px 0;
    display: grid;
    gap: 12px;
}

.file-item {
    display: grid;
    grid-template-columns: 52px 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAFBFF;
}

.file-remove-button {
    min-height: 32px;
    border: 1px solid #FECACA;
    border-radius: 8px;
    background: #FEF2F2;
    color: #B91C1C;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    padding: 0 10px;
}

.file-remove-button:hover {
    background: #FEE2E2;
}

.file-type,
.employee-cell > span {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--primary);
    font-weight: 900;
    font-size: 12px;
}

.file-item strong,
.file-item small,
.employee-cell strong,
.employee-cell small {
    display: block;
}

.badge {
    min-height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.badge-info { background: #CFFAFE; color: #0E7490; }
.badge-muted { background: #EEF2F7; color: #475467; }
.badge-success { background: #D1FAE5; color: #047857; }
.badge-warning { background: #FEF3C7; color: #B45309; }
.badge-error { background: #FEE2E2; color: #B91C1C; }

.progress-box {
    border-radius: 8px;
    background: #F8FAFC;
    border: 1px solid var(--line);
    padding: 16px;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #E6EAF2;
    margin: 12px 0;
}

.progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 240ms ease;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin-top: 18px;
    -webkit-overflow-scrolling: touch;
}

.employee-picker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.employee-picker {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    font-weight: 800;
    cursor: pointer;
}

.employee-picker span {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--primary);
    font-size: 12px;
}

.employee-picker.active,
.employee-picker:hover {
    border-color: #C7D2FE;
    background: var(--surface-soft);
    color: var(--primary);
}

table {
    width: 100%;
    min-width: 740px;
    border-collapse: collapse;
}

.recap-table {
    min-width: 560px;
}

.overall-table {
    min-width: 1480px;
    font-size: 12px;
}

.overall-table th,
.overall-table td {
    vertical-align: middle;
}

.overall-table th {
    line-height: 1.35;
    white-space: normal;
}

.overall-table td:not(:nth-child(2)) {
    text-align: center;
}

.overall-table td:nth-child(2),
.overall-table th:nth-child(2) {
    min-width: 210px;
}

.overall-table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
}

.overall-table-wrap table {
    margin: 0;
}

th,
td {
    padding: 13px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.recap-table th:last-child,
.recap-table td:last-child {
    text-align: right;
    width: 180px;
}

.highlight-row {
    background: #F8FAFF;
}

th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0;
}

tbody tr {
    cursor: pointer;
    transition: background 140ms ease;
}

tbody tr:hover,
tbody tr.selected {
    background: #F8FAFF;
}

.employee-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compact-cell {
    gap: 10px;
}

.detail-panel {
    position: sticky;
    top: 24px;
    height: 100%;
}

.detail-avatar {
    width: 94px;
    height: 94px;
    margin: 24px auto;
    border-radius: 8px;
    background: linear-gradient(145deg, var(--primary), var(--secondary));
    color: white;
    font-size: 38px;
    font-weight: 900;
    box-shadow: 0 18px 36px rgba(79, 70, 229, 0.24);
}

.detail-list {
    display: grid;
    gap: 12px;
    margin: 0;
}

.detail-list div {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line);
}

.detail-list dd {
    margin: 0;
    font-weight: 800;
}

.status-guide {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 12px;
}

.status-guide h3 {
    margin: 0;
    font-size: 15px;
}

.status-guide-item {
    display: grid;
    gap: 7px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #FAFBFF;
}

.status-guide-item .badge {
    justify-self: start;
}

.status-guide-item p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.pdf-processing {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 14px;
    border-radius: 8px;
    background: #EEF2FF;
    color: var(--primary-dark);
    font-weight: 800;
}

.pdf-processing.show {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 3px solid rgba(79, 70, 229, 0.2);
    border-top-color: var(--primary);
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        flex-direction: row;
        align-items: center;
        padding: 16px;
        gap: 16px;
    }

    .nav-list {
        display: flex;
        flex: 1;
    }

    .sidebar-note {
        display: none;
    }

    .workspace-grid,
    .results-grid {
        grid-template-columns: 1fr;
    }

    .detail-panel {
        position: static;
    }
}

@media (max-width: 920px) {
    .main-content {
        padding: 22px;
    }

    .topbar,
    .section-heading {
        align-items: flex-start;
    }

    .overall-table {
        min-width: 1280px;
        font-size: 11px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    th,
    td {
        padding: 11px 10px;
    }
}

@media (max-width: 760px) {
    .main-content {
        padding: 18px;
    }

    .sidebar,
    .topbar,
    .section-heading,
    .export-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .brand,
    .nav-list,
    .nav-item,
    .primary-button,
    .secondary-button,
    .ghost-button,
    .filter-control,
    .inline-filter {
        width: 100%;
    }

    .summary-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 18px;
    }

    h1 {
        font-size: 30px;
    }

    h2 {
        font-size: 18px;
    }

    .dropzone {
        min-height: 230px;
    }

    .file-item {
        grid-template-columns: 44px 1fr;
    }

    .file-item .badge,
    .file-remove-button {
        grid-column: 2;
        justify-self: start;
    }

    .recap-table {
        min-width: 460px;
    }

    .overall-table {
        min-width: 1120px;
    }

    .overall-table td:nth-child(2),
    .overall-table th:nth-child(2) {
        min-width: 160px;
    }
}
