/* ============================================================
   MRML KOL dashboard — UI-1 (2026-11-01)
   Design language = MRML Shorts v13 "VoiceBox" (/opt/shorts/web/assets/app.css L996–1262): black on white, one red
   accent, flat, square, 2px borders, no shadows. Red = what waits for YOU / errors / danger only; running = black.
   New vs Shorts: a dark theme done ONLY through tokens (prefers-color-scheme + [data-theme]); no component has its own
   dark rule. Thai: body line-height 1.7, headings 1.3–1.45, never letter-spacing, never uppercase, no forced breaks.
   ============================================================ */
:root {
  --paper: #FAFAFA; --soft: #F5F5F5; --field: #FFFFFF;
  --ink: #0A0A0A; --ink-2: #262626; --ink-3: #525252; --hint: #6B6B6B; --line: #D4D4D4; --line-soft: #E5E5E5;
  /* red: accent (borders, dots) · fill (solid backgrounds with white text) · text (red words on paper) */
  --red: #EF4444; --red-fill: #DC2626; --red-text: #DC2626; --red-soft: #FEF2F2; --red-line: #FECACA; --red-ink: #7F1D1D;
  --green: #16A34A; --green-fill: #15803D; --green-text: #15803D; --green-soft: #F0FDF4; --green-line: #BBF7D0;
  --warn: #CA8A04; --warn-text: #854D0E; --warn-soft: #FEFCE8; --warn-line: #FDE68A;
  --on-fill: #FFFFFF; --scrim: rgba(10, 10, 10, .55); --hover-ink: #262626;
  --font: "Work Sans", "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Archivo Black", "Kanit", Impact, "Arial Black", sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  --fs: 15px; --fs-sm: 14px; --fs-xs: 13px; --lh: 1.7;
  --nav-h: 60px; --tab-h: 64px; --b2: 2px;
  color-scheme: light;
}
/* dark: same components, swapped tokens. Ink becomes the light slab, so the one "black" primary button is a white slab. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B0B0B; --soft: #171717; --field: #111111;
    --ink: #F5F5F5; --ink-2: #E5E5E5; --ink-3: #B3B3B3; --hint: #949494; --line: #4A4A4A; --line-soft: #2A2A2A;
    --red: #EF4444; --red-fill: #DC2626; --red-text: #F87171; --red-soft: #2A1111; --red-line: #7F1D1D; --red-ink: #FECACA;
    --green: #22C55E; --green-fill: #15803D; --green-text: #4ADE80; --green-soft: #0B2615; --green-line: #166534;
    --warn: #EAB308; --warn-text: #FDE047; --warn-soft: #262006; --warn-line: #854D0E;
    --on-fill: #FFFFFF; --scrim: rgba(0, 0, 0, .7); --hover-ink: #D4D4D4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0B0B0B; --soft: #171717; --field: #111111;
  --ink: #F5F5F5; --ink-2: #E5E5E5; --ink-3: #B3B3B3; --hint: #949494; --line: #4A4A4A; --line-soft: #2A2A2A;
  --red: #EF4444; --red-fill: #DC2626; --red-text: #F87171; --red-soft: #2A1111; --red-line: #7F1D1D; --red-ink: #FECACA;
  --green: #22C55E; --green-fill: #15803D; --green-text: #4ADE80; --green-soft: #0B2615; --green-line: #166534;
  --warn: #EAB308; --warn-text: #FDE047; --warn-soft: #262006; --warn-line: #854D0E;
  --on-fill: #FFFFFF; --scrim: rgba(0, 0, 0, .7); --hover-ink: #D4D4D4;
  color-scheme: dark;
}

/* ---------- base */
* { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: var(--fs); line-height: var(--lh); -webkit-font-smoothing: antialiased; }
body { overflow-x: hidden; min-width: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; display: block; }
[hidden] { display: none !important; }
p { margin: 0; }
ul { margin: 0; padding-left: 20px; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
h1, h2, h3, h4 { margin: 0; letter-spacing: 0; text-transform: none; }
h1, h2, .brand, .stat b, .costbox b, .inbox-strip .hd { font-family: var(--display); font-weight: 800; font-synthesis: none; letter-spacing: 0; }
h1 { font-size: 34px; line-height: 1.3; text-wrap: balance; }
h2 { font-size: 22px; line-height: 1.35; text-wrap: balance; }
h3 { font-size: 16px; font-weight: 700; line-height: 1.45; }
h4 { font-size: 14px; font-weight: 700; line-height: 1.45; color: var(--ink-3); }
.u { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.6; }
.lbl { font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); }
.mono, code { font-family: var(--mono); font-size: .92em; }
code.blk { display: block; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--soft); border: 2px solid var(--line-soft); padding: 8px 10px; font-size: 12px; line-height: 1.55; max-height: 260px; overflow: auto; }
.red { color: var(--red-text); } .green { color: var(--green-text); } .muted { color: var(--ink-3); }
.ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.ico.sm { width: 18px; height: 18px; }
.ico.xs { width: 15px; height: 15px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- top bar: 2px rule, wordmark in a black block, red underline on the active page */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; height: var(--nav-h); padding: 0 24px; background: var(--paper); border-bottom: 2px solid var(--ink); }
.brand { display: inline-flex; align-items: center; gap: 6px; font-size: 21px; line-height: 1; white-space: nowrap; }
.brand .logo { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; background: var(--ink); color: var(--paper); }
.brand b { color: var(--paper); background: var(--ink); padding: 3px 7px 4px; margin-left: 4px; font-weight: 400; }
.nav { display: flex; gap: 2px; height: 100%; min-width: 0; }
.nav a { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; color: var(--ink-3); font-size: var(--fs); font-weight: 600; white-space: nowrap; border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); border-bottom-color: var(--red); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; background: var(--red-fill); color: var(--on-fill); font-family: var(--mono); font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.spacer { flex: 1; }
.jobs-indicator { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px; border: 2px solid var(--ink); color: var(--ink); font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.spin { width: 10px; height: 10px; background: var(--ink); animation: pulse 1.1s infinite; flex: none; }
.who { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 10px; border: 2px solid var(--line); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.who:hover { border-color: var(--ink); }
.degraded { position: sticky; top: var(--nav-h); z-index: 25; display: flex; gap: 10px; align-items: flex-start; padding: 10px 24px; background: var(--red-soft); border-bottom: 2px solid var(--red-line); border-left: 4px solid var(--red); color: var(--red-ink); font-size: var(--fs-sm); line-height: 1.6; }
.degraded b { font-weight: 700; }

/* ---------- layout */
main { max-width: 1280px; margin: 0 auto; padding: 24px 24px 96px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head .sub { color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.6; margin-top: 2px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: var(--fs-sm); font-weight: 600; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); }
.section { margin-top: 28px; }
.section > h2, .section > .sechead { margin-bottom: 12px; }
.sechead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.sechead h2, .sechead h3 { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.stack > * + * { margin-top: 12px; }
.btngroup { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- buttons: black slab primary (red on hover), outlined secondary, red destructive */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 7px 16px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-size: var(--fs-sm); font-weight: 600; line-height: 1.4; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; text-align: center; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 700; }
.btn.primary:hover:not(:disabled) { background: var(--red-fill); border-color: var(--red-fill); color: var(--on-fill); }
.btn.primary:disabled:hover { background: var(--ink); color: var(--paper); }
.btn.ok { border-color: var(--green); color: var(--green-text); }
.btn.ok:hover:not(:disabled) { background: var(--green-fill); border-color: var(--green-fill); color: var(--on-fill); }
.btn.danger, .btn.no { border-color: var(--red); color: var(--red-text); }
.btn.danger:hover:not(:disabled), .btn.no:hover:not(:disabled) { background: var(--red-fill); border-color: var(--red-fill); color: var(--on-fill); }
.btn.ghost { border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.sm { min-height: 34px; padding: 3px 12px; font-size: var(--fs-xs); }
.btn.block { width: 100%; }
.btn .cost { font-family: var(--mono); font-size: 12px; opacity: .8; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 2px solid var(--ink); background: transparent; color: var(--ink); padding: 0; flex: none; }
.iconbtn:hover { background: var(--ink); color: var(--paper); }

/* ---------- chips: flat squares, status by border colour (UI §6.1) */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 2px solid var(--line); background: transparent; color: var(--ink-3); font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.grey { color: var(--ink-3); border-color: var(--line); }
.chip.outline { color: var(--ink); border-color: var(--ink); }
.chip.green { color: var(--green-text); border-color: var(--green); background: var(--green-soft); }
.chip.solid { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.chip.run { color: var(--paper); border-color: var(--ink); background: var(--ink); }
.chip.red { color: var(--red-text); border-color: var(--red); background: var(--red-soft); }
.chip.redsoft { color: var(--red-text); border-color: var(--red-line); background: transparent; }
.chip.redsolid { color: var(--on-fill); border-color: var(--red-fill); background: var(--red-fill); }
.chip.warn { color: var(--warn-text); border-color: var(--warn); background: var(--warn-soft); }
.chip.mono { font-family: var(--mono); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }

/* status lights: square dots — green done · black (blinking) running · RED waits for you · grey idle */
.light { display: inline-block; width: 10px; height: 10px; background: var(--line); flex: none; vertical-align: middle; }
.light.done { background: var(--green); }
.light.run { background: var(--ink); animation: pulse 1.1s infinite; }
.light.you, .light.bad { background: var(--red); }
.light.warn { background: var(--warn); }

/* ---------- surfaces */
.card { background: var(--paper); border: 2px solid var(--line-soft); }
.card > .body { padding: 16px 18px; }
.card.hl { border-color: var(--ink); }
.empty { padding: 32px 20px; text-align: center; color: var(--ink-3); border: 2px dashed var(--line); background: var(--paper); font-size: var(--fs); line-height: 1.7; }
.strip { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; margin-bottom: 16px; background: var(--soft); border: 2px solid var(--line-soft); border-left: 4px solid var(--ink); color: var(--ink); flex-wrap: wrap; line-height: 1.6; }
.strip > .grow { flex: 1; min-width: 200px; }
.strip.bad, .flagbar { background: var(--red-soft); border: 2px solid var(--red-line); border-left: 4px solid var(--red); color: var(--red-ink); }
.strip.warn { background: var(--warn-soft); border-color: var(--warn-line); border-left-color: var(--warn); color: var(--warn-text); }
.strip.ok { background: var(--green-soft); border-color: var(--green-line); border-left-color: var(--green); color: var(--ink); }
.flagbar { padding: 10px 14px; margin: 0 0 12px; line-height: 1.6; }
.flagbar b { display: block; margin-bottom: 2px; }
.flagbar ul { margin-top: 4px; }
.flagbar li + li { margin-top: 2px; }
.progress { position: relative; height: 12px; background: var(--line-soft); border: 2px solid var(--ink); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ink); }
.progress.over > i { background: var(--red); }
.costbox { border: 2px solid var(--ink); padding: 12px 14px; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.6; min-width: 0; }
.costbox b { display: block; font-size: 26px; color: var(--ink); line-height: 1.25; margin: 2px 0 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.stat { display: grid; gap: 2px; border: 2px solid var(--line-soft); padding: 10px 14px; background: var(--paper); min-width: 0; }
.stat b { font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.stat b.unk { font-family: var(--font); font-size: 17px; font-weight: 700; color: var(--ink-3); }
.stat span { color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.5; }
.stat.you { border-color: var(--red); }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 14px; font-size: var(--fs); align-items: start; }
.kv > b { color: var(--ink-3); font-weight: 700; font-size: var(--fs-xs); padding-top: 3px; line-height: 1.5; display: inline-flex; gap: 4px; align-items: center; }
.kv > div { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.kv > div.diff { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); padding-left: 8px; }

/* home: "รอคุณ" strip gets the one red rule; rows are flat list items */
.inbox-strip { border: 2px solid var(--line-soft); border-top: 4px solid var(--red); margin-bottom: 20px; background: var(--paper); }
.inbox-strip.none { border-top-color: var(--green); }
.inbox-strip .hd { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 2px solid var(--ink); font-size: 18px; line-height: 1.4; }
.inbox-strip .hd .grow { flex: 1; min-width: 160px; }
.inbox-strip .hd .btn { font-family: var(--font); }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.row:last-child { border-bottom: 0; }
a.row:hover { background: var(--soft); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.row .s { color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.55; overflow-wrap: anywhere; }
.row .pic { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 2px solid var(--line); color: var(--ink); flex: none; }
.row .pic.you { border-color: var(--red); color: var(--red-text); }
.row .pic.run { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.row .pic.done { border-color: var(--green); color: var(--green-text); }
.row.sel { background: var(--soft); box-shadow: inset 4px 0 0 var(--ink); }
.row .end { flex: none; text-align: right; font-size: var(--fs-xs); color: var(--ink-3); }

/* KOL card */
.kcard { display: flex; flex-direction: column; border: 2px solid var(--line-soft); background: var(--paper); min-width: 0; transition: border-color .15s; }
.kcard:hover { border-color: var(--ink); }
.kcard .kc-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px 10px; }
.kcard .avatar { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; border: 2px solid var(--ink); font-family: var(--display); font-size: 20px; line-height: 1; overflow: hidden; }
.kcard .kc-name { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.35; overflow-wrap: anywhere; }
.kcard .kc-id { min-width: 0; flex: 1; }
.kcard .kc-id .chip { margin-top: 6px; }
.kcard .kc-niche { color: var(--ink-3); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere; }
.kcard .kc-sent { padding: 0 16px 12px; font-size: var(--fs); line-height: 1.6; overflow-wrap: anywhere; }
.kcard .kc-sent.you { color: var(--red-text); font-weight: 600; }
.kcard .kc-foot { margin-top: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 16px; border-top: 2px solid var(--line-soft); background: var(--soft); font-size: var(--fs-xs); color: var(--ink-3); min-height: 44px; }
.kcard .kc-foot .grow { flex: 1; }
.quota { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.quota .q { border: 2px solid var(--line-soft); padding: 10px 14px; }
.quota .q b { font-family: var(--mono); font-size: 20px; }
.quota .q.full { border-color: var(--ink); }
.quota .q span { display: block; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters label { display: grid; gap: 4px; font-size: var(--fs-xs); font-weight: 700; color: var(--ink-3); }
.filters select { min-width: 170px; }

/* tabs */
.seg { display: flex; border: 2px solid var(--ink); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.seg a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; min-height: 42px; color: var(--ink-3); font-weight: 600; white-space: nowrap; flex: none; border-right: 2px solid var(--line-soft); }
.seg a:last-child { border-right: 0; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: var(--ink); color: var(--paper); }
.seg .pill { margin-left: 2px; }

/* review items (.item of Shorts) */
.items { display: grid; gap: 14px; }
.item { position: relative; border: 2px solid var(--line-soft); background: var(--paper); min-width: 0; }
.item::before { content: ""; position: absolute; left: -2px; top: -2px; bottom: -2px; width: 4px; background: var(--ink); }
.item.flag::before { background: var(--red); }
.item.sel { border-color: var(--ink); }
.item .ihead { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 2px solid var(--line-soft); flex-wrap: wrap; }
.item .ihead .ttl { flex: 1; min-width: 0; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.item .ireason { padding: 10px 16px 0; font-size: var(--fs); line-height: 1.6; overflow-wrap: anywhere; }
.item .ireason.you { color: var(--red-text); font-weight: 600; }
.item .ibody { padding: 12px 16px; min-width: 0; }
.item .ifoot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 2px solid var(--line-soft); background: var(--soft); flex-wrap: wrap; }
.item .ifoot .grow { flex: 1; }
.item .ifoot .ver { color: var(--ink-3); font-size: var(--fs-xs); font-family: var(--mono); }

/* error card (JOB-03) */
.errcard { border: 2px solid var(--red-line); border-left: 4px solid var(--red); background: var(--red-soft); padding: 12px 16px; color: var(--red-ink); }
.errcard .eh { font-weight: 700; font-size: 17px; line-height: 1.45; color: var(--red-text); }
.errcard .er { margin-top: 4px; line-height: 1.6; }
.errcard .btngroup { margin-top: 10px; }
.errcard details.fold { margin-top: 10px; background: var(--paper); color: var(--ink); }

/* details.fold "ดูเพิ่ม" */
details.fold { border: 2px solid var(--line-soft); background: var(--paper); min-width: 0; }
details.fold + details.fold { margin-top: 10px; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; min-height: 44px; font-size: var(--fs-sm); font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary:hover { background: var(--soft); }
details.fold > summary .more { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); }
details.fold[open] > summary .more::after { content: ' ▴'; }
details.fold:not([open]) > summary .more::after { content: ' ▾'; }
details.fold[open] > summary { border-bottom: 2px solid var(--line-soft); }
details.fold > .fbody { padding: 12px 14px; min-width: 0; }

/* tables: scroll inside their own container, never the page */
.tblwrap { overflow-x: auto; border: 2px solid var(--line-soft); max-width: 100%; -webkit-overflow-scrolling: touch; }
.tblwrap.tall { max-height: 70vh; overflow-y: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.tbl th, table.tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; line-height: 1.55; }
table.tbl th { position: sticky; top: 0; z-index: 1; background: var(--soft); color: var(--ink); font-weight: 700; font-size: var(--fs-xs); border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.tbl td { overflow-wrap: anywhere; }
table.tbl td.nw { white-space: nowrap; overflow-wrap: normal; }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
table.tbl tr:hover td { background: var(--soft); }
table.tbl tr.click { cursor: pointer; }

/* forms: 44px, 2px borders, black focus */
input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; border: 2px solid var(--line); background: var(--field); color: var(--ink); line-height: 1.5; }
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); outline: none; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--ink); flex: none; margin: 2px 0 0; }
input[readonly] { background: var(--soft); }
.field { display: grid; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > span { color: var(--ink); font-weight: 700; font-size: var(--fs-xs); line-height: 1.5; }
.field > small { color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.55; }
.field.err input, .field.err textarea, .field.err select { border-color: var(--red); }
.field .ferr { color: var(--red-text); font-size: var(--fs-xs); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; cursor: pointer; line-height: 1.55; }
.check small { display: block; color: var(--ink-3); font-size: var(--fs-xs); }
.frow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.caprow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.caprow > span { font-size: var(--fs-sm); font-weight: 600; line-height: 1.45; }

/* checklist */
.cl { border: 2px solid var(--line-soft); }
.cl .ci { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); min-height: 52px; }
.cl .ci:last-child { border-bottom: 0; }
.cl .ci .mark { width: 26px; height: 26px; flex: none; display: flex; align-items: center; justify-content: center; border: 2px solid var(--line); }
.cl .ci.ok .mark { border-color: var(--green); color: var(--green-text); background: var(--green-soft); }
.cl .ci.miss .mark { border-color: var(--red); color: var(--red-text); }
.cl .ci .grow { flex: 1; min-width: 0; }
.cl .ci .t { font-weight: 600; line-height: 1.5; }
.cl .ci .s { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; }

/* queue split view */
.split { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.split .list { border: 2px solid var(--line-soft); min-width: 0; }
.split .detail { min-width: 0; }
.jobrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); min-height: 60px; }
.jobrow:hover { background: var(--soft); }
.jobrow.sel { background: var(--soft); box-shadow: inset 4px 0 0 var(--ink); }
.jobrow .t { font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.jobrow .s { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; overflow-wrap: anywhere; }
.jobrow .end { text-align: right; display: grid; gap: 2px; justify-items: end; }
.timeline { border-left: 2px solid var(--ink); margin-left: 6px; padding-left: 16px; }
.timeline .ev { position: relative; padding: 4px 0 10px; line-height: 1.55; }
.timeline .ev::before { content: ""; position: absolute; left: -22px; top: 10px; width: 10px; height: 10px; background: var(--paper); border: 2px solid var(--ink); }
.timeline .ev.bad::before { border-color: var(--red); background: var(--red); }
.timeline .ev.ok::before { border-color: var(--green); background: var(--green); }
.timeline .ev time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-right: 8px; }
.timeline .ev .k { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.timeline .ev .x { overflow-wrap: anywhere; }

/* media */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.thumb { border: 2px solid var(--line-soft); background: var(--soft); aspect-ratio: 9 / 16; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; min-width: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ph { padding: 10px; text-align: center; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; overflow-wrap: anywhere; }
.thumb .ph .ico { display: block; margin: 0 auto 6px; }
.thumb.bad { border-color: var(--red-line); background: var(--red-soft); }
.thumb.bad .ph { color: var(--red-ink); }

/* modal (bottom sheet on phone), toasts */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--scrim); padding: 20px; }
.modal .box { width: min(640px, 100%); max-height: 90vh; overflow: auto; background: var(--paper); border: 2px solid var(--ink); display: flex; flex-direction: column; }
.modal .box.wide { width: min(900px, 100%); }
.modal .mhead { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 2px solid var(--ink); background: var(--paper); }
.modal .mhead h2 { flex: 1; font-size: 20px; line-height: 1.4; min-width: 0; overflow-wrap: anywhere; }
.modal .mbody { padding: 18px; min-width: 0; }
.modal .mfoot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 2px solid var(--ink); background: var(--paper); flex-wrap: wrap; }
.modal .menu { display: grid; gap: 8px; }
.modal .menu .btn { justify-content: flex-start; min-height: 52px; text-align: left; white-space: normal; }
.paidline { border: 2px solid var(--ink); padding: 12px 14px; margin-bottom: 14px; line-height: 1.6; }
.paidline .amt { font-family: var(--mono); font-weight: 700; font-size: 22px; display: block; line-height: 1.35; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: grid; gap: 8px; }
.toast { padding: 11px 16px; background: var(--ink); color: var(--paper); font-size: var(--fs-sm); max-width: 420px; line-height: 1.55; border-left: 4px solid var(--paper); overflow-wrap: anywhere; }
.toast.bad { background: var(--red-fill); color: var(--on-fill); border-left-color: var(--on-fill); }
.toast.ok { background: var(--green-fill); color: var(--on-fill); border-left-color: var(--on-fill); }
.fresh { font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* connectors: neutral list (no left bar — nothing here waits for anyone) */
.item.conn::before { display: none; }
.item.conn .ifoot .u { overflow-wrap: anywhere; }
/* password field with a 44px show/hide toggle */
.pw { display: flex; min-width: 0; }
.pw input { flex: 1; min-width: 0; border-right: 0; }
.pw .iconbtn { width: 48px; height: auto; min-height: 44px; border-color: var(--line); border-width: 2px; }
.pw input:focus + .iconbtn { border-color: var(--ink); }
.login .fold { margin-top: 18px; }
.login .tokrow { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pwform { max-width: 460px; }
/* login */
.login { max-width: 460px; margin: 8vh auto 0; }
.login .brand { font-size: 28px; margin-bottom: 22px; }
.login .card > .body { padding: 22px; }
.login h1 { font-size: 28px; margin-bottom: 6px; }
.login p { color: var(--ink-3); margin-bottom: 16px; line-height: 1.7; }

.tabbar { display: none; }
.phone-only { display: none !important; }

/* ---------- phone (< 760px) */
@media (max-width: 759.98px) {
  :root { --nav-h: 54px; }
  main { padding: 14px 16px calc(var(--tab-h) + 28px + env(safe-area-inset-bottom)); }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  .topbar { gap: 8px; padding: 0 12px 0 16px; }
  .brand .wordmark { display: none; }
  .nav { gap: 0; flex: 1 1 auto; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 0 8px; font-size: 13.5px; }
  .nav a .ico { display: none; }
  .spacer, #plusBtn, #themeBtn, .who { display: none; }
  .jobs-indicator { padding: 0; width: 34px; min-height: 34px; justify-content: center; }
  .jobs-indicator #jobsText { display: none; }
  .degraded { padding: 10px 16px; }
  .page-head { gap: 10px; margin-bottom: 14px; }
  .page-head .grow { flex-basis: 100%; }
  .page-head .btn { flex: 1 1 auto; }
  .btn { min-height: 44px; padding: 8px 14px; }
  .btn.sm { min-height: 44px; }
  .iconbtn { width: 44px; height: 44px; }
  .cols2, .frow { grid-template-columns: 1fr; }
  .grid.cards { grid-template-columns: 1fr; gap: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats .stat.wide { grid-column: 1 / -1; }
  .stat b { font-size: 20px; }
  .quota { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .quota .q { padding: 8px 10px; }
  .quota .q b { font-size: 17px; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv > b { padding-top: 10px; }
  .filters label { flex: 1 1 140px; }
  .filters select { min-width: 0; }
  .split { grid-template-columns: 1fr; }
  .split.has-detail .list { display: none; }
  .split:not(.has-detail) .detail { display: none; }
  .caprow { grid-template-columns: 1fr 1fr; }
  .caprow > span { grid-column: 1 / -1; padding-top: 6px; }
  .item .ihead, .item .ibody, .item .ifoot { padding-left: 12px; padding-right: 12px; }
  .item .ireason { padding-left: 12px; padding-right: 12px; }
  .item .ifoot .btn { flex: 1 1 auto; min-height: 44px; white-space: normal; padding: 6px 10px; }
  .item .ifoot .grow, .item .ifoot .ver { display: none; }
  /* review detail: ✓ ✕ stick to the bottom above the tab bar, 44px */
  .item.focus .ifoot { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); z-index: 5; border-top: 2px solid var(--ink); }
  .seg { margin-left: -16px; margin-right: -16px; max-width: none; border-left: 0; border-right: 0; }
  table.tbl { font-size: 13px; }
  table.tbl th, table.tbl td { padding: 7px 8px; }
  .modal { padding: 0; place-items: end center; }
  .modal .box, .modal .box.wide { width: 100%; max-width: 100%; max-height: 92vh; border-left: 0; border-right: 0; border-bottom: 0; }
  .modal .mbody { padding: 16px; }
  .modal .mhead { padding: 10px 16px; }
  .modal .mfoot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .modal .mfoot .btn { flex: 1 1 auto; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--paper); border-top: 2px solid var(--ink); }
  .tabbar[hidden] { display: none; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); position: relative; line-height: 1.3; min-height: 44px; }
  .tabbar a.active { color: var(--ink); box-shadow: inset 0 3px 0 var(--red); }
  .tabbar .plus { width: 44px; height: 44px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; }
  .tabbar .pill { position: absolute; top: 6px; left: calc(50% + 4px); min-width: 18px; line-height: 18px; font-size: 11px; padding: 0 4px; }
  .login { margin-top: 4vh; }
  .phone-only { display: inline-flex !important; }
}
