/* Media Panthers Invoices. Media Panthers brand tokens from the company design system (baseline
   packages/design-system/src/styles/tokens.css): sky blue #3fa9f5 with dark ink, crimson signal #e9204f (decoration only),
   true neutral greys, square 2px corners, Poppins for text and headings, Roboto Condensed for labels.
   Dark is the default theme (the brand is dark-first); theme-init.js applies a stored choice before first paint.
   Fonts are self-hosted (CSP: font-src 'self'), SIL Open Font License (fonts/LICENSE-*.txt). */
@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/poppins-400.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/poppins-500.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-600.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/poppins-700.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/poppins-800.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/poppins-400-ext.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/poppins-500-ext.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-600-ext.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/poppins-700-ext.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Poppins; font-style: normal; font-weight: 800; font-display: swap; src: url(/fonts/poppins-800-ext.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/roboto-condensed.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/roboto-condensed-ext.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* ── Tokens · dark (default) ──────────────────────────────────────────────── */
:root {
  color-scheme: dark;
  --bg: #0c0c0d; --surface: #161616; --surface-2: #1c1c1c; --popover: #1c1c1c;
  --border: #2a2a2b; --input-border: #6a6a6e; --text: #f2f2f2; --muted: #a3a3a3;
  --primary: #3fa9f5; --primary-fg: #061019; --accent: #10273a; --link: #3fa9f5; --ring: #3fa9f5;
  --ok: #0ca30c; --ok-fg: #0c0c0d; --warn: #fab219; --bad: #ff4d73; --bad-fg: #0c0c0d; --info: #3fa9f5;
  --sidebar: #101011; --sidebar-fg: #dedede; --sidebar-accent: #1c1c1c; --sidebar-border: #1f1f20;
  --sidebar-active: #3fa9f5; --sidebar-active-fg: #061019;
  --signal: #e9204f; --brand-surface: #050505; --brand-fg: #f2f2f2; --brand-muted: #a3a3a3;
  --shadow: none; --backdrop: rgba(5, 5, 5, .7);

  --font: Poppins, "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --label: "Roboto Condensed", Poppins, "Arial Narrow", sans-serif;
  --code: ui-monospace, "SF Mono", Consolas, monospace;
  --radius: 2px; --control-h: 2.375rem; --ease: cubic-bezier(0.16, 1, 0.3, 1); --dur: 250ms;
  font-family: var(--font);
}
/* ── Tokens · light ───────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f7f8; --surface: #fdfdfd; --surface-2: #efeff0; --popover: #fdfdfd;
  --border: #e0e0e2; --input-border: #8a8a8e; --text: #101010; --muted: #5c5c5c;
  --primary: #3fa9f5; --primary-fg: #061019; --accent: #e8f4fd; --link: #0b6fbf; --ring: #1d8fe0;
  --ok: #006300; --ok-fg: #fdfdfd; --warn: #8a5300; --bad: #d30a44; --bad-fg: #fdfdfd; --info: #0b6fbf;
  --sidebar: #f0f0f1; --sidebar-fg: #1a1a1a; --sidebar-accent: #e4e4e6; --sidebar-border: #e0e0e2;
  --sidebar-active: #101010; --sidebar-active-fg: #f7f7f8;
  --shadow: 0 1px 2px rgba(16, 16, 16, .05); --backdrop: rgba(12, 12, 13, .45);
}
/* Status backgrounds are tints of the status colour, so they follow the theme. */
:root { --ok-soft: color-mix(in srgb, var(--ok) 14%, var(--surface)); --warn-soft: color-mix(in srgb, var(--warn) 14%, var(--surface));
  --bad-soft: color-mix(in srgb, var(--bad) 13%, var(--surface)); --info-soft: color-mix(in srgb, var(--info) 14%, var(--surface)); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-underline-offset: 4px; text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.boot { padding: 48px; text-align: center; color: var(--muted); }
h1, h2 { font-weight: 700; letter-spacing: -.02em; line-height: 1.12; text-wrap: balance; }
h1 { font-size: 2rem; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
h3 { font-size: .95rem; font-weight: 600; margin: 18px 0 8px; }
h1 .mono { font-family: var(--code); font-size: .5em; color: var(--muted); font-weight: 500; vertical-align: middle; letter-spacing: 0; }
.eyebrow, th, legend, .badge, .tag, .stat .l, .nav-label, .label { font-family: var(--label); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
/* The crimson vertical rule (mediapanthers.com section dividers) marks each page title. */
.eyebrow { display: inline-block; font-size: .78rem; color: var(--muted); border-left: 2px solid var(--signal); padding-left: 10px; margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--code); font-size: .84rem; word-break: break-all; }

/* ── App shell: sidebar + top bar (the company app shell) ─────────────────── */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "side top" "side main"; min-height: 100vh; }
.sidebar { grid-area: side; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar); color: var(--sidebar-fg); border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 6px; padding: 18px 12px 14px; }
.sidebar .logo { display: block; padding: 2px 8px 14px; }
.sidebar .logo img { height: 52px; width: auto; display: block; }
.nav-label { font-size: .72rem; color: var(--muted); padding: 10px 10px 4px; }
.sidebar > nav { display: flex; flex-direction: column; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--sidebar-fg); font-weight: 500; font-size: .9rem; text-decoration: none; transition: background-color var(--dur) var(--ease); }
.nav a:hover { background: var(--sidebar-accent); }
.nav a.active { background: var(--sidebar-active); color: var(--sidebar-active-fg); font-weight: 600; }
.nav a .ico { width: 18px; text-align: center; font-size: .95rem; line-height: 1; opacity: .9; }
.count { margin-left: auto; background: var(--primary); color: var(--primary-fg); font-family: var(--label); font-size: .72rem; font-weight: 700; padding: 0 7px; border-radius: var(--radius); }
.nav a.active .count { background: var(--sidebar-active-fg); color: var(--sidebar-active); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--sidebar-border); padding: 14px 6px 2px; display: flex; flex-direction: column; gap: 10px; font-size: .86rem; }
.sidebar-foot .who strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { display: block; color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar { grid-area: top; position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); }
.topbar .mark { display: none; height: 30px; width: 30px; }
.topbar .label { font-size: .78rem; color: var(--muted); }
.topbar .spacer { flex: 1; }
.topbar .mobile-only { display: none; }
.shell > main { grid-area: main; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 32px 72px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 4px 0 22px; flex-wrap: wrap; }
.page-head > div > .muted.small { max-width: 65ch; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "top" "side" "main"; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--sidebar-border); overflow-x: auto; }
  .sidebar .logo, .nav-label, .sidebar-foot { display: none; }
  .sidebar > nav, .nav { flex-direction: row; gap: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a .ico { display: none; }
  .topbar { padding: 0 16px; }
  .topbar .mark, .topbar .mobile-only { display: inline-flex; }
  .shell > main { padding: 20px 16px 56px; }
}

/* ── Badges & tags ────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; font-size: .72rem; border-radius: var(--radius); white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.b-DRAFT { background: var(--surface-2); color: var(--muted); }
.b-SUBMITTED { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b-APPROVED, .b-FILED { background: var(--info-soft); color: var(--info); border-color: transparent; }
.b-PAID { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b-REJECTED { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.b-WITHDRAWN { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.b-sent { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.b-skipped, .b-pending, .b-sending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.b-failed { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag { font-size: .72rem; padding: 1px 6px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); }
.tag.crypto { border-color: var(--info); color: var(--info); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; font-size: .85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); white-space: nowrap; }
.pill.away { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ── Cards, tables ────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
.card > .table-wrap { border: 0; border-radius: 0; box-shadow: none; margin: 0 -22px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.card > h2 + .table-wrap, .card > p + .table-wrap { margin-top: 4px; }
.card > h3 { margin-top: 24px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-size: .74rem; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
td { padding: .625rem 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable td { transition: background-color var(--dur) var(--ease); }
tr.clickable:hover td, tr.clickable:focus-visible td { background: var(--accent); }
tr.clickable:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.show-sm { display: none; }
.empty { padding: 44px; text-align: center; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .86rem; }
dl.kv dd { margin: 0; }
@media (max-width: 600px) { dl.kv { grid-template-columns: 1fr; gap: 2px 16px; } dl.kv dt { margin-top: 8px; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 10px 18px; border-left: 2px solid var(--border); position: relative; font-size: .88rem; }
.timeline li::before { content: ""; width: 10px; height: 10px; background: var(--primary); position: absolute; left: -6px; top: 14px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); padding: 6px 12px; cursor: pointer; font: inherit; font-size: .84rem; font-weight: 500; transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.tabs button:hover { color: var(--text); border-color: var(--input-border); }
.tabs button.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); font-weight: 600; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 14px; }
.row > .actions { align-self: end; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .86rem; font-weight: 600; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea { font: inherit; min-height: var(--control-h); padding: 7px 11px; border: 1px solid var(--input-border); border-radius: var(--radius); background: var(--surface); color: var(--text); width: 100%; transition: border-color var(--dur) var(--ease); }
input:hover, select:hover, textarea:hover { border-color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ring); outline-offset: 0; border-color: var(--ring); }
textarea { min-height: 80px; resize: vertical; }
.err { color: var(--bad); font-size: .8rem; font-weight: 500; }
.invalid input, .invalid select, .invalid textarea { border-color: var(--bad); }
.invalid .choice label { border-color: var(--bad); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice label { border: 1px solid var(--border); border-radius: var(--radius); padding: 13px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; background: var(--surface); transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease); }
.choice label:hover { border-color: var(--input-border); }
.choice label[hidden] { display: none; }
.choice label:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--accent); }
.choice input { width: auto; min-height: 0; margin-top: 4px; accent-color: var(--primary); }
.choice .ct { font-weight: 600; }
.choice.compact { grid-template-columns: repeat(4, minmax(0, 200px)); gap: 6px 24px; }
@media (max-width: 640px) { .choice.compact { grid-template-columns: 1fr; } }
.choice.compact label { border: 0; background: transparent; padding: 4px 0; align-items: center; box-shadow: none; }
.choice.compact label:has(input:checked) { background: transparent; box-shadow: none; }
.choice.compact .ct { font-weight: 500; font-size: .9rem; }
.choice .cd { font-size: .8rem; color: var(--muted); font-weight: 400; }
.choice.people label { align-items: center; }
.choice.people input { margin-top: 0; }
.choice .avatar { flex: none; width: 34px; height: 34px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--label); font-weight: 700; font-size: .85rem; color: var(--text); }
.choice label:has(input:checked) .avatar { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 0 0 22px; min-width: 0; }
legend { margin-bottom: 12px; font-size: .84rem; display: flex; align-items: center; }
form { counter-reset: step; }
fieldset:not([hidden]) > legend .step { counter-increment: step; }
.step::before { content: counter(step); }
.step { display: inline-flex; width: 22px; height: 22px; background: var(--primary); color: var(--primary-fg); align-items: center; justify-content: center; font-size: .78rem; margin-right: 10px; letter-spacing: 0; border-radius: var(--radius); }
.form-footer { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 4px; }
.crypto-box { border: 1px dashed var(--info); border-radius: var(--radius); padding: 14px; margin-bottom: 22px; background: var(--info-soft); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions select, .actions input { width: auto; }
form > .actions { margin-top: 14px; }
td.row-actions { white-space: nowrap; width: 1%; }
td.row-actions .actions { flex-wrap: nowrap; }
th.pick, td.pick { width: 1%; padding-right: 0; }
th.pick input, td.pick input { width: 18px; height: 18px; min-height: 0; margin: 0; cursor: pointer; accent-color: var(--primary); }
.bulk-bar { justify-content: flex-end; align-items: center; margin-top: 10px; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toolbar .tabs { margin-bottom: 0; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar-right input[type=search] { width: 300px; max-width: 100%; }
/* Inputs keep 3:1 against the page (WCAG 1.4.11) and are 16px on phones so iOS does not zoom on focus. */
@media (max-width: 640px) { input, select, textarea { font-size: 16px; } .toolbar-right, .toolbar-right input[type=search] { width: 100%; } }

/* ── Buttons. Outline buttons fill from the left on hover (mediapanthers.com signature). ── */
.btn { --fill: var(--primary); --fill-fg: var(--primary-fg); position: relative; isolation: isolate; overflow: hidden; font: inherit; font-weight: 600; font-size: .86rem;
  min-height: var(--control-h); border-radius: var(--radius); padding: 7px 16px; border: 1px solid var(--fill); background: transparent; color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: color var(--dur) var(--ease); }
.btn::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--fill); transform: scaleX(0); transform-origin: left; transition: transform var(--dur) var(--ease); }
.btn:hover { color: var(--fill-fg); text-decoration: none; }
.btn:hover::before { transform: scaleX(1); }
.btn.primary { background: var(--primary); color: var(--primary-fg); }
.btn.primary::before { background: color-mix(in srgb, var(--primary) 82%, #ffffff); }
.btn.ok { --fill: var(--ok); --fill-fg: var(--ok-fg); background: var(--ok); color: var(--ok-fg); }
.btn.ok::before { background: color-mix(in srgb, var(--ok) 85%, #ffffff); }
.btn.danger { --fill: var(--bad); --fill-fg: var(--bad-fg); color: var(--bad); }
.btn.sm { min-height: 2rem; padding: 4px 11px; font-size: .8rem; }
.btn.icon { min-width: 2.375rem; padding: 4px 9px; font-size: 1rem; line-height: 1; }
.btn.ghost { --fill: var(--surface-2); --fill-fg: var(--text); border-color: var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled::before { transform: scaleX(0); }
.btn:disabled:hover { color: inherit; }
.btn.primary:disabled:hover { color: var(--primary-fg); }
.btn.ok:disabled:hover { color: var(--ok-fg); }
/* .btn.danger sets its own text colour, which would otherwise win over .btn:hover and vanish into the fill. */
.btn.danger:hover { color: var(--bad-fg); }
.btn.danger:disabled:hover { color: var(--bad); }
.notice { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; border-left: 3px solid currentColor; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--accent); color: var(--text); border-left-color: var(--primary); }
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .85rem; }
.switch input { width: auto; min-height: 0; accent-color: var(--primary); }

/* ── Toast & dialog ───────────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 8px); background: var(--popover); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: var(--radius); padding: 11px 16px; font-size: .9rem; opacity: 0; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); pointer-events: none; z-index: 50; max-width: 90vw; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: var(--bad-fg); border-color: var(--bad); }
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; background: var(--popover); color: var(--text); width: min(480px, 92vw); }
dialog::backdrop { background: var(--backdrop); }
dialog h2 { margin-bottom: 8px; }
dialog p { margin: 0 0 16px; }
dialog .err:empty { display: none; }
dialog .err { margin-top: 6px; }
dialog .actions { justify-content: flex-end; margin-top: 20px; }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none; transition: border-color var(--dur) var(--ease); }
a.stat:hover { border-color: var(--primary); text-decoration: none; }
.stat .l { font-size: .74rem; color: var(--muted); }
.stat .v { font-weight: 800; font-size: 2.6rem; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: .8rem; color: var(--muted); margin-top: auto; }
.stat.hot { background: var(--brand-surface); color: var(--brand-fg); border-color: var(--brand-surface); border-left: 3px solid var(--signal); }
.stat.hot .v { color: #3fa9f5; }
.stat.hot .l, .stat.hot .s { color: var(--brand-muted); }
.totals { font-size: .88rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid2.even { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .grid2.even { grid-template-columns: 1fr; } }
tr.current td { background: var(--accent); }
tr.edit-row > td { background: var(--surface-2); padding: 16px 18px 18px; border-bottom: 2px solid var(--border); }

/* ── Sign-in: dark brand panel with the crimson rule + calm form side ─────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 7fr 5fr; }
.login .hero { background: var(--brand-surface); color: var(--brand-fg); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; position: relative; overflow: hidden; }
.login .hero > img { height: 72px; width: auto; align-self: flex-start; }
.login .hero .rule { display: block; width: 2px; height: 64px; background: var(--signal); margin-bottom: 30px; }
.login .hero .label { color: #3fa9f5; font-size: .9rem; }
.login .hero h1 { font-size: clamp(2.6rem, 5.4vw, 4.4rem); font-weight: 800; line-height: 1.02; letter-spacing: -.035em; margin: 12px 0 0; max-width: 12ch; }
.login .hero p { margin: 22px 0 0; color: var(--brand-muted); max-width: 40ch; font-size: 1.02rem; }
.login .hero .legal { font-size: .75rem; color: var(--brand-muted); opacity: .8; margin: 0; }
.login .hero .copy { animation: rise .7s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.login .side { display: flex; flex-direction: column; }
.login .side-top { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 16px; }
.login .side-top .mark { display: none; height: 34px; width: 34px; margin-right: auto; }
.login .panel { flex: 1; display: grid; place-items: center; padding: 16px 20px 64px; }
.login .panel > div { width: min(380px, 100%); }
.login .panel h2 { font-size: 1.6rem; }
.login .panel p { color: var(--muted); }
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login .hero { padding: 28px 20px 32px; gap: 24px; }
  .login .hero > img { height: 52px; }
  .login .hero .rule { height: 40px; margin-bottom: 18px; }
  .login .hero .legal { display: none; }
}
.auth-msg { max-width: 480px; margin: 12vh auto; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--signal); border-radius: var(--radius); }
.auth-logo { height: 56px; width: auto; }
.ms-btn { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 2.75rem; padding: 10px 18px; background: var(--primary); color: var(--primary-fg); border-radius: var(--radius); font-weight: 600; text-decoration: none; margin-top: 24px; transition: filter var(--dur) var(--ease); }
.ms-btn:hover { filter: brightness(1.08); text-decoration: none; }
.ms-logo { display: grid; grid-template-columns: 8px 8px; gap: 2px; }
.ms-logo i { width: 8px; height: 8px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }

/* ── Small-screen polish ──────────────────────────────────────────────────── */
td.mono, td.num, td.nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  th, td { padding: 10px 8px; }
  h1 { font-size: 1.65rem; }
  .card { padding: 18px; }
  .card > .table-wrap { margin: 0 -18px; }
}

/* Descriptions keep their line breaks. */
.notes { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Motion is opt-out for everyone who asks the OS for it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
