/* personal-dashboard — Apple-style design.
   SF Pro system fonts, System Blue accent, vibrancy blur,
   Heroicons inline (loaded via Iconify Web Component). */

/* ── Tokens (Apple HIG) ──────────────────────────────────────── */

:root {
  --sidebar-width: 232px;
  --content-max: 920px;

  /* Apple system colors — light mode */
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.6);
  --label-3: rgba(60, 60, 67, 0.3);
  --bg: #f2f2f7;             /* iOS systemGroupedBackground */
  --bg-card: #ffffff;
  --bg-soft: rgba(120, 120, 128, 0.08);
  --bg-fill: rgba(120, 120, 128, 0.16);
  --separator: rgba(60, 60, 67, 0.12);
  --separator-opaque: #d1d1d6;

  --accent: #007AFF;          /* System Blue */
  --accent-fill: rgba(0, 122, 255, 0.12);
  --success: #34C759;
  --warning: #FF9500;
  --danger: #FF3B30;
  --indigo: #5856D6;
  --purple: #AF52DE;
  --teal: #5AC8FA;

  /* Radii — Apple uses generous corners */
  --r-sm: 6px;
  --r-md: 10px;
  --r-card: 14px;
  --r-pill: 999px;

  /* Shadows — barely-there, layered */
  --shadow-1: 0 0.5px 0 rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 1px 0 rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-3: 0 1px 0 rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;

  /* Apple standard easing */
  --ease: cubic-bezier(0.42, 0, 0.58, 1);
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --t-fast: 150ms var(--ease);
  --t-base: 250ms var(--ease);
}

/* Dark tokens — applied via:
   1. system pref WHEN no manual override (data-theme attr absent)
   2. manual override `:root[data-theme="dark"]`
   The manual `[data-theme="light"]` keeps the default :root light tokens. */

:root[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* baseline for system-pref dark — wrapped by media query below */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.6);
    --label-3: rgba(235, 235, 245, 0.3);
    --bg: #000000;
    --bg-card: #1c1c1e;
    --bg-soft: rgba(120, 120, 128, 0.16);
    --bg-fill: rgba(120, 120, 128, 0.24);
    --separator: rgba(84, 84, 88, 0.5);
    --separator-opaque: #38383a;
    --accent: #0A84FF;
    --accent-fill: rgba(10, 132, 255, 0.18);
    --success: #30D158;
    --warning: #FF9F0A;
    --danger: #FF453A;
    --indigo: #5E5CE6;
    --purple: #BF5AF2;
    --teal: #64D2FF;
    --shadow-1: 0 0.5px 0 rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.6);
  }
}

/* Manual dark — same tokens, not gated on system pref */
:root[data-theme="dark"] {
  --label: #ffffff;
  --label-2: rgba(235, 235, 245, 0.6);
  --label-3: rgba(235, 235, 245, 0.3);
  --bg: #000000;
  --bg-card: #1c1c1e;
  --bg-soft: rgba(120, 120, 128, 0.16);
  --bg-fill: rgba(120, 120, 128, 0.24);
  --separator: rgba(84, 84, 88, 0.5);
  --separator-opaque: #38383a;
  --accent: #0A84FF;
  --accent-fill: rgba(10, 132, 255, 0.18);
  --success: #30D158;
  --warning: #FF9F0A;
  --danger: #FF453A;
  --indigo: #5E5CE6;
  --purple: #BF5AF2;
  --teal: #64D2FF;
  --shadow-1: 0 0.5px 0 rgba(255, 255, 255, 0.04), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* ── Base ───────────────────────────────────────────────────── */

html {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Helvetica Neue", "PingFang TC", "Microsoft JhengHei",
               system-ui, sans-serif;
  font-feature-settings: "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.011em;
}

* { box-sizing: border-box; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-feature-settings: "tnum";
  font-size: 0.92em;
}
.tabular { font-variant-numeric: tabular-nums; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

iconify-icon {
  display: inline-flex;
  vertical-align: -0.125em;
  flex-shrink: 0;
}

/* ── App layout ─────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* ── Sidebar (vibrancy panel) ──────────────────────────────── */

.sidebar {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  padding: var(--s-5) var(--s-3) var(--s-3);
  background: var(--bg-card);
  border-right: 0.5px solid var(--separator);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.sidebar-brand {
  display: flex; align-items: center; gap: var(--s-2);
  font-weight: 600; font-size: 15px;
  letter-spacing: -0.022em;
  padding: 0 var(--s-3) var(--s-5);
  color: var(--label);
}
.sidebar-brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fill);
}

.sidebar-section-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--label-3);
  padding: var(--s-3) var(--s-3) var(--s-1);
}

.sidebar-nav { list-style: none; padding: 0; margin: 0; }
.sidebar-nav li { margin: 0; padding: 0; }
.sidebar-nav li.divider {
  height: 0.5px; margin: var(--s-3) var(--s-3);
  background: var(--separator);
}

.sidebar-nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--r-md);
  color: var(--label);
  font-size: 14px; font-weight: 500;
  margin-bottom: 1px;
  transition: background var(--t-fast);
}
.sidebar-nav a:hover { background: var(--bg-soft); }
.sidebar-nav a.active {
  background: var(--accent);
  color: white;
}

.sidebar-nav .nav-label {
  display: flex; align-items: center; gap: 10px;
}
.sidebar-nav iconify-icon {
  font-size: 17px;
  opacity: 0.9;
}

.sidebar-nav .count {
  font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--bg-fill);
  color: var(--label-2);
  min-width: 22px; text-align: center;
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-nav a.active .count {
  background: rgba(255, 255, 255, 0.24);
  color: white;
}

/* ── Main content ───────────────────────────────────────────── */

.main {
  padding: var(--s-6) var(--s-8) var(--s-10);
  max-width: var(--content-max);
  width: 100%;
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-6);
  font-size: 13px; color: var(--label-2);
  font-variant-numeric: tabular-nums;
}

.btn-link {
  background: none; border: none; padding: 0;
  color: var(--accent); cursor: pointer;
  font: inherit; font-weight: 500;
  transition: opacity var(--t-fast);
  display: inline-flex; align-items: center;
}
.btn-link:hover { opacity: 0.7; }
.btn-link iconify-icon { font-size: 16px; }

.topbar-right { display: inline-flex; align-items: center; gap: var(--s-3); }
.topbar-time { color: var(--label-3); font-size: 12px; }
.theme-toggle iconify-icon { font-size: 18px; color: var(--label-2); }
.theme-toggle:hover iconify-icon { color: var(--accent); }

.page-title {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.028em; line-height: 1.15;
  margin: 0 0 var(--s-6);
  color: var(--label);
  display: flex; align-items: baseline; gap: var(--s-3);
}
.page-title .count {
  color: var(--label-3);
  font-weight: 500;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ── Cards (Apple sheet style) ─────────────────────────────── */

.card {
  border-radius: var(--r-card);
  padding: var(--s-4) var(--s-5);
  margin-bottom: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.card.warn {
  background: linear-gradient(0deg, rgba(255, 149, 0, 0.04), rgba(255, 149, 0, 0.04)), var(--bg-card);
  box-shadow: var(--shadow-1), inset 0 0 0 0.5px rgba(255, 149, 0, 0.5);
}
.card.critical {
  background: linear-gradient(0deg, rgba(255, 59, 48, 0.05), rgba(255, 59, 48, 0.05)), var(--bg-card);
  box-shadow: var(--shadow-1), inset 0 0 0 0.5px rgba(255, 59, 48, 0.5);
}

.card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--s-4);
}

.card-meta {
  display: flex; gap: 6px; align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.card-title {
  font-weight: 600; font-size: 15px;
  letter-spacing: -0.014em;
  margin: 0; line-height: 1.35;
  color: var(--label);
}
.card-detail {
  font-size: 13px; color: var(--label-2);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.card-detail code {
  background: var(--bg-soft);
  padding: 1px 6px; border-radius: 4px;
  font-size: 12px;
}

.card-aside {
  text-align: right; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px;
}

/* ── Badges (Apple style) ──────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--r-pill);
  font-size: 11px; font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  line-height: 1;
}
.badge iconify-icon { font-size: 11px; }

.badge-blue   { background: rgba(0, 122, 255, 0.12); color: #0066CC; }
.badge-purple { background: rgba(175, 82, 222, 0.12); color: #8A2BE2; }
.badge-cyan   { background: rgba(90, 200, 250, 0.16); color: #0E7E9E; }
.badge-green  { background: rgba(52, 199, 89, 0.14); color: #248A3D; }
.badge-amber  { background: rgba(255, 149, 0, 0.14); color: #C7700A; }
.badge-rose   { background: rgba(255, 59, 48, 0.12); color: #C7281E; }
.badge-slate  { background: var(--bg-fill); color: var(--label-2); }

@media (prefers-color-scheme: dark) {
  .badge-blue   { color: #6CB2FF; }
  .badge-purple { color: #DA8FFF; }
  .badge-cyan   { color: #82DCFF; }
  .badge-green  { color: #6BE89C; }
  .badge-amber  { color: #FFC56F; }
  .badge-rose   { color: #FF8A82; }
}

.kind {
  font-size: 12px;
  color: var(--label-3);
  font-weight: 500;
  letter-spacing: 0;
}

/* ── Age indicator ─────────────────────────────────────────── */

.age {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--label-2);
}
.age-fresh    { color: var(--label-2); font-weight: 500; }
.age-warn     { color: var(--warning); }
.age-critical { color: var(--danger); }
.age-when {
  color: var(--label-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ── Empty state ───────────────────────────────────────────── */

.empty {
  text-align: center;
  padding: var(--s-10) var(--s-5);
  color: var(--label-2);
  background: var(--bg-card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
}
.empty-icon {
  font-size: 48px;
  display: block;
  margin: 0 auto var(--s-3);
  color: var(--accent);
  opacity: 0.85;
}
.empty strong { color: var(--label); font-weight: 600; font-size: 17px; display: block; margin-bottom: 4px; }
.empty small { color: var(--label-3); display: block; margin-top: var(--s-2); font-size: 13px; }

/* ── Smooth HTMX swap ──────────────────────────────────────── */

.htmx-swapping { opacity: 0.6; transition: opacity var(--t-base); }
.htmx-settling { opacity: 1; }

/* ── Visibility helpers (responsive) ───────────────────────── */

.desktop-only { /* default: visible everywhere */ }
.mobile-only  { display: none; }

/* ── Categories grid (More page) ───────────────────────────── */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-3);
}
.cat-tile {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  border-radius: var(--r-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
  color: var(--label);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.cat-tile:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.cat-tile-icon {
  font-size: 28px;
  color: var(--accent);
  flex-shrink: 0;
}
.cat-tile-body { flex: 1; min-width: 0; }
.cat-tile-label {
  font-size: 15px; font-weight: 600;
  letter-spacing: -0.013em;
  margin-bottom: 2px;
}
.cat-tile-meta { font-size: 13px; color: var(--label-2); }
.cat-tile-meta strong { color: var(--label); font-weight: 600; }
.cat-tile-chev { font-size: 16px; color: var(--label-3); }

/* Tile-level category accent (matches sidebar/card border-left) */
.cat-tile[data-category="werewolf"]    .cat-tile-icon { color: var(--indigo); }
.cat-tile[data-category="werewolf"]    { border-left: 3px solid var(--indigo); }
.cat-tile[data-category="idea"]        .cat-tile-icon { color: var(--warning); }
.cat-tile[data-category="idea"]        { border-left: 3px solid var(--warning); }
.cat-tile[data-category="linkedin"]    .cat-tile-icon { color: var(--teal); }
.cat-tile[data-category="linkedin"]    { border-left: 3px solid var(--teal); }
.cat-tile[data-category="planner"]     .cat-tile-icon { color: var(--purple); }
.cat-tile[data-category="planner"]     { border-left: 3px solid var(--purple); }
.cat-tile[data-category="remediation"] .cat-tile-icon { color: var(--danger); }
.cat-tile[data-category="remediation"] { border-left: 3px solid var(--danger); }
.cat-tile[data-category="sources"]     .cat-tile-icon { color: var(--success); }
.cat-tile[data-category="sources"]     { border-left: 3px solid var(--success); }

/* ── Mobile ────────────────────────────────────────────────── */

@media (max-width: 768px) {
  body { font-size: 16px; }
  /* Belt-and-suspenders: viewport overflow is a constant battle on
     mobile when content has long unbreakable strings (UUIDs, Chinese
     paragraphs, JSON payloads). Force the root tree to viewport width
     and let inner elements scroll/wrap as needed. */
  html, body { max-width: 100vw; overflow-x: hidden; }
  .desktop-only { display: none !important; }
  .mobile-only  { display: list-item; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    max-width: 100vw;
  }
  .main { max-width: 100%; overflow-x: hidden; }
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0;
    top: auto; height: auto;
    border-right: none;
    border-top: 0.5px solid var(--separator);
    padding: 8px 4px max(8px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    z-index: 10;
  }
  @media (prefers-color-scheme: dark) {
    .sidebar { background: rgba(28, 28, 30, 0.85); }
  }
  .sidebar-brand, .sidebar-section-label, .sidebar-nav li.divider { display: none; }
  /* Bottom nav now has only 4 items: Pending / Timeline / Recent / More
     (Apple HIG max-5 pattern; categories live in /more hub) */
  .sidebar-nav { display: flex; justify-content: space-around; gap: 0; }
  .sidebar-nav li { flex: 1; position: relative; }
  .sidebar-nav a {
    flex-direction: column;
    padding: 6px 4px;
    font-size: 10px;
    gap: 3px;
    margin-bottom: 0;
    border-radius: 8px;
  }
  .sidebar-nav .nav-label { flex-direction: column; gap: 3px; }
  .sidebar-nav iconify-icon { font-size: 22px; }
  .sidebar-nav .count {
    font-size: 9px; padding: 0 4px; min-width: 16px;
    position: absolute; top: 2px; right: calc(50% - 22px);
    background: var(--danger); color: white;
    font-weight: 700;
  }
  /* Hide zero-count badges on mobile to reduce noise */
  .sidebar-nav .count:empty { display: none; }
  .sidebar-nav a.active { background: transparent; color: var(--accent); }
  .sidebar-nav a.active .count { background: var(--accent); }
  .main { padding: var(--s-4) var(--s-4) calc(var(--s-10) * 2.5); max-width: 100%; }
  .page-title { font-size: 22px; margin-bottom: var(--s-4); }
  .card { padding: var(--s-3) var(--s-4); }
  .cat-grid { grid-template-columns: 1fr; }
}

/* ── Inline elements & helpers ─────────────────────────────── */

.muted        { color: var(--label-2); }
.muted-link   { color: var(--label-2); }
.muted-link:hover { color: var(--accent); }
.muted-small  { color: var(--label-3); font-size: 12px; padding: var(--s-2) 0; }
.muted-mono   { color: var(--label-3); font-size: 11px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.actor        { color: var(--label); font-weight: 500; font-size: 13px; }
.item-link    { color: var(--accent); font-weight: 500; }
.item-link:hover { text-decoration: none; opacity: 0.7; }
.sep          { color: var(--label-3); font-size: 12px; }
.kv           { font-size: 12px; color: var(--label-2); }
.kv strong    { color: var(--label); font-weight: 600; margin-right: 2px; }
.kv-detail    {
  display: block;
  background: var(--bg-soft);
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 4px;
  border-left: 2px solid var(--accent);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}
.kv-long { display: block; }
.kv-long > summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--label-2);
}
.kv-long > summary::-webkit-details-marker { display: none; }
.kv-long > summary::before {
  content: "▸";
  color: var(--label-3);
  margin-right: 6px;
  display: inline-block;
  transition: transform 150ms;
}
.kv-long[open] > summary::before {
  transform: rotate(90deg);
}
.kv-long .kv-full {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--bg-soft);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.5;
}
.title-icon   { color: var(--accent); font-size: 26px; }

/* ── Filter bar (Timeline) ─────────────────────────────────── */

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: var(--s-5);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-card);
  color: var(--label);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-1);
  transition: background var(--t-fast), color var(--t-fast);
}
.filter-chip iconify-icon { font-size: 14px; }
.filter-chip:hover { background: var(--bg-soft); }
.filter-chip.active {
  background: var(--accent); color: white;
}

.filter-active {
  font-size: 13px; color: var(--label-2);
  margin-bottom: var(--s-4);
}

/* ── Tabs (Category page) ──────────────────────────────────── */

.tabs {
  display: flex; gap: 2px;
  border-bottom: 0.5px solid var(--separator);
  margin-bottom: var(--s-5);
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px 10px;
  color: var(--label-2);
  font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.tab:hover { color: var(--label); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-count {
  font-size: 12px; padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--bg-fill);
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
}
.tab.active .tab-count { background: var(--accent-fill); color: var(--accent); }

/* ── Item rows (Category list) ─────────────────────────────── */

.item-rows { display: flex; flex-direction: column; gap: 6px; }
.item-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.item-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
}
.item-row-main { flex: 1; min-width: 0; }
.item-row-meta {
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 4px;
}
.item-row-title {
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.013em;
  margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-row-detail { font-size: 12px; color: var(--label-2); margin-top: 2px; }
.item-row-detail code {
  background: var(--bg-soft); padding: 1px 5px;
  border-radius: 3px; font-size: 11px;
}
.item-row-aside {
  display: flex; align-items: center; gap: var(--s-3);
  flex-shrink: 0;
  color: var(--label-3);
}
.row-chev { font-size: 16px; opacity: 0.6; }

/* ── Item detail page ──────────────────────────────────────── */

.item-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--label-2);
  margin-bottom: var(--s-3);
}
.item-breadcrumb a {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--label-2);
  font-weight: 500;
}
.item-breadcrumb a:hover { color: var(--accent); }
.item-breadcrumb iconify-icon { font-size: 14px; }
.crumb-sep { color: var(--label-3); }

.item-status-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: var(--s-6);
  font-size: 13px;
  padding-bottom: var(--s-4);
  border-bottom: 0.5px solid var(--separator);
}

.item-section {
  margin-bottom: var(--s-8);
}
.section-title {
  font-size: 17px; font-weight: 600;
  letter-spacing: -0.018em;
  margin: 0 0 var(--s-3);
  display: flex; align-items: baseline; gap: var(--s-2);
}
.section-title .count {
  color: var(--label-3);
  font-weight: 500;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ── Revisions ─────────────────────────────────────────────── */

.revision {
  border-radius: var(--r-card);
  padding: var(--s-4);
  margin-bottom: 10px;
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
}
.revision-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: var(--s-3);
}
.rev-version {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px; font-weight: 600;
  background: var(--accent-fill);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: var(--r-md);
}
.revision-content,
.revision-diff {
  margin-top: var(--s-2);
}
.revision-content > summary,
.revision-diff > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  padding: 4px 0;
  user-select: none;
}
.revision-content > summary:hover,
.revision-diff > summary:hover {
  opacity: 0.7;
}
.content-blob {
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  font-size: 12px;
  line-height: 1.55;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
  color: var(--label);
}

/* ── Diff renderer ─────────────────────────────────────────── */

.diff {
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: var(--s-3);
  font-size: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  overflow-x: auto;
  margin-top: var(--s-2);
}
.diff-line {
  white-space: pre;
  line-height: 1.55;
  padding: 0 6px;
  border-radius: 3px;
}
.diff-add  { background: rgba(52, 199, 89, 0.14); color: #248a3d; }
.diff-del  { background: rgba(255, 59, 48, 0.12); color: #c7281e; }
.diff-hunk { color: var(--label-3); margin: 4px 0 2px; font-weight: 600; }
.diff-meta { color: var(--label-3); }
.diff-ctx  { color: var(--label-2); }

@media (prefers-color-scheme: dark) {
  .diff-add  { color: #6BE89C; }
  .diff-del  { color: #FF8A82; }
}

/* ── Event stream (Timeline + Item events) ─────────────────── */

.event-stream { display: flex; flex-direction: column; gap: 4px; }

.event {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: var(--s-3);
  padding: 10px var(--s-3);
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.event:hover { background: var(--bg-soft); }

.event-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-fill);
  color: var(--label-2);
}
.event-icon iconify-icon { font-size: 16px; }

.event-body { min-width: 0; overflow: hidden; }
.event-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-bottom: 2px;
  font-size: 13px;
  min-width: 0;
}
.event-payload {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  margin-top: 4px;
  min-width: 0;
  max-width: 100%;
}
.event-payload .kv {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  /* Preserve \n in detail/payload values (announce events carry full
     Slack messages with newlines). */
  white-space: pre-wrap;
}
.event-link {
  margin-top: 4px;
  font-size: 12px;
}
.event-link a {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--accent); font-weight: 500;
}
.event-link iconify-icon { font-size: 12px; }

.event-time {
  font-size: 12px;
  color: var(--label-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  align-self: center;
}

/* ── Category page header (h1 + start button) ──────────────── */

.cat-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.cat-header .page-title { margin-bottom: 0; }

.recent-triggers {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: var(--s-3);
  margin-bottom: var(--s-5);
  font-size: 12px;
}
.trigger-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
}
.trigger-row iconify-icon { font-size: 16px; color: var(--label-3); }

/* ── Category-specific tints (visual differentiation) ──────── */

/* Werewolf — night/moon theme, indigo→amber accents */
.item-row[data-category="werewolf"],
.card[data-category="werewolf"] {
  border-left: 3px solid var(--indigo);
}
.item-row[data-category="werewolf"] .item-row-title { color: var(--label); }
.sidebar-nav a[data-category="werewolf"] iconify-icon { color: var(--indigo); opacity: 1; }
.sidebar-nav a[data-category="werewolf"].active iconify-icon { color: white; }

/* Idea — yellow lightbulb */
.item-row[data-category="idea"],
.card[data-category="idea"] {
  border-left: 3px solid var(--warning);
}
.sidebar-nav a[data-category="idea"] iconify-icon { color: var(--warning); opacity: 1; }
.sidebar-nav a[data-category="idea"].active iconify-icon { color: white; }

/* LinkedIn — cyan */
.item-row[data-category="linkedin"],
.card[data-category="linkedin"] {
  border-left: 3px solid var(--teal);
}

/* Sources — globe (no special accent unless dead) */
.item-row[data-category="sources"],
.card[data-category="sources"] {
  border-left: 3px solid var(--success);
}

/* Remediation — alert */
.item-row[data-category="remediation"],
.card[data-category="remediation"] {
  border-left: 3px solid var(--danger);
}

/* Planner — clipboard */
.item-row[data-category="planner"],
.card[data-category="planner"] {
  border-left: 3px solid var(--purple);
}

/* Blog — default accent (no left border to keep blog as the baseline) */

/* ── Decision panel (approve / reject buttons) ─────────────── */

.decide-panel {
  background: var(--bg-card);
  border-radius: var(--r-card);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-5);
  box-shadow: var(--shadow-1);
  border: 0.5px solid var(--separator);
}
.decide-panel.queued {
  background: linear-gradient(0deg, rgba(0, 122, 255, 0.04), rgba(0, 122, 255, 0.04)), var(--bg-card);
  border-color: rgba(0, 122, 255, 0.3);
}
.decide-panel.readonly {
  background: var(--bg-soft);
  border-style: dashed;
}

.decide-row {
  display: flex; gap: var(--s-2); flex-wrap: wrap;
}

.decide-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--label);
  margin-bottom: 4px;
}
.decide-status iconify-icon { font-size: 18px; color: var(--accent); }

.decide-meta {
  margin-top: var(--s-3);
  padding-top: var(--s-2);
  border-top: 0.5px solid var(--separator);
}
.decide-meta code {
  background: var(--bg-soft); padding: 1px 5px;
  border-radius: 3px; font-size: 11px;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border: none; border-radius: var(--r-md);
  font: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: opacity var(--t-fast), transform 60ms;
}
.btn:active { transform: scale(0.97); }
.btn iconify-icon { font-size: 16px; }
.btn-primary    { background: var(--accent); color: white; }
.btn-primary:hover { opacity: 0.85; }
.btn-secondary  { background: var(--bg-fill); color: var(--label); }
.btn-secondary:hover { background: var(--bg-soft); }
.btn-danger     { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.85; }
.btn-link       { background: none; color: var(--label-2); padding: 8px 12px; }
.btn-link:hover { color: var(--label); }

.reject-form {
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 0.5px solid var(--separator);
}
.reject-form.hidden { display: none; }
.reject-form textarea {
  width: 100%; min-height: 100px;
  padding: var(--s-3);
  border-radius: var(--r-md);
  border: 0.5px solid var(--separator);
  background: var(--bg-card);
  color: var(--label);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}
.reject-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-fill);
}
.reject-actions {
  display: flex; gap: var(--s-2);
  margin-top: var(--s-2);
}

/* ── Timeline event grouping + live indicator ──────────────── */

.live-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: var(--s-2);
  font-size: 11px;
  opacity: 0.5;
}
.live-indicator.connected { opacity: 1; }
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--label-3);
  flex-shrink: 0;
}
.live-indicator.connected .live-dot {
  background: var(--success);
  box-shadow: 0 0 0 0 var(--success);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); }
}

.event-new {
  background: rgba(52, 199, 89, 0.06);
  transition: background 1500ms ease-out;
}

/* Grouped event row (collapsible) */
.event-group {
  margin: 0;
  padding: 0;
  border-radius: var(--r-md);
}
.event-group[open] { background: var(--bg-soft); }
.event-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 4px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: var(--s-3);
  align-items: center;
  border-radius: var(--r-md);
  transition: background var(--t-fast);
}
.event-group > summary:hover { background: var(--bg-soft); }
.event-group > summary::-webkit-details-marker { display: none; }
.event-group > summary::before {
  content: "▸";
  position: absolute;
  margin-left: -16px;
  color: var(--label-3);
  font-size: 10px;
  transition: transform 150ms;
}
.event-group[open] > summary::before {
  transform: rotate(90deg);
}
.event-group > summary { position: relative; padding-left: 20px; }

.event-group .group-icon {
  position: relative;
  background: var(--accent-fill);
  color: var(--accent);
}
.event-group .group-icon iconify-icon { font-size: 16px; }
.event-group .group-count {
  position: absolute;
  top: -4px; right: -4px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: white;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  min-width: 18px;
  text-align: center;
}

.event-group-body {
  padding: 4px 4px 8px 32px;
  border-left: 2px solid var(--separator);
  margin: 4px 0 8px 16px;
}
.event-group-body .event {
  background: var(--bg-card);
  border-radius: var(--r-md);
  margin-bottom: 4px;
}

@media (max-width: 768px) {
  .event-group-body { padding-left: 16px; margin-left: 8px; }
  .event-group > summary { grid-template-columns: 30px 1fr auto; }
  .event-group .group-icon iconify-icon { font-size: 14px; }
}

/* ── Aged-pending banner (top of every page) ───────────────── */

.aged-banner {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 10px var(--s-4);
  margin: 0 0 var(--s-3);
  border-radius: var(--r-card);
  background: linear-gradient(0deg, rgba(255, 59, 48, 0.08), rgba(255, 59, 48, 0.08)), var(--bg-card);
  border: 0.5px solid rgba(255, 59, 48, 0.4);
  color: var(--label);
  font-size: 13px;
  box-shadow: var(--shadow-1);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.aged-banner:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.aged-banner > iconify-icon:first-child {
  font-size: 18px;
  color: var(--danger);
  flex-shrink: 0;
}
.aged-banner > span { flex: 1; }
.aged-banner strong { color: var(--danger); }
.aged-banner-arrow { font-size: 14px; color: var(--label-3); }

/* ── Search ─────────────────────────────────────────────────── */

.search-form {
  position: relative;
  display: flex; align-items: center;
  background: var(--bg-card);
  border-radius: var(--r-card);
  padding: var(--s-1) var(--s-3);
  box-shadow: var(--shadow-1);
  margin-bottom: var(--s-3);
}
.search-icon {
  font-size: 18px; color: var(--label-3);
  margin-right: 8px;
}
.search-input {
  flex: 1;
  border: none; background: transparent;
  font: inherit; font-size: 16px;
  padding: 10px 0;
  color: var(--label);
  outline: none;
  min-width: 0;
}
.search-input::placeholder { color: var(--label-3); }
.search-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-fill);
  color: var(--label-2);
}
.search-clear iconify-icon { font-size: 14px; }

.search-results { display: flex; flex-direction: column; gap: var(--s-2); }
.search-result {
  display: block;
  padding: var(--s-3);
  border-radius: var(--r-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
  color: var(--label);
  transition: transform var(--t-base), box-shadow var(--t-base);
}
.search-result:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.search-result-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.search-result-title { font-weight: 600; font-size: 14px; }
.search-result-snip {
  font-size: 13px; color: var(--label-2);
  line-height: 1.4;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.search-result-snip mark {
  background: rgba(255, 149, 0, 0.25);
  color: var(--label);
  padding: 0 2px;
  border-radius: 3px;
}
.search-result-slug {
  margin-top: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
}

/* ── Metrics ────────────────────────────────────────────────── */

.bar-chart { display: flex; flex-direction: column; gap: 6px; }
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 50px;
  gap: var(--s-3);
  align-items: center;
  font-size: 13px;
}
.bar-label {
  display: flex; align-items: center; gap: 6px;
  color: var(--label);
  font-weight: 500;
}
.bar-label iconify-icon { font-size: 14px; color: var(--label-2); }
.bar-track {
  height: 8px; border-radius: 4px;
  background: var(--bg-soft);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width var(--t-base);
}
.bar-blue   { background: var(--accent); }
.bar-green  { background: var(--success); }
.bar-rose   { background: var(--danger); }
.bar-amber  { background: var(--warning); }
.bar-purple { background: var(--purple); }
.bar-cyan   { background: var(--teal); }
.bar-slate  { background: var(--label-3); }
.bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--label);
}

.metric-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--s-3);
}
.metric-tile {
  padding: var(--s-4);
  border-radius: var(--r-card);
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
  text-align: center;
}
.metric-tile-icon {
  font-size: 24px;
  margin-bottom: var(--s-2);
  display: block;
}
.metric-tile-value {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--label);
}
.metric-tile-label {
  font-size: 12px; color: var(--label-2);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.metric-blue   { color: var(--accent); }
.metric-green  { color: var(--success); }
.metric-rose   { color: var(--danger); }
.metric-amber  { color: var(--warning); }
.metric-purple { color: var(--purple); }
.metric-cyan   { color: var(--teal); }
.metric-slate  { color: var(--label-2); }

.metric-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  font-size: 13px;
}
.metric-table th, .metric-table td {
  padding: 10px var(--s-3);
  text-align: left;
  border-bottom: 0.5px solid var(--separator);
}
.metric-table th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--label-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.metric-table tr:last-child td { border-bottom: none; }
.metric-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.metric-table iconify-icon { font-size: 14px; vertical-align: -0.125em; margin-right: 4px; color: var(--label-2); }

@media (max-width: 768px) {
  .bar-row { grid-template-columns: 100px 1fr 40px; gap: 8px; font-size: 12px; }
  .metric-table { font-size: 12px; }
  .metric-table th, .metric-table td { padding: 8px 10px; }
}

/* ── Bulk action bar + checkboxes ───────────────────────────── */

.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  margin-bottom: var(--s-3);
  background: var(--bg-card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: saturate(180%) blur(20px);
}
.bulk-select-all {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer;
  font-size: 13px; color: var(--label-2);
}
.bulk-select-all input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
}
.bulk-actions { display: inline-flex; gap: var(--s-2); }
.bulk-actions .btn { font-size: 12px; padding: 5px 10px; }

.card-check {
  position: absolute;
  top: var(--s-3); right: var(--s-3);
  width: 20px; height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  z-index: 1;
}
.card { position: relative; }

@media (max-width: 768px) {
  .bulk-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .bulk-actions .btn { flex: 1; justify-content: center; }
}

/* ── Undo toast (bottom of viewport) ────────────────────────── */

.undo-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s-6) + 80px);   /* sit above mobile bottom nav */
  transform: translateX(-50%) translateY(20px);
  display: inline-flex; align-items: center; gap: var(--s-3);
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--label);
  color: var(--bg);
  box-shadow: var(--shadow-3);
  font-size: 13px; font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms, transform 250ms;
  z-index: 1000;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
}
.undo-toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.undo-toast iconify-icon { font-size: 18px; color: var(--success); }
.undo-toast .undo-label { color: var(--bg); }
.undo-toast .undo-btn {
  background: rgba(255, 255, 255, 0.18);
  color: var(--bg);
  border: none;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}
.undo-toast .undo-btn:hover { background: rgba(255, 255, 255, 0.28); }

@media (prefers-color-scheme: dark) {
  .undo-toast { background: #f5f5f5; color: #0a0a0a; }
  .undo-toast .undo-btn { background: rgba(0, 0, 0, 0.15); color: #0a0a0a; }
}

@media (max-width: 768px) {
  .undo-toast { bottom: 90px; font-size: 12px; padding: 10px 16px; }
}

/* ── Article approve/reject (on /pending cards) ────────────── */

.article-actions {
  display: flex; gap: var(--s-2);
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 0.5px solid var(--separator);
}
.article-actions .btn { font-size: 13px; padding: 6px 12px; }

/* Inline status row that replaces the buttons during/after a
   decision. Provides obvious "I heard you" feedback before the
   slide-out animation kicks in. */
.card-status {
  display: flex; align-items: center; gap: 6px;
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 0.5px solid var(--separator);
  color: var(--success);
  font-size: 13px; font-weight: 600;
}
.card-status iconify-icon { font-size: 18px; }
.card-status.error { color: var(--danger); }

@media (max-width: 768px) {
  .article-actions .btn { flex: 1; justify-content: center; }
}

/* ── Decision history (per-item) ───────────────────────────── */

.decision-history { display: flex; flex-direction: column; gap: 6px; }
.decision-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: var(--s-3);
  padding: 10px var(--s-3);
  border-radius: var(--r-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-1);
}
.decision-icon {
  display: flex; align-items: center; justify-content: center;
}
.decision-icon iconify-icon { font-size: 22px; }
.dec-approve { color: var(--success); }
.dec-reject  { color: var(--danger); }
.decision-body { font-size: 14px; }
.decision-comment {
  margin-top: 4px; padding: 6px 10px;
  background: var(--bg-soft); border-radius: 6px;
  font-size: 13px; color: var(--label);
  white-space: pre-wrap;
}

/* ── Mobile tweaks for new components ──────────────────────── */

@media (max-width: 768px) {
  /* Topbar — pure right-aligned, single line */
  .topbar {
    font-size: 12px;
    margin-bottom: var(--s-4);
    flex-wrap: nowrap;
    overflow: hidden;
  }

  /* Timeline filter chips — horizontally scrollable, no squish, edge-fade */
  .filter-bar {
    gap: 6px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    margin: 0 calc(-1 * var(--s-4)) var(--s-3);
    padding-left: var(--s-4);
    padding-right: var(--s-4);
    scroll-padding-left: var(--s-4);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-chip {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 5px 10px;
    font-size: 12px;
  }

  /* Category page tabs — scrollable like filter bar */
  .tabs {
    gap: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 8px 12px 10px;
    font-size: 13px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Category header — title above button, button full-width */
  .cat-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-2);
  }
  .cat-header .btn { justify-content: center; width: 100%; }

  /* Item rows */
  .item-row { padding: 10px 12px; gap: var(--s-2); }
  .item-row-aside { gap: 6px; align-items: flex-end; flex-direction: column; }
  .row-chev { display: none; }
  .item-row-title { font-size: 14px; }

  /* Event stream — drop time column entirely on mobile; ts stays
     in title attr for long-press inspect. Stack payload kvs. */
  .event {
    grid-template-columns: 26px 1fr;
    gap: 8px; padding: 8px 4px;
    min-width: 0;
  }
  .event-icon { width: 26px; height: 26px; flex-shrink: 0; }
  .event-icon iconify-icon { font-size: 13px; }
  .event-meta { font-size: 12px; }
  .event-payload {
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
  }
  .event-payload .kv {
    display: block;
    font-size: 11px;
    line-height: 1.4;
    width: 100%;
  }
  .event-time { display: none; }

  /* Diff / content blob */
  .content-blob, .diff { font-size: 11px; padding: 10px; }
  .diff-line { padding: 0 4px; }

  /* Item-status-bar — smaller, badges still readable */
  .item-status-bar {
    font-size: 12px;
    gap: 6px;
    padding-bottom: var(--s-3);
  }
  .item-status-bar .sep { display: none; }

  /* Item breadcrumb */
  .item-breadcrumb { font-size: 12px; flex-wrap: wrap; }
  .item-breadcrumb a { font-size: 12px; }

  /* Section title */
  .section-title { font-size: 15px; }

  /* Decision panel — buttons stack on narrow widths */
  .decide-panel { padding: var(--s-3) var(--s-4); }
  .decide-row { gap: var(--s-2); }
  .decide-row .btn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
  .decide-meta { font-size: 11px; word-break: break-all; }
  .decide-meta code { word-break: break-all; }
  .reject-actions { flex-direction: column; }
  .reject-actions .btn { justify-content: center; }

  /* Recent triggers */
  .trigger-row {
    flex-wrap: wrap;
    font-size: 11px;
  }
  .trigger-row .item-link {
    flex-basis: 100%;
    word-break: break-all;
  }

  /* Decision history rows */
  .decision-comment { font-size: 12px; word-break: break-word; }

  /* Card meta — smaller on mobile so badges fit */
  .card-meta { gap: 4px; }
  .badge { padding: 2px 6px; }

  /* /more page tile chevron a bit smaller */
  .cat-tile { padding: var(--s-3); }
  .cat-tile-icon { font-size: 24px; }
  .cat-tile-label { font-size: 14px; }
  .cat-tile-meta { font-size: 12px; }
}

/* ── Very narrow phones (≤375px iPhone SE / mini) ──────────── */

@media (max-width: 380px) {
  .page-title { font-size: 20px; }
  .event { grid-template-columns: 24px 1fr 0; }   /* hide time column */
  .event-time { display: none; }
  .topbar { font-size: 11px; }
  .item-row-aside .age-when { font-size: 10px; }
  .badge { font-size: 10px; }
}

