/* LDWTrack — quiet workspace UI: dark rail, soft canvas, white panels, one accent.
   Layout pieces: .page-head (title + actions), .stats (tiles), .panel (card with a table),
   .board/.lane/.task (overview to-do cards), details.sync (collapsed plumbing). */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --ink: #171c2b;
  --ink-2: #4a5268;
  --muted: #7a8196;
  --line: #e6e8ef;
  --line-2: #d5d9e4;
  --accent: #3061e3;
  --accent-ink: #2550c4;
  --accent-soft: #e9efff;
  --green: #15803d; --green-soft: #e4f6ea; --green-line: #b9e4c8;
  --amber: #a85d00; --amber-soft: #fff3dc; --amber-line: #f1d9a4;
  --red: #c2322a; --red-soft: #fdecea; --red-line: #f3c3be;
  --blue: #2a5bd7; --blue-soft: #e6edff; --blue-line: #c4d3fb;
  --side: #0f1322;
  --side-2: #171d31;
  --side-ink: #9aa3bd;
  --side-ink-strong: #ffffff;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-2: 0 8px 24px rgba(16, 24, 40, .12);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.45; color: var(--ink);
  background: var(--bg); display: flex; height: 100vh; overflow: hidden; -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
h1 .light { font-weight: 500; color: var(--ink-2); }
h2 { font-size: 1rem; font-weight: 650; letter-spacing: -.01em; margin: 0; display: flex; align-items: baseline; gap: .5rem; }
h2 .hint, h3 .hint { font-weight: 400; letter-spacing: 0; }
h3 { font-size: .86rem; font-weight: 650; margin: 1.1rem 0 .4rem; color: var(--ink-2); display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
a.quiet { color: inherit; }
a.ext { color: var(--muted); font-weight: 400; font-size: .85rem; }
a.ext:hover { color: var(--accent-ink); }
p { margin: .5rem 0; }
strong, b { font-weight: 600; }
small { font-size: .8em; }

/* ---------- sidebar ---------- */
.sidebar {
  width: 208px; flex-shrink: 0; display: flex; flex-direction: column; overflow-y: auto;
  background: linear-gradient(180deg, var(--side-2), var(--side) 70%); color: var(--side-ink); padding: 1.1rem 0 0;
}
.sidebar .brand {
  display: flex; align-items: center; gap: .6rem; padding: 0 1.1rem; color: var(--side-ink-strong);
  font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em;
}
.sidebar .brand:hover { text-decoration: none; }
.sidebar .brand::before {
  content: ""; width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #6a93ff, #3061e3 55%, #7a4dff);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 2px 8px rgba(48,97,227,.5);
}
.year { padding: .9rem 1.1rem .4rem; }
.year label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0; color: var(--side-ink); font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.year select {
  width: auto; padding: .22rem 1.7rem .22rem .6rem; font-size: .82rem; font-weight: 600; margin: 0;
  background-color: rgba(255,255,255,.07); color: var(--side-ink-strong);
  border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-s); cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%239aa3bd' stroke-width='1.6' stroke-linecap='round'/></svg>");
}
.year select option { color: #111; }
.sidebar nav { padding: .2rem .7rem; display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #5f6880; padding: .9rem .6rem .3rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: .6rem; padding: .48rem .65rem; border-radius: var(--radius-s); color: var(--side-ink);
  font-weight: 500; font-size: .9rem; position: relative; transition: background .12s, color .12s;
}
.sidebar nav a svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .75; flex-shrink: 0; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: var(--side-ink-strong); text-decoration: none; }
.sidebar nav a.active { background: rgba(48,97,227,.28); color: var(--side-ink-strong); }
.sidebar nav a.active svg { opacity: 1; }
.sidebar .refresh { margin: auto .7rem 0; padding-top: .8rem; }
.sidebar .refresh button { width: 100%; justify-content: center; gap: .5rem; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: var(--side-ink); box-shadow: none; font-size: .84rem; }
.sidebar .refresh button:hover { background: rgba(255,255,255,.11); color: var(--side-ink-strong); }
.sidebar .refresh svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .user {
  padding: .8rem 1.1rem; font-size: .82rem; display: flex; justify-content: space-between; gap: .5rem;
}
.sidebar .user a { color: var(--side-ink); }
.sidebar .user a:hover { color: var(--side-ink-strong); }

/* ---------- content ---------- */
.content { flex: 1; padding: 1.5rem 2rem 4rem; min-width: 0; overflow-y: auto; }
.content > * { max-width: 1280px; }
.flashes { margin-bottom: .8rem; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.1rem; }
.page-head .crumbs { margin: 0 0 .25rem; font-size: .82rem; }
.page-head .crumbs a { color: var(--muted); }
.page-head .crumbs a:hover { color: var(--accent-ink); }
.page-head .sub { margin: .25rem 0 0; color: var(--ink-2); font-size: .92rem; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.inline { display: inline; margin: 0; }
.inline button { vertical-align: middle; }

/* callouts */
.flash, .flag, p.ok {
  padding: .55rem .85rem; margin: .5rem 0; border-radius: var(--radius-s); border: 1px solid transparent; font-size: .9rem;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
}
.flash { background: var(--amber-soft); border-color: var(--amber-line); color: #5a3b00; }
.flag { background: var(--red-soft); border-color: var(--red-line); color: #7a1f17; }
p.ok { background: var(--green-soft); border-color: var(--green-line); color: #0f5a38; }
.flag a, .flash a, p.ok a { color: inherit; font-weight: 600; }
.flag ul, .flash ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.ok { color: var(--green); }
.bad { color: var(--red); }
.hint { color: var(--muted); font-size: .85rem; }
.sub { color: var(--ink-2); }
.lead { color: var(--ink-2); max-width: 70ch; }
.pre { white-space: pre-wrap; }
.clip { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
td.clip { display: table-cell; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); vertical-align: middle; }
.dot.ok { background: var(--green); } .dot.bad { background: var(--red); } .dot.amber { background: #e0a100; }

/* stats tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: 0 0 1rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .7rem .9rem .65rem; display: flex; flex-direction: column; gap: .1rem; min-width: 0;
}
.stat span { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 1.25rem; font-weight: 650; letter-spacing: -.01em; }
.stat small { color: var(--muted); font-size: .78rem; }
.stat small.bad { color: var(--red); }

/* panels */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 0 0 1rem; padding: .85rem 1rem 1rem; min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin: 0 0 .6rem; }
.panel-head .toolbar { margin: 0; }
.panel .grid { box-shadow: none; border: 1px solid var(--line); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1rem; align-items: start; }
.two-col > .panel { margin: 0; }
.two-col + .panel, .two-col + details, .two-col + p { margin-top: 1rem; }

/* overview board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.lane h2 { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 .5rem .2rem; }
.lane { display: flex; flex-direction: column; gap: .55rem; }
.task {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .9rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .7rem 1rem; color: inherit; transition: border-color .15s, box-shadow .15s, transform .08s;
}
.task:hover { text-decoration: none; border-color: #b9c6ec; box-shadow: var(--shadow-2); transform: translateY(-1px); }
.task b { grid-row: 1 / 3; font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; min-width: 2.2rem; text-align: center; color: var(--muted); }
.task.todo b { color: var(--accent-ink); }
.task span { font-weight: 600; }
.task em { font-style: normal; color: var(--muted); font-size: .84rem; }

/* rows */
.toolbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: .6rem 0; }
.toolbar form { display: contents; }
.toolbar .spacer, .page-head .spacer { flex: 1; }
.title-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.filters { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0 0 .9rem; }
.filters label { margin: 0; }
.filters select, .filters input { width: auto; }
.filters .search { min-width: 18rem; }
.filters .check { display: flex; align-items: center; gap: .35rem; font-weight: 500; color: var(--ink-2); }
.links { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
dl.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .55rem 1rem; margin: 0; }
dl.facts .wide { grid-column: 1 / -1; }
dl.facts dt { font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
dl.facts dd { margin: .05rem 0 0; }
.chip { display: inline-block; font-size: .78rem; font-weight: 600; padding: .1rem .55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); margin: .1rem .15rem .1rem 0; }
.chip:hover { text-decoration: none; background: #dbe5ff; }

/* tables */
table { border-collapse: collapse; width: 100%; }
table.grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; font-size: .9rem; box-shadow: var(--shadow); }
table.grid th, table.grid td { padding: .45rem .7rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.grid th { background: var(--surface-2); font-size: .68rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
table.grid th.num { text-align: right; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover { background: #f7f9ff; }
table.grid tbody tr.hint td { color: var(--muted); }
table.grid tbody tr.current td { background: var(--accent-soft); }
table.grid tfoot td { border-bottom: 0; border-top: 1px solid var(--line-2); background: var(--surface-2); }
table.grid select { padding: .18rem 1.6rem .18rem .4rem; font-size: .84rem; }
table.grid td:first-child a { font-weight: 600; }
table.grid td:first-child a.ext, table.grid td a.quiet { font-weight: 400; }
table.grid td.actions-cell { text-align: right; white-space: nowrap; }
table.grid input.qty, input.qty { width: 4.4rem; text-align: right; }
table.items td { padding: .18rem .25rem; }
table.items .rownum { width: 2rem; color: var(--muted); font-size: .8rem; padding-top: .55rem; text-align: right; }
table.items input, table.items textarea { padding: .3rem .4rem; }
table.items .remove-row { padding: .2rem .45rem; color: var(--muted); border-color: transparent; background: transparent; box-shadow: none; }
table.items .remove-row:hover { color: var(--red); background: var(--red-soft); }
table.kv th { text-align: left; padding: .2rem 1rem .2rem 0; vertical-align: top; color: var(--muted); font-weight: 500; }
table.copyrow td, table.copyrow th { font-size: .82rem; }
table.copyrow td.hint { font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .66rem; padding-top: .55rem; }
table.receive tr.done td { color: var(--muted); }
table.receive input.qty { font-size: 1rem; padding: .35rem .5rem; }
table.stock td { vertical-align: middle; }
table.grid td.part { max-width: 24ch; overflow-wrap: anywhere; }
table.grid td.pre { min-width: 14rem; }
.scroll { overflow-x: auto; }
.cols { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.cols > * { flex: 1; min-width: 280px; }
.actions form { display: inline; }
p.actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* collapsed panels: the Google / log plumbing lives here */
details.sync { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0 0 1rem; }
details.sync summary { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; cursor: pointer; list-style: none; font-size: .9rem; }
details.sync summary::-webkit-details-marker { display: none; }
details.sync summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.2rem; transition: transform .15s; }
details.sync[open] summary::after { transform: rotate(90deg); }
details.sync summary .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.sync .sync-body { padding: 0 1rem 1rem; border-top: 1px solid var(--line); }
details.sync .sync-body h3:first-child { margin-top: .9rem; }
details.plain { margin: .6rem 0; }
details.plain summary { cursor: pointer; color: var(--ink-2); font-size: .88rem; font-weight: 500; }
details.plain summary:hover { color: var(--accent-ink); }
details.menu { position: relative; }
details.menu summary { list-style: none; padding: .4rem .6rem; letter-spacing: .1em; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu > div {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 200px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); box-shadow: var(--shadow-2); padding: .3rem;
}
details.menu > div a, details.menu > div button { display: block; width: 100%; text-align: left; padding: .45rem .7rem; border: 0; background: none; box-shadow: none; border-radius: 6px; color: var(--ink); font-size: .88rem; font-weight: 500; }
details.menu > div a:hover, details.menu > div button:hover { background: var(--surface-2); text-decoration: none; }
details.menu > div button.danger { color: var(--red); }
details.menu > div button.danger:hover { background: var(--red-soft); }
details.menu form { margin: 0; }

/* status pills */
.status {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .73rem; font-weight: 600; vertical-align: middle;
  padding: .12rem .6rem .12rem .5rem; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-2);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-accepted, .status-received, .status-paid { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.status-sent, .status-partially-received { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.status-not-received, .status-draft, .status-not-paid { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.status-declined, .status-not-in-log { background: #eef0f4; color: var(--muted); border-color: var(--line-2); }
h1 .status { font-size: .74rem; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .6rem 1rem; }
.form-grid > p, .form-grid > label { margin: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid select { display: block; width: 100%; }
.form-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.form-row input { width: auto; min-width: 8rem; }
.form-row .grow, .inline-form .grow { flex: 1; min-width: 12rem; }
.inline-form { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin: 0; }
table .inline-form { flex-wrap: nowrap; }
table .inline-form select { max-width: 8rem; }
.inline-form select { width: auto; max-width: 12rem; }
.inline-form input:not(.qty) { width: auto; }
.inline-label { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 500; }
.inline-label input { margin: 0; }
label { font-size: .8rem; font-weight: 500; color: var(--ink-2); display: block; }
label input, label select, label textarea { margin-top: .22rem; color: var(--ink); font-size: 14.5px; font-weight: 400; }
label .hint { display: block; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin: 0 0 1rem; padding: .7rem 1rem 1rem; }
legend { font-weight: 650; font-size: .95rem; padding: 0 .4rem; letter-spacing: -.01em; }
input, textarea, select {
  font: inherit; width: 100%; padding: .42rem .65rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-s); transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(48,97,227,.16); }
input::placeholder, textarea::placeholder { color: #a3aab9; }
input[type=radio], input[type=checkbox] { width: auto; accent-color: var(--accent); }
input[type=date] { width: auto; min-width: 10.5rem; }
input.short { width: 7rem; }
textarea { resize: vertical; }
select { width: auto; max-width: 100%; padding-right: 1.9rem; appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%237a8196' stroke-width='1.6' stroke-linecap='round'/></svg>") no-repeat right .55rem center; }
select.status-select { font-size: .84rem; padding: .25rem 1.7rem .25rem .55rem; font-weight: 500; }

/* buttons */
.button, button {
  display: inline-flex; align-items: center; gap: .35rem; padding: .42rem .9rem; border-radius: var(--radius-s);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none;
  cursor: pointer; font: inherit; font-size: .87rem; font-weight: 550; line-height: 1.25; white-space: nowrap;
  box-shadow: 0 1px 1px rgba(16,24,40,.04); transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
}
.button:hover, button:hover { background: var(--surface-2); border-color: #bfc6d6; text-decoration: none; }
.button:active, button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(48,97,227,.25); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent-ink); color: #fff; box-shadow: 0 1px 2px rgba(48,97,227,.3); }
button.primary:hover, .button.primary:hover { background: var(--accent-ink); }
button.small, .button.small { padding: .22rem .6rem; font-size: .78rem; }
button.quiet, .button.quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
button.quiet:hover, .button.quiet:hover { background: var(--surface-2); color: var(--ink); }

.toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); padding: 2px; gap: 2px; margin-top: .22rem; }
.toggle label { margin: 0; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { display: inline-block; padding: .3rem .8rem; cursor: pointer; border-radius: 6px; font-size: .86rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: background .12s, color .12s; }
.toggle input:checked + span { background: var(--ink); color: #fff; }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* drag & drop file zone (app.js) */
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); transition: border-color .12s, background .12s; margin-top: .6rem; }
.dropzone:hover { border-color: #b4bccf; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.dropzone input[type=file] { display: none; }
.dropzone ul { list-style: none; padding: 0; margin: .6rem 0 0; text-align: left; font-size: .88rem; color: var(--ink); }
.dropzone li { padding: .15rem 0; }
.dropzone li button { margin-left: .5rem; }

/* incoming: one card per outstanding order */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; margin: .4rem 0; }
.cards > p { grid-column: 1 / -1; }
.card {
  display: flex; flex-direction: column; gap: .3rem; padding: .85rem 1rem .7rem; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: box-shadow .15s, border-color .15s, transform .08s;
}
.card:hover { text-decoration: none; border-color: #b9c6ec; box-shadow: var(--shadow-2); transform: translateY(-1px); }
.card.late { border-left: 4px solid var(--red); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.card-head b { font-size: 1.05rem; letter-spacing: -.01em; color: var(--accent-ink); }
.card-title { font-weight: 600; }
.card-sub { color: var(--muted); font-size: .84rem; margin-top: -.2rem; }
.card-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .8rem; margin: .4rem 0 .2rem; }
.card-facts dt { font-size: .66rem; font-weight: 600; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }
.card-facts dd { margin: 0; }
.card-items { list-style: none; margin: .2rem 0 0; padding: .45rem 0 0; border-top: 1px dashed var(--line); font-size: .84rem; color: var(--ink-2); }
.card-items li { display: flex; gap: .45rem; padding: .08rem 0; }
.card-items .num { min-width: 2.6rem; color: var(--ink); font-weight: 600; }
.card-foot { margin-top: auto; padding-top: .5rem; font-size: .84rem; font-weight: 600; color: var(--accent-ink); }

/* login */
.login { max-width: 360px; margin: 10vh auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); padding: 1.6rem 1.7rem 1.4rem; }
.login h1 { margin-bottom: 1rem; display: block; }
.login h1::before { content: ""; display: block; width: 34px; height: 34px; border-radius: 10px; margin-bottom: .8rem; background: linear-gradient(135deg, #6a93ff, #3061e3 55%, #7a4dff); box-shadow: 0 2px 8px rgba(48,97,227,.4); }
.login p { margin: .7rem 0; }
.login button { width: 100%; justify-content: center; margin-top: .3rem; }

/* ---------- small screens: the rail becomes a top bar ---------- */
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { width: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: .6rem .7rem; gap: .2rem .6rem; overflow: visible; }
  .sidebar .brand { padding: 0; }
  .year { padding: 0; }
  .year label span { display: none; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; padding: 0; width: 100%; }
  .nav-group { display: none; }
  .sidebar nav a { padding: .35rem .55rem; font-size: .84rem; }
  .sidebar nav a svg { display: none; }
  .sidebar .refresh { margin: auto .7rem 0; padding-top: .8rem; }
.sidebar .refresh button { width: 100%; justify-content: center; gap: .5rem; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: var(--side-ink); box-shadow: none; font-size: .84rem; }
.sidebar .refresh button:hover { background: rgba(255,255,255,.11); color: var(--side-ink-strong); }
.sidebar .refresh svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar .user { margin-top: 0; margin-left: auto; border: 0; padding: .2rem 0; }
  .content { padding: 1rem 1rem 3rem; }
  table.grid { font-size: .85rem; }
  .two-col { grid-template-columns: 1fr; }
}
table.grid tr.hit td { border-top: 0; padding-top: 0; font-size: .85rem; }
table.grid tr.hit td:nth-child(2)::before { content: "↳ "; color: var(--muted); }
