* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--surface-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
}
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, .dropzone:focus-within {
    outline: 3px solid var(--border-active);
    outline-offset: 3px;
}
.site-header {
    min-height: 68px;
    padding: 14px clamp(20px, 5vw, 72px);
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand { display: block; line-height: 0; text-decoration: none; }
.brand img { display: block; width: 80px; height: auto; }
@media (min-width: 768px) { .brand img { width: 112px; } }
@media (min-width: 1280px) { .brand img { width: 160px; } }
.user { position: relative; display: flex; align-items: center; gap: 16px; color: var(--text-secondary); font-size: 14px; }
.system-notice {
    margin: 0;
    padding: 12px clamp(20px, 5vw, 72px);
    border-bottom: 1px solid var(--border-default);
    background: var(--surface-secondary);
    color: var(--text-secondary);
    font-size: 14px;
}
.ack { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 20px; color: var(--text-secondary); }
.shell { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 96px; }
.hero { max-width: 680px; margin-bottom: 32px; }
h1, h2 { margin: 0; font-weight: 500; letter-spacing: -.7px; }
h1 { font-size: clamp(32px, 6vw, 48px); line-height: 1.08; }
h2 { font-size: 24px; }
.hero > p:last-child, .denied > p { color: var(--text-secondary); font-size: 18px; }
.eyebrow { margin: 0 0 8px; color: var(--text-tonal-blue); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.panel {
    padding: clamp(20px, 4vw, 36px);
    border: 1px solid var(--border-default-emphasized);
    border-radius: var(--radius-panel);
    background: var(--surface-secondary);
    box-shadow: var(--elevation-panel);
}
.dropzone {
    min-height: 190px;
    padding: 32px;
    border: 1px dashed var(--border-active);
    border-radius: var(--radius-control);
    display: grid;
    place-content: center;
    gap: 8px;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
}
.dropzone:hover { border-color: var(--text-primary); }
.dropzone__title { color: var(--text-primary); font-size: 20px; font-weight: 500; }
.dropzone input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.limit-hint { margin: 12px 0 0; color: var(--text-tertiary); font-size: 13px; }
.staged-files { margin: 16px 0 0; padding: 0; list-style: none; }
.staged-file { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border-default); }
.staged-file__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.staged-file__meta { display: flex; flex: none; align-items: center; gap: 8px; }
.staged-file__size { flex: none; color: var(--text-tertiary); font-size: 13px; font-variant-numeric: tabular-nums; }
.actions, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.actions { margin-top: 20px; }
.actions p { margin: 0; color: var(--text-secondary); }
.button {
    border: 0;
    border-radius: var(--radius-control);
    padding: 11px 16px;
    background: var(--surface-brand-blue);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
}
.button:disabled { opacity: .45; cursor: not-allowed; }
.button--quiet { border: 1px solid var(--border-default-emphasized); background: transparent; }
.staged-file--duplicate .staged-file__name { color: #f55014; }
.message { min-height: 24px; margin-top: 12px; color: var(--text-tonal-red); }
.message--info { color: var(--text-secondary); }
.history { margin-top: 56px; }
.section-heading { margin-bottom: 20px; }
.batch-list { display: grid; gap: 12px; }
.batch {
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-control);
    background: var(--surface-secondary);
}
.batch__heading, .upload-row { display: flex; justify-content: space-between; gap: 16px; }
.batch__heading { align-items: center; }
.batch__heading p { margin: 4px 0 0; color: var(--text-secondary); font-size: 14px; }
.badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .01em;
    text-transform: capitalize;
    white-space: nowrap;
}
.badge--uploaded { color: var(--text-tonal-green); text-transform: none; }
.badge--processing { color: var(--text-tonal-blue); font-variant-numeric: tabular-nums; text-transform: none; }
.badge--progress { font-variant-numeric: tabular-nums; text-transform: none; white-space: normal; text-align: right; }
.badge--duplicate { color: #f55014; text-transform: none; }
.badge--clean, .badge--complete { color: var(--text-tonal-green); }
.badge--failed, .badge--rejected { color: var(--text-tonal-red); }
.uploads { margin: 16px 0 0; padding: 0; list-style: none; }
.upload-row { padding: 12px 0; border-top: 1px solid var(--border-default); align-items: center; }
.upload-row__file { min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.upload-row__name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.upload-row__size { flex: none; color: var(--text-tertiary); font-size: 13px; font-variant-numeric: tabular-nums; }
.upload-row__meta { display: flex; flex: none; align-items: center; gap: 8px; }
.batch .upload-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.batch .upload-row__file { width: 100%; }
.batch .upload-row__meta { flex-wrap: wrap; }
.progress { width: 140px; height: 8px; border-radius: 999px; appearance: none; }
.progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-primary); }
.progress::-webkit-progress-value { border-radius: 999px; background: var(--surface-brand-blue); }
.progress::-moz-progress-bar { border-radius: 999px; background: var(--surface-brand-blue); }
.small-button { padding: 6px 9px; font-size: 12px; }
.denied { max-width: 620px; margin: 40px auto; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}
.directory-search { display: block; margin: 36px 0 12px; }
.upload-launch { display: flex; justify-content: center; margin: 8px 0 0; }
.upload-launch .button { width: auto; min-width: min(280px, 100%); padding: 16px 36px; font-size: 18px; }
.directory-search input,
.directory-tools select,
.directory-tools input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-default-emphasized);
    border-radius: var(--radius-control);
    background: var(--surface-primary);
    color: var(--text-primary);
}
.directory-search input { width: 100%; }
.directory-who { color: var(--text-tertiary); font-size: 13px; }
.directory-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px 16px;
    margin: 0 0 16px;
}
.directory-tools label {
    display: grid;
    gap: 6px;
    min-width: min(140px, 100%);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.directory-search { flex: 1 1 220px; margin: 0; }
#directory-note:empty, #page-status:empty { display: none; margin: 0; min-height: 0; }
#directory-list .upload-row__file { flex: 1; }
.directory-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin: 0 0 4px; }
.directory-select-all, .directory-check { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 14px; cursor: pointer; }
.directory-check { flex: none; align-self: center; }
.directory-bar input, .directory-check input { accent-color: var(--surface-brand-blue); width: 16px; height: 16px; }
.directory-bar input:disabled, .directory-check input:disabled, #directory-download:disabled { opacity: .45; pointer-events: none; }
.batch > summary { cursor: pointer; list-style: none; justify-content: flex-start; }
.batch > summary::-webkit-details-marker { display: none; }
.batch > summary::marker { content: ""; }
.batch > summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    flex: none;
}
.batch[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.batch > summary > div:first-child { flex: 1; min-width: 0; }
body:has(.workspace) {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}
body:has(.workspace) .shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    min-height: 0;
    overflow: hidden;
}
.workspace {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
}
.directory-pane, .transfer-rail {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.directory-pane { padding: 28px 28px 0; }
.directory-heading { flex: none; max-width: 680px; }
.directory-heading h1 { font-size: clamp(28px, 4vw, 36px); }
.directory-heading > p:last-child { margin: 8px 0 0; color: var(--text-secondary); }
.directory-pane .directory-tools,
.directory-pane .directory-bar,
.directory-pane #directory-empty,
.directory-pane #directory-note { flex: none; }
.directory-pane .directory-tools { margin-top: 20px; }
#directory-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
}
.download-bar {
    flex: none;
    padding: 16px 0 20px;
}
.download-bar[hidden] { display: none; }
.download-bar .button { width: 100%; }
.transfer-rail {
    border-left: 1px solid var(--border-default);
    background: var(--surface-secondary);
}
.rail-heading {
    flex: none;
    margin: 0;
    padding: 20px 20px 0;
    font-size: 20px;
    letter-spacing: -.4px;
}
.rail-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.batch-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 16px;
}
.stage-panel {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 33.333%;
    max-height: 75%;
    overflow: hidden;
    margin: 0;
    padding: 16px;
    border-top: 1px solid var(--border-default);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.stage-panel .dropzone { flex: 1 1 auto; min-height: 112px; padding: 20px; }
.stage-panel:has(#staged-files:not([hidden])) .dropzone { flex: none; min-height: 72px; padding: 16px; }
.stage-panel .upload-log,
.stage-panel .limit-hint,
.stage-panel .actions,
.stage-panel .message { flex: none; }
.upload-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-tonal-red);
}
.upload-log[hidden] { display: none; }
.upload-log__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.upload-log__bar h3 { margin: 0; font-size: 14px; font-weight: 500; }
.upload-log ul {
    max-height: 7.5rem;
    margin: 0;
    padding-left: 1.1rem;
    overflow: auto;
}
.stage-panel .staged-files { flex: 1 1 auto; min-height: 0; max-height: none; overflow: auto; }
.stage-panel .message:empty { display: none; min-height: 0; margin: 0; }
@media (max-width: 800px) {
    body:has(.workspace) {
        height: auto;
        max-height: none;
        overflow: auto;
    }
    body:has(.workspace) .shell,
    .workspace,
    .directory-pane,
    .transfer-rail,
    .rail-body { overflow: visible; }
    .workspace { grid-template-columns: 1fr; grid-template-rows: auto; }
    .directory-pane, .transfer-rail { min-height: 70vh; }
    .transfer-rail { border-left: 0; border-top: 1px solid var(--border-default); }
    #directory-list, .batch-scroll { flex: none; overflow: visible; }
    .stage-panel { max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
    .shell { padding-top: 40px; }
    body:has(.workspace) .shell { padding-top: 0; }
    .user > span { display: none; }
    .actions, .section-heading { align-items: stretch; flex-direction: column; }
    .button { width: 100%; }
    .batch__heading, .upload-row, .staged-file { align-items: flex-start; flex-direction: column; }
    .staged-file__meta { width: 100%; flex-wrap: wrap; }
    .upload-row__meta { width: 100%; flex-wrap: wrap; }
    .progress { width: 100%; }
}
