:root {
    --ink: #17202a;
    --muted: #68737d;
    --line: #dfe4e8;
    --paper: #ffffff;
    --canvas: #f3f5f6;
    --navy: #13283b;
    --blue: #11637d;
    --blue-dark: #0a4c62;
    --green: #287452;
    --amber: #9a6412;
    --red: #a53b35;
    --shadow: 0 12px 35px rgb(20 35 48 / 8%);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.035em; }
h2 { margin-bottom: 5px; font-size: 18px; }
p { color: var(--muted); }

.site-header { min-height: 72px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 0 max(24px, calc((100% - 1240px) / 2)); background: var(--navy); color: white; }
.site-header nav { display: flex; align-self: stretch; gap: 4px; }
.site-header nav a { display: grid; place-items: center; padding: 0 18px; border-bottom: 3px solid transparent; color: #bdd0dc; font-weight: 650; text-decoration: none; }
.site-header nav a:hover, .site-header nav a.active { border-color: #55bad2; color: white; }
.site-header form { justify-self: end; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand span:last-child { display: grid; line-height: 1.15; }
.brand small { color: #9fb7c5; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #5b8297; border-radius: 10px; background: #173d52; color: #81d7e8; font-size: 12px; font-weight: 800; letter-spacing: .06em; }
.brand-mark-large { width: 52px; height: 52px; font-size: 15px; }

.page-shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 44px 0 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.page-heading p:last-child { margin-bottom: 0; font-size: 16px; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.panel { margin-bottom: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.add-panel { display: grid; grid-template-columns: minmax(220px, .75fr) 1.5fr; align-items: start; gap: 36px; padding: 24px; }
.add-panel p, .panel-toolbar p { margin-bottom: 0; }
.inline-form { display: grid; grid-template-columns: minmax(180px, 1fr) 110px auto; align-items: start; gap: 12px; }
.inline-form .button { margin-top: 27px; }
.field { display: grid; gap: 6px; }
.field label, .form-stack label { font-size: 13px; font-weight: 700; }
input { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #bac4ca; border-radius: 8px; background: white; color: var(--ink); }
input:focus { outline: 3px solid rgb(17 99 125 / 18%); border-color: var(--blue); }
.validation { display: block; color: var(--red); font-size: 13px; }
.validation:empty { display: none; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 0; border-radius: 8px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button-primary { background: var(--blue); color: white; }
.button-primary:hover { background: var(--blue-dark); }
.button-danger { min-height: 34px; padding: 6px 10px; background: #fff0ef; color: var(--red); font-size: 13px; }
.button-danger:hover { background: #f8d9d6; }
.button-quiet { background: transparent; color: #c5d4dc; }
.button-quiet:hover { background: rgb(255 255 255 / 8%); color: white; }
.button-full { width: 100%; margin-top: 8px; }

.flash { margin: -10px 0 22px; padding: 12px 15px; border: 1px solid; border-radius: 9px; }
.flash-success { border-color: #b7dac8; background: #eaf6ef; color: #1e6748; }
.flash-alert { border-color: #efd4a8; background: #fff6e7; color: #80500b; }
.table-panel { overflow: hidden; }
.panel-toolbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: #eef1f3; }
.filters a { padding: 6px 11px; border-radius: 6px; color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; }
.filters a.active { background: white; color: var(--ink); box-shadow: 0 1px 4px rgb(20 35 48 / 12%); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: #fafbfb; color: var(--muted); font-size: 11px; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfc; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.sku { font-size: 13px; letter-spacing: .02em; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 99px; font-size: 12px; font-weight: 750; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-pending { background: #fff4dc; color: var(--amber); }
.status-complete { background: #e7f4ec; color: var(--green); }
.status-warning { background: #fae9e6; color: var(--red); }
.cell-detail { display: block; max-width: 180px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; }
.muted { color: #9aa3aa; }
.actions { width: 1%; }
.empty-state { padding: 54px 24px; text-align: center; }
.empty-state p { margin: 4px 0 0; }

.run-list { display: grid; }
.run-card { border-bottom: 1px solid var(--line); }
.run-card:last-child { border-bottom: 0; }
.run-card summary { display: grid; grid-template-columns: minmax(230px, 1.5fr) repeat(3, minmax(80px, .5fr)) minmax(145px, .7fr); align-items: center; gap: 22px; padding: 18px 22px; cursor: pointer; list-style: none; }
.run-card summary::-webkit-details-marker { display: none; }
.run-card summary::after { content: "+"; position: absolute; right: 12px; color: var(--muted); font-size: 20px; }
.run-card[open] summary::after { content: "−"; }
.run-card summary { position: relative; padding-right: 40px; }
.run-card summary:hover { background: #fafbfb; }
.summary-main { display: flex; align-items: center; gap: 10px; }
.summary-stat { display: grid; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-stat small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.run-card time { color: var(--muted); font-size: 13px; text-align: right; }
.run-detail { padding: 0 22px 22px; background: #fafbfb; }
.metadata { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0 0 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--line); }
.metadata div { padding: 12px; background: white; }
.metadata dt { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.metadata dd { margin: 3px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.nested-table { border: 1px solid var(--line); border-radius: 9px; background: white; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 20px; background: radial-gradient(circle at top, #20455a 0, var(--navy) 42%, #0d1b27 100%); }
.login-card { width: min(440px, 100%); padding: 32px; border: 1px solid rgb(255 255 255 / 16%); border-radius: 18px; background: white; box-shadow: 0 30px 80px rgb(0 0 0 / 25%); }
.login-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 28px; }
.login-heading h1 { font-size: 30px; }
.login-heading p:last-child { margin-bottom: 0; }
.form-stack { display: grid; gap: 7px; }
.form-stack input { margin-bottom: 10px; }
.error-panel { max-width: 650px; padding: 34px; }
.error-panel .button { margin-top: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 850px) {
    .site-header { grid-template-columns: 1fr auto; padding: 0 18px; }
    .site-header nav { grid-row: 2; grid-column: 1 / -1; height: 46px; justify-content: center; }
    .site-header nav a { padding: 0 14px; }
    .site-header form { grid-column: 2; grid-row: 1; }
    .add-panel { grid-template-columns: 1fr; gap: 20px; }
    .run-card summary { grid-template-columns: 1fr 1fr 1fr; gap: 13px; }
    .summary-main { grid-column: 1 / -1; }
    .run-card time { text-align: left; }
    .metadata { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
    .page-shell { width: min(100% - 24px, 1240px); padding-top: 28px; }
    .page-heading { margin-bottom: 20px; }
    .inline-form { grid-template-columns: 1fr 90px; }
    .inline-form .button { grid-column: 1 / -1; width: 100%; margin-top: 0; }
    .panel-toolbar { align-items: flex-start; flex-direction: column; }
    .filters { width: 100%; }
    .filters a { flex: 1; text-align: center; }
    .run-card summary { grid-template-columns: 1fr 1fr; }
    .run-card time { grid-column: 1 / -1; }
    .metadata { grid-template-columns: 1fr; }
    .login-card { padding: 25px; }
}
