/* ============================================================
   AIGC Research Hub — Component Library
   All pages use ONLY these classes. Do not invent new visual
   styles on pages; compose from these.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; display: block; }
/* Author `display` (flex/grid) outranks the UA sheet's [hidden] rule, so any
   component we toggle with .hidden needs this to actually disappear. */
[hidden] { display: none !important; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
button { font-family: inherit; }
::selection { background: var(--primary-soft); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-sm); }

/* Subtle scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- Icons ---------- */
.ic { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none;
      stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 30px; height: 30px; }

/* ============================================================
   APP SHELL  (sidebar + topbar + main)
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ----- Sidebar ----- */
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 14px; font-weight: 800; font-size: var(--fs-md);
  letter-spacing: .2px;
}
.sidebar-logo .logo-mark {
  width: 34px; height: 34px; border-radius: var(--r-md);
  background: var(--primary); color: var(--on-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; flex: 0 0 auto;
}
.sidebar-logo small { display: block; font-weight: 500; color: var(--text-3); font-size: var(--fs-xs); }
.nav { padding: 6px 12px 24px; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  margin: 16px 10px 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: var(--text-3);
}

/* Collapsible nav groups (sidebar) */
.nav-group { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: var(--fs-sm); font-weight: 800;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-2);
  border-radius: var(--r-md); text-align: left;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-group-head:hover { background: var(--gray-soft); color: var(--text); }
.nav-group-head .chev {
  margin-left: auto; color: var(--text-3);
  transition: transform var(--dur) var(--ease);
}
.nav-group:not(.open) .nav-group-head .chev { transform: rotate(-90deg); }
.nav-group-items {
  display: grid; grid-template-rows: 1fr;
  transition: grid-template-rows .2s var(--ease);
}
.nav-group:not(.open) .nav-group-items { grid-template-rows: 0fr; }
.nav-group-items > .nav-group-inner {
  overflow: hidden; display: flex; flex-direction: column; gap: 2px; min-height: 0;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-md);
  color: var(--text-2); font-weight: 500; font-size: var(--fs-base);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item:hover { background: var(--gray-soft); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 700; }
.nav-item .ic { width: 19px; height: 19px; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--r-full); background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ----- Main column ----- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ----- Topbar ----- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--page-x);
  position: sticky; top: 0; z-index: 30;
}
.topbar-search {
  flex: 1; max-width: 560px; position: relative;
}
.topbar-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar-search input {
  width: 100%; height: 38px; padding: 0 14px 0 40px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); color: var(--text); font-size: var(--fs-base);
}
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); outline: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative;
  transition: background var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--gray-soft); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--surface);
}
.lang-btn {
  height: 38px; padding: 0 12px; display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: transparent; color: var(--text-2); font-weight: 700; font-size: var(--fs-sm);
  cursor: pointer;
}
.lang-btn:hover { background: var(--gray-soft); color: var(--text); }
.topbar .avatar { cursor: pointer; }
.hamburger { display: none; }

/* ----- Page container (Rule 17: 5% / 90% / 5%) ----- */
.page { padding: var(--sp-7) var(--page-x) var(--sp-9); }

/* Page header — Rule 1: the title must be unmistakable */
.page-head {
  display: flex; align-items: flex-start; gap: var(--sp-5); flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}
.page-head .grow { flex: 1; min-width: 240px; }
.page-title {
  font-size: var(--fs-3xl); font-weight: 800;
  letter-spacing: -.8px; line-height: 1.12; color: var(--text);
}
.page-sub { color: var(--text-2); margin-top: var(--sp-2); font-size: var(--fs-md); line-height: 1.5; }
.page-actions { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }

.breadcrumbs {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); margin-bottom: var(--sp-3);
}
.breadcrumbs a { color: var(--text-3); }
.breadcrumbs a:hover { color: var(--primary-text); }
.breadcrumbs .sep { opacity: .5; }

/* Section headings — clear second level under the page title */
.section-title { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.2px; display: flex; align-items: center; gap: var(--sp-2); }
.section-title .ic { color: var(--text-3); }
.section-head { display: flex; align-items: center; gap: var(--sp-3); margin: var(--gap-section) 0 var(--sp-4); }
.section-head:first-child { margin-top: 0; }
.section-head .link-more { margin-left: auto; font-size: var(--fs-sm); font-weight: 700; display: flex; align-items: center; gap: var(--sp-1); }

/* Optional eyebrow above a section title */
.eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-3); margin-bottom: var(--sp-2);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-md);
  font-size: var(--fs-base); font-weight: 600; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }

/* Filled buttons get a gradient body, a lit top edge and a coloured shadow
   so they read as physically raised (Rule 6 — the primary action pops). */
.btn-primary {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: var(--on-primary); font-weight: 700;
  box-shadow: var(--shadow-primary), var(--sheen-strong);
}
.btn-primary:hover { background: linear-gradient(180deg, var(--primary-hover) 0%, var(--primary) 100%); box-shadow: var(--elev-3), var(--sheen-strong); }
.btn-primary:active { box-shadow: var(--elev-1), inset 0 2px 4px rgba(0,0,0,.18); }

.btn-secondary {
  background: var(--surface-grad); border-color: var(--border-strong); color: var(--text);
  box-shadow: var(--elev-1), var(--sheen);
}
.btn-secondary:hover { background: var(--gray-soft); box-shadow: var(--elev-2), var(--sheen); }
.btn-secondary:active { box-shadow: inset 0 2px 4px rgba(0,0,0,.08); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-soft); color: var(--text); }

.btn-danger {
  background: linear-gradient(180deg, var(--danger) 0%, #b91c1c 100%); color: #fff; font-weight: 700;
  box-shadow: var(--shadow-danger), var(--sheen-strong);
}
.btn-danger:hover { filter: brightness(1.08); box-shadow: var(--elev-3), var(--sheen-strong); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger-text); font-weight: 700; box-shadow: var(--sheen); }
.btn-success {
  background: linear-gradient(180deg, var(--success) 0%, #15803d 100%); color: #fff; font-weight: 700;
  box-shadow: var(--shadow-success), var(--sheen-strong);
}
.btn-success:hover { filter: brightness(1.08); box-shadow: var(--elev-3), var(--sheen-strong); }

.btn-lg { height: 46px; padding: 0 24px; font-size: var(--fs-md); border-radius: var(--r-md); }
.btn-sm { height: 31px; padding: 0 11px; font-size: var(--fs-sm); border-radius: var(--r-sm); gap: 6px; }
.btn-sm .ic { width: 14px; height: 14px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* Inline loading spinner (Rule 7 — every async action shows it is working) */
.spinner {
  width: 14px; height: 14px; flex: 0 0 auto; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-block { width: 100%; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface-grad); border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--elev-1), var(--sheen);
}
.card-pad { padding: var(--card-pad); }
.card-head {
  padding: var(--sp-4) var(--card-pad); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-3);
}
.card-head .section-title { font-size: var(--fs-lg); }
.card-head .link-more { margin-left: auto; font-size: var(--fs-sm); font-weight: 700; display: flex; align-items: center; gap: var(--sp-1); }
.card-body { padding: var(--card-pad); }
.card-foot {
  padding: var(--sp-3) var(--card-pad); border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-3); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-hover {
  transition: box-shadow var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out),
              border-color var(--dur) var(--ease);
}
.card-hover:hover {
  box-shadow: var(--elev-3), var(--sheen);
  border-color: var(--border-strong);
  transform: translateY(-4px);
}
.card-hover:active { transform: translateY(-1px); box-shadow: var(--elev-2), var(--sheen); }
a.card { color: inherit; }
a.card:hover { text-decoration: none; }

/* Rule 11 — the ONE focal card on a screen carries extra weight */
.card-focal { border: 2px solid var(--border-focal); box-shadow: var(--elev-3), var(--sheen); }
/* Rule 3 — status-accented cards; the left bar carries the meaning */
.card-accent { border-left: 4px solid var(--border-strong); }
.card-accent.red { border-left-color: var(--danger); }
.card-accent.amber { border-left-color: var(--warn); }
.card-accent.green { border-left-color: var(--success); }
.card-accent.blue { border-left-color: var(--primary); }
.card-accent.purple { border-left-color: var(--purple); }

/* ----- KPI cards (Rule 15: numbers first, labels second, details third) ----- */
.kpi-label {
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-2);
  display: flex; align-items: center; gap: var(--sp-2);
  letter-spacing: .2px;
}
.kpi-label .ic { color: var(--text-3); }
.kpi-value {
  font-size: var(--fs-num); font-weight: 800;
  letter-spacing: -2.2px; line-height: 1; margin-top: var(--sp-3);
  font-variant-numeric: tabular-nums; color: var(--text);
}
.kpi-value small {
  font-size: var(--fs-lg); font-weight: 700; color: var(--text-3);
  letter-spacing: 0; margin-left: var(--sp-2);
}
.kpi-hint { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--sp-3); }
.kpi-trend {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-xs); font-weight: 800; padding: 3px 9px; border-radius: var(--r-full);
}
.kpi-trend .ic { width: 13px; height: 13px; }
.kpi-trend.up { color: var(--success-text); background: var(--success-soft); }
.kpi-trend.down { color: var(--danger-text); background: var(--danger-soft); }
.kpi-trend.flat { color: var(--gray-text); background: var(--gray-soft); }
/* Trend colour is never the only signal (Rule 3) — arrow + sign carry it too */

/* Primary hero KPI — the dominant insight (Rule 18) */
.kpi-primary {
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-strong) 100%);
  border: none; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--shadow-focal);
}
.kpi-primary::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: rgba(255, 255, 255, .07);
}
.kpi-primary > * { position: relative; z-index: 1; }
.kpi-primary .kpi-label { color: rgba(255,255,255,.88); }
.kpi-primary .kpi-label .ic { color: rgba(255,255,255,.7); }
.kpi-primary .kpi-value { font-size: var(--fs-num-lg); color: #fff; letter-spacing: -3px; }
.kpi-primary .kpi-value small { color: rgba(255,255,255,.75); }
.kpi-primary .kpi-hint { color: rgba(255,255,255,.78); }
.kpi-primary .kpi-trend { background: rgba(255,255,255,.2); color: #fff; }
.kpi-primary .spark > i { background: #fff; opacity: .3; }
.kpi-primary .spark > i.on { opacity: 1; }
.kpi-primary .btn-secondary {
  background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.34); color: #fff;
}
.kpi-primary .btn-secondary:hover { background: rgba(255,255,255,.26); }

/* Rule 18 — one dominant card + supporting grid */
.split-50 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: stretch; }
.kpi-grid-2x2 { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: var(--gap); }

/* ============================================================
   BADGES / STATUS / TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 700; white-space: nowrap;
}
.badge .ic { width: 12px; height: 12px; }
.badge.blue   { background: var(--primary-soft); color: var(--primary-text); }
.badge.green  { background: var(--success-soft); color: var(--success-text); }
.badge.red    { background: var(--danger-soft);  color: var(--danger-text); }
.badge.amber  { background: var(--warn-soft);    color: var(--warn-text); }
.badge.purple { background: var(--purple-soft);  color: var(--purple-text); }
.badge.gray   { background: var(--gray-soft);    color: var(--gray-text); }
.badge.solid-red   { background: var(--danger);  color: #fff; }
.badge.solid-green { background: var(--success); color: #fff; }
.badge.solid-blue  { background: var(--primary); color: #fff; }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

.badge-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600;
  background: var(--gray-soft); color: var(--text-2);
}
.tag:hover { color: var(--primary-text); text-decoration: none; }

.task-id { font-family: var(--font-mono); font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); letter-spacing: .3px; }

/* ============================================================
   AVATARS
   ============================================================ */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--primary);
  user-select: none;
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; }
.avatar.a2 { background: #0e9f6e; } .avatar.a3 { background: #d97706; }
.avatar.a4 { background: #7c3aed; } .avatar.a5 { background: #db2777; }
.avatar.a6 { background: #0891b2; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .p-name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.3; }
.person .p-sub { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.3; }

/* ============================================================
   PROGRESS
   ============================================================ */
.progress { height: 8px; border-radius: var(--r-full); background: var(--gray-soft); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--primary); }
.progress.green > i { background: var(--success); }
.progress.amber > i { background: var(--warn); }
.progress.red > i { background: var(--danger); }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress { flex: 1; }
.progress-row .pct { font-size: var(--fs-xs); font-weight: 700; color: var(--text-2); min-width: 34px; text-align: right; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }

/* Header: clearly a header — raised band with a real 2px baseline */
.table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px; color: var(--text-3);
  padding: var(--sp-3) var(--sp-5); border-bottom: 2px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-3) 100%);
  box-shadow: var(--sheen); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.table th:first-child { border-top-left-radius: var(--r-lg); }
.table th:last-child  { border-top-right-radius: var(--r-lg); }

/* Rows: room to breathe (Rule 16), and they lift under the cursor */
.table td {
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text-2);
}
.table tbody tr {
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.table tbody tr:hover {
  background: var(--surface-2);
  box-shadow: var(--elev-2);
  position: relative; z-index: 1;
}
.table tbody tr:last-child td { border-bottom: none; }
/* Zebra option for long, dense tables */
.table-zebra tbody tr:nth-child(even) { background: var(--surface-2); }
.table-zebra tbody tr:nth-child(even):hover { background: var(--surface-3); }

/* The scannable column — bold, dark, obviously the row's subject */
.table .row-title {
  font-weight: 700; color: var(--text); font-size: var(--fs-md);
  display: inline-block; line-height: 1.4;
}
.table .row-title:hover { color: var(--primary-text); text-decoration: none; }
.table .row-sub { display: block; margin-top: var(--sp-1); }

/* Numbers align and never wobble (Rule 15) */
.table .num {
  text-align: right; font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--text);
}
.table th.num { text-align: right; }

/* Attention rows carry a colour bar, not just coloured text (Rule 3) */
.table tr.row-alert td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.table tr.row-warn  td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.table tr.row-ok    td:first-child { box-shadow: inset 3px 0 0 var(--success); }

/* Compact variant for dense admin tables */
.table-compact th { padding: var(--sp-2) var(--sp-4); }
.table-compact td { padding: var(--sp-3) var(--sp-4); }
.table-compact .row-title { font-size: var(--fs-base); }

/* ============================================================
   TABS
   ============================================================ */
/* Section tabs — the active one is unmistakable: tinted body, heavier
   type, and a solid rail welded to the container edge (Rules 1/2/6). */
.tabs {
  display: flex; gap: var(--sp-1); border-bottom: 2px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 13px 20px; font-size: var(--fs-md); font-weight: 700;
  color: var(--text-3); cursor: pointer; white-space: nowrap;
  border: none; background: none; position: relative;
  margin-bottom: -2px; border-radius: var(--r-md) var(--r-md) 0 0;
  display: flex; align-items: center; gap: var(--sp-2);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tab:hover { color: var(--text); background: var(--gray-soft); }
.tab.active { color: var(--primary-text); background: var(--primary-soft); font-weight: 800; }
.tab.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: -2px; height: 3px;
  background: var(--primary); border-radius: var(--r-full);
  box-shadow: 0 -1px 6px rgba(37, 99, 235, .45);
  animation: tab-rail .28s var(--ease-out) both;
}
@keyframes tab-rail { from { transform: scaleX(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.tab .count {
  font-size: 11px; font-weight: 800; background: var(--gray-soft); color: var(--text-2);
  border-radius: var(--r-full); padding: 2px 8px;
}
.tab.active .count { background: var(--primary); color: #fff; }
/* a count that means "needs your attention", not just "how many" */
.tab .count.attn { background: var(--warn); color: #fff; }
.tab.active .count.attn { background: var(--warn); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: panel-in .34s var(--ease-out) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Segmented control — a recessed track with a raised, lit thumb */
.pills {
  display: inline-flex; gap: var(--sp-1);
  background: var(--bg-sunken); padding: 5px; border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 5px rgba(13, 21, 38, .07);
}
:root[data-theme="dark"] .pills { box-shadow: inset 0 2px 6px rgba(0, 0, 0, .45); }
.pill {
  height: 36px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-2);
  display: inline-flex; align-items: center; gap: var(--sp-2); white-space: nowrap;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.pill:hover { color: var(--text); }
.pill.active {
  background: var(--surface-grad); color: var(--primary-text); font-weight: 800;
  border-color: var(--border); box-shadow: var(--elev-2), var(--sheen);
  transform: translateY(-1px);
}
.pill.active .ic { color: var(--primary); }

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: var(--fs-sm); font-weight: 700; margin-bottom: 7px; }
.field label .req { color: var(--danger); margin-left: 3px; }
.field .help { font-size: var(--fs-xs); color: var(--text-3); margin-top: 6px; }
.field .error-msg { font-size: var(--fs-xs); color: var(--danger-text); margin-top: 6px; display: flex; align-items: center; gap: 5px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-base); font-family: inherit;
  padding: 0 13px; height: 40px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 104px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input.invalid, .textarea.invalid { border-color: var(--danger); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Radio-card group (beneficiary picker etc.) */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice-card {
  border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 13px 14px; cursor: pointer; background: var(--surface);
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: var(--fs-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.choice-card:hover { border-color: var(--border-strong); }
.choice-card.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.choice-card .ic { color: var(--text-3); }
.choice-card.selected .ic { color: var(--primary-text); }

/* Toggle switch */
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 auto; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .knob {
  position: absolute; inset: 0; border-radius: var(--r-full);
  background: var(--border-strong); transition: background var(--dur) var(--ease); cursor: pointer;
}
.switch .knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .knob { background: var(--primary); }
.switch input:checked + .knob::after { transform: translateX(18px); }

.check-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.check-row input[type="checkbox"], .check-row input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* Upload dropzone */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 34px 20px; text-align: center; color: var(--text-3); cursor: pointer;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.dropzone .ic-xl { margin: 0 auto 10px; }
.dropzone strong { color: var(--text); display: block; margin-bottom: 3px; }

/* File tile */
.file-tile {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
}
.file-tile .file-ic {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-text);
}
.file-tile .f-name { font-weight: 600; font-size: var(--fs-sm); }
.file-tile .f-meta { font-size: var(--fs-xs); color: var(--text-3); }
.file-tile .grow { min-width: 0; flex: 1; }

/* ============================================================
   ALERTS / BANNERS
   ============================================================ */
.alert {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r-md);
  font-size: var(--fs-sm); border: 1px solid transparent; align-items: flex-start;
}
.alert .ic { margin-top: 1px; }
.alert strong { display: block; margin-bottom: 2px; font-size: var(--fs-base); }
.alert.info    { background: var(--primary-soft); color: var(--primary-text); }
.alert.success { background: var(--success-soft); color: var(--success-text); }
.alert.warn    { background: var(--warn-soft);    color: var(--warn-text); }
.alert.danger  { background: var(--danger-soft);  color: var(--danger-text); }

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 24px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: -30px; top: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center; color: var(--text-3);
}
.tl-dot .ic { width: 10px; height: 10px; }
.tl-dot.blue  { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.tl-dot.green { border-color: var(--success); color: var(--success); background: var(--success-soft); }
.tl-dot.red   { border-color: var(--danger);  color: var(--danger);  background: var(--danger-soft); }
.tl-dot.amber { border-color: var(--warn);    color: var(--warn);    background: var(--warn-soft); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-title { font-weight: 700; font-size: var(--fs-base); }
.tl-time { font-size: var(--fs-xs); color: var(--text-3); margin-left: auto; white-space: nowrap; }
.tl-body { color: var(--text-2); font-size: var(--fs-sm); margin-top: 4px; }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kb-col { flex: 0 0 292px; background: var(--bg-sunken); border-radius: var(--r-lg); padding: 12px; }
.kb-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 700; font-size: var(--fs-sm); }
.kb-col-head .count { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-weight: 700; background: var(--surface); border-radius: var(--r-full); padding: 2px 9px; }
.kb-cards { display: flex; flex-direction: column; gap: 10px; min-height: 40px; }
.kb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 14px; cursor: grab; box-shadow: var(--shadow-sm); display: block; color: inherit;
}
.kb-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); text-decoration: none; }
.kb-card.overdue { border-left: 3px solid var(--danger); }
.kb-title { font-weight: 700; font-size: var(--fs-sm); line-height: 1.4; margin: 6px 0 10px; color: var(--text); }
.kb-foot { display: flex; align-items: center; gap: 8px; }
.kb-foot .due { font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; gap: 4px; margin-left: auto; }
.kb-foot .due.red { color: var(--danger-text); font-weight: 700; }

/* ============================================================
   WORKFLOW STEPPER
   ============================================================ */
.steps { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 0; }
.step { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.step .s-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 800;
  background: var(--gray-soft); color: var(--text-3); border: 2px solid transparent;
}
.step.done .s-dot { background: var(--success); color: #fff; }
.step.current .s-dot { background: var(--surface); border-color: var(--primary); color: var(--primary-text); box-shadow: var(--focus-ring); }
.step .s-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-3); }
.step.done .s-label { color: var(--text-2); }
.step.current .s-label { color: var(--primary-text); font-weight: 800; }
.step-line { flex: 1; min-width: 26px; height: 2px; background: var(--border); margin: 0 10px; }
.step-line.done { background: var(--success); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay); z-index: 90;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 88vh; display: flex; flex-direction: column;
  border: 1px solid var(--border);
}
.modal.wide { max-width: 760px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { font-size: var(--fs-lg); font-weight: 800; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-zone { position: fixed; bottom: 24px; right: 24px; z-index: 120; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: var(--r-md); padding: 13px 18px; box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); font-weight: 600; min-width: 260px; max-width: 380px;
  animation: toast-in .25s var(--ease);
}
.toast.success { border-left-color: var(--success); }
.toast.success .ic { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.warn .ic { color: var(--warn); }
.toast.error .ic { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dd { position: relative; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; display: none;
}
.dd.open .dd-menu { display: block; }
.dd-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-2); background: none; border: none; cursor: pointer; text-align: left;
}
.dd-item:hover { background: var(--gray-soft); color: var(--text); text-decoration: none; }
.dd-item.danger { color: var(--danger-text); }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-label {
  padding: 8px 12px 4px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: var(--text-3);
}
.dd-item .check { margin-left: auto; color: var(--success); }

/* Role-based visibility (account view-as switch) */
[data-role="user"] .role-admin { display: none !important; }
[data-role="admin"] .role-user { display: none !important; }

/* ============================================================
   EMPTY / SKELETON STATES
   ============================================================ */
.empty {
  text-align: center; padding: 52px 24px; color: var(--text-3);
}
.empty .empty-ic {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: var(--r-lg);
  background: var(--gray-soft); display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.empty h4 { color: var(--text); font-size: var(--fs-lg); font-weight: 800; margin-bottom: 6px; }
.empty p { font-size: var(--fs-sm); max-width: 360px; margin: 0 auto 18px; }

.skeleton {
  border-radius: var(--r-sm); background: var(--gray-soft);
  position: relative; overflow: hidden;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 1.4s infinite;
}
:root[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ============================================================
   COMMENTS / NOTIFICATIONS
   ============================================================ */
.comment { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: none; }
.comment .c-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.comment .c-name { font-weight: 700; font-size: var(--fs-sm); }
.comment .c-time { font-size: var(--fs-xs); color: var(--text-3); }
.comment .c-body { font-size: var(--fs-sm); color: var(--text-2); margin-top: 4px; }
.comment .c-body .mention { color: var(--primary-text); font-weight: 700; }
.comment .c-actions { display: flex; gap: 14px; margin-top: 8px; }
.comment .c-actions a { font-size: var(--fs-xs); font-weight: 700; color: var(--text-3); }
.comment .c-actions a:hover { color: var(--primary-text); }
.comment .replies { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--border); }

.notif {
  display: flex; gap: 13px; padding: 15px 18px; border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease); position: relative;
}
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--primary-soft); }
.notif.unread::before {
  content: ""; position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
}
.notif .n-ic {
  width: 38px; height: 38px; border-radius: var(--r-md); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.notif .n-ic.blue  { background: var(--primary-soft); color: var(--primary-text); }
.notif .n-ic.green { background: var(--success-soft); color: var(--success-text); }
.notif .n-ic.red   { background: var(--danger-soft);  color: var(--danger-text); }
.notif .n-ic.amber { background: var(--warn-soft);    color: var(--warn-text); }
.notif .n-ic.purple { background: var(--purple-soft); color: var(--purple-text); }
.notif .n-title { font-weight: 700; font-size: var(--fs-sm); }
.notif .n-body { font-size: var(--fs-sm); color: var(--text-2); margin-top: 2px; }
.notif .n-time { font-size: var(--fs-xs); color: var(--text-3); margin-left: auto; white-space: nowrap; }

/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--border); border: none; margin: 20px 0; }

.stat-inline { display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.stat-inline .ic { width: 14px; height: 14px; }

/* ============================================================
   ARTWORK  (inline SVG illustrations — see assets/art.js)
   Every news / library item shows a real, subject-specific
   picture rather than a bare icon.
   ============================================================ */
.cover {
  aspect-ratio: 16 / 9; border-radius: var(--r-lg) var(--r-lg) 0 0; position: relative;
  display: flex; align-items: center; justify-content: center; color: #fff;
  overflow: hidden; background: var(--surface-3);
}
.cover .ic { width: 42px; height: 42px; opacity: .9; }
.cover .art-svg,
.thumb .art-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cover > *:not(.art-svg) { position: relative; z-index: 1; }
.cover .cover-badge { position: absolute; top: var(--sp-3); left: var(--sp-3); z-index: 2; }
.cover .cover-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: var(--sp-5) var(--sp-4) var(--sp-3);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .55));
  color: #fff; font-size: var(--fs-sm); font-weight: 700;
}
/* Legacy gradient fallbacks (kept so older markup still renders) */
.cover.g1 { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.cover.g2 { background: linear-gradient(135deg, #0e9f6e, #0891b2); }
.cover.g3 { background: linear-gradient(135deg, #d97706, #db2777); }
.cover.g4 { background: linear-gradient(135deg, #334155, #64748b); }
.cover.g5 { background: linear-gradient(135deg, #7c3aed, #db2777); }
.cover.g6 { background: linear-gradient(135deg, #0891b2, #2563eb); }

/* Standalone artwork frame — list thumbnails, hero images */
.thumb {
  position: relative; overflow: hidden; border-radius: var(--r-md);
  background: var(--surface-3); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.thumb.wide { aspect-ratio: 16 / 9; width: 100%; }
.thumb.list { width: 200px; align-self: stretch; border-radius: 0; }
.thumb.sq { aspect-ratio: 1 / 1; width: 68px; border-radius: var(--r-md); }
.thumb.hero { aspect-ratio: 21 / 9; width: 100%; border-radius: var(--r-lg); }
.thumb .thumb-badge { position: absolute; top: var(--sp-2); left: var(--sp-2); z-index: 2; }
.thumb .thumb-dur {
  position: absolute; right: var(--sp-2); bottom: var(--sp-2); z-index: 2;
  background: rgba(0, 0, 0, .68); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--r-sm);
}
a.thumb:hover .art-svg { transform: scale(1.04); }
.thumb .art-svg { transition: transform var(--dur-slow) var(--ease); }

/* ============================================================
   JHD-5 COMPONENTS
   Light touches only — presence, not weight (see CLAUDE.md:
   "JHD-5 Must Not Become Feature Stuffing")
   ============================================================ */

/* Growth — a trend that reads without relying on colour alone */
.trend {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  font-size: var(--fs-xs); font-weight: 800; padding: 3px 9px;
  border-radius: var(--r-full); white-space: nowrap;
}
.trend .ic { width: 13px; height: 13px; }
.trend.up   { color: var(--success-text); background: var(--success-soft); }
.trend.down { color: var(--danger-text);  background: var(--danger-soft); }
.trend.flat { color: var(--gray-text);    background: var(--gray-soft); }

/* Growth — tiny inline bar chart, no library needed */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark > i {
  display: block; width: 7px; border-radius: 2px 2px 0 0;
  background: var(--primary); opacity: .35;
}
.spark > i.on { opacity: 1; }
.spark.green > i { background: var(--success); }

/* Emotion — reserved for moments that genuinely deserve it */
.celebrate {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-5); border-radius: var(--r-lg);
  background: var(--success-soft); border: 1px solid var(--success);
}
.celebrate .cel-ic {
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto;
  background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.celebrate strong { display: block; font-size: var(--fs-lg); color: var(--success-text); }
.celebrate span { font-size: var(--fs-sm); color: var(--text-2); }

/* Connection — marks content that belongs to the current user */
.mine {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--fs-xs); font-weight: 800; padding: 2px 9px;
  border-radius: var(--r-full); background: var(--purple-soft); color: var(--purple-text);
}

/* Growth — milestone / streak marker */
.milestone {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 700; color: var(--text-2);
}
.milestone .ic { color: var(--warn); }

/* Freedom — AI suggests, the human decides (CLAUDE.md Rule 25) */
.ai-card {
  border: 1px dashed var(--purple); background: var(--purple-soft);
  border-radius: var(--r-lg); padding: var(--sp-5);
}
.ai-card .ai-head {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 800; color: var(--purple-text);
  margin-bottom: var(--sp-3);
}
.ai-card .ai-why {
  margin-left: auto; font-size: var(--fs-xs); font-weight: 700;
  color: var(--purple-text); text-decoration: underline; cursor: pointer;
  background: none; border: none; font-family: inherit;
}
.ai-card .ai-body { font-size: var(--fs-base); color: var(--text); }
.ai-card .ai-reason {
  font-size: var(--fs-sm); color: var(--text-2); margin-top: var(--sp-2);
  padding-left: var(--sp-3); border-left: 2px solid var(--purple);
}
.ai-card .ai-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); flex-wrap: wrap; }

/* Confidence meter for AI output */
.confidence { display: flex; align-items: center; gap: var(--sp-2); }
.confidence .bars { display: flex; gap: 3px; }
.confidence .bars > i { width: 18px; height: 6px; border-radius: 3px; background: var(--gray-soft); display: block; }
.confidence .bars > i.on { background: var(--purple); }
.confidence .val { font-size: var(--fs-xs); font-weight: 800; color: var(--purple-text); }

/* ============================================================
   MOTION
   Content rises into place, numbers count up, bars grow. Driven
   by assets/motion.js — the `.motion` class is only present when
   that script runs, so everything is fully visible without JS.
   ============================================================ */
.motion [data-reveal] {
  opacity: 0;
  transform: translateY(18px) scale(.99);
  will-change: opacity, transform;
}
.motion [data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* Table rows arrive one after another */
.motion tr[data-reveal] { transform: translateY(10px); }

/* Bars and meters grow from their baseline */
.motion .progress > i { transform-origin: left center; }
.motion [data-grow-x] { transform: scaleX(0); }
.motion [data-grow-x].in {
  transform: scaleX(1);
  transition: transform .85s var(--ease-out) var(--reveal-delay, 0ms);
}
.motion .spark > i { transform-origin: bottom center; }
.motion [data-grow-y] { transform: scaleY(0); }
.motion [data-grow-y].in {
  transform: scaleY(1);
  transition: transform .7s var(--ease-spring) var(--reveal-delay, 0ms);
}

/* Numbers land with a slight pop once counting finishes */
.motion .counting { font-variant-numeric: tabular-nums; }
@keyframes num-pop { 0% { transform: scale(1); } 45% { transform: scale(1.045); } 100% { transform: scale(1); } }
.motion .counted { animation: num-pop .34s var(--ease-spring); }

/* SVG artwork fades up with its card */
.motion [data-reveal] .art-svg { opacity: 0; transition: opacity .5s var(--ease-out) .1s; }
.motion [data-reveal].in .art-svg { opacity: 1; }

/* Toasts already animate; keep modals consistent */
.modal-backdrop.open .modal { animation: modal-in .28s var(--ease-out) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

/* Anyone who asks for less motion gets none of it */
@media (prefers-reduced-motion: reduce) {
  .motion [data-reveal],
  .motion [data-grow-x],
  .motion [data-grow-y] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .modal-backdrop.open .modal,
  .tab-panel.active,
  .tab.active::after { animation: none; }
  .motion .counted { animation: none; }
  .tg-pop { animation: none; }
  .spinner { animation: none; border-right-color: currentColor; opacity: .5; }
  .live-dot::after { animation: none; opacity: 0; }
  .lk-wait i { animation: none; opacity: .6; }
}

/* ============================================================
   DEPTH PASS
   Raised things catch light on top and cast a shadow below;
   things you type into are recessed. Applied last so it layers
   cleanly over the component definitions above.
   ============================================================ */

/* Recessed inputs */
.input, .select, .textarea, .topbar-search input {
  box-shadow: inset 0 2px 4px rgba(13, 21, 38, .05);
}
:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea,
:root[data-theme="dark"] .topbar-search input {
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .35);
}
.input:focus, .select:focus, .textarea:focus, .topbar-search input:focus {
  box-shadow: var(--focus-ring), inset 0 2px 4px rgba(13, 21, 38, .04);
}

/* Raised chrome */
.badge { box-shadow: var(--sheen); }
.badge.solid-red, .badge.solid-green, .badge.solid-blue { box-shadow: var(--sheen-strong), var(--elev-1); }
.avatar { box-shadow: var(--elev-1), var(--sheen-strong); }
.qa-ic, .empty-ic, .n-ic, .file-ic, .cel-ic { box-shadow: var(--sheen), var(--elev-1); }
.tag { box-shadow: var(--sheen); }

.sidebar { box-shadow: 1px 0 0 var(--border), 4px 0 16px rgba(13, 21, 38, .04); }
:root[data-theme="dark"] .sidebar { box-shadow: 1px 0 0 var(--border), 6px 0 22px rgba(0, 0, 0, .4); }
.topbar { box-shadow: 0 1px 0 var(--border), 0 4px 14px rgba(13, 21, 38, .05); }
:root[data-theme="dark"] .topbar { box-shadow: 0 1px 0 var(--border), 0 6px 20px rgba(0, 0, 0, .4); }
.nav-item.active { box-shadow: var(--sheen), var(--elev-1); }

.modal { box-shadow: var(--elev-4), var(--sheen); }
.dd-menu { box-shadow: var(--elev-3), var(--sheen); }
.toast { box-shadow: var(--elev-3), var(--sheen); }
.filter-bar { background: var(--surface-grad); box-shadow: var(--elev-1), var(--sheen); }
.kb-col { box-shadow: inset 0 2px 6px rgba(13, 21, 38, .05); }
:root[data-theme="dark"] .kb-col { box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35); }
.kb-card {
  background: var(--surface-grad); box-shadow: var(--elev-1), var(--sheen);
  transition: box-shadow var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.kb-card:hover { box-shadow: var(--elev-3), var(--sheen); transform: translateY(-3px); }

.search-hero input { box-shadow: var(--elev-2), inset 0 2px 4px rgba(13, 21, 38, .04); }
.search-hero input:focus { box-shadow: var(--focus-ring), var(--elev-3); }

.prompt-block { box-shadow: inset 0 2px 6px rgba(13, 21, 38, .06); }
:root[data-theme="dark"] .prompt-block { box-shadow: inset 0 2px 8px rgba(0, 0, 0, .4); }
.progress { box-shadow: inset 0 1px 3px rgba(13, 21, 38, .12); }
.progress > i { box-shadow: var(--sheen-strong); }
.cover, .thumb { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }

/* Alerts read as raised notices, not flat blocks */
.alert { box-shadow: var(--elev-1), var(--sheen); }
.celebrate { box-shadow: var(--elev-2), var(--sheen); }
.ai-card { box-shadow: var(--elev-1); }

/* Steppers */
.step .s-dot { box-shadow: var(--elev-1), var(--sheen-strong); }
.step.done .s-dot { box-shadow: var(--shadow-success), var(--sheen-strong); }

/* Timeline dots sit above the rail */
.tl-dot { box-shadow: var(--elev-1); }

.video-thumb { position: relative; border-radius: var(--r-md); overflow: hidden; }
.video-thumb .play-btn {
  position: absolute; inset: 0; margin: auto; width: 54px; height: 54px;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.video-thumb .duration {
  position: absolute; bottom: 8px; right: 8px; background: rgba(0,0,0,.7); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-sm);
}

.prompt-block {
  background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 15px 16px; font-family: var(--font-mono); font-size: var(--fs-sm);
  white-space: pre-wrap; word-break: break-word; position: relative; color: var(--text-2);
  line-height: 1.6;
}
.prompt-block .copy-btn { position: absolute; top: 9px; right: 9px; }

.kv { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 9px 20px; font-size: var(--fs-sm); }
.kv dt { color: var(--text-3); font-weight: 600; }
.kv dd { margin: 0; color: var(--text); font-weight: 500; }

.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 26px; }
.pg-btn {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pg-btn:hover { border-color: var(--border-strong); color: var(--text); }
.pg-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 800; }
.pg-btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Filter bar */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); margin-bottom: 18px;
}
.filter-bar .select, .filter-bar .input { width: auto; min-width: 130px; height: 35px; font-size: var(--fs-sm); }
.filter-bar .spacer { flex: 1; }

/* Search hero (dashboard) */
.search-hero { max-width: 780px; margin: 0 auto; }
.search-hero .search-box { position: relative; }
.search-hero .search-box .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 22px; height: 22px; }
.search-hero input {
  width: 100%; height: 58px; padding: 0 130px 0 52px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text); font-size: var(--fs-lg);
  box-shadow: var(--shadow-md);
}
.search-hero input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.search-hero .btn { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }

/* Utility */
.row { display: flex; align-items: center; gap: 12px; }
.row-top { display: flex; align-items: flex-start; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
.center { text-align: center; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xsmall { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.text-success { color: var(--success-text); }
.text-danger { color: var(--danger-text); }
.text-warn { color: var(--warn-text); }
.text-primary { color: var(--primary-text); }

.grid { display: grid; gap: 20px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }

.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }

/* ============================================================
   AUTH LAYOUT (login / reset / invite)
   ============================================================ */
.auth-wrap { min-height: 100vh; display: flex; }
.auth-side {
  flex: 1; background: linear-gradient(160deg, #1e3a8a, #2563eb 55%, #7c3aed);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side h2 { font-size: var(--fs-3xl); font-weight: 800; line-height: 1.25; max-width: 420px; }
.auth-side .points { display: flex; flex-direction: column; gap: 18px; }
.auth-side .point { display: flex; gap: 13px; align-items: flex-start; max-width: 400px; }
.auth-side .point .p-ic {
  width: 38px; height: 38px; border-radius: var(--r-md); flex: 0 0 auto;
  background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center;
}
.auth-side .point b { display: block; font-size: var(--fs-md); }
.auth-side .point span { font-size: var(--fs-sm); opacity: .82; }
.auth-form-col {
  width: 480px; flex: 0 0 480px; background: var(--surface);
  display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; position: relative;
}
.auth-form-col .corner-actions { position: absolute; top: 20px; right: 22px; display: flex; gap: 6px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .split-50 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .22s var(--ease); box-shadow: var(--shadow-lg);
  }
  .app.sidebar-open .sidebar { transform: none; }
  .hamburger { display: flex; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: var(--overlay); z-index: 35;
  }
  .app.sidebar-open .sidebar-backdrop { display: block; }
  :root { --page-x: 4%; }
  .cols-3 { grid-template-columns: repeat(2, 1fr); }
  .auth-side { display: none; }
  .auth-form-col { width: 100%; flex: 1; }
}
@media (max-width: 720px) {
  :root { --page-x: 16px; }
  .cols-2, .cols-3, .cols-4, .form-row, .form-row-3, .kpi-grid-2x2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .page-title { font-size: var(--fs-2xl); }
  .topbar-search { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .hide-mobile { display: none !important; }
}

/* ============================================================
   SEARCH SUGGESTIONS  (assets/suggest.js)
   Typing shows grouped, related matches so people never have to
   guess what the system knows about (Rule 7 / Rule 21).
   ============================================================ */
.search-box { position: relative; }
.search-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 70;
  background: var(--surface-grad); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--elev-4), var(--sheen);
  padding: var(--sp-2); max-height: 460px; overflow-y: auto; display: none;
  text-align: left;
}
.search-suggest.open { display: block; animation: panel-in .18s var(--ease-out) both; }
.sg-group {
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  font-size: 11px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase;
  color: var(--text-3);
}
.sg-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md);
  cursor: pointer; color: inherit; text-decoration: none;
}
.sg-item:hover, .sg-item.cursor { background: var(--primary-soft); text-decoration: none; }
.sg-ic {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-soft); color: var(--text-2); box-shadow: var(--sheen);
}
.sg-item:hover .sg-ic, .sg-item.cursor .sg-ic { background: var(--primary); color: #fff; }
.sg-main { min-width: 0; flex: 1; }
.sg-title {
  font-size: var(--fs-base); font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sg-title mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 2px; font-weight: 800; }
.sg-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }
.sg-meta { margin-left: auto; flex: 0 0 auto; }
.sg-foot {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3); margin-top: var(--sp-1);
  border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3);
}
.sg-foot kbd {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  background: var(--gray-soft); border: 1px solid var(--border-strong);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--text-2);
}
.sg-empty { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--text-3); font-size: var(--fs-sm); }

/* topbar variant sits tighter */
.topbar-search { position: relative; }
.topbar-search .search-suggest { top: calc(100% + 6px); }

/* Completion checklist rows (single-page forms) */
.ck-rows { display: flex; flex-direction: column; gap: var(--sp-2); }
.ck-row {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--text-3);
}
.ck-row .ic { color: var(--text-3); flex: 0 0 auto; }
.ck-row.done { color: var(--success-text); }
.ck-row.done .ic { color: var(--success); }

/* Type quick-chips: an obvious selected state (Rule 2/6) */
.tag[data-chip] { cursor: pointer; }
.tag[data-chip].active {
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow-primary), var(--sheen-strong);
}
.tag[data-chip].active .muted { color: rgba(255, 255, 255, .82); }

/* ============================================================
   TELEGRAM CONNECT — QR linking + live connection state
   Shared by telegram-connect.html and admin-telegram.html so the
   scan affordance looks identical everywhere (Rule 13).
   ============================================================ */

/* --- the scannable plate ------------------------------------ */
.qr-plate {
  position: relative; align-self: center;
  width: 100%; max-width: 258px; aspect-ratio: 1 / 1;
  padding: 16px; border-radius: var(--r-lg);
  background: #fff;
  box-shadow: var(--elev-3), inset 0 0 0 1px rgba(13, 21, 38, .1);
}
.qr-plate.sm { max-width: 178px; padding: 12px; }
.qr-svg { display: block; width: 100%; height: 100%; }
.qr-fail { display: flex; align-items: center; justify-content: center; height: 100%; color: #94a3b8; font-size: var(--fs-sm); }

/* corner brackets — reads as "aim your camera here" */
.qr-plate::before,
.qr-plate::after {
  content: ""; position: absolute; width: 26px; height: 26px; pointer-events: none;
  border: 3px solid var(--primary); border-radius: 4px;
}
.qr-plate::before { top: -5px; left: -5px; border-right: 0; border-bottom: 0; }
.qr-plate::after { bottom: -5px; right: -5px; border-left: 0; border-top: 0; }

/* expired / superseded overlay */
.qr-plate .qr-shade {
  position: absolute; inset: 0; border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(3px);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); text-align: center; padding: var(--sp-4); color: #0d1526;
}
.qr-plate.expired .qr-shade { display: flex; }
.qr-plate.expired::before, .qr-plate.expired::after { border-color: var(--warn); }

/* --- live indicator ----------------------------------------- */
.live-dot {
  position: relative; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  background: var(--success);
}
.live-dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--success); opacity: .7;
  animation: livePulse 1.8s var(--ease-out) infinite;
}
.live-dot.amber { background: var(--warn); }
.live-dot.amber::after { border-color: var(--warn); }
.live-dot.grey { background: var(--text-3); }
.live-dot.grey::after { animation: none; opacity: 0; }
@keyframes livePulse {
  0%   { transform: scale(.7); opacity: .8; }
  70%  { transform: scale(1.7); opacity: 0; }
  100% { transform: scale(1.7); opacity: 0; }
}

/* --- vertical live step tracker ------------------------------ */
.lk-steps { display: flex; flex-direction: column; gap: 0; }
.lk-step { position: relative; display: flex; gap: var(--sp-4); padding-bottom: var(--sp-5); }
.lk-step:last-child { padding-bottom: 0; }
.lk-step::before {
  content: ""; position: absolute; left: 13px; top: 28px; bottom: 4px;
  width: 2px; background: var(--border); border-radius: 2px;
}
.lk-step:last-child::before { display: none; }
.lk-step.done::before { background: var(--success); }
.lk-dot {
  position: relative; z-index: 1; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-3);
  box-shadow: var(--elev-1), var(--sheen-strong);
  font-size: var(--fs-xs); font-weight: 800;
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out),
              color var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}
.lk-step.done .lk-dot {
  background: var(--success); border-color: var(--success); color: #fff;
  box-shadow: var(--shadow-success), var(--sheen-strong); transform: scale(1.06);
}
.lk-step.current .lk-dot {
  background: var(--primary-soft); border-color: var(--primary); color: var(--primary-text);
  box-shadow: var(--focus-ring), var(--elev-2);
}
.lk-body { min-width: 0; padding-top: 2px; }
.lk-title { font-size: var(--fs-base); font-weight: 700; color: var(--text-3); }
.lk-step.done .lk-title { color: var(--text-2); }
.lk-step.current .lk-title { color: var(--text); font-weight: 800; }
.lk-sub { font-size: var(--fs-xs); color: var(--text-3); margin-top: 3px; }
.lk-step.current .lk-sub { color: var(--primary-text); font-weight: 700; }

/* animated "working" dots for the active step */
.lk-wait i {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%;
  background: var(--primary); margin-left: 3px; opacity: .3;
  animation: waitDot 1.2s infinite;
}
.lk-wait i:nth-child(2) { animation-delay: .18s; }
.lk-wait i:nth-child(3) { animation-delay: .36s; }
@keyframes waitDot { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* --- benefit rows -------------------------------------------- */
.perk { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-3) 0; }
.perk + .perk { border-top: 1px solid var(--border); }
.perk .perk-ic {
  width: 36px; height: 36px; border-radius: var(--r-md); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-text);
}
.perk .perk-ic.green { background: var(--success-soft); color: var(--success-text); }
.perk .perk-ic.amber { background: var(--warn-soft); color: var(--warn-text); }
.perk .perk-ic.purple { background: var(--purple-soft); color: var(--purple-text); }
.perk b { display: block; font-size: var(--fs-sm); font-weight: 700; color: var(--text); }
.perk span { font-size: var(--fs-xs); color: var(--text-3); }

/* --- connected identity card --------------------------------- */
.tg-id {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-5); border-radius: var(--r-lg);
  background: var(--success-soft); border: 2px solid var(--success);
  box-shadow: var(--elev-2), var(--sheen);
}
.tg-id .tg-av {
  width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  background: var(--success); color: #fff;
  display: flex; align-items: center; justify-content: center;
}
.tg-id .tg-name { font-size: var(--fs-xl); font-weight: 800; color: var(--success-text); line-height: 1.15; }
.tg-id .tg-meta { font-size: var(--fs-xs); color: var(--text-2); margin-top: 4px; }

/* entrance for the success swap */
.tg-pop { animation: tgPop .5s var(--ease-spring) both; }
@keyframes tgPop {
  from { opacity: 0; transform: scale(.94) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* --- FAQ disclosure ------------------------------------------ */
.faq { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.faq + .faq { margin-top: var(--sp-3); }
.faq > summary {
  list-style: none; cursor: pointer; padding: var(--sp-4) var(--sp-5);
  font-size: var(--fs-sm); font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: var(--sp-3);
}
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after {
  content: "+"; margin-left: auto; font-size: var(--fs-lg); font-weight: 700; color: var(--text-3);
}
.faq[open] > summary::after { content: "\2212"; }
.faq[open] > summary { border-bottom: 1px solid var(--border); background: var(--bg-sunken); }
.faq > summary:hover { background: var(--bg-sunken); }
.faq .faq-body { padding: var(--sp-4) var(--sp-5); font-size: var(--fs-sm); color: var(--text-2); line-height: 1.65; }

/* --- discovered-chat row emphasis (admin) --------------------- */
.row-new td { background: var(--warn-soft); }
.row-new:hover td { background: var(--warn-soft); }

/* Topbar Telegram status — the always-on answer to "am I connected?" */
.tg-chip {
  height: 38px; padding: 0 12px; display: flex; align-items: center; gap: 7px;
  border-radius: var(--r-md); font-weight: 800; font-size: var(--fs-sm);
  border: 1.5px solid var(--warn); background: var(--warn-soft); color: var(--warn-text);
  text-decoration: none; white-space: nowrap;
}
.tg-chip:hover { background: var(--warn); color: #fff; text-decoration: none; }
.tg-chip:hover .live-dot { background: #fff; }
.tg-chip:hover .live-dot::after { border-color: #fff; }
/* connected: shrink to a quiet dot, no words needed */
.tg-chip.on {
  width: 38px; padding: 0; justify-content: center; position: relative;
  border-color: var(--border); background: transparent; color: var(--text-2);
}
.tg-chip.on:hover { background: var(--gray-soft); color: var(--text); }
.tg-chip.on .badge-dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--success); box-shadow: 0 0 0 2px var(--surface);
}
@media (max-width: 720px) { .tg-chip [data-i18n] { display: none; } .tg-chip { width: 38px; padding: 0; justify-content: center; } }

/* "this row is you" marker */
.row-me td { background: var(--primary-soft); }
.row-me:hover td { background: var(--primary-soft); }

/* Identity awaiting your confirmation — amber, not green: nothing is bound yet */
.tg-id.pending { background: var(--warn-soft); border-color: var(--warn); }
.tg-id.pending .tg-av { background: var(--warn); }
.tg-id.pending .tg-name { color: var(--warn-text); }

/* ============================================================
   LINK CARD — for requests whose whole point is a shared URL.
   Loud on purpose: this is content, not metadata.
   ============================================================ */
.link-card {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 12px 14px; border-radius: var(--r-md);
  border: 1.5px solid var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text); text-decoration: none;
  box-shadow: var(--elev-1);
  transition: background var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out),
              transform var(--dur) var(--ease-out);
  min-width: 0;
}
.link-card:hover {
  background: var(--primary); color: #fff; text-decoration: none;
  box-shadow: var(--shadow-primary); transform: translateY(-1px);
}
.link-card .lc-ic {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--primary-text);
  box-shadow: var(--elev-1);
}
.link-card:hover .lc-ic { background: rgba(255, 255, 255, .95); }
.link-card .lc-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.link-card .lc-domain {
  font-size: var(--fs-base); font-weight: 800; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-card .lc-url {
  font-family: var(--font-mono); font-size: var(--fs-xs); opacity: .75;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-card .lc-go {
  margin-left: auto; flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: 800; white-space: nowrap;
}
.link-card + .link-card { margin-top: var(--sp-2); }
.link-more { font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--sp-2); }

/* inside a dense notification row it can be a touch smaller */
.notif .link-card { padding: 9px 12px; }
.notif .link-card .lc-ic { width: 32px; height: 32px; }
.notif .link-card .lc-domain { font-size: var(--fs-sm); }

/* Quoted rationale (decline reasons, reviewer notes) — used by
   submissions/proposals; previously referenced with no styling at all. */
.quote {
  border-left: 3px solid var(--border-strong);
  background: var(--bg-sunken);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--sp-4) var(--sp-5);
}
.quote.red { border-left-color: var(--danger); background: var(--danger-soft); }
