/* AICI Demo Hub UI. Plain CSS, no build step.
   Order: tokens (light, dark) -> base -> shared components -> pages -> tones (last, so they win). */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --bg: #f6f7f9;
  --glow-1: rgba(99, 102, 241, 0.10);
  --glow-2: rgba(14, 165, 233, 0.07);
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --sunken: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #475467;
  --text-3: #667085;
  --brand: #4f46e5;
  --brand-solid: #4f46e5;
  --brand-hover: #4338ca;
  --brand-soft: rgba(79, 70, 229, 0.09);
  --focus: #6366f1;
  --scrim: rgba(16, 24, 40, 0.5);
  --stage: #0c0e13;
  --tip-bg: #101828;
  --tip-fg: #ffffff;
  --sk-base: #eceef2;
  --sk-hi: #f8f9fb;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 20px -6px rgba(16, 24, 40, 0.12), 0 2px 6px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.28), 0 8px 16px -8px rgba(16, 24, 40, 0.12);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 120ms;
  --t: 180ms;
  --gutter: 24px;
  --maxw: 1200px;

  --danger: #e5484d;  --danger-fg: #b42318; --danger-bg: #fef3f2; --danger-bd: #fecdca;
  --warn: #f79009;    --warn-fg: #b54708;   --warn-bg: #fffaeb;   --warn-bd: #fedf89;
  --ok: #12b76a;      --ok-fg: #067647;     --ok-bg: #ecfdf3;     --ok-bd: #abefc6;
  --info: #2e90fa;    --info-fg: #175cd3;   --info-bg: #eff8ff;   --info-bd: #b2ddff;
  --neutral: #98a2b3; --neutral-fg: #475467; --neutral-bg: #f2f4f7; --neutral-bd: #e4e7ec;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0d12;
    --glow-1: rgba(99, 102, 241, 0.16);
    --glow-2: rgba(14, 165, 233, 0.08);
    --surface: #12151c;
    --surface-2: #161a22;
    --sunken: #0e1117;
    --border: #242a35;
    --border-strong: #323a49;
    --text: #edf0f5;
    --text-2: #b3bac6;
    --text-3: #8a93a3;
    --brand: #a5b4fc;
    --brand-solid: #5850ec;
    --brand-hover: #4f46e5;
    --brand-soft: rgba(129, 140, 248, 0.14);
    --focus: #818cf8;
    --scrim: rgba(0, 0, 0, 0.62);
    --stage: #07080b;
    --tip-bg: #e9ecf2;
    --tip-fg: #0b0d12;
    --sk-base: #1a1f29;
    --sk-hi: #252b37;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 24px -8px rgba(0, 0, 0, 0.6), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 28px 56px -12px rgba(0, 0, 0, 0.75), 0 8px 16px -8px rgba(0, 0, 0, 0.5);
    --danger: #f2555a;  --danger-fg: #fda29b; --danger-bg: rgba(240, 68, 56, 0.14);  --danger-bd: rgba(240, 68, 56, 0.34);
    --warn: #fdb022;    --warn-fg: #fec84b;   --warn-bg: rgba(247, 144, 9, 0.14);   --warn-bd: rgba(247, 144, 9, 0.34);
    --ok: #32d583;      --ok-fg: #75e0a7;     --ok-bg: rgba(18, 183, 106, 0.14);   --ok-bd: rgba(18, 183, 106, 0.34);
    --info: #53b1fd;    --info-fg: #84caff;   --info-bg: rgba(46, 144, 250, 0.14); --info-bd: rgba(46, 144, 250, 0.34);
    --neutral: #858d9b; --neutral-fg: #cfd4dc; --neutral-bg: rgba(152, 162, 179, 0.12); --neutral-bd: rgba(152, 162, 179, 0.26);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d12;
  --glow-1: rgba(99, 102, 241, 0.16);
  --glow-2: rgba(14, 165, 233, 0.08);
  --surface: #12151c;
  --surface-2: #161a22;
  --sunken: #0e1117;
  --border: #242a35;
  --border-strong: #323a49;
  --text: #edf0f5;
  --text-2: #b3bac6;
  --text-3: #8a93a3;
  --brand: #a5b4fc;
  --brand-solid: #5850ec;
  --brand-hover: #4f46e5;
  --brand-soft: rgba(129, 140, 248, 0.14);
  --focus: #818cf8;
  --scrim: rgba(0, 0, 0, 0.62);
  --stage: #07080b;
  --tip-bg: #e9ecf2;
  --tip-fg: #0b0d12;
  --sk-base: #1a1f29;
  --sk-hi: #252b37;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 24px -8px rgba(0, 0, 0, 0.6), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 28px 56px -12px rgba(0, 0, 0, 0.75), 0 8px 16px -8px rgba(0, 0, 0, 0.5);
  --danger: #f2555a;  --danger-fg: #fda29b; --danger-bg: rgba(240, 68, 56, 0.14);  --danger-bd: rgba(240, 68, 56, 0.34);
  --warn: #fdb022;    --warn-fg: #fec84b;   --warn-bg: rgba(247, 144, 9, 0.14);   --warn-bd: rgba(247, 144, 9, 0.34);
  --ok: #32d583;      --ok-fg: #75e0a7;     --ok-bg: rgba(18, 183, 106, 0.14);   --ok-bd: rgba(18, 183, 106, 0.34);
  --info: #53b1fd;    --info-fg: #84caff;   --info-bg: rgba(46, 144, 250, 0.14); --info-bd: rgba(46, 144, 250, 0.34);
  --neutral: #858d9b; --neutral-fg: #cfd4dc; --neutral-bg: rgba(152, 162, 179, 0.12); --neutral-bd: rgba(152, 162, 179, 0.26);
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 480px at 12% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 420px at 96% -8%, var(--glow-2), transparent 60%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
main { flex: 1; outline: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--focus) 28%, transparent); }

.icon { flex: none; }
.muted { color: var(--text-3); }
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .only-touch { display: inline; }
  .only-pointer { display: none; }
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; border-radius: 10px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-md); transition: top var(--t);
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 64px; }

/* ------------------------------------------------------------------ top bar & footer */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); height: 60px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  color: var(--text); font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-version {
  flex: none; font-size: 11.5px; font-weight: 550; color: var(--text-3); font-variant-numeric: tabular-nums;
  padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.logo {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #ec4899 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 2px 8px -1px rgba(99, 102, 241, 0.45);
}
.logo-lg { width: 46px; height: 46px; border-radius: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.footer { border-top: 1px solid var(--border); }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px var(--gutter); font-size: 12.5px; color: var(--text-3);
  display: flex; gap: 6px 16px; flex-wrap: wrap; justify-content: space-between;
}

/* ------------------------------------------------------------------ buttons & inputs */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast),
    box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover { text-decoration: none; }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--brand-solid); color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover:not([disabled]) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not([disabled]) { background: var(--surface-2); border-color: var(--text-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not([disabled]) { background: var(--sunken); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.btn-danger:hover:not([disabled]) { background: color-mix(in srgb, var(--danger) 86%, #000); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn:hover:not([disabled]) { background: var(--sunken); color: var(--text); }
.icon-btn[disabled] { opacity: 0.35; cursor: default; }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }

.link-btn {
  padding: 0; border: 0; background: none; color: var(--brand); font-size: 13px; font-weight: 600; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.select {
  appearance: none; -webkit-appearance: none; height: 32px; padding: 0 30px 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background-color: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a93a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
}

.spinner {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 12px; height: 12px; border-width: 1.75px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ shared bits */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.section-head h2 { font-size: 15px; font-weight: 650; display: flex; align-items: baseline; gap: 10px; }
.section-head .count { font-size: 13px; font-weight: 500; color: var(--text-3); }

.badge {
  --b: var(--accent, var(--brand));
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; flex: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: color-mix(in srgb, var(--b) 72%, var(--text));
  background: color-mix(in srgb, var(--b) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--b) 30%, transparent);
}
.version { font-family: var(--mono); font-size: 12px; color: var(--text-3); white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-sm {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 7px;
  font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--sunken); border: 1px solid var(--border);
  white-space: nowrap;
}

.icon-tile {
  --a: var(--accent, var(--brand));
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  color: color-mix(in srgb, var(--a) 78%, var(--text));
  background: color-mix(in srgb, var(--a) 13%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--a) 24%, transparent);
}
.icon-tile.lg { width: 60px; height: 60px; border-radius: 16px; }

/* state pill */
.state {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px 0 9px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; flex: none;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border); cursor: default;
}
.state-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral); }
.state[data-state="ready"] { color: var(--ok-fg); }
.state[data-state="ready"] .state-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.state[data-state="sleeping"] .state-dot { background: transparent; border: 2px solid var(--neutral); }
.state[data-state="starting"], .state[data-state="loading"] { color: var(--warn-fg); }
.state[data-state="starting"] .state-dot, .state[data-state="loading"] .state-dot { background: var(--warn); animation: pulse 1.3s ease-out infinite; }
.state[data-state="error"] { color: var(--danger-fg); border-color: var(--danger-bd); background: var(--danger-bg); }
.state[data-state="error"] .state-dot { background: var(--danger); }
.state[data-state="not_installed"] { color: var(--text-3); }
.state[data-state="not_installed"] .state-dot { background: transparent; border: 2px dashed var(--neutral); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 60%, transparent); }
  80%, 100% { box-shadow: 0 0 0 7px transparent; }
}

/* tooltip */
[data-tip]::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 20;
  width: max-content; max-width: 250px; padding: 7px 10px; border-radius: 8px;
  background: var(--tip-bg); color: var(--tip-fg); box-shadow: var(--shadow-md);
  font-size: 12px; font-weight: 500; line-height: 1.4; white-space: normal; text-align: left; letter-spacing: 0;
  opacity: 0; transform: translateY(-3px); pointer-events: none; transition: opacity var(--t-fast), transform var(--t-fast);
}
[data-tip]:hover::after { opacity: 1; transform: none; transition-delay: 0.25s; }
[data-tip=""]::after { display: none; }
.tip-left[data-tip]::after { right: auto; left: 0; }

/* skeleton shimmer */
.sk {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--sk-base) 25%, var(--sk-hi) 50%, var(--sk-base) 75%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }

/* callouts */
.callout {
  --c-bg: var(--info-bg); --c-bd: var(--info-bd); --c-fg: var(--info-fg);
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--c-bg); border: 1px solid var(--c-bd); color: var(--text); font-size: 13.5px;
}
.callout > .icon { color: var(--c-fg); margin-top: 1px; }
.callout strong { display: block; font-weight: 650; margin-bottom: 2px; }
.callout p { color: var(--text-2); }
.callout-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.callout-body .btn { align-self: flex-start; margin-top: 8px; }
.callout-danger { --c-bg: var(--danger-bg); --c-bd: var(--danger-bd); --c-fg: var(--danger-fg); }
.callout-warn { --c-bg: var(--warn-bg); --c-bd: var(--warn-bd); --c-fg: var(--warn-fg); }
.callout-neutral { --c-bg: var(--neutral-bg); --c-bd: var(--neutral-bd); --c-fg: var(--text-2); }

/* empty / error states */
.empty-state { text-align: center; padding: 72px 16px; max-width: 460px; margin: 0 auto; }
.empty-state .icon-tile { margin: 0 auto 18px; }
.empty-state h1 { font-size: 22px; font-weight: 700; }
.empty-state p { color: var(--text-2); margin: 8px 0 22px; }

/* toasts */
.toasts {
  position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px;
  width: min(420px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 14px;
  border-radius: 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 13.5px;
  opacity: 0; transform: translateY(8px) scale(0.98); transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show { opacity: 1; transform: none; }
.toast > .icon { color: var(--tone); margin-top: 1px; }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast .icon-btn { width: 24px; height: 24px; margin: -2px 0; border-radius: 6px; }

/* ------------------------------------------------------------------ dashboard */

.hero { padding: 52px 0 32px; max-width: 760px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 16px; padding: 4px 11px 4px 9px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--brand); background: var(--brand-soft);
}
.hero h1 { font-size: clamp(28px, 4.2vw, 40px); font-weight: 720; letter-spacing: -0.028em; line-height: 1.12; }
.hero-sub { margin-top: 14px; font-size: 17px; line-height: 1.55; color: var(--text-2); max-width: 640px; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.app-card {
  --accent: var(--brand);
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px; min-height: 216px; padding: 20px;
  border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--text);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}
.app-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border)); }
.app-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.app-card::after {
  content: ""; position: absolute; z-index: -1; width: 300px; height: 300px; right: -130px; top: -150px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 20%, transparent), transparent);
  opacity: 0.7; transition: opacity var(--t);
}
.app-card:hover::after { opacity: 1; }
.app-card:focus-visible { outline-offset: 3px; }
.app-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.app-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.app-card h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.app-card-tagline {
  color: var(--text-2); font-size: 14px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.app-card-foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.app-card-meta { display: flex; align-items: center; gap: 8px; flex: none; color: var(--text-3); }
.app-card-go { transition: transform var(--t) var(--ease), color var(--t); }
.app-card:hover .app-card-go { transform: translateX(3px); color: color-mix(in srgb, var(--accent) 75%, var(--text)); }
.app-card.is-off .icon-tile { filter: grayscale(1); opacity: 0.7; }
.app-card.is-off::before { background: var(--border-strong); }
.app-card.is-skeleton { pointer-events: none; }
.app-card.is-skeleton::before, .app-card.is-skeleton::after { display: none; }

/* ------------------------------------------------------------------ app page */

.back-link {
  display: inline-flex; align-items: center; gap: 6px; margin: 22px 0 14px -6px; padding: 5px 10px 5px 6px;
  border-radius: 8px; font-size: 14px; font-weight: 550; color: var(--text-2);
  transition: background-color var(--t-fast), color var(--t-fast);
}
.back-link:hover { text-decoration: none; color: var(--text); background: var(--sunken); }
.back-link .icon { transition: transform var(--t) var(--ease); }
.back-link:hover .icon { transform: translateX(-2px); }

.app-hero {
  --accent: var(--brand);
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: center; gap: 18px; padding: 22px 24px;
  border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.app-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(640px 220px at 0% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%);
}
.app-hero::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--accent); }
.app-hero-main { flex: 1; min-width: 0; }
.app-hero-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.app-hero h1 { font-size: 26px; font-weight: 720; letter-spacing: -0.022em; }
.app-hero-tagline { margin-top: 4px; color: var(--text-2); }
.app-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }

.app-alerts { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.app-alerts:empty { display: none; }

.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 20px; align-items: start; }
.app-work { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.dropzone {
  --accent: var(--brand);
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; min-height: 260px; padding: 32px 24px; text-align: center; cursor: pointer;
  border-radius: var(--r-lg); border: 2px dashed var(--border-strong); background: var(--surface);
  transition: border-color var(--t), background-color var(--t), box-shadow var(--t);
}
.dropzone:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong));
  background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.dropzone:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent); }
.dropzone.is-over {
  border-style: solid; border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent);
}
.dropzone.is-disabled { cursor: not-allowed; opacity: 0.6; }
.dropzone.is-disabled:hover { border-color: var(--border-strong); background: var(--surface); }
.dz-icon {
  width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center; margin-bottom: 10px;
  color: color-mix(in srgb, var(--accent) 80%, var(--text));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  transition: transform var(--t) var(--ease);
}
.dropzone:hover .dz-icon, .dropzone.is-over .dz-icon { transform: translateY(-3px); }
.dz-title { font-size: 19px; font-weight: 680; letter-spacing: -0.015em; }
.dz-sub { color: var(--text-2); }
.dz-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.dz-types { margin-top: 14px; font-size: 12.5px; line-height: 1.55; color: var(--text-3); max-width: 540px; }
.dz-note {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 550; color: var(--warn-fg); background: var(--warn-bg); border: 1px solid var(--warn-bd);
}
.dz-note.is-info { color: var(--text-2); background: var(--sunken); border-color: var(--border); }
kbd {
  font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; background: var(--surface-2); color: var(--text-2);
}

.drop-overlay {
  --accent: var(--brand);
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  opacity: 0; visibility: hidden; transition: opacity var(--t), visibility 0s linear var(--t);
}
.drop-overlay.show { opacity: 1; visibility: visible; transition: opacity var(--t); }
.drop-overlay-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 56px; text-align: center;
  border-radius: 24px; border: 2px dashed var(--accent); background: var(--surface); box-shadow: var(--shadow-lg);
  transform: scale(0.97); transition: transform var(--t) var(--ease);
}
.drop-overlay.show .drop-overlay-card { transform: none; }

.examples { padding: 16px 16px 12px; }
.examples-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.examples-head h2 { font-size: 14px; font-weight: 650; }
.examples-row {
  display: flex; gap: 12px; overflow-x: auto; padding: 4px 4px 8px; margin: -4px -4px 0;
  scroll-snap-type: x proximity; scrollbar-width: thin; overscroll-behavior-x: contain;
}
.example {
  flex: none; width: 124px; display: flex; flex-direction: column; gap: 7px; padding: 0; border: 0;
  background: none; text-align: left; cursor: pointer; scroll-snap-align: start; color: var(--text-2);
}
.example:focus-visible { outline: none; }
.example-thumb {
  position: relative; width: 124px; height: 92px; border-radius: 10px; overflow: hidden; display: grid; place-items: center;
  background: var(--sunken); border: 1px solid var(--border); color: var(--text-3);
  transition: transform var(--t) var(--ease), box-shadow var(--t), border-color var(--t);
}
.example-thumb img { width: 100%; height: 100%; object-fit: cover; }
.example-thumb::after {
  content: ""; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.35)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5.5v13l10.5-6.5z'/%3E%3C/svg%3E")
    no-repeat center / 26px;
  opacity: 0; transition: opacity var(--t);
}
.example:hover .example-thumb, .example:focus-visible .example-thumb {
  transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.example:hover .example-thumb::after, .example:focus-visible .example-thumb::after { opacity: 1; }
.example:focus-visible .example-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
.example-label {
  font-size: 12.5px; font-weight: 550; line-height: 1.3; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.example[disabled] { cursor: not-allowed; opacity: 0.55; }

.about { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.about h2 { font-size: 12px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.about-desc { display: flex; flex-direction: column; gap: 8px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.limits { border-top: 1px solid var(--border); padding-top: 4px; }
.limits summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0;
  list-style: none; cursor: pointer; font-size: 14px; font-weight: 600; border-radius: 6px;
}
.limits summary::-webkit-details-marker { display: none; }
.limits summary .icon { color: var(--text-3); transition: transform var(--t) var(--ease); }
.limits[open] summary .icon { transform: rotate(180deg); }
.limits ul { margin: 2px 0 6px; padding-left: 18px; color: var(--text-2); font-size: 13.5px; }
.limits li + li { margin-top: 5px; }
.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.links a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
.links a:hover { text-decoration: none; border-color: var(--border-strong); background: var(--sunken); }
.links a .icon { color: var(--text-3); }
.stats-note { font-size: 12.5px; color: var(--text-3); border-top: 1px solid var(--border); padding-top: 12px; }

/* jobs */
.jobs { margin-top: 36px; }
.jobs-list { display: flex; flex-direction: column; gap: 16px; }
.jobs-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 16px; text-align: center;
  color: var(--text-3); font-size: 14px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}

.job { --accent: var(--brand); overflow: hidden; animation: rise 0.28s var(--ease); scroll-margin-top: 76px; }
.item { scroll-margin: 76px 0 16px; }
@keyframes rise { from { opacity: 0; transform: translateY(-6px); } }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 4px 10px; }
.job-toggle {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 8px 5px 6px; border: 0; border-radius: 8px;
  background: none; cursor: pointer; text-align: left; font-size: 15px; font-weight: 650; color: var(--text);
}
.job-toggle:hover { background: var(--sunken); }
.job-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-chev { color: var(--text-3); transition: transform var(--t) var(--ease); }
.job.collapsed .job-chev { transform: rotate(-90deg); }
.job-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.job-time { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: 4px; }
.job-status {
  display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; min-height: 24px; padding: 0 18px;
  font-size: 13.5px; color: var(--text-2);
}
.job-status-main { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.job-status-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; color: var(--accent); flex: none; }
.job[data-phase="done"] .job-status-icon { color: var(--ok); }
.job[data-phase="error"] .job-status-icon { color: var(--danger); }
.job-status-text { font-weight: 600; color: var(--text); }
.job[data-phase="error"] .job-status-text { color: var(--danger-fg); }
.job-status-meta { display: inline-flex; flex-wrap: wrap; gap: 4px 0; color: var(--text-3); font-variant-numeric: tabular-nums; }
.job-status-meta > span + span::before { content: "·"; margin: 0 8px; color: var(--border-strong); }
.job-status-meta .is-bad { color: var(--danger-fg); }
.job-status-meta .is-reconnect { color: var(--warn-fg); }

.progress { position: relative; height: 4px; margin: 10px 18px 14px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent));
  transition: width 0.35s var(--ease), background-color var(--t);
}
.progress.is-indeterminate .progress-fill { width: 34% !important; animation: indeterminate 1.25s ease-in-out infinite; }
@keyframes indeterminate { from { transform: translateX(-110%); } to { transform: translateX(310%); } }
.job[data-phase="done"] .progress-fill { background: var(--ok); }
.job[data-phase="error"] .progress-fill { background: var(--danger); }
.job[data-phase="done"] .progress { opacity: 0.6; }

.job-body { border-top: 1px solid var(--border); padding: 14px 16px 18px; background: var(--surface-2); }
.job.collapsed .job-body { display: none; }
.job.collapsed .progress { margin-bottom: 12px; }
.job-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-chip {
  --tone: var(--text-3);
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 560; cursor: pointer; white-space: nowrap;
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.filter-chip:hover { color: var(--text); border-color: var(--border-strong); }
.filter-chip .chip-dot { background: var(--tone); }
.filter-n { color: var(--text-3); font-weight: 650; font-variant-numeric: tabular-nums; }
.filter-chip[aria-pressed="true"] {
  color: var(--tone-fg, var(--surface)); background: var(--tone-bg, var(--text)); border-color: var(--tone, var(--text));
}
.filter-chip[aria-pressed="true"] .filter-n { color: inherit; opacity: 0.75; }
.filter-chip[data-key="all"][aria-pressed="true"] { color: var(--surface); background: var(--text); border-color: var(--text); }
.sort { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }

/* Section headers sit in the item grid itself, spanning a full row. */
.group-head {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; margin-top: 14px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.group-head.is-first { margin-top: 0; }
.group-head .icon { color: var(--text-3); }
.group-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-count { flex: none; color: var(--text-3); font-weight: 500; }
.job-empty { padding: 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 12px; }

.item {
  --tone: transparent;
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; cursor: pointer;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
  animation: pop 0.3s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: scale(0.965); } }
.item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.item::before { content: ""; position: absolute; z-index: 2; inset: 0 0 auto 0; height: 3px; background: var(--tone); transition: background-color var(--t); pointer-events: none; }
/* Transparent full-card button that opens the details; the feedback row sits above it. */
.item-open {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; border-radius: inherit; background: transparent; cursor: pointer;
}
.item-open:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.item-media { position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden; background: var(--sunken); color: var(--text-3); }
.item-media.sk { border-radius: 0; }
.item-media img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 0.25s; }
.item-media img.is-loaded { opacity: 1; }
.item-text {
  align-self: stretch; justify-self: stretch; padding: 40px 14px 0; overflow: hidden; text-align: left;
  font-size: 11.5px; line-height: 1.5; color: var(--text-2); background: var(--surface-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
  -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent);
}
.item-kind, .item-badge {
  position: absolute; z-index: 1; top: 10px; display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 6px; border-radius: 6px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.02em;
  color: #fff; background: rgba(12, 14, 19, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  pointer-events: none;
}
.item-kind { left: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.item-badge { right: 10px; }
.job[data-phase="scanning"] .item[data-state="pending"] .item-media::after {
  content: ""; position: absolute; left: 0; right: 0; top: -45%; height: 45%; pointer-events: none;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
  animation: sweep 1.7s ease-in-out infinite;
}
@keyframes sweep { to { top: 100%; } }
.item-body { display: flex; flex-direction: column; gap: 4px; min-height: 96px; padding: 10px 12px 11px; }
.item-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.item-ms { flex: none; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.item-headline {
  font-size: 13.5px; font-weight: 620; line-height: 1.3; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item-summary { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-label { margin-top: auto; padding-top: 3px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sk-chip { width: 58px; height: 20px; border-radius: 999px; }
.item .sk-line { width: 88%; height: 10px; margin-top: 4px; }
.item .sk-line.short { width: 56%; }
.item[data-state="skipped"] { box-shadow: none; background: var(--surface-2); }
.item[data-state="skipped"] .item-media, .item[data-state="skipped"] .item-body { opacity: 0.55; }
.item[data-state="skipped"] .item-media img { filter: grayscale(1); }
.item[data-state="failed"] { border-color: var(--danger-bd); }
.item[data-state="failed"] .item-headline { color: var(--danger-fg); }
.item[data-state="missing"] .item-body { opacity: 0.7; }

/* one-tap feedback on a card */
.item-fb {
  position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 34px; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--border);
}
.item-fb-q, .item-fb-err {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-fb-err { color: var(--danger-fg); font-weight: 550; }
.item-fb-btns { display: flex; gap: 4px; flex: none; margin-left: auto; }
.fb-mini {
  display: grid; place-items: center; width: 30px; height: 26px; padding: 0; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.fb-mini-label { display: none; }
.fb-mini.is-yes:hover { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.fb-mini.is-no:hover { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-bd); }
.fb-badge {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; height: 24px; padding: 0 9px 0 7px;
  border-radius: 999px; border: 1px solid; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.fb-badge-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-badge.is-ok { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.fb-badge.is-wrong { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-bd); }
.fb-badge:hover { filter: brightness(0.97); }

/* retention line under the drop zone */
.dz-wrap { display: flex; flex-direction: column; gap: 8px; }
.retention-line { display: inline-flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.retention-line .icon { margin-top: 2px; }
.dz-retention { padding: 0 6px; }

/* verdict chips */
.chip {
  --tone: var(--neutral); --tone-fg: var(--neutral-fg); --tone-bg: var(--neutral-bg); --tone-bd: var(--neutral-bd);
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; height: 22px; padding: 0 9px 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap;
  color: var(--tone-fg); background: var(--tone-bg); border: 1px solid var(--tone-bd);
}
.chip-text { overflow: hidden; text-overflow: ellipsis; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--tone); }
.chip-lg { height: 28px; padding: 0 12px 0 10px; font-size: 13.5px; gap: 7px; }
.chip-lg .chip-dot { width: 8px; height: 8px; }

/* ------------------------------------------------------------------ detail dialog */

dialog.detail {
  --accent: var(--brand);
  width: min(1240px, calc(100vw - 48px)); height: min(860px, calc(100vh - 48px));
  max-width: none; max-height: none; margin: auto; padding: 0; border: 0; overflow: hidden;
  border-radius: var(--r-xl); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.detail[open] { display: flex; flex-direction: column; animation: dlg-in 0.2s var(--ease); }
dialog.detail:focus { outline: none; }
dialog.detail::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 20px; border-bottom: 1px solid var(--border); flex: none; }
.dlg-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-nav { display: flex; align-items: center; gap: 2px; flex: none; }
.dlg-pos { min-width: 62px; text-align: center; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.dlg-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; flex: none; }
.dlg-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 390px; }
.dlg-stage { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--stage); color: #e6e9ef; }
.viewer { position: relative; flex: 1; min-height: 0; margin: 18px; }
.viewer img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-overlay { pointer-events: none; transition: opacity var(--t); }
.viewer-ph { position: absolute; inset: 0; display: grid; place-items: center; color: #6b7280; }
.overlay-bar {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 0 18px 16px;
  font-size: 12.5px; color: #c9ced8;
}
.ov-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: #e6e9ef; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); }
.seg button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: #b9bfcb;
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background-color var(--t-fast), color var(--t-fast);
}
.seg button:hover { color: #fff; }
.seg button[aria-pressed="true"] { background: rgba(255, 255, 255, 0.16); color: #fff; }
.ov-range { display: inline-flex; align-items: center; gap: 8px; }
.ov-range input { width: 130px; accent-color: #818cf8; }
.ov-range input:disabled { opacity: 0.4; }
.ov-val { min-width: 34px; font-variant-numeric: tabular-nums; color: #9aa1ae; }
.ov-hint { margin-left: auto; color: #7d8492; }
.text-view {
  flex: 1; min-height: 0; margin: 18px; padding: 22px 24px; overflow: auto; border-radius: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.text-view pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); font-size: 14px; line-height: 1.65; }

.dlg-panel { min-width: 0; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 22px; border-left: 1px solid var(--border); }
.panel-head { display: flex; flex-direction: column; align-items: flex-start; gap: 0; }
.panel-title { margin-top: 12px; font-size: 21px; font-weight: 720; letter-spacing: -0.02em; line-height: 1.25; }
.panel-summary { margin-top: 6px; color: var(--text-2); }
.meta { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.meta li {
  font-size: 12px; color: var(--text-2); padding: 3px 8px; border-radius: 6px; background: var(--sunken);
  border: 1px solid var(--border); font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.panel-sec h3 { margin-bottom: 12px; font-size: 12px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.scores { display: flex; flex-direction: column; gap: 11px; }
.score-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13px; }
.score-label { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.score-val { flex: none; color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.score-track { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.score-fill { height: 100%; width: calc(var(--v, 0) * 100%); min-width: 2px; border-radius: inherit; background: var(--neutral); transition: width 0.5s var(--ease); }
.score.is-hl .score-label { color: var(--text); font-weight: 650; }
.score.is-hl .score-val { color: var(--tone-fg); }
.score.is-hl .score-track { height: 8px; }
.score.is-hl .score-fill { background: var(--tone); }
.scores .link-btn { align-self: flex-start; margin-top: 2px; }
.fields { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); margin: 0; font-size: 13.5px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.fields dt, .fields dd { margin: 0; padding: 8px 12px; border-top: 1px solid var(--border); }
.fields dt:first-of-type, .fields dt:first-of-type + dd { border-top: 0; }
.fields dt { color: var(--text-3); background: var(--surface-2); }
.fields dd { overflow-wrap: anywhere; }
.fields dd.is-empty { color: var(--text-3); }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
/* "Is this right?" block in the dialog */
.fb {
  display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); scroll-margin: 16px;
}
.fb.is-saved { background: var(--ok-bg); border-color: var(--ok-bd); }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fb-q { font-size: 14px; font-weight: 650; }
.fb-keys { flex: none; font-size: 12px; color: var(--text-3); }
.fb-actions { display: flex; gap: 8px; }
.fb-actions .btn { flex: 1; }
.fb-yes:hover:not([disabled]), .fb-yes[aria-pressed="true"] { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.fb-no:hover:not([disabled]), .fb-no[aria-pressed="true"] { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-bd); }
.fb-form { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fb-form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fb-form legend { padding: 0; margin-bottom: 10px; font-size: 13.5px; font-weight: 600; color: var(--text); }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-chip { position: relative; display: inline-flex; }
.fb-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fb-chip span {
  display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 550; transition: background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.fb-chip:hover span { color: var(--text); border-color: var(--text-3); }
.fb-chip input:checked + span { color: #fff; background: var(--brand-solid); border-color: var(--brand-solid); }
.fb-chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.fb-chip input:disabled + span { opacity: 0.5; }
.fb .input { height: 38px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.fb textarea.input { height: auto; min-height: 72px; padding: 9px 12px; line-height: 1.45; resize: vertical; }
.fb-note-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.fb-note-row label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.fb-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.fb-send { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.fb-send-hint { font-size: 12px; }
.fb-hint { font-size: 12.5px; color: var(--text-3); }
.fb-err { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--danger-fg); }
.fb-err .icon { margin-top: 1px; }
.fb-saved { display: flex; align-items: flex-start; gap: 10px; }
.fb-saved > .icon { color: var(--ok); }
.fb-saved-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; color: var(--text-2); }
.fb-saved-body strong { color: var(--text); font-weight: 650; }
.fb-saved-note { font-style: italic; overflow-wrap: anywhere; }

.raw { border-top: 1px solid var(--border); padding-top: 14px; }
.raw summary {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; border-radius: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.raw summary::-webkit-details-marker { display: none; }
.raw summary .icon { color: var(--text-3); transition: transform var(--t) var(--ease); transform: rotate(-90deg); }
.raw[open] summary .icon { transform: none; }
.raw summary .link-btn { margin-left: auto; }
.code {
  margin: 10px 0 0; max-height: 380px; overflow: auto; padding: 12px 14px; border-radius: 10px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre; tab-size: 2;
  background: var(--sunken); border: 1px solid var(--border); color: var(--text);
}

/* ------------------------------------------------------------------ login */

.login-page main { display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: 100%; max-width: 400px; padding: 34px 32px 26px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.login-card .logo { margin-bottom: 22px; }
.login-card h1 { font-size: 23px; font-weight: 720; letter-spacing: -0.022em; }
.login-sub { margin: 6px 0 24px; color: var(--text-2); }
.field label { display: block; margin-bottom: 7px; font-size: 13.5px; font-weight: 600; }
.input-wrap { position: relative; }
.input {
  width: 100%; height: 46px; padding: 0 46px 0 14px; border-radius: 11px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 15px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 20%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.input:disabled { opacity: 0.6; }
.input-wrap .icon-btn { position: absolute; top: 5px; right: 5px; width: 36px; height: 36px; }
.form-error {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px;
  color: var(--danger-fg); background: var(--danger-bg); border: 1px solid var(--danger-bd);
}
.form-error.is-warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--warn-bd); }
.form-error .icon { margin-top: 1px; }
.login-card .btn { height: 46px; margin-top: 18px; font-size: 15px; border-radius: 11px; }
.login-foot { margin-top: 20px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.login-retention {
  display: flex; align-items: flex-start; justify-content: center; gap: 6px; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); text-align: left;
}
.login-retention svg { flex: none; margin-top: 2px; }
.login-theme { position: fixed; top: 14px; right: 14px; z-index: 5; }
.shake { animation: shake 0.36s ease-in-out; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* ------------------------------------------------------------------ admin: shared */

.badge-plain { --b: var(--text-3); color: var(--text-2); }
.badge-ok { --b: var(--ok); color: var(--ok-fg); }
.note { font-size: 13.5px; color: var(--text-2); padding: 10px 12px; border-radius: 10px; background: var(--sunken); border: 1px solid var(--border); }
.is-bad { color: var(--danger-fg); }
.sub-h { font-size: 13px; font-weight: 650; color: var(--text); margin-bottom: 10px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.page-foot { margin-top: 18px; font-size: 13.5px; }

.settings-page { display: flex; flex-direction: column; gap: 18px; }
.settings-head .back-link { margin-bottom: 8px; }
.settings-head h1 { font-size: 28px; font-weight: 720; letter-spacing: -0.025em; }
.settings-sub { margin-top: 4px; color: var(--text-2); }
.jump { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.jump-chip {
  height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 13px; font-weight: 550; cursor: pointer;
}
.jump-chip:hover { color: var(--text); border-color: var(--border-strong); }

.panel { padding: 20px; scroll-margin-top: 76px; }
.panel-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.panel-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none;
  color: var(--brand); background: var(--brand-soft);
}
.panel-titles { flex: 1; min-width: 0; }
.panel-titles h2 { font-size: 17px; font-weight: 680; letter-spacing: -0.015em; }
.panel-sub { margin-top: 2px; font-size: 13.5px; color: var(--text-3); }
.panel-tools { display: flex; gap: 8px; flex: none; }
.panel-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.stat {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.stat-label { font-size: 12px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.stat-value { font-size: 17px; font-weight: 680; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-sub { font-size: 12.5px; color: var(--text-3); }

.meter { --tone: var(--ok); display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.meter-label { color: var(--text-2); }
.meter-text { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-track { position: relative; height: 8px; border-radius: 999px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--border); }
.meter-fill { height: 100%; border-radius: inherit; background: var(--tone); transition: width 0.5s var(--ease); }
.meter-marker {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px;
  background: var(--text); opacity: 0.55;
}
.meter-sub { font-size: 12.5px; color: var(--text-3); }

.field-help { margin-top: 5px; font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.field-err, .form-err { margin-top: 5px; font-size: 12.5px; color: var(--danger-fg); }
.form-err:empty { display: none; }
.input-suffix { display: flex; align-items: center; gap: 8px; }
.input-suffix .suffix { font-size: 13.5px; color: var(--text-3); white-space: nowrap; }
.settings-form .input, .pw-form .input, .modal .input { height: 38px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.input-num { max-width: 140px; }
.select-lg { height: 38px; width: 100%; max-width: 360px; font-size: 14px; }
.settings-form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px 20px; }
.form-grid .field label, .settings-form > .field label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.form-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.switch-list { display: flex; flex-direction: column; gap: 14px; }
.switch-row { display: flex; align-items: flex-start; gap: 12px; }
.switch { position: relative; display: inline-flex; flex: none; margin-top: 1px; cursor: pointer; }
.switch-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track {
  position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--border-strong);
  transition: background-color var(--t-fast);
}
.switch-track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform var(--t) var(--ease);
}
.switch-input:checked + .switch-track { background: var(--brand-solid); }
.switch-input:checked + .switch-track::after { transform: translateX(16px); }
.switch-input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-input:disabled + .switch-track { opacity: 0.5; }
.switch-text { min-width: 0; }
.switch-label { font-size: 14px; font-weight: 600; cursor: pointer; }
.switch-text .field-help { margin-top: 2px; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.s3, .box-instance { font-family: var(--mono); font-size: 12.5px; }

/* box */
.box-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.box-type { font-family: var(--mono); font-size: 18px; font-weight: 650; }
.box-instance { color: var(--text-3); }
.size-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.size-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; text-align: left;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.size-card:hover:not([disabled]) { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.size-card[disabled] { cursor: default; }
.size-card[disabled]:not(.is-current) { opacity: 0.55; }
.size-card.is-current { border-color: var(--ok-bd); background: var(--ok-bg); box-shadow: inset 0 0 0 1px var(--ok-bd); }
.size-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.size-name { font-family: var(--mono); font-weight: 650; font-size: 14.5px; }
.size-specs { font-size: 13px; color: var(--text-2); }
.size-gpu { font-size: 12.5px; color: var(--text-3); }
.size-price { margin-top: 4px; font-size: 13px; color: var(--text-3); }
.size-price strong { font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.danger-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--danger-bd); background: var(--danger-bg);
}
.danger-row strong { font-size: 14px; }
.danger-row p { font-size: 13px; }
.price-change {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px;
  background: var(--sunken); border: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.price-old { color: var(--text-3); text-decoration: line-through; }
.price-new { font-size: 16px; }
.price-delta { width: 100%; font-size: 12.5px; }
.price-delta.is-up { color: var(--warn-fg); }
.price-delta.is-down { color: var(--ok-fg); }

/* archive */
.archive-body { display: flex; flex-direction: column; gap: 18px; }
.archive-status { display: flex; flex-direction: column; gap: 14px; }
.counts { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 13.5px; }
.counts-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.counts-row:first-child { border-top: 0; }
.counts-head { background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 650; }
.counts-app { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.push-progress { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); border: 1px solid var(--info-bd); }
.push-line { display: flex; align-items: center; gap: 8px; color: var(--info-fg); }
.push-progress .progress { margin: 0; --accent: var(--info); }

/* passwords */
.pw-rows { display: flex; flex-direction: column; }
.pw-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.pw-row:first-child { border-top: 0; padding-top: 0; }
.pw-text strong { font-size: 14px; }
.pw-text p { font-size: 13px; }
.pw-actions { display: flex; gap: 6px; }
.pw-form { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pw-form .input { max-width: 300px; flex: 1; min-width: 180px; }
.pw-form .form-err { width: 100%; margin: 0; }

/* apps list */
.admin-apps { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.admin-app {
  --accent: var(--brand); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border);
  color: var(--text); transition: background-color var(--t-fast);
}
.admin-app:first-child { border-top: 0; }
.admin-app:hover { text-decoration: none; background: var(--surface-2); }
.admin-app .icon-tile { width: 38px; height: 38px; border-radius: 10px; }
.admin-app-main { flex: 1; min-width: 0; }
.admin-app-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-app-meta { display: flex; flex-wrap: wrap; gap: 2px 0; margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.admin-app-meta > span + span::before { content: "·"; margin: 0 7px; color: var(--border-strong); }
.admin-app-go { color: var(--text-3); }
.app-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* recent feedback table */
.fbt { display: flex; flex-direction: column; gap: 12px; }
.fbt-toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.fbt-toolbar .switch-row { align-items: center; }
.fbt-toolbar .switch-label { font-weight: 550; font-size: 13.5px; }
.fbt-spacer { flex: 1; }
.fbt-dl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.fbt-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fbt-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--border); }
.fbt-row:first-child { border-top: 0; }
.fbt-row.is-sk { align-items: center; }
.fbt-thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: var(--sunken); color: var(--text-3); }
.fbt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fbt-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fbt-top { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-3); }
.fbt-app { font-weight: 650; color: var(--text-2); }
.fbt-label { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbt-verdict { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.fbt-arrow { color: var(--text-3); }
.fbt-answer { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-weight: 650; border: 1px solid; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbt-answer.is-ok { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-bd); }
.fbt-answer.is-wrong { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-bd); }
.fbt-note { font-size: 12.5px; font-style: italic; color: var(--text-2); overflow-wrap: anywhere; }
.fbt-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.fbt-empty { padding: 18px; text-align: center; font-size: 13.5px; color: var(--text-3); }
.fbt-empty.is-error { color: var(--danger-fg); }

/* dashboard banner */
.archive-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding: 12px 14px;
  border-radius: 14px; border: 1px solid var(--warn-bd); background: var(--warn-bg); box-shadow: var(--shadow-sm);
  animation: rise 0.28s var(--ease);
}
.archive-banner.is-busy { border-color: var(--info-bd); background: var(--info-bg); color: var(--info-fg); }
.archive-banner.is-ok { border-color: var(--ok-bd); background: var(--ok-bg); }
.archive-banner.is-ok > .icon { color: var(--ok); }
.archive-banner.is-bad { border-color: var(--danger-bd); background: var(--danger-bg); }
.archive-banner.is-bad > .icon { color: var(--danger); }
.archive-banner-icon { display: grid; place-items: center; color: var(--warn-fg); }
.archive-banner-text { flex: 1; min-width: 200px; display: flex; flex-direction: column; font-size: 14px; color: var(--text); }
.archive-banner-text span { color: var(--text-2); font-size: 13.5px; }
.archive-banner-actions { display: flex; gap: 6px; }
.archive-banner + .hero { padding-top: 28px; }

/* modal dialogs */
dialog.modal {
  width: min(480px, calc(100vw - 32px)); margin: auto; padding: 0; border: 0; border-radius: var(--r-xl);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal[open] { animation: dlg-in 0.2s var(--ease); }
dialog.modal::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.modal-head { display: flex; align-items: center; gap: 12px; }
.modal-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; color: var(--brand); background: var(--brand-soft); }
dialog.modal.is-danger .modal-icon { color: var(--danger-fg); background: var(--danger-bg); }
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; }
.modal-body { font-size: 14px; color: var(--text-2); line-height: 1.55; }
.modal-type label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.modal-type code, .modal code { font-family: var(--mono); font-size: 0.92em; padding: 1px 6px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--border); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.secret-box { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--border-strong); }
.secret-value { flex: 1; min-width: 0; font-family: var(--mono); font-size: 17px; font-weight: 650; overflow-wrap: anywhere; user-select: all; }

/* full-screen resize / stop state */
dialog.busy {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 24px 16px;
  border: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); color: var(--text);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
dialog.busy[open] { display: grid; place-items: center; }
dialog.busy::backdrop { background: transparent; }
.busy-card {
  width: 100%; max-width: 520px; padding: 32px 28px; border-radius: 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.busy-glyph { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; color: var(--brand); background: var(--brand-soft); }
.busy-glyph[data-tone="ok"] { color: var(--ok); background: var(--ok-bg); }
.busy-glyph[data-tone="danger"] { color: var(--danger); background: var(--danger-bg); }
.busy-spinner { width: 34px; height: 34px; border-width: 3px; }
.busy-title { font-size: 22px; font-weight: 720; letter-spacing: -0.02em; }
.busy-text { color: var(--text-2); max-width: 420px; }
.busy-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; max-width: 360px; }
.busy-step { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-3); }
.busy-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid var(--border-strong); }
.busy-step[data-state="active"] { color: var(--text); font-weight: 600; }
.busy-step[data-state="active"] .busy-dot { border-color: var(--brand); background: var(--brand-soft); animation: pulse-brand 1.3s ease-out infinite; }
.busy-step[data-state="done"] { color: var(--text-2); }
.busy-step[data-state="done"] .busy-dot { border-color: var(--ok); background: var(--ok); }
@keyframes pulse-brand { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 50%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
.busy-status { min-height: 1.5em; font-size: 13.5px; color: var(--text-2); }
.busy-meta { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.busy-actions { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.busy-actions:empty { display: none; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 960px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  dialog.detail { width: 100vw; height: 100vh; height: 100dvh; max-height: none; margin: 0; border-radius: 0; }
  .dlg-body { display: block; overflow-y: auto; }
  .dlg-stage { height: 52vh; height: 52dvh; }
  .dlg-panel { border-left: 0; border-top: 1px solid var(--border); overflow: visible; padding: 18px 16px 28px; }
  .ov-hint { display: none; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  body { font-size: 14.5px; }
  .topbar-inner { height: 56px; }
  .brand-version { display: none; }
  .hide-sm { display: none !important; }
  .hero { padding: 32px 0 24px; }
  .hero-sub { font-size: 15.5px; }
  .app-hero { flex-wrap: wrap; gap: 14px; padding: 18px 16px; }
  .app-hero .icon-tile.lg { width: 48px; height: 48px; border-radius: 13px; }
  .app-hero h1 { font-size: 22px; }
  .app-hero-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .dropzone { min-height: 220px; padding: 26px 16px; }
  .dz-title { font-size: 17px; }
  .job-head { padding: 10px 10px 2px 6px; }
  .job-status { padding: 0 14px; }
  .progress { margin: 10px 14px 12px; }
  .job-body { padding: 12px 10px 14px; }
  .job-time { display: none; }
  .item-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  /* Narrow cards: drop the question, make the two answers labelled, full-width buttons. */
  .item-fb .item-fb-q { display: none; }
  .item-fb-btns { flex: 1; margin-left: 0; }
  .fb-mini { flex: 1; width: auto; height: 30px; display: inline-flex; gap: 4px; justify-content: center; font-size: 11.5px; font-weight: 600; }
  .fb-mini-label { display: inline; }
  .item-body { padding: 9px 10px 10px; min-height: 90px; }
  .login-card { padding: 28px 22px 22px; }
  .drop-overlay-card { padding: 32px 24px; }
  [data-tip]::after { display: none; }
  /* admin */
  .settings-head h1 { font-size: 24px; }
  .panel { padding: 16px 14px; }
  .panel-top { margin-bottom: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-value { font-size: 15px; }
  .counts-head { display: none; }
  .counts-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
  .counts-app { grid-column: 1 / -1; }
  .counts-row [data-label]::before { content: attr(data-label) ": "; color: var(--text-3); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd + dt { margin-top: 8px; }
  .pw-row { grid-template-columns: minmax(0, 1fr); }
  .fbt-row { grid-template-columns: 44px minmax(0, 1fr); }
  .fbt-thumb { width: 44px; height: 44px; }
  .fbt-time { grid-column: 2; }
  .fbt-spacer { display: none; }
  .admin-app { flex-wrap: wrap; }
  .admin-app-main { flex-basis: calc(100% - 60px); }
  .admin-app .state { margin-left: 50px; }
  .admin-app-go { display: none; }
  .admin-app-meta { flex-direction: column; }
  .admin-app-meta > span + span::before { content: none; }
  .archive-banner-actions { width: 100%; }
  .archive-banner-actions .btn { flex: 1; }
  .modal-form { padding: 18px 16px; }
  .busy-card { padding: 26px 18px; }
}
@media (max-width: 400px) {
  .hide-xs { display: none !important; }
}

/* ================================================================== client-ready pages (round 4) */

.mono { font-family: var(--mono); font-size: 0.92em; }
.admin-only { display: none !important; }
body.is-admin .admin-only { display: revert !important; }

.btn-accent {
  --a: var(--accent, var(--brand));
  color: color-mix(in srgb, var(--a) 80%, var(--text));
  background: color-mix(in srgb, var(--a) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--a) 35%, transparent);
}
.btn-accent:hover:not([disabled]) { background: color-mix(in srgb, var(--a) 20%, var(--surface)); }

/* ---- dashboard */
.hero { padding: 44px 0 28px; }
.hero-steps { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 0; padding: 0; list-style: none; font-size: 13.5px; color: var(--text-2); }
.hero-steps li { display: inline-flex; align-items: center; gap: 8px; }
.hero-steps b {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 12px;
  color: var(--brand); background: var(--brand-soft);
}
.app-card { padding: 0; gap: 0; min-height: 0; }
.app-card::before { z-index: 2; }
.app-card::after { display: none; }
.app-card-media {
  position: relative; height: 128px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), color-mix(in srgb, var(--accent) 6%, var(--surface)));
  border-bottom: 1px solid var(--border);
}
.app-card-media > .state { position: absolute; top: 12px; right: 12px; z-index: 1; box-shadow: var(--shadow-sm); }
.app-card-mosaic { position: absolute; inset: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; }
.app-card-mosaic img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.4s, transform 0.6s var(--ease); }
.app-card-mosaic img.is-loaded { opacity: 1; }
.app-card:hover .app-card-mosaic img { transform: scale(1.04); }
.mosaic-mark { position: absolute; inset: 0; display: grid; place-items: center; color: color-mix(in srgb, var(--accent) 55%, transparent); }
.app-card-content { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.app-card-content .icon-tile { width: 32px; height: 32px; border-radius: 9px; }
.app-card-content .chips { margin-top: 2px; }
.app-card-foot { margin-top: auto; padding-top: 12px; display: flex; align-items: center; justify-content: space-between; }
.app-card-cta {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 650;
  color: color-mix(in srgb, var(--accent) 75%, var(--text));
}
.app-card.is-skeleton .app-card-media { background: none; }

/* ---- app page: header, layout */
.app-hero-side { align-items: flex-end; }
.guide-btn { height: 34px; }
.app-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; margin-top: 22px; }
.stage { min-width: 0; }
.stage-idle { display: flex; flex-direction: column; gap: 18px; }
.stage-live { min-width: 0; }
.dz-formats { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 16px; max-width: 560px; }
.format-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 550; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); cursor: help;
}
.format-chip .icon { color: var(--text-3); }
.dz-limit { width: 100%; margin-top: 4px; font-size: 12px; color: var(--text-3); }
.good-to-know h3 { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 6px; }
.good-to-know ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-3); }
.good-to-know li + li { margin-top: 4px; }
.about .link-btn { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }

/* ---- sample gallery */
.samples { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.samples-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.samples-head h2 { font-size: 16px; font-weight: 680; letter-spacing: -0.01em; }
.samples-head p { font-size: 13px; margin-top: 2px; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 228px), 1fr)); gap: 12px; }
.sample-group {
  --tone: var(--neutral);
  display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); animation: rise 0.25s var(--ease);
  transition: border-color var(--t), box-shadow var(--t);
}
.sample-group:hover { border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); box-shadow: var(--shadow-sm); }
.sample-head { display: flex; align-items: center; gap: 8px; }
.sample-head .chip-dot { width: 8px; height: 8px; background: var(--tone); }
.sample-head h3 { font-size: 13.5px; font-weight: 650; }
.sample-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.4; min-height: 2.8em; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sample-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sample-thumbs.n1 { grid-template-columns: 1fr; }
.sample { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 0; border: 0; background: none; text-align: left; color: var(--text-2); cursor: pointer; }
.sample-img {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 9px; overflow: hidden;
  background: var(--sunken); border: 1px solid var(--border); color: var(--text-3);
  transition: transform var(--t) var(--ease), box-shadow var(--t), border-color var(--t);
}
.sample-thumbs.n1 .sample-img { aspect-ratio: 16 / 7; }
.sample-img img { width: 100%; height: 100%; object-fit: cover; }
.sample-img::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity var(--t);
  background: rgba(0, 0, 0, 0.32) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5.5v13l10.5-6.5z'/%3E%3C/svg%3E") no-repeat center / 24px;
}
.sample:hover .sample-img, .sample:focus-visible .sample-img { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--tone) 50%, var(--border)); }
.sample:hover .sample-img::after, .sample:focus-visible .sample-img::after { opacity: 1; }
.sample:focus-visible { outline: none; }
.sample:focus-visible .sample-img { outline: 2px solid var(--focus); outline-offset: 2px; }
.sample[disabled] { cursor: not-allowed; opacity: 0.55; }
.sample-label { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-caption { font-size: 11.5px; color: var(--text-3); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sample-credit { font-size: 10.5px; color: var(--text-3); opacity: 0.8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sample-credit::before { content: "© "; }
.sample-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; font-size: 12px; }
.sample-try { display: inline-flex; align-items: center; gap: 4px; }
.samples-more { display: flex; justify-content: center; margin-top: 12px; }
.sample-more .icon { transition: transform var(--t); }
.sample-more[aria-expanded="true"] .icon { transform: rotate(180deg); }

/* ---- scans: the one on the stage, and earlier ones */
.job.is-active { animation: none; box-shadow: var(--shadow-md); }
.job.is-active .job-chev { display: none; }
.job.is-active .job-toggle { cursor: default; }
.job.is-active .job-toggle:hover { background: none; }
.job-new { flex: none; }
.job-summary { display: none; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; flex: 1; overflow: hidden; max-height: 28px; }
.job.collapsed .job-summary { display: flex; }
.job.collapsed .job-head { cursor: pointer; padding-bottom: 12px; transition: background-color var(--t-fast); }
.job.collapsed .job-head:hover { background: var(--surface-2); }
.job.collapsed .job-status { display: none; }
.job.collapsed[data-phase="done"] .progress, .job.collapsed[data-phase="error"] .progress { display: none; }
.job.collapsed .progress { margin-top: 0; }
.job.collapsed .job-actions .btn-secondary { display: none; }
.job-summary-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.mini-chip {
  --tone: var(--neutral); --tone-fg: var(--neutral-fg); --tone-bg: var(--neutral-bg); --tone-bd: var(--neutral-bd);
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; white-space: nowrap;
  font-size: 11.5px; font-weight: 600; color: var(--tone-fg); background: var(--tone-bg); border: 1px solid var(--tone-bd);
}
.mini-chip b { font-weight: 750; font-variant-numeric: tabular-nums; }
.jobs .section-head h2 { font-size: 15px; }
.job-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.view-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--sunken); border: 1px solid var(--border); }
.view-seg button {
  display: grid; place-items: center; width: 30px; height: 26px; border: 0; border-radius: 6px; background: none;
  color: var(--text-3); cursor: pointer; transition: background-color var(--t-fast), color var(--t-fast);
}
.view-seg button:hover { color: var(--text); }
.view-seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---- results: shared bits, then the list view */
.item-main { display: contents; }
.item-score, .item-media-icon { display: none; }
.item-grid.is-list { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.is-list .item {
  flex-direction: row; align-items: center; gap: 12px; padding: 8px 10px 8px 12px; border-radius: 12px;
  animation: row-in 0.24s var(--ease) both;
}
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } }
.is-list .item:hover { transform: none; background: var(--surface-2); box-shadow: var(--shadow-sm); }
.is-list .item::before { inset: 8px auto 8px 0; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
.is-list .item-media { flex: none; width: 48px; height: 48px; aspect-ratio: auto; border-radius: 9px; }
.is-list .item-media img { object-fit: cover; }
.is-list .item-text, .is-list .item-kind, .is-list .item-badge { display: none; }
.is-list .item-media-icon { display: grid; place-items: center; color: var(--text-3); }
.is-list .item-body {
  flex: 1; min-width: 0; min-height: 0; padding: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label fb" "main fb" "score fb";
  column-gap: 14px; row-gap: 3px; align-items: center;
}
.is-list .item-label { grid-area: label; margin: 0; padding: 0; }
.is-list .item-main { grid-area: main; display: flex; align-items: center; gap: 8px; min-width: 0; }
.is-list .item-top { flex: none; }
.is-list .item-ms { display: none; }
.is-list .item-headline { flex: none; max-width: 45%; -webkit-line-clamp: 1; line-clamp: 1; font-size: 13.5px; }
.is-list .item-summary { flex: 1; min-width: 0; font-size: 12.5px; }
.is-list .item-summary::before { content: "·"; margin-right: 8px; color: var(--border-strong); }
.is-list .item-score { grid-area: score; display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-score-track { position: relative; flex: 0 1 180px; height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.item-score-fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: var(--tone, var(--neutral)); }
.item-score-text { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-list .sk-chip { flex: none; }
.is-list .sk-line { margin: 0; width: 40%; }
.is-list .sk-line.short { width: 25%; }
.is-list .item-fb { grid-area: fb; margin: 0; padding: 0; border: 0; min-height: 0; }
.is-list .item-fb-q { display: none; }
.is-list .fb-badge { max-width: 210px; }
.is-list .group-head { margin-top: 10px; }
.is-list .group-head.is-first { margin-top: 0; }
.job[data-phase="scanning"] .is-list .item[data-state="pending"] .item-media::after { height: 100%; top: -100%; }

/* ---- guide panel */
dialog.modal.guide { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); }
dialog.modal.guide[open] { display: flex; flex-direction: column; }
.guide-wrap { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.guide-head {
  --a: var(--accent, var(--brand));
  display: flex; align-items: center; gap: 14px; padding: 22px 22px 18px;
  background: radial-gradient(520px 160px at 0% 0%, color-mix(in srgb, var(--a) 16%, transparent), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.guide-titles { flex: 1; min-width: 0; }
.guide-eyebrow { font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: color-mix(in srgb, var(--a) 75%, var(--text)); }
.guide-titles h2 { font-size: 22px; font-weight: 720; letter-spacing: -0.02em; }
.guide-body { padding: 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.guide-purpose { font-size: 16.5px; line-height: 1.55; color: var(--text); }
.guide-how { display: flex; gap: 8px; align-items: flex-start; margin-top: -10px; font-size: 14px; color: var(--text-2); }
.guide-how .icon { margin-top: 3px; color: var(--text-3); }
.guide-sec h3 { margin-bottom: 10px; font-size: 12px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.guide-outcomes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 8px 16px; }
.guide-outcomes li { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2); }
.guide-outcomes .chip { flex: none; }
.guide-classes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.guide-classes li {
  padding: 10px 12px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--border); border-left: 3px solid var(--tone);
}
.guide-class-top { display: flex; align-items: center; gap: 6px; }
.guide-class-top .chip-dot { background: var(--tone); }
.guide-class-top strong { font-size: 13.5px; flex: 1; min-width: 0; }
.guide-class-verdict { flex: none; font-size: 11px; font-weight: 650; color: var(--tone-fg); background: var(--tone-bg); border: 1px solid var(--tone-bd); padding: 1px 7px; border-radius: 999px; }
.guide-classes p { margin-top: 3px; font-size: 12.5px; color: var(--text-3); }
.guide-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.guide-do, .guide-dont { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 14px; color: var(--text-2); }
.guide-do li, .guide-dont li { display: flex; align-items: flex-start; gap: 8px; }
.guide-do .icon { color: var(--ok); margin-top: 3px; }
.guide-dont .icon { color: var(--danger); margin-top: 3px; }
.guide-privacy { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--sunken); font-size: 13px; color: var(--text-2); }
.guide-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--border); }

/* ---- admin details at the bottom of the app page */
.admin-details { margin-top: 28px; padding: 0; border-style: dashed; box-shadow: none; background: transparent; }
.admin-details summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; list-style: none; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.admin-details summary::-webkit-details-marker { display: none; }
.admin-details summary .muted { font-weight: 500; font-size: 12.5px; }
.admin-chev { margin-left: auto; transition: transform var(--t); }
.admin-details[open] .admin-chev { transform: rotate(180deg); }
.admin-details .kv { padding: 0 16px 12px; }
.admin-details .kv a { display: inline-flex; align-items: center; gap: 4px; margin-right: 12px; }
.admin-details > .btn { margin: 0 16px 16px; }

/* ---- settings: sidebar with scroll-spy (desktop), tab row (phones) */
.settings-page { gap: 22px; }
.settings-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.shell-nav { position: sticky; top: 84px; }
.shell-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.shell-link {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--text-2); font-size: 14px; font-weight: 550; text-align: left; cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast);
}
.shell-link .icon { color: var(--text-3); }
.shell-link:hover { background: var(--sunken); color: var(--text); }
.shell-link.is-active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.shell-link.is-active .icon { color: var(--brand); }
.shell-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.shell-main .panel { padding: 24px; }
.shell-main .panel-top { padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }

@media (max-width: 960px) {
  .app-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-shell { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .shell-nav {
    top: 56px; z-index: 20; margin: 0 calc(var(--gutter) * -1); padding: 8px var(--gutter);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
    overflow-x: auto; scrollbar-width: none;
  }
  .shell-nav::-webkit-scrollbar { display: none; }
  .shell-nav ul { flex-direction: row; gap: 6px; }
  .shell-link { width: auto; height: 34px; white-space: nowrap; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); }
  .panel { scroll-margin-top: 120px; }
}
@media (max-width: 640px) {
  .hero { padding: 30px 0 22px; }
  .app-hero-side { align-items: center; }
  .app-layout { gap: 18px; }
  .samples { padding: 14px; }
  .sample-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sample-group { padding: 10px; }
  .sample-thumbs { grid-template-columns: 1fr; }
  .sample-thumbs .sample:nth-child(n+2) { display: none; }
  .sample-desc { min-height: 0; }
  .samples-head { flex-direction: column; }
  .job-tools { margin-left: 0; }
  .job.collapsed .job-head { flex-wrap: wrap; }
  .job.collapsed .job-summary { order: 3; flex-basis: 100%; padding-left: 30px; }
  .is-list .item { gap: 10px; padding: 8px; }
  .is-list .item-media { width: 44px; height: 44px; }
  .is-list .item-main { flex-wrap: wrap; row-gap: 3px; }
  .is-list .item-headline { max-width: none; flex: 1 1 100%; min-width: 0; }
  .is-list .item-summary { display: none; }
  .is-list .item-score-track { flex: 1 1 auto; }
  .is-list .item-score-text { flex: none; max-width: 60%; }
  .is-list .fb-mini { flex: none; width: 32px; height: 30px; }
  .is-list .fb-mini-label { display: none; }
  .is-list .item-fb-btns { flex: none; }
  .is-list .fb-badge { max-width: 92px; }
  .guide-lists { grid-template-columns: 1fr; }
  .guide-head { padding: 18px 16px 14px; }
  .guide-body { padding: 16px; }
  .guide-foot { padding: 12px 16px 16px; }
  .shell-main .panel { padding: 16px 14px; }
  .app-card-media { height: 108px; }
}

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

/* ------------------------------------------------------------------ tones (keep last) */

.tone-danger, [data-tone="danger"] { --tone: var(--danger); --tone-fg: var(--danger-fg); --tone-bg: var(--danger-bg); --tone-bd: var(--danger-bd); }
.tone-warn, [data-tone="warn"] { --tone: var(--warn); --tone-fg: var(--warn-fg); --tone-bg: var(--warn-bg); --tone-bd: var(--warn-bd); }
.tone-ok, [data-tone="ok"] { --tone: var(--ok); --tone-fg: var(--ok-fg); --tone-bg: var(--ok-bg); --tone-bd: var(--ok-bd); }
.tone-info, [data-tone="info"] { --tone: var(--info); --tone-fg: var(--info-fg); --tone-bg: var(--info-bg); --tone-bd: var(--info-bd); }
.tone-neutral, [data-tone="neutral"] { --tone: var(--neutral); --tone-fg: var(--neutral-fg); --tone-bg: var(--neutral-bg); --tone-bd: var(--neutral-bd); }
