/* Bulkie console: partner portal and admin. Tokens from web-v2 (black, graphite, ash,
   smoke, paper; green, yellow, red for meaning only). Dark by default, light when the
   system asks for it. No inline styles anywhere: the CSP blocks them. */
:root {
  color-scheme: dark light;
  --bg: #000;
  --surface: #1c1c1e;
  --raised: #2c2c2e;
  --line: #2c2c2e;
  --line-soft: #1c1c1e;
  --text: #f3f1ec;
  --text-2: #d6d4cf;
  --muted: #8e8e93;
  --ink: #f3f1ec;
  --on-ink: #000;
  --green: #30d158;
  --yellow: #ffd60a;
  --red: #ff453a;
  --green-bg: rgba(48, 209, 88, .14);
  --yellow-bg: rgba(255, 214, 10, .14);
  --red-bg: rgba(255, 69, 58, .14);
  --chart: #f3f1ec;
  --chart-muted: #3a3a3c;
  --focus: #f3f1ec;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Spacing: one 4px scale. Everything below spaces with these, nothing else. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;
  /* Roles of the scale */
  --pad: var(--space-5);        /* inside cards, tiles, charts, table edges */
  --gap: var(--space-4);        /* between cards and tiles in a grid */
  --stack: var(--space-4);      /* between fields and blocks inside a card or form */
  --flow: var(--space-7);       /* between sections of a page */
  --flow-tight: var(--space-6); /* page head to its content */
  --gutter: var(--space-7);     /* page side padding */
  /* One control height for buttons, inputs and selects */
  --control: 40px;
  --control-sm: 32px;
  --control-lg: 48px;
  --radius: 16px;
  --radius-sm: 12px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f1ec;
    --surface: #fff;
    --raised: #e9e6df;
    --line: #dcd8cf;
    --line-soft: #ebe8e1;
    --text: #0d070a;
    --text-2: #2c2c2e;
    --muted: #5c5c61;
    --ink: #0d070a;
    --on-ink: #f3f1ec;
    --green: #1f7a35;
    --yellow: #8a5a00;
    --red: #c4120a;
    --green-bg: #dff3e4;
    --yellow-bg: #fbefc9;
    --red-bg: #fbe0de;
    --chart: #0d070a;
    --chart-muted: #c9c5bc;
    --focus: #0d070a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; }
:where(h1, h2, h3, p, ul, ol, dl, dd, figure) { margin: 0; }
a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: var(--space-2); z-index: 50; background: var(--ink); color: var(--on-ink); padding: var(--space-2) var(--space-4); border-radius: 999px; }
.skip:focus { left: var(--space-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .93em; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }

/* Lockup */
.lockup { display: inline-flex; align-items: center; gap: 7px; color: var(--text); fill: currentColor; text-decoration: none; }
.lockup .mark { width: 12px; height: 17px; }
.lockup .word { width: 58px; height: 17px; }
.lockup .tag { margin-left: var(--space-1); font-size: 13px; font-weight: 600; color: var(--muted); }

/* Shell */
.shell { display: grid; min-height: 100vh; grid-template-columns: minmax(0, 1fr); }
.shell > * { min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-5); height: 56px; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line-soft); }
.top .spacer { flex: 1; }
.top form { margin: 0; }
.top-inner { display: contents; }
.who { font-size: 13px; color: var(--muted); }
.main { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--space-7) var(--gutter) var(--space-8); }
.main.narrow { max-width: 560px; }

/* Page flow: every top-level block of a page sits one --flow apart. The page head,
   a notice and a filter bar sit closer to what they introduce. */
.main > * + * { margin-top: var(--flow); }
.main > .card + .card { margin-top: var(--flow); }
.main > .head + *, .main > .notice + * { margin-top: var(--flow-tight); }
.main > .filters + *, .main > nav.actions + * { margin-top: var(--stack); }
/* A footnote under a table belongs to it. */
.main > .table-wrap + .hint, .section > .table-wrap + .hint { margin-top: var(--space-3); }

/* Tabs (partner) */
.tabs { border-bottom: 1px solid var(--line-soft); background: var(--bg); }
.tabs ul { display: flex; gap: var(--space-1); max-width: 1120px; margin: 0 auto; padding: 0 calc(var(--gutter) - 10px); list-style: none; overflow-x: auto; scrollbar-width: none; }
.tabs ul::-webkit-scrollbar { display: none; }
.tabs a { display: block; padding: var(--space-3) 10px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--ink); }

/* Sidebar (admin). Item text, group labels, lockup and footer share one left edge:
   nav padding (12) + item padding (12) = 24. */
@media (min-width: 900px) {
  .shell.side { grid-template-columns: 240px minmax(0, 1fr); }
  .side .nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line-soft); padding: var(--space-7) var(--space-3) var(--space-6); }
  .js .side .nav-toggle { display: none; }
  .side .menu { display: block !important; }
  .side .nav-bar { display: flex; align-items: center; height: 28px; padding: 0 var(--space-3); margin-bottom: var(--space-6); }
}
.menu ul { list-style: none; padding: 0; display: grid; gap: 2px; }
.menu a { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-3); border-radius: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.menu a[aria-current="page"] { background: var(--surface); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .menu a:hover { color: var(--text); } }
.menu .group { margin: var(--space-6) var(--space-3) var(--space-2); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.menu .group:first-child { margin-top: 0; }
.menu .count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--raised); font-size: 12px; line-height: 20px; text-align: center; }
.side-foot { display: grid; gap: var(--space-1); margin-top: var(--space-6); padding: var(--space-4) var(--space-3) 0; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
.side-foot .role { display: block; }
.side-foot form { margin-top: var(--space-2); }
@media (max-width: 899.98px) {
  .side .nav { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line-soft); padding: 0 var(--gutter); }
  .side .nav-bar { display: flex; align-items: center; justify-content: space-between; height: 56px; }
  .side .menu { padding-bottom: var(--space-4); margin: 0 calc(var(--space-3) * -1); }
  .js .side .menu { display: none; }
  .js .side .nav.open .menu { display: block; }
}
.nav-toggle { display: none; }
.js .nav-toggle { display: inline-flex; align-items: center; }
.nav-toggle { min-height: var(--control); padding: 0 var(--space-4); border: 1px solid var(--line); border-radius: 999px; background: none; cursor: pointer; font-weight: 500; }

/* Page head: title block left, actions right, bottoms aligned */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6); }
.head > div:first-child { min-width: 0; flex: 1 1 320px; }
.head h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.head p { margin-top: var(--space-2); color: var(--muted); max-width: 46em; }
.head > :not(:first-child) { flex: none; }
.head .inline-form { flex-wrap: nowrap; }
.head .inline-form .field { flex: none; width: 200px; }
.crumb { font-size: 13px; line-height: 20px; color: var(--muted); margin-bottom: var(--space-1); }
.crumb a { color: inherit; }
h2 { font-size: 18px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 15px; font-weight: 600; }
.section { margin-top: var(--flow); }
/* A section inside a section or card is a sub-block, not a new page section. */
:is(section, .section, .card) .section, .ticket-layout .section { margin-top: var(--gap); }
section > h2 + *, .section > h2 + * { margin-top: var(--space-3); }
section > h2 + p.hint, section > h2 + p.muted { margin-top: var(--space-2); }
section > p.hint + *, section > p.muted + * { margin-top: var(--space-3); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.section-head + * { margin-top: var(--space-3); }

/* Cards and stat tiles: one padding (--pad), one radius, one gap (--gap) */
.card { background: var(--surface); border-radius: var(--radius); padding: var(--pad); min-width: 0; }
.card + .card { margin-top: var(--gap); }
/* Children of a card or stack form sit one --stack apart; hidden inputs don't count.
   Zero specificity, so any rule below can tune a pair. */
:where(.card, form.stack) > :where(:not([type=hidden]) ~ :not([type=hidden])) { margin-top: var(--stack); }
:where(.card, form.stack) > h2 + * { margin-top: var(--space-3); }
:where(.card, form.stack) > h2 + :is(.hint, p.muted) { margin-top: var(--space-2); }
:where(.card, form.stack) > h3 + :is(.hint, p.muted) { margin-top: var(--space-2); }
.card > h3 { font-size: 16px; line-height: 1.3; }
.card > .section-head + * { margin-top: var(--space-3); }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.grid > * { margin-top: 0 !important; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.stat { background: var(--surface); border-radius: var(--radius); padding: var(--space-4) var(--pad) var(--pad); min-width: 0; container-type: inline-size; }
.stat dt { font-size: 13px; line-height: 20px; color: var(--muted); font-weight: 500; }
.stat dd { margin-top: var(--space-1); font-size: clamp(20px, 16cqi, 28px); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; overflow-wrap: anywhere; }
.stat .sub { display: block; margin-top: var(--space-2); font-size: 13px; line-height: 18px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.stat dd .lines { display: block; font-size: clamp(18px, 13cqi, 23px); line-height: 1.25; }
.stat dd .lines > span { display: block; }
.stat.lead { background: var(--ink); color: var(--on-ink); }
.stat.lead dt, .stat.lead .sub { color: color-mix(in srgb, var(--on-ink) 70%, transparent); }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.stat.lead .delta-up, .stat.lead .delta-down { color: inherit; font-weight: 600; }
dl.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: var(--space-2) var(--space-6); }
dl.kv dt { color: var(--muted); }
dl.kv dd { min-width: 0; overflow-wrap: anywhere; }

/* Tables. Cells pad --space-3 by --space-4; the outer cells pad --pad, so the first
   column lines up with card text and headings inside cards. */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: var(--space-3) var(--space-4); text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th:first-child, td:first-child { padding-left: var(--pad); }
th:last-child, td:last-child { padding-right: var(--pad); }
thead th { padding-top: var(--space-4); font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); letter-spacing: .02em; vertical-align: bottom; }
tbody tr:last-child td { border-bottom: 0; }
td.right, th.right { text-align: right; }
td a { font-weight: 500; }
.badges { display: flex; flex-wrap: wrap; gap: var(--space-1); }
tr.dim td { color: var(--muted); }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
caption { text-align: left; padding: var(--space-3) var(--pad) 0; font-weight: 600; }
/* A table directly in a card runs edge to edge; its cells keep the card's inset. */
.card > .table-wrap, .card .table-wrap.flush { margin-left: calc(var(--pad) * -1); margin-right: calc(var(--pad) * -1); background: none; border-radius: 0; }
.card > .table-wrap:last-child { margin-bottom: calc(var(--space-3) * -1); }
.card > .table-wrap thead th { padding-top: 0; }
/* Nested tables (in a grid inside a card) sit on the page color. */
.card .grid .table-wrap { background: var(--bg); }

/* Badges: color only with a word */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--raised); color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.good { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--yellow-bg); color: var(--yellow); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.info { background: var(--raised); color: var(--text); }

/* Buttons: one height (--control), small (--control-sm), block (--control-lg) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control); padding: 0 var(--space-5); border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 14.5px; line-height: 1; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform 150ms var(--ease-out), opacity 150ms; }
.btn:active { transform: scale(.97); }
.btn.secondary { background: var(--raised); color: var(--text); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: none; color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.small { height: var(--control-sm); padding: 0 var(--space-3); font-size: 13px; }
.btn.block { width: 100%; height: var(--control-lg); font-size: 16px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) { .btn:hover { opacity: .86; } }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:active { transform: none; } }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--muted); cursor: pointer; }

/* Forms */
.field { display: grid; gap: var(--space-2); align-content: start; }
.field > label, .field > .label, fieldset > legend { font-size: 13.5px; line-height: 20px; font-weight: 600; }
fieldset > legend { padding: 0; margin-bottom: var(--space-2); }
.hint { font-size: 13px; line-height: 18px; color: var(--muted); }
.error-text { font-size: 13px; line-height: 18px; color: var(--red); font-weight: 500; }
input[type=text], input[type=email], input[type=search], input[type=number], input:not([type]), select, textarea {
  width: 100%; height: var(--control); padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); }
@media (prefers-color-scheme: light) { input[type=text], input[type=email], input[type=search], input[type=number], input:not([type]), select, textarea { background: #fff; } }
textarea { height: auto; min-height: 120px; padding: 10px var(--space-3); resize: vertical; line-height: 1.5; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
input[readonly] { color: var(--text-2); }
fieldset { border: 0; padding: 0; min-width: 0; }
:where(fieldset) { margin: 0; }
.row { display: grid; gap: var(--stack); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); align-items: start; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
.choices { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); }
.field .choices, legend + .choices { margin-top: 0; }
.choices label { display: inline-flex; gap: var(--space-2); align-items: center; min-height: var(--control); }
.choices input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: flex-end; }
.inline-form .field { flex: 1 1 200px; }
.filters { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-end; }
.filters .field { min-width: 140px; flex: 1 1 140px; max-width: 260px; }
.filters .field.grow { max-width: none; flex: 3 1 220px; }
input[type=range] { width: 100%; accent-color: var(--ink); height: var(--control-sm); margin: 0; }
.range { display: flex; gap: var(--space-3); align-items: center; }
.range output { min-width: 4ch; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
td .inline-form { flex-wrap: nowrap; align-items: center; }
/* Small controls in a row: center them on the first text line (21px). */
td > .inline-form, td > .btn.small { margin-block: calc((21px - var(--control-sm)) / 2); }
td .inline-form input { width: 120px; height: var(--control-sm); padding: 0 10px; border-radius: 10px; }

/* Notices */
.notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--surface); box-shadow: inset 3px 0 0 var(--muted); }
.notice.good { box-shadow: inset 3px 0 0 var(--green); }
.notice.bad { box-shadow: inset 3px 0 0 var(--red); }
.notice.warn { box-shadow: inset 3px 0 0 var(--yellow); }
.notice strong { font-weight: 600; }
.card .notice, form .notice { background: var(--bg); }
.mockbar { padding: 6px var(--space-5); font-size: 12.5px; text-align: center; background: var(--yellow-bg); color: var(--yellow); font-weight: 600; }
.empty { padding: var(--space-8) var(--pad); text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: var(--space-1); }
.empty .btn { margin-top: var(--space-4); }

/* Copy rows, QR */
.copy { display: flex; gap: var(--space-2); align-items: stretch; }
.copy input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 14px; }
.code-big { font: 700 clamp(28px, 6vw, 40px)/1.1 var(--mono); letter-spacing: .06em; overflow-wrap: anywhere; }
.qr { width: 200px; max-width: 100%; padding: var(--space-3); background: #fff; border-radius: var(--radius-sm); }
.qr svg { width: 100%; height: auto; }
.split { display: grid; gap: var(--gap); }
@media (min-width: 860px) { .split { grid-template-columns: 1.4fr 1fr; align-items: start; } }

/* Charts: small multiples, one series each */
.charts { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.chart { background: var(--surface); border-radius: var(--radius); padding: var(--space-4) var(--pad) var(--space-3); min-width: 0; display: flex; flex-direction: column; }
.chart header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.chart h3 { font-size: 14px; font-weight: 600; }
.chart .total { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.chart .note { margin-top: var(--space-2); font-size: 12.5px; line-height: 18px; color: var(--muted); }
.chart svg { width: 100%; height: auto; margin-top: var(--space-3); overflow: visible; }
.chart .bar { fill: var(--chart); }
.chart .bar.neg { fill: var(--red); }
.chart .gap { fill: none; stroke: var(--chart-muted); stroke-width: 1.5; stroke-dasharray: 2 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover + .bar, .chart g:hover .bar { opacity: .7; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart.wide { grid-column: 1 / -1; }
details.table-view { margin-top: auto; padding-top: var(--space-2); font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--muted); padding: var(--space-1) 0; }
details.table-view .table-wrap { margin-top: var(--space-2); background: var(--bg); border-radius: var(--radius-sm); max-height: 320px; overflow-y: auto; }
details.table-view th:first-child, details.table-view td:first-child { padding-left: var(--space-3); }
details.table-view th:last-child, details.table-view td:last-child { padding-right: var(--space-3); }
details.table-view th, details.table-view td { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.hbar { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: var(--space-2) var(--space-3); align-items: center; font-size: 14px; }
.hbar .contents-row { display: contents; }
.hbar svg { width: 100%; height: 12px; }
.hbar rect { fill: var(--chart); }
.inline-bar { display: inline-block; vertical-align: middle; }
.inline-bar .track { fill: var(--raised); }
.inline-bar .fill { fill: var(--ink); }

/* Tickets */
.thread { display: grid; gap: var(--space-3); }
ol.thread { list-style: none; padding: 0; }
.msg { padding: var(--space-3) var(--space-4); border-radius: 14px; background: var(--surface); max-width: 760px; }
.msg.staff { background: var(--raised); margin-left: auto; }
.msg.note { background: var(--yellow-bg); }
.msg header { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 13px; color: var(--muted); margin-bottom: var(--space-1); }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .hint { margin-top: var(--space-2); }
.ticket-layout { display: grid; gap: var(--gap); }
@media (min-width: 980px) { .ticket-layout { grid-template-columns: 1fr 300px; align-items: start; } }
.ticket-layout aside > * + * { margin-top: var(--stack); }
.unread { font-weight: 700; }
ul.stack { list-style: none; padding: 0; margin-top: var(--space-3); }
ul.stack > li + li { margin-top: var(--space-4); }
.plain-list { list-style: none; padding: 0; }
.plain-list > li + li { margin-top: var(--space-3); }

/* Prose (agreement, brief) */
.prose { color: var(--text-2); max-width: 46em; }
.prose > * + * { margin-top: var(--space-3); }
.prose h1, .prose h2 { color: var(--text); margin-top: var(--space-6); }
.prose h1 { font-size: 22px; }
.prose ol, .prose ul { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose strong { color: var(--text); }
.prose table { font-size: 14px; margin-top: var(--space-3); }
.prose th, .prose td, .prose th:first-child, .prose td:first-child, .prose th:last-child, .prose td:last-child { padding: var(--space-2) 10px var(--space-2) 0; background: none; }
.prose code { font-family: var(--mono); font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--raised); }
.agreement { max-height: 360px; overflow-y: auto; padding: var(--space-4) var(--pad); border-radius: var(--radius-sm); background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }

/* Assets */
.shots { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.shots figure { background: var(--surface); border-radius: var(--radius); padding: 10px; }
.shots img { width: 100%; border-radius: var(--radius-sm); aspect-ratio: 1206 / 2622; object-fit: cover; background: #000; }
.shots figcaption { margin-top: var(--space-2); font-size: 13px; display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-6) var(--space-5); }
.auth .box { width: 100%; max-width: 420px; }
.auth .lockup { margin-bottom: var(--space-7); }
.auth h1 { font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; }
.auth p.lead { margin-top: var(--space-2); color: var(--muted); }
.auth .notice { margin-top: var(--space-4); }
.auth form { margin-top: var(--space-6); }
.auth form.stack .notice { margin-top: 0; }
.auth .box > .btn, .auth .box > a.btn { margin-top: var(--space-6); }
.auth .box > .btn + .btn { margin-top: var(--space-3); }
.auth .box > .hint { margin-top: var(--space-3); }
.auth .foot { margin-top: var(--space-6); font-size: 13px; color: var(--muted); display: flex; gap: var(--space-4); flex-wrap: wrap; }
.demo { margin-top: var(--space-7); padding: var(--space-4); border-radius: var(--radius-sm); background: var(--yellow-bg); font-size: 13.5px; }
.demo strong { color: var(--yellow); }
.demo ul { margin-top: 6px; padding-left: 18px; }
.demo li + li { margin-top: var(--space-1); }
.demo-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
.auth .demo form { margin: 0; }
.demo > form { margin-top: var(--space-3); }
.demo-sub { margin-top: var(--space-4); }

/* Pagination */
.pager { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); margin-top: var(--space-4); font-size: 14px; color: var(--muted); }

/* Danger zone and collapsible actions */
.danger-zone { box-shadow: inset 0 0 0 1px var(--red-bg); }
details.action { border-top: 1px solid var(--line-soft); }
.card > details.action { margin-top: var(--space-3); }
.card > details.action + details.action { margin-top: 0; }
details.action:first-of-type { border-top: 0; }
details.action > summary { cursor: pointer; padding: var(--space-3) 0; min-height: var(--control); font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
details.action > summary::-webkit-details-marker { display: none; }
details.action > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details.action[open] > summary::after { content: "\2212"; }
details.action > form { padding-bottom: var(--space-5); }
details.card > summary { cursor: pointer; font-weight: 600; }
details.card[open] > summary { margin-bottom: var(--stack); }

/* Phone: tighter page gutter and card padding, same rhythm */
@media (max-width: 560px) {
  :root { --pad: var(--space-4); --gap: var(--space-3); --flow: var(--space-6); --flow-tight: var(--space-5); --gutter: var(--space-4); --control: 44px; --control-sm: 36px; }
  .top { gap: var(--space-2); padding: 0 var(--gutter); }
  .top .who, .top .lockup .tag { display: none; }
  .main { padding: var(--space-5) var(--gutter) var(--space-8); }
  th, td { padding-left: var(--space-3); padding-right: var(--space-3); }
}
