/* ─────────────────────────────────────────────────────────────────────────────
   Sellly design system: tokens, base styles and shared components.
   Loaded by every Sellly-branded page (the merchant app, sign-in, the website,
   error pages). Customer-facing store pages are the merchant's, not Sellly's,
   and carry their own small stylesheet (src/web/public.js).
   Source of truth: SELLLY_BRAND_GUIDELINES.md.
   ───────────────────────────────────────────────────────────────────────────── */

@font-face { font-family: "Public Sans"; src: url("/static/fonts/public-sans-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Public Sans"; src: url("/static/fonts/public-sans-rupee.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+20B9; }
@font-face { font-family: "Newsreader"; src: url("/static/fonts/newsreader-latin.woff2") format("woff2"); font-weight: 400 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; src: url("/static/fonts/newsreader-rupee.woff2") format("woff2"); font-weight: 400 600; font-display: swap; unicode-range: U+20B9; }

:root {
  /* Brand */
  --ink: #16192b;          /* text, primary buttons, the wordmark */
  --paper: #faf8f3;        /* page background */
  --red: #a51f37;          /* Sellly red: the tally, the margin rule, the active nav. Never for errors or buttons. */
  --red-on-ink: #ec6a80;

  /* Neutrals */
  --sheet: #ffffff;        /* surfaces that hold content */
  --wash: #f3f0e9;         /* hover, table headers, quiet fills */
  --wash-2: #ebe7de;
  --rule: #e6e1d6;         /* hairlines between things */
  --rule-strong: #d5cfc2;
  --field-line: #8f897e;   /* input borders: 3:1 on white, as WCAG asks of controls */
  --ink-2: #3a3d4c;        /* strong secondary text */
  --muted: #5a5d6b;        /* secondary text: 6.2:1 on paper */
  --faint: #6b6e7a;        /* hints, captions: 4.8:1 on paper */
  --focus: #2f5bd3;

  /* Status: never borrowed from the brand */
  --success: #1d6b3f; --success-bg: #e5f2ea; --success-line: #b9dcc6; --success-solid: #2e8b57;
  --warning: #7a4a00; --warning-bg: #fcf1d9; --warning-line: #efd39a; --warning-solid: #c98600;
  --danger:  #b42318; --danger-bg:  #fcebe9; --danger-line:  #f0bcb6; --danger-solid:  #d92d20;
  --info:    #1e4fa8; --info-bg:    #e7eefb; --info-line:    #bcd0f3; --info-solid:    #2f6bdb;
  --neutral: #4a4d5a; --neutral-bg: #efece5; --neutral-line: #d9d4c8; --neutral-solid: #8a877f;

  /* Type */
  --sans: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --t-display: 500 clamp(40px, 6vw, 64px)/1.02 var(--serif);
  --t-h1: 500 clamp(26px, 3vw, 32px)/1.15 var(--serif);
  --t-h2: 600 19px/1.35 var(--sans);
  --t-h3: 600 16px/1.4 var(--sans);
  --t-h4: 600 14px/1.4 var(--sans);
  --t-body-lg: 400 17px/1.6 var(--sans);
  --t-body: 400 15px/1.55 var(--sans);
  --t-body-sm: 400 13.5px/1.5 var(--sans);
  --t-label: 600 13.5px/1.35 var(--sans);
  --t-caption: 500 12.5px/1.4 var(--sans);
  --t-button: 600 15px/1.2 var(--sans);
  --t-figure: 600 26px/1.15 var(--sans);

  /* Space: a 4 px grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px;

  /* Shape */
  --r-xs: 4px;   /* tags */
  --r-sm: 6px;   /* buttons, inputs */
  --r-md: 10px;  /* sheets */
  --r-lg: 16px;  /* media, app icon */
  --r-full: 999px; /* dots, switches, avatars only */
  --shadow-float: 0 8px 24px rgba(22, 25, 43, .12), 0 1px 3px rgba(22, 25, 43, .08);
  --shadow-modal: 0 24px 64px rgba(22, 25, 43, .22), 0 2px 6px rgba(22, 25, 43, .08);

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --fast: 120ms; --base: 180ms; --slow: 240ms;

  /* Layout */
  --w-prose: 680px; --w-page: 1080px; --w-site: 1200px;
  --z-sticky: 10; --z-header: 20; --z-drawer: 40; --z-scrim: 39; --z-modal: 60; --z-toast: 70;

  color-scheme: light;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: var(--t-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-feature-settings: "kern"; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); letter-spacing: normal; }
h1 { font: var(--t-h1); letter-spacing: -.01em; }
h2 { font: var(--t-h2); }
h3 { font: var(--t-h3); }
h4 { font: var(--t-h4); }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color var(--fast); }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::selection { background: color-mix(in srgb, var(--red) 18%, transparent); }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s-6) 0; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--wash); color: var(--ink-2); padding: 1px 5px; border-radius: var(--r-xs); }
.display { font: var(--t-display); letter-spacing: -.02em; }
.lead { font: var(--t-body-lg); color: var(--ink-2); }
.small { font: var(--t-body-sm); }
.caption { font: var(--t-caption); color: var(--faint); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.err-text { color: var(--danger); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: var(--s-2); z-index: var(--z-toast); background: var(--ink); color: var(--paper); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); text-decoration: none; }
.skip:focus { left: var(--s-2); }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); }
.plain li:last-child { border-bottom: 0; }
.inline { display: inline; margin: 0; }
.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.icon.sm { width: 16px; height: 16px; }

/* The tally rule: a hairline with a short red segment at its start, the way a
   ledger marks its money column. For one important division per view. */
.ruled { position: relative; border-top: 1px solid var(--rule); }
.ruled::before { content: ""; position: absolute; left: 0; top: -1px; width: 48px; height: 2px; background: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 40px; padding: 0 var(--s-4); border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--sheet); color: var(--ink); font: var(--t-button); text-decoration: none; white-space: nowrap; cursor: pointer; user-select: none; transition: background var(--fast), border-color var(--fast), box-shadow var(--fast), color var(--fast); }
.btn:hover { background: var(--wash); border-color: var(--field-line); }
.btn:active { background: var(--wash-2); }
.btn.primary, .btn.success { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.primary:hover, .btn.success:hover { background: #2a2e45; border-color: #2a2e45; }
.btn.danger { color: var(--danger); border-color: var(--danger-line); background: var(--sheet); }
.btn.danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--wash); border-color: transparent; }
.btn.small { min-height: 32px; padding: 0 var(--s-3); font-size: 13.5px; }
.btn.lg { min-height: 48px; padding: 0 var(--s-5); font-size: 16px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .icon { margin: 0 -2px; }
.link { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
@media (pointer: coarse) { .btn { min-height: 44px; } .btn.small { min-height: 36px; } }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.field { display: block; margin: 0 0 var(--s-4); border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font: var(--t-label); color: var(--ink); margin-bottom: 6px; padding: 0; }
.field small { display: block; color: var(--faint); font: var(--t-body-sm); margin-top: 6px; }
.field .error { display: flex; gap: 6px; align-items: baseline; color: var(--danger); font: 500 13.5px/1.4 var(--sans); margin-top: 6px; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], input[type=search], input[type=url], input:not([type]), textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--field-line); background: var(--sheet);
  color: var(--ink); font: 400 15px/1.35 var(--sans); transition: border-color var(--fast), box-shadow var(--fast); outline: none;
}
input::placeholder, textarea::placeholder { color: #8b8e99; }
input:hover, textarea:hover, select:hover { border-color: var(--ink-2); }
input:focus-visible, textarea:focus-visible, select:focus-visible, input:focus, textarea:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(47, 91, 211, .28); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); outline: none; }
input[readonly] { background: var(--wash); }
input[type=file] { font: var(--t-body-sm); max-width: 100%; }
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
select { appearance: none; background: var(--sheet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2316192b' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center; padding-right: 38px; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 18px; height: 18px; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 var(--s-4); }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.money-input, .prefix-input, .color-input { display: flex; align-items: stretch; }
.field > span.money-input, .field > span.prefix-input, .field > span.color-input { display: flex; margin: 0; padding: 0; font: inherit; color: inherit; }
.money-input > span, .prefix-input > span { display: flex; align-items: center; padding: 0 var(--s-3); background: var(--wash); border: 1px solid var(--field-line); border-right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm); color: var(--muted); font: var(--t-body-sm); white-space: nowrap; }
.money-input input, .prefix-input input { border-radius: 0 var(--r-sm) var(--r-sm) 0; min-width: 0; }
.color-input input[type=color] { width: 48px; min-height: 44px; padding: 3px; border: 1px solid var(--field-line); border-radius: var(--r-sm) 0 0 var(--r-sm); background: var(--sheet); }
.color-input input:not([type=color]) { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: 0; font-family: var(--mono); }
details.more { margin-top: var(--s-2); }
details.more > summary { cursor: pointer; font: var(--t-label); list-style: none; padding: var(--s-2) 0; display: inline-flex; align-items: center; gap: 6px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 8px; height: 8px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform var(--fast); margin-right: 2px; }
details.more[open] > summary::before { transform: rotate(45deg); }

/* Switch: a hidden "0" plus a checkbox "1" */
.switch { display: inline-flex; align-items: flex-start; gap: var(--s-3); cursor: pointer; user-select: none; font: 400 15px/1.4 var(--sans); color: var(--ink); }
.switch input[type=checkbox] { appearance: none; width: 38px; height: 22px; border-radius: var(--r-full); background: #c9c4b8; position: relative; cursor: pointer; transition: background var(--base) var(--ease); margin: 0; flex: none; }
.switch input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(22, 25, 43, .25); transition: transform var(--base) var(--ease); }
.switch input[type=checkbox]:checked { background: var(--ink); }
.switch input[type=checkbox]:checked::after { transform: translateX(16px); }
.switch input[type=checkbox]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input[disabled] { opacity: .5; }
.switch > span { display: flex; flex-direction: column; }
.switch small { color: var(--faint); font: var(--t-body-sm); margin-top: 2px; }
.switch.lg { font-weight: 600; }
.switch.small { font-size: 13.5px; }

/* Choice chips: one of several (radio) or several (checkbox) */
.segmented { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink-2); font: 500 14px/1 var(--sans); cursor: pointer; transition: border-color var(--fast), background var(--fast); }
.segmented span:hover { border-color: var(--field-line); }
.segmented input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Messages ────────────────────────────────────────────────────────────── */
.flash { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); margin-bottom: var(--s-4); font: var(--t-body-sm); background: var(--info-bg); color: var(--info); border: 1px solid var(--info-line); }
.flash > .icon { margin-top: 1px; }
.flash.ok { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.flash.err { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.flash.warn { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.flash a, .flash .link { color: inherit; font-weight: 600; }
.flash code { background: rgba(255, 255, 255, .6); }

/* A success message after an action: a quiet toast at the top that fades (admin.js). */
.toast { position: fixed; z-index: var(--z-toast); left: 50%; top: var(--s-4); transform: translateX(-50%); max-width: min(560px, calc(100vw - 32px)); display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); background: var(--ink); color: var(--paper); font: 500 14.5px/1.4 var(--sans); box-shadow: var(--shadow-float); animation: toast-in var(--slow) var(--ease) both; }
.toast .icon { color: #9fd9b4; }
.toast.leaving { animation: toast-out var(--slow) var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -8px); } }

/* ── Tags and statuses ───────────────────────────────────────────────────── */
/* Tags: compact metadata (Hidden, Sample, Test, Repeat). */
.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 12px/1 var(--sans); padding: 4px 7px; border-radius: var(--r-xs); background: var(--neutral-bg); color: var(--neutral); white-space: nowrap; vertical-align: 1px; }
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.amber { background: var(--warning-bg); color: var(--warning); }
.badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.blue { background: var(--info-bg); color: var(--info); }
.badge.purple, .badge.neutral { background: var(--neutral-bg); color: var(--neutral); }

/* Order stage (fulfilment): a dot and words. Payment: an outlined tag.
   Two different shapes so they are never read as one another. */
.stage { display: inline-flex; align-items: center; gap: 7px; font: 600 13.5px/1.2 var(--sans); white-space: nowrap; color: var(--ink-2); }
.stage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-solid); flex: none; }
.stage.new { color: var(--warning); } .stage.new::before { background: var(--warning-solid); }
.stage.active { color: var(--info); } .stage.active::before { background: var(--info-solid); }
.stage.done { color: var(--success); } .stage.done::before { background: var(--success-solid); }
.stage.off { color: var(--neutral); } .stage.off::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--neutral-solid); }
.stage.waiting { color: var(--muted); } .stage.waiting::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--neutral-solid); }
.pay { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border: 1px solid var(--neutral-line); border-radius: var(--r-xs); font: 600 12px/1.1 var(--sans); color: var(--neutral); background: var(--sheet); white-space: nowrap; }
.pay .icon { width: 13px; height: 13px; vertical-align: 0; }
.pay.paid { color: var(--success); border-color: var(--success-line); }
.pay.check { color: var(--warning); border-color: var(--warning-line); background: var(--warning-bg); }
.pay.due { color: var(--warning); border-color: var(--warning-line); }
.pay.failed { color: var(--danger); border-color: var(--danger-line); }

/* ── Sheets (the one container) ──────────────────────────────────────────── */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s-5); margin-bottom: var(--s-4); }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head h2 { font: var(--t-h3); }
.card-head p { margin: 4px 0 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: var(--s-4) var(--s-5) 0; margin-bottom: var(--s-3); }
.card.flush-list { padding-bottom: var(--s-2); }
.card.attention { border-color: var(--warning-line); }
.card.current, .card.highlight { border-color: var(--ink); }
details.card > summary { cursor: pointer; font: var(--t-h3); list-style: none; display: flex; align-items: center; gap: var(--s-2); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); transition: transform var(--fast); }
details.card[open] > summary::after { transform: rotate(-135deg); }
details.card[open] > summary { margin-bottom: var(--s-3); }

/* A section without a box: a heading and content under a hairline. */
.section { margin: 0 0 var(--s-8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding-bottom: var(--s-2); margin-bottom: var(--s-1); border-bottom: 1px solid var(--rule); }
.section-head h2 { font: var(--t-h3); }
.section-head a { font: var(--t-body-sm); }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: var(--s-6); border-bottom: 1px solid var(--rule); margin-bottom: var(--s-5); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: var(--s-3) 0; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font: 600 14.5px/1.2 var(--sans); text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--wash-2); color: var(--ink-2); font: 600 12px/1 var(--sans); font-variant-numeric: tabular-nums; }
.tabs a.on .count { background: var(--ink); color: var(--paper); }
@media (max-width: 700px) {
  .tabs { gap: var(--s-5); margin-left: calc(-1 * var(--gutter, 16px)); margin-right: calc(-1 * var(--gutter, 16px)); padding: 0 var(--gutter, 16px); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}

/* ── Lists and tables ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; position: relative; }
table.list { width: 100%; border-collapse: collapse; font: var(--t-body-sm); font-size: 14px; }
table.list th { text-align: left; font: 600 12.5px/1.3 var(--sans); color: var(--muted); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule); background: var(--wash); white-space: nowrap; }
table.list td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list th.num, table.list td.num { text-align: right; }
table.list tbody tr:hover { background: color-mix(in srgb, var(--wash) 55%, transparent); }
.card:not(.flush) table.list th:first-child, .card:not(.flush) table.list td:first-child { padding-left: 0; }
/* Tables that become labelled rows on a phone: <td data-label="…"> */
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: var(--s-4); text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 500; text-align: left; }
  table.stack td.lead-cell { font-weight: 600; text-align: left; padding-bottom: 4px; }
  table.stack td.lead-cell::before { content: none; }
}
.kv { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: var(--s-2) var(--s-5); margin: 0; }
.kv dt { color: var(--muted); font: var(--t-body-sm); padding-top: 1px; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ── Empty states ────────────────────────────────────────────────────────── */
.empty { padding: var(--s-8) var(--s-5); max-width: 520px; }
.empty h2 { font: var(--t-h3); margin-bottom: var(--s-1); }
.empty p { margin: 0 0 var(--s-4); color: var(--muted); }
.empty p:last-child { margin-bottom: 0; }
.card:not(.flush) > .empty { padding: var(--s-4) 0; }

/* ── Pager, breadcrumbs, progress, skeleton ──────────────────────────────── */
.pager { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-3); }
.pager a { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; font: 600 14px/1 var(--sans); text-decoration: none; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; color: var(--muted); text-decoration: none; font: 500 14px/1 var(--sans); margin-bottom: var(--s-1); }
.back:hover { color: var(--ink); }
.progress { height: 4px; border-radius: var(--r-full); background: var(--wash-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-full); transition: width var(--slow) var(--ease); }
.skeleton { background: linear-gradient(90deg, var(--wash) 0, var(--wash-2) 40%, var(--wash) 80%); background-size: 300% 100%; border-radius: var(--r-xs); animation: shimmer 1.4s linear infinite; color: transparent !important; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* ── Tooltip: <span data-tip="…"> ─────────────────────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; z-index: var(--z-toast); left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); width: max-content; max-width: 240px; padding: 6px 9px; border-radius: var(--r-xs); background: var(--ink); color: var(--paper); font: 500 12.5px/1.35 var(--sans); white-space: normal; pointer-events: none; }

/* ── Dialog (confirmations; see admin.js) ────────────────────────────────── */
dialog.confirm { border: 0; padding: 0; border-radius: var(--r-md); box-shadow: var(--shadow-modal); width: min(440px, calc(100vw - 32px)); color: var(--ink); background: var(--sheet); }
dialog.confirm::backdrop { background: rgba(22, 25, 43, .42); }
dialog.confirm[open] { animation: dialog-in var(--base) var(--ease) both; }
dialog.confirm .body { padding: var(--s-6) var(--s-6) var(--s-4); }
dialog.confirm h2 { font: var(--t-h2); margin-bottom: var(--s-2); }
dialog.confirm p { color: var(--muted); margin: 0; }
dialog.confirm .foot { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-4) var(--s-6) var(--s-6); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (max-width: 520px) {
  dialog.confirm { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--r-md) var(--r-md) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog.confirm .foot { flex-direction: column-reverse; }
  dialog.confirm .foot .btn { width: 100%; min-height: 48px; }
}

/* ── Wordmark ─────────────────────────────────────────────────────────────── */
.wordmark { display: inline-flex; align-items: center; text-decoration: none; line-height: 0; }
.wordmark img { height: 22px; width: auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
