:root {
    --bg: #ffffff;
    --side: #fafafa;
    --line: #e5e5e5;
    --line-strong: #d4d4d4;
    --ink: #171717;
    --ink-soft: #525252;
    --ink-faint: #666666;
    --button: #262626;
    --button-hover: #404040;

    --brand: #0078d8;
    --brand-50: #e6f3ff;
    --brand-100: #cce7ff;
    --brand-600: #0060ad;
    --brand-700: #004882;

    --drop-bg: #fef3c7; --drop-ink: #92400e; --drop-bar: #f59e0b;
    --rem-bg: #dbeafe;  --rem-ink: #1e40af;  --rem-bar: #3b82f6;
    --fin-bg: #dcfce7;  --fin-ink: #166534;  --fin-bar: #22c55e;
    --info-bg: #ffe4e6; --info-ink: #9f1239; --info-bar: #f43f5e;

    --focus: var(--brand);
    --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;

    --s1: .5rem;
    --s2: 1rem;
    --s3: 1.5rem;
    --s4: 2rem;
    --s5: 3.5rem;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .04);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .35rem; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 var(--s2); }

a { color: var(--brand-600); text-underline-offset: .18em; }
a:hover { color: var(--brand-700); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.icon { width: 1.15rem; height: 1.15rem; flex: none; }
.mono { font-family: var(--mono); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: var(--s2); top: -10rem; background: var(--ink); color: #fff; padding: var(--s1) var(--s2); z-index: 50; border-radius: var(--radius-sm); }
.skip:focus { top: var(--s2); }

/* shell */
body.has-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side) calc(16rem - 1px), var(--line) calc(16rem - 1px), var(--line) 16rem, var(--bg) 16rem); }
.main-col { display: flex; flex-direction: column; min-width: 0; }
main { flex: 1; }
main:focus { outline: none; }
.page { width: 100%; max-width: 76rem; padding: var(--s4) clamp(1rem, 3vw, 3.5rem) var(--s5); }

.sidebar {
    background: var(--side);
    border-right: 1px solid var(--line);
    padding: var(--s2) .75rem;
    display: flex; flex-direction: column; gap: var(--s2);
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-weight: 600; padding: .25rem .25rem; }
.brand:hover { color: var(--ink); }
.brand__mark {
    display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #2d8cf0, var(--brand-600)); color: #fff; font-weight: 700;
}
.brand--center { justify-content: center; width: 100%; font-size: 1.35rem; margin-bottom: var(--s3); }
.brand--center .brand__mark { width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }

.sidenav { flex: 1; }
.sidenav__group { font-size: .8rem; color: var(--ink-faint); margin: var(--s2) .5rem .3rem; }
.sidenav__group:first-child { margin-top: .25rem; }
.sidenav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sidenav a {
    display: flex; align-items: center; gap: .65rem; padding: .45rem .6rem;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    color: var(--ink-soft); text-decoration: none; font-weight: 500;
}
.sidenav a .icon { color: #737373; }
.sidenav a:hover { background: #f0f0f0; color: var(--ink); }
.sidenav a[aria-current="page"] { background: #fff; border-color: var(--line); color: var(--ink); box-shadow: var(--shadow); }
.sidenav a[aria-current="page"] .icon { color: var(--ink); }

.who { display: flex; align-items: center; gap: .6rem; padding: .5rem; border-top: 1px solid var(--line); padding-top: var(--s2); }
.who__avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius-sm); background: #e5e5e5; font-size: .8rem; font-weight: 600; flex: none; }
.who__text { display: grid; min-width: 0; flex: 1; line-height: 1.3; }
.who__name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__role { font-size: .8rem; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who form { margin: 0; }
.icon-button { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--ink-soft); cursor: pointer; }
.icon-button:hover { background: #f0f0f0; color: var(--ink); }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s2); margin-bottom: var(--s3); }
.page-head .lede { margin: 0; }
.lede { color: var(--ink-soft); max-width: 44rem; }
.eyebrow { color: var(--ink-faint); margin-bottom: .2rem; font-size: .9rem; }

.flash {
    display: flex; align-items: center; gap: .6rem;
    background: var(--fin-bg); color: var(--fin-ink); border: 1px solid #86efac;
    padding: .75rem var(--s2); margin-bottom: var(--s3); font-weight: 500; border-radius: var(--radius);
}

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    font: inherit; font-weight: 500; line-height: 1.2;
    background: var(--button); color: #fff; border: 1px solid var(--button);
    padding: .6rem 1rem; min-height: 44px; border-radius: var(--radius-sm);
    text-decoration: none; cursor: pointer; box-shadow: var(--shadow);
}
.button:hover { background: var(--button-hover); border-color: var(--button-hover); color: #fff; }
.button--quiet { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.button--quiet:hover { background: var(--side); color: var(--ink); border-color: var(--line-strong); }
.button--block { width: 100%; }

.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-600); text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); margin-bottom: var(--s3); box-shadow: var(--shadow); }
.card--tight { padding: var(--s2); }
.card__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s2); }
.card__sub { color: var(--ink-soft); font-size: .92rem; margin: 0; }
.card__link { font-size: .9rem; white-space: nowrap; }

/* banner */
.banner {
    display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
    background: var(--brand-50); border: 1px solid #99cfff; color: var(--brand-700);
    border-radius: var(--radius); padding: var(--s2) var(--s3); margin-bottom: var(--s3);
}
.banner__icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 999px; background: var(--brand); color: #fff; flex: none; }
.banner__icon .icon { width: 1.35rem; height: 1.35rem; }
.banner__text { flex: 1; min-width: 12rem; }
.banner__text h2 { font-size: 1.05rem; margin: 0; }
.banner__text p { margin: 0; font-size: .95rem; }
.banner__link { color: inherit; font-weight: 500; }
.banner--warn { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.banner--warn .banner__icon { background: #ea580c; }
.banner--warn .banner__link { color: #9a3412; }

/* stats */
.stats { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); box-shadow: var(--shadow); }
.stat__label { display: flex; justify-content: space-between; align-items: center; color: var(--ink-soft); margin: 0 0 .5rem; font-weight: 500; }
.stat__icon { color: #8a8a8a; }
.stat__value { font-size: 2rem; font-weight: 600; line-height: 1; margin: 0 0 .75rem; letter-spacing: -.02em; }
.stat__of { font-size: 1.1rem; font-weight: 400; color: var(--ink-faint); }
.stat__note { margin: .6rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.meter { display: block; height: 6px; background: #e5e5e5; border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 999px; background: var(--bar); min-width: 0; }
.stat--dropbox { --bar: var(--drop-bar); }
.stat--rembox { --bar: var(--rem-bar); }
.stat--finbox { --bar: var(--fin-bar); }
.stat--info_needed { --bar: var(--info-bar); }

/* lanes */
.lanes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-bottom: var(--s3); align-items: start; }
.lane { padding: 0; margin: 0; overflow: hidden; }
.lane .card__head { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.lane .card__head h2 { display: flex; align-items: center; gap: .5rem; }
.lane .card__head h2::before { content: ""; width: .6rem; height: .6rem; border-radius: 999px; background: var(--bar); }
.lane--dropbox { --bar: var(--drop-bar); }
.lane--rembox { --bar: var(--rem-bar); }
.lane--finbox { --bar: var(--fin-bar); }
.lane__empty { padding: var(--s2) var(--s3); margin: 0; color: var(--ink-soft); }

.tickets { list-style: none; margin: 0; padding: 0; }
.ticket { display: flex; gap: .75rem; padding: .85rem var(--s3); border-bottom: 1px solid #f0f0f0; }
.ticket:last-child { border-bottom: 0; }
.ticket__icon { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: var(--radius-sm); background: var(--side); border: 1px solid var(--line); color: var(--ink-soft); flex: none; }
.ticket__body { min-width: 0; }
.ticket__link { display: block; color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.3; }
.ticket__link:hover { text-decoration: underline; color: var(--ink); }
.ticket__meta { display: flex; flex-wrap: wrap; gap: .1rem .65rem; margin-top: .2rem; font-size: .85rem; color: var(--ink-soft); }
.ticket__ref { font-family: var(--mono); font-size: .8rem; }

/* action cards */
.actions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: var(--s2); }
.action-card { display: flex; align-items: center; gap: var(--s2); padding: var(--s3); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.action-card:hover { border-color: var(--line-strong); background: var(--side); color: var(--ink); }
.action-card strong { display: block; font-weight: 600; }
.action-card span span { color: var(--ink-soft); font-size: .92rem; }
.action-card__icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: var(--radius-sm); flex: none; }
.action-card__icon .icon { width: 1.4rem; height: 1.4rem; }
.action-card__icon--blue { background: var(--brand-50); color: var(--brand-600); }
.action-card__icon--green { background: #dcfce7; color: #15803d; }
.action-card__icon--purple { background: #f3e8ff; color: #7e22ce; }

/* status chips */
.status { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.status::before { content: ""; width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; }
.status--dropbox { background: var(--drop-bg); color: var(--drop-ink); }
.status--rembox { background: var(--rem-bg); color: var(--rem-ink); }
.status--finbox { background: var(--fin-bg); color: var(--fin-ink); }
.status--info_needed { background: var(--info-bg); color: var(--info-ink); }

/* track */
.track { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s1); }
.track__step { position: relative; padding: .8rem var(--s2); border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink-faint); }
.track__step::before { content: ""; display: block; height: 4px; border-radius: 999px; background: #e5e5e5; margin-bottom: .6rem; }
.track__name { font-weight: 600; display: block; }
.track__step.is-past { color: var(--ink-soft); }
.track__step.is-past::before { background: var(--fin-bar); }
.track__step.is-past .track__name::after { content: " ✓"; color: var(--fin-ink); }
.track__step.is-here { color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow); }
.track__step--dropbox.is-here::before { background: var(--drop-bar); }
.track__step--rembox.is-here::before { background: var(--rem-bar); }
.track__step--finbox.is-here::before { background: var(--fin-bar); }
.track__note { display: block; font-size: .88rem; font-weight: 500; color: var(--info-ink); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: var(--s3); align-items: start; }
.split__side { position: sticky; top: var(--s2); }

.facts { margin: 0 0 var(--s3); display: grid; gap: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem var(--s2); box-shadow: var(--shadow); }
.facts div { display: grid; grid-template-columns: 6.5rem 1fr; gap: var(--s1); align-items: baseline; border-bottom: 1px solid #f0f0f0; padding: .6rem 0; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--ink-faint); font-size: .9rem; }
.facts dd { margin: 0; }
.facts__big { font-size: 1.6rem; font-weight: 600; line-height: 1; }
.side-title { font-size: 1rem; margin-top: var(--s3); }

.downloads { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }
.download { display: block; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2); background: var(--side); }
.download:hover { border-color: var(--line-strong); color: var(--ink); background: #f3f3f3; }
.download--done { background: #f0fdf4; border-color: #86efac; color: var(--fin-ink); }
.download--done:hover { background: #dcfce7; color: var(--fin-ink); }
.download__label { display: block; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.download__name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.download__meta { display: block; font-size: .85rem; }

.callout { background: #fff7ed; color: #7c2d12; border: 1px solid #fdba74; border-radius: var(--radius); padding: var(--s3); margin-bottom: var(--s3); }
.callout blockquote { margin: 0 0 var(--s2); padding-left: var(--s2); border-left: 3px solid #ea580c; font-size: 1.05rem; }
.callout blockquote footer { font-size: .9rem; }
.callout label, .callout .optional, .callout .hint { color: #7c2d12; }

.notes { list-style: none; margin: 0; padding: 0; }
.note { padding: .75rem 0; border-bottom: 1px solid #f0f0f0; }
.note:last-child { border-bottom: 0; }
.note__who { font-size: .88rem; color: var(--ink-soft); margin-bottom: .2rem; }
.note--info_request { border-left: 3px solid #ea580c; padding-left: var(--s2); }
.note--info_response { border-left: 3px solid var(--brand); padding-left: var(--s2); }

.history { list-style: none; margin: 0; padding: 0; font-size: .88rem; color: var(--ink-soft); max-height: 26rem; overflow: auto; }
.history li { padding: .45rem 0; border-bottom: 1px solid #f0f0f0; overflow-wrap: anywhere; }
.history time { display: block; font-size: .8rem; color: var(--ink-faint); }

.inline-action { margin: calc(-1 * var(--s1)) 0 var(--s3); }

/* forms */
.form { max-width: 42rem; }
.field { margin: 0 0 var(--s3); border: 0; padding: 0; }
fieldset.field { min-width: 0; }
label, legend { display: block; font-weight: 500; margin-bottom: .35rem; }
legend { padding: 0; }
.optional { font-weight: 400; color: var(--ink-faint); }
.hint { font-size: .9rem; color: var(--ink-soft); margin: 0 0 .4rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], input[type=tel], select, textarea {
    display: block; width: 100%; font: inherit; color: var(--ink);
    background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    padding: .55rem .75rem; min-height: 44px; box-shadow: var(--shadow);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
input[type=file] { font: inherit; width: 100%; max-width: 100%; padding: .5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--side); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: #e11d48; border-width: 2px; }
.field-error { color: #be123c; font-weight: 500; margin: .35rem 0 0; }
.field--check { display: flex; align-items: flex-start; gap: .6rem; }
.field--check input { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; flex: none; accent-color: var(--button); }
.field--check label { margin: 0; font-weight: 400; }

.choices { display: grid; gap: .5rem; }
.choice { display: grid; grid-template-columns: 1.2rem 1fr; column-gap: .6rem; align-items: start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem; background: #fff; }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.choice input { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; accent-color: var(--button); }
.choice label { margin: 0; }
.choice .hint { grid-column: 2; margin: 0; }

.error-summary { border: 1px solid #fda4af; background: #fff1f2; color: #9f1239; border-radius: var(--radius); padding: var(--s2) var(--s3); margin-bottom: var(--s3); }
.error-summary h2 { font-size: 1rem; }
.error-summary ul { margin: 0; padding-left: 1.2rem; }
.error-summary a { color: #9f1239; font-weight: 500; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); margin-bottom: var(--s3); }
.filters .field { margin: 0; min-width: 11rem; flex: 1 1 11rem; max-width: 18rem; }
.filters .error-summary { flex-basis: 100%; }

.tabs { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: #f0f0f0; border-radius: var(--radius-sm); margin-bottom: var(--s3); }
.tabs a { padding: .4rem .9rem; text-decoration: none; color: var(--ink-soft); border-radius: 6px; font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s2); margin-bottom: var(--s3); max-width: 28rem; }
.totals p { margin: 0; color: var(--ink-soft); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2) var(--s3); box-shadow: var(--shadow); }
.totals__num { display: block; font-size: 1.9rem; font-weight: 600; line-height: 1.1; color: var(--ink); }

/* tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--s3); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
caption { text-align: left; padding: var(--s2) var(--s3); font-weight: 600; color: var(--ink); }
th, td { padding: .7rem var(--s3); border-top: 1px solid #f0f0f0; text-align: left; vertical-align: top; }
thead th { background: var(--side); font-size: .82rem; font-weight: 500; color: var(--ink-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody th { font-weight: 600; }
tbody tr:hover { background: #fcfcfc; }
th.num, td.num { text-align: right; }
.empty { padding: var(--s3); background: var(--side); border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-soft); }

.pager { display: flex; gap: var(--s2); align-items: center; }
.pager [aria-disabled] { color: var(--ink-faint); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s4) var(--s2); background: var(--side); }
.login__panel { width: 100%; max-width: 27rem; }
.login__form { padding: var(--s4); }
.login__form h1 { font-size: 1.4rem; text-align: center; }
.login__form .lede { text-align: center; }
.route { list-style: none; padding: 0; margin: var(--s3) 0 0; display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s2); color: var(--ink-soft); font-size: .9rem; }
.route li { display: flex; flex-direction: column; align-items: center; gap: .3rem; }

.foot { padding: var(--s3) clamp(1rem, 3vw, 3.5rem); color: var(--ink-faint); font-size: .85rem; border-top: 1px solid var(--line); }
.foot p { margin: 0; }
body:not(.has-shell) .foot { display: none; }

@media (max-width: 72rem) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lanes { grid-template-columns: minmax(0, 1fr); }
    .split { grid-template-columns: minmax(0, 1fr); }
    .split__side { position: static; }
}

@media (max-width: 52rem) {
    body.has-shell { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: .5rem; }
    .sidenav__group { display: none; }
    .sidenav { display: flex; flex-wrap: wrap; gap: 2px; }
    .sidenav ul { display: contents; }
    .who { border-top: 0; padding-top: 0; }
    .track { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 30rem) {
    .stats { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
    .card, .stat, .status, .button, .track__step, .download, .banner { border: 1px solid CanvasText; }
    :focus-visible { outline: 2px solid Highlight; }
}
.card > .side-title:first-of-type { margin-top: 0; }
