/* ── MEM-01 Centre Collector — "Neo Console" design system (v14.7) ───────
   High-tech mission-control aesthetic: deep-space dark, glassmorphism,
   cyan→violet neon accents, aurora backdrop, glow micro-interactions.
   Dark is the default; light theme stays crisp & modern. All class names
   used by app.js are covered — DOM untouched. */

:root {
  --paper: #060a14;
  --surface: rgba(15, 23, 42, .66);
  --surface-2: #0d1526;
  --surface-3: rgba(30, 41, 66, .5);
  --ink: #e8edf7;
  --ink-soft: #a8b3cc;
  --muted: #66718c;
  --line: rgba(var(--slate-rgb), .16);
  --teal: #2dd4bf;
  --teal-deep: #14b8a6;
  --teal-tint: rgba(var(--teal-rgb), .13);
  --amber: #fbbf24;
  --amber-tint: rgba(var(--amber-rgb), .13);
  --green: #34d399;
  --green-tint: rgba(var(--green-rgb), .13);
  --red: #fb7185;
  --red-tint: rgba(var(--red-rgb), .13);
  --slate: #93a4c3;
  --slate-tint: rgba(147, 164, 195, .13);
  --blue: #60a5fa;
  --blue-tint: rgba(var(--blue-rgb), .13);
  --violet: #a78bfa;
  --violet-tint: rgba(var(--violet-rgb), .13);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 44px -14px rgba(0, 0, 0, .65);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .35), 0 0 26px -6px rgba(var(--teal-rgb), .6);
  --glow-soft: 0 8px 30px -10px rgba(var(--teal-rgb), .4);
  --grad: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 45%, #818cf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .16), rgba(var(--violet-rgb), .16));
  --serif: "Noto Serif TC", "Songti TC", "STSong", Georgia, serif;
  --sans: "Inter", "SF Pro Text", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Consolas, monospace;
  --teal-rgb: 45, 212, 191; --amber-rgb: 251, 191, 36; --green-rgb: 52, 211, 153;
  --red-rgb: 251, 113, 133; --blue-rgb: 96, 165, 250; --violet-rgb: 167, 139, 250; --slate-rgb: 148, 163, 205;
  --aurora-1: rgba(45, 212, 191, .16); --aurora-2: rgba(129, 140, 248, .14); --aurora-3: rgba(56, 189, 248, .1);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: 15px; scrollbar-color: var(--teal-deep) transparent; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .4s ease, color .3s ease;
}
::selection { background: var(--teal-tint); color: var(--ink); }

/* slim neon scrollbars */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--slate-tint); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--teal-tint); border: 2px solid transparent; background-clip: content-box; }

/* ── aurora backdrop (fixed, decorative) ── */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 520px at 82% -8%, var(--aurora-1), transparent 62%),
    radial-gradient(760px 480px at -6% 6%, var(--aurora-2), transparent 60%),
    radial-gradient(680px 460px at 55% 112%, var(--aurora-3), transparent 60%);
  animation: aurora 18s ease-in-out infinite alternate;
}
@keyframes aurora {
  0% { opacity: .75; transform: translate3d(0, 0, 0) scale(1); }
  50% { opacity: 1; transform: translate3d(-2%, 1.5%, 0) scale(1.05); }
  100% { opacity: .8; transform: translate3d(1.5%, -1%, 0) scale(1.02); }
}
body::after { /* faint blueprint grid */
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 78%);
  opacity: .4;
}

.app { max-width: 1460px; margin: 0 auto; padding: 18px 26px 70px; }
.hint { font-size: .74rem; color: var(--muted); }
.sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.muted-note { font-size: .74rem; color: var(--muted); line-height: 1.6; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* ── Buttons ── */
.btn {
  font-family: var(--sans); font-size: .8rem; font-weight: 600;
  padding: 8px 15px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface-3); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: transform .14s ease, box-shadow .2s ease, border-color .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--teal); box-shadow: var(--glow-soft); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary {
  background: var(--grad); border: none; color: #04121a;
  background-size: 160% 160%; animation: gradShift 7s ease-in-out infinite;
  box-shadow: 0 6px 22px -8px rgba(var(--teal-rgb), .55);
}
body.light-ui .btn-primary { color: #fff; }
.btn-primary:hover { box-shadow: var(--glow); filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--teal-tint); }
.btn-danger { background: var(--red-tint); border-color: rgba(var(--red-rgb), .4); color: var(--red); }
.btn-danger:hover { box-shadow: 0 6px 20px -8px rgba(var(--red-rgb), .5); border-color: var(--red); }
.btn-sm { font-size: .73rem; padding: 5px 10px; border-radius: 9px; gap: 4px; }
.btn-block { width: 100%; justify-content: center; }
@keyframes gradShift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-3); color: var(--ink); cursor: pointer; font-size: .9rem;
  display: grid; place-items: center; transition: all .18s ease;
}
.icon-btn:hover { border-color: var(--teal); box-shadow: var(--glow-soft); transform: translateY(-1px); }
.lang-btn { font-size: .68rem; font-weight: 800; letter-spacing: .04em; }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 18px; border-radius: 18px; flex-wrap: wrap;
  background: var(--surface); backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; color: #06231f;
  background: var(--grad); display: grid; place-items: center;
  box-shadow: 0 0 26px -6px rgba(var(--teal-rgb), .7), inset 0 0 0 1px rgba(255, 255, 255, .25);
  transition: transform .25s ease;
}
.brand-mark:hover { transform: rotate(-6deg) scale(1.06); }
.brand-mark svg { width: 27px; height: 27px; }
.brand-text h1 {
  font-family: var(--serif); font-size: 1.4rem; font-weight: 800; letter-spacing: .01em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
body.light-ui .brand-text h1 { -webkit-text-fill-color: transparent; }
.brand-text p { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.provider-pills { display: flex; gap: 6px; }
.pill {
  font-size: .7rem; padding: 4px 10px; border-radius: 999px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); background: var(--surface-2); letter-spacing: .02em;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.on { border-color: rgba(var(--green-rgb), .45); color: var(--green); }
.pill.on .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-tint), 0 0 12px rgba(var(--green-rgb), .8); }
.pill.warn { border-color: rgba(var(--amber-rgb), .45); color: var(--amber); }
.pill.warn .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-tint); animation: pulse 1.2s infinite; }
.pill.off { opacity: .75; }
.pill.off .dot { background: var(--muted); }

.pipeline-chip {
  font-size: .73rem; font-weight: 700; padding: 6px 13px; border-radius: 999px;
  background: var(--slate-tint); color: var(--slate); display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line);
}
.pipeline-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--slate); }
.pipeline-chip.running {
  background: var(--amber-tint); color: var(--amber);
  border-color: rgba(var(--amber-rgb), .4);
}
.pipeline-chip.running .dot { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-tint); animation: pulse 1.1s infinite; }

/* ── View nav ── */
.viewnav {
  display: flex; gap: 5px; align-items: center; flex-wrap: wrap;
  padding: 7px; border-radius: 16px; margin-bottom: 16px;
  background: var(--surface); backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  position: sticky; top: 76px; z-index: 55;
}
.viewnav-btn {
  font-family: var(--sans); font-size: .76rem; font-weight: 600;
  padding: 7px 13px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .18s ease;
}
.viewnav-btn:hover { color: var(--ink); background: var(--teal-tint); }
.viewnav-btn.active {
  color: #04121a; background: var(--grad); box-shadow: 0 4px 18px -6px rgba(var(--teal-rgb), .6);
}
body.light-ui .viewnav-btn.active { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.viewnav-hint { margin-left: auto; font-size: .68rem; color: var(--muted); padding-right: 6px; }

/* ── Views ── */
.view { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Dashboard grid + cards ── */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat-card, .dash-card {
  position: relative; overflow: hidden;
  background: var(--surface); backdrop-filter: blur(14px) saturate(1.35);
  -webkit-backdrop-filter: blur(14px) saturate(1.35);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s;
}
.stat-card::after, .dash-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 160px at 85% -30%, var(--teal-tint), transparent 65%);
  opacity: 0; transition: opacity .3s;
}
.stat-card:hover, .dash-card:hover { transform: translateY(-3px); border-color: rgba(var(--teal-rgb), .45); box-shadow: var(--shadow), var(--glow-soft); }
.stat-card:hover::after, .dash-card:hover::after { opacity: 1; }
.dash-card h4 { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.dash-card h4 .ic { font-size: .9rem; }
.dash-sub { font-size: .74rem; color: var(--muted); margin-top: 6px; }
.dash-targets { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }
.dash-week { font-size: .72rem; color: var(--muted); margin-top: 8px; }
.dash-wide { grid-column: 1 / -1; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { cursor: pointer; padding: 14px 16px; }
.stat-card .st { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.stat-card .num { font-size: 1.7rem; font-weight: 800; margin-top: 4px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.light-ui .stat-card .num { -webkit-text-fill-color: transparent; }
.stat-card .sub { margin-top: 2px; }

/* ── Sweep strip / progress ── */
.sweep-strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 13px; margin-bottom: 14px;
  background: var(--amber-tint); border: 1px solid rgba(var(--amber-rgb), .4); font-size: .78rem;
}
.sweep-strip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px var(--amber-tint); animation: pulse 1.2s infinite; }
.sweep-strip.done { background: var(--green-tint); border-color: rgba(var(--green-rgb), .4); }
.sweep-strip.done .dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-tint); animation: none; }
.batch-progress { margin: 12px 0; }
.progress-note { font-size: .78rem; margin-bottom: 6px; display: flex; justify-content: space-between; }
.progress-bar {
  height: 10px; border-radius: 99px; overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line);
}
.progress-bar i {
  display: block; height: 100%; width: 0%;
  background: var(--grad); background-size: 200% 200%; animation: gradShift 4s linear infinite;
  box-shadow: 0 0 14px rgba(var(--teal-rgb), .7); transition: width .5s ease;
  border-radius: 99px;
}
.progress-conc { font-size: .72rem; color: var(--muted); margin-top: 5px; }

/* ── Controls / filters ── */
.controls {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.control-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--ink-soft); }
.field-inline select, .filters select, .filters input, .controls select, .controls input, .triage-toolbar input, .news-toolbar select {
  font-family: var(--sans); font-size: .78rem; color: var(--ink);
  padding: 7px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field-inline select:focus, .filters select:focus, .filters input:focus, .controls select:focus, .controls input:focus, .triage-toolbar input:focus, .news-toolbar select:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint);
}

.switch-label { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--ink-soft); cursor: pointer; }
.switch-label input { display: none; }
.switch {
  width: 34px; height: 19px; border-radius: 99px; position: relative;
  background: var(--surface-3); border: 1px solid var(--line); transition: all .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--muted); transition: all .2s;
}
.switch-label input:checked + .switch { background: var(--teal-tint); border-color: var(--teal); }
.switch-label input:checked + .switch::after { left: 17px; background: var(--teal); box-shadow: 0 0 8px rgba(var(--teal-rgb), .9); }

.bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 13px; margin-bottom: 12px;
  background: var(--violet-tint); border: 1px solid rgba(var(--violet-rgb), .4); font-size: .78rem;
  animation: fadeUp .3s ease both;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters input[type="search"] { flex: 1; min-width: 200px; }
.filter-count { font-size: .74rem; color: var(--muted); margin-left: auto; white-space: nowrap; }

.alert-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 13px; margin-bottom: 12px; font-size: .8rem; font-weight: 600;
  background: var(--red-tint); border: 1px solid rgba(var(--red-rgb), .45); color: var(--red);
  box-shadow: 0 6px 24px -12px rgba(var(--red-rgb), .5);
}
.alert-banner .btn { margin-left: auto; }

/* ── Tables ── */
.table-wrap {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
table { width: 100%; border-collapse: collapse; font-size: .8rem; }
thead th {
  text-align: left; font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 11px 12px; white-space: nowrap;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2; backdrop-filter: blur(8px);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .15s ease, box-shadow .2s; }
tbody tr:nth-child(even) { background: rgba(var(--slate-rgb), .04); }
tbody tr:hover { background: var(--teal-tint); box-shadow: inset 3px 0 0 var(--teal); }
tbody tr:last-child td { border-bottom: none; }
tbody tr.row-done { opacity: .55; }
tbody tr.row-blocked { background: var(--red-tint); }
.tbl { font-size: .78rem; }
.col-chk { width: 30px; }
.col-star { width: 30px; }
.col-chk input, .triage-toolbar input[type="checkbox"], .checkbox-inline input {
  accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer;
}
.row-chk { accent-color: var(--teal); }
.row-arrow { color: var(--muted); font-size: .85rem; cursor: pointer; transition: all .2s; }
tbody tr:hover .row-arrow { color: var(--teal); transform: translateX(3px); }

/* chips, tags, depth, age */
.tag {
  font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface-3);
}
.tag-verified { background: var(--green-tint); color: var(--green); border-color: rgba(var(--green-rgb), .45); box-shadow: 0 0 10px -4px rgba(var(--green-rgb), .7); }
.tag-pending { background: var(--amber-tint); color: var(--amber); border-color: rgba(var(--amber-rgb), .45); }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .68rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-3);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.badge.pending { color: var(--slate); }
.badge.pending .dot { background: var(--muted); }
.badge.l1 { color: var(--green); border-color: rgba(var(--green-rgb), .4); background: var(--green-tint); }
.badge.l1 .dot { background: var(--green); }
.badge.approved { color: var(--teal); border-color: rgba(var(--teal-rgb), .4); background: var(--teal-tint); }
.badge.approved .dot { background: var(--teal); }
.badge.blocked { color: var(--red); border-color: rgba(var(--red-rgb), .4); background: var(--red-tint); }
.badge.blocked .dot { background: var(--red); }
.badge.paused { color: var(--amber); border-color: rgba(var(--amber-rgb), .4); background: var(--amber-tint); }
.badge.paused .dot { background: var(--amber); }
.badge.warn { color: var(--amber); border-color: rgba(var(--amber-rgb), .4); background: var(--amber-tint); }
.badge.danger { color: var(--red); border-color: rgba(var(--red-rgb), .4); background: var(--red-tint); }
.badge.ok { color: var(--green); border-color: rgba(var(--green-rgb), .4); background: var(--green-tint); }

.depth-chip {
  font-size: .66rem; font-weight: 800; padding: 2px 8px; border-radius: 8px;
  font-family: var(--mono); letter-spacing: .02em; background: var(--surface-3); border: 1px solid var(--line); color: var(--muted);
}
.depth-chip.d0, .depth-chip.d1 { color: var(--slate); }
.depth-chip.d2 { color: var(--blue); background: var(--blue-tint); border-color: rgba(var(--blue-rgb), .4); }
.depth-chip.d3 { color: var(--green); background: var(--green-tint); border-color: rgba(var(--green-rgb), .45); box-shadow: 0 0 12px -4px rgba(var(--green-rgb), .8); }
.depth-chip.d4 { color: var(--teal); background: var(--teal-tint); border-color: rgba(var(--teal-rgb), .5); box-shadow: 0 0 14px -4px rgba(var(--teal-rgb), .9); }
.depth-row { display: inline-flex; align-items: center; gap: 6px; }

.age-fresh { color: var(--green); }
.age-ok { color: var(--ink-soft); }
.age-aging { color: var(--amber); }
.age-stale, .age-never { color: var(--red); font-weight: 700; }

.cell-main { font-weight: 600; }
.cell-sub { font-size: .72rem; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.clickable { cursor: pointer; }

/* star */
.star-btn { background: none; border: none; cursor: pointer; font-size: 1rem; padding: 2px; transition: transform .15s; }
.star-btn:hover { transform: scale(1.25); }
.starred { color: var(--amber); text-shadow: 0 0 10px rgba(var(--amber-rgb), .7); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 46px 20px; color: var(--muted); font-size: .84rem;
  border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 12px;
  background: var(--surface);
}
.empty .emoji { font-size: 2rem; opacity: .8; }

/* ── Opportunities ── */
.opps-head, .news-head, .admin-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 14px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow);
}
.opps-head h3, .news-head h3, .admin-head h3 { font-size: 1.02rem; font-weight: 800; }
.news-sub { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.news-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-hk-date { font-size: .78rem; font-family: var(--mono); color: var(--muted); }

.opps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.opp-card {
  background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .25s, border-color .2s;
  position: relative; overflow: hidden;
}
.opp-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad); opacity: 0; transition: opacity .25s;
}
.opp-card:hover { transform: translateY(-3px); border-color: rgba(var(--teal-rgb), .45); box-shadow: var(--shadow), var(--glow-soft); }
.opp-card:hover::before { opacity: 1; }
.opp-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.opp-name { font-size: .94rem; font-weight: 700; }
.opp-meta { font-size: .73rem; color: var(--muted); margin-top: 3px; }
.opp-score {
  font-family: var(--mono); font-weight: 800; font-size: 1.05rem; padding: 4px 11px;
  border-radius: 11px; background: var(--grad); color: #04121a; box-shadow: 0 4px 16px -6px rgba(var(--teal-rgb), .6);
}
body.light-ui .opp-score { color: #fff; }
.opp-why { font-size: .76rem; color: var(--ink-soft); margin-top: 10px; line-height: 1.6; }
.opp-main { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.opp-angle { font-size: .7rem; padding: 3px 9px; border-radius: 999px; background: var(--violet-tint); color: var(--violet); border: 1px solid rgba(var(--violet-rgb), .35); }
.opp-actions { display: flex; gap: 8px; margin-top: 13px; }
.opp-open { margin-left: auto; }
.opp-approve { color: var(--green); }
.opp-draft { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: .74rem; color: var(--muted); }

/* ── Drawer ── */
.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(4, 8, 18, .6); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px); animation: fadeIn .2s ease both;
}
body.light-ui .scrim { background: rgba(15, 23, 42, .35); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95; width: min(680px, 96vw);
  background: var(--surface); backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-left: 1px solid var(--line); box-shadow: -24px 0 70px -20px rgba(0, 0, 0, .65);
  display: flex; flex-direction: column;
  animation: slideIn .28s cubic-bezier(.22, .9, .3, 1) both;
}
body.light-ui .drawer { box-shadow: -24px 0 70px -30px rgba(15, 23, 42, .4); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 16px 18px 10px;
}
.drawer-kicker { font-size: .7rem; font-family: var(--mono); color: var(--teal); letter-spacing: .06em; margin-bottom: 3px; }
.drawer-head h2 { font-size: 1.18rem; font-weight: 800; }
.drawer-sub { font-size: .76rem; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.drawer-head-actions { display: flex; gap: 8px; }

.hist-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 4px 18px 8px; padding: 8px 12px; border-radius: 11px;
  background: var(--blue-tint); border: 1px solid rgba(var(--blue-rgb), .4);
  font-size: .76rem; color: var(--blue);
}
.hist-banner .btn { margin-left: auto; }

.drawer-tabs {
  display: flex; gap: 3px; overflow-x: auto; padding: 4px 14px 10px;
  border-bottom: 1px solid var(--line); scrollbar-width: none;
}
.drawer-tabs::-webkit-scrollbar { display: none; }
.drawer-tabs .tab, .news-tabs .tab {
  font-family: var(--sans); font-size: .76rem; font-weight: 600;
  padding: 7px 12px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--ink-soft); cursor: pointer;
  white-space: nowrap; transition: all .18s ease; position: relative;
}
.drawer-tabs .tab:hover, .news-tabs .tab:hover { color: var(--ink); background: var(--teal-tint); }
.drawer-tabs .tab.active, .news-tabs .tab.active {
  color: #04121a; background: var(--grad); box-shadow: 0 4px 16px -6px rgba(var(--teal-rgb), .6);
}
body.light-ui .drawer-tabs .tab.active, body.light-ui .news-tabs .tab.active { color: #fff; }

.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--surface-2); }
.drawer-kbhint { font-size: .68rem; color: var(--muted); text-align: center; padding: 7px; border-top: 1px solid var(--line); }

/* drawer blocks */
.blk { margin-bottom: 16px; }
.blk h4 { font-size: .82rem; font-weight: 800; margin-bottom: 9px; letter-spacing: .03em; display: flex; align-items: center; gap: 7px; }
.blk h4::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--grad); box-shadow: 0 0 8px rgba(var(--teal-rgb), .8); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: .8rem; }
.kv .lbl { color: var(--muted); font-size: .74rem; padding-top: 2px; }
.kv div { line-height: 1.55; }

.pending-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 11px; margin-bottom: 7px;
  background: var(--surface-3); border: 1px solid var(--line); font-size: .8rem;
  transition: border-color .18s;
}
.pending-row:hover { border-color: rgba(var(--teal-rgb), .4); }

/* B–D confirmation cards (v14.6) */
.bd-card { border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; margin-bottom: 10px; background: var(--surface-3); transition: border-color .2s, box-shadow .2s; }
.bd-card:hover { border-color: rgba(var(--teal-rgb), .35); }
.bd-card.done { border-color: rgba(var(--green-rgb), .5); background: var(--green-tint); box-shadow: 0 0 18px -8px rgba(var(--green-rgb), .8); }
.bd-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bd-head b { font-size: .86rem; }
.bd-meaning { font-size: .76rem; color: var(--ink-soft); margin-top: 5px; line-height: 1.55; }
.bd-q { font-size: .78rem; color: var(--teal); margin-top: 5px; background: var(--teal-tint); border-radius: 9px; padding: 6px 9px; line-height: 1.5; border: 1px solid rgba(var(--teal-rgb), .25); }
.bd-input { display: flex; gap: 8px; margin-top: 8px; }
.bd-input input {
  flex: 1; font-family: var(--sans); font-size: .8rem; padding: 7px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.bd-input input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }

/* source cards */
.src-card { padding: 11px 13px; border-radius: 12px; margin-bottom: 9px; background: var(--surface-3); border: 1px solid var(--line); transition: border-color .18s; }
.src-card:hover { border-color: rgba(var(--teal-rgb), .4); }
.src-type { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--blue); }
.src-url { font-size: .7rem; font-family: var(--mono); color: var(--muted); word-break: break-all; margin-top: 3px; }
.src-quote { font-size: .78rem; line-height: 1.6; margin-top: 7px; color: var(--ink-soft); border-left: 2px solid var(--teal); padding-left: 9px; }
.src-count { font-size: .7rem; color: var(--muted); }
.src-meta { font-size: .72rem; color: var(--muted); line-height: 1.6; }
.src-meta b { color: var(--ink-soft); }

/* flags */
.flag { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); }
.flag.warn { color: var(--amber); border-color: rgba(var(--amber-rgb), .4); background: var(--amber-tint); }
.flag.danger, .flag.blocked { color: var(--red); border-color: rgba(var(--red-rgb), .4); background: var(--red-tint); }
.flag.ok, .flag.pass, .flag.verified { color: var(--green); border-color: rgba(var(--green-rgb), .4); background: var(--green-tint); }
.flag.pending, .flag.hold { color: var(--slate); background: var(--slate-tint); }
.flag.reviewed, .flag.approved, .flag.sent, .flag.done { color: var(--teal); border-color: rgba(var(--teal-rgb), .4); background: var(--teal-tint); }
.flag.fail { color: var(--red); background: var(--red-tint); }
.flag.on, .flag.l1 { color: var(--green); background: var(--green-tint); }
.flag.off, .flag.arch { color: var(--muted); }

/* timeline (tl) */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--teal), var(--violet)); border-radius: 2px; opacity: .5; }
.tl-item { position: relative; margin-bottom: 13px; }
.tl-dot { position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--teal); box-shadow: 0 0 10px rgba(var(--teal-rgb), .8); }
.tl-time { font-size: .7rem; font-family: var(--mono); color: var(--muted); }
.tl-note { font-size: .78rem; margin-top: 2px; line-height: 1.55; }
.tl-body { font-size: .76rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; }

/* act list (timeline tab) */
.act-list { display: flex; flex-direction: column; gap: 9px; }
.act-line { display: flex; gap: 10px; font-size: .78rem; }
.act-text { flex: 1; line-height: 1.55; }
.act-text .sub { display: block; }
.act-tag { flex-shrink: 0; }

/* acc (audit list) */
.acc-list { display: flex; flex-direction: column; gap: 9px; }
.acc-item { padding: 10px 13px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line); font-size: .78rem; }
.acc-ic { margin-right: 7px; }
.acc-lbl { font-weight: 700; }
.acc-note { color: var(--muted); margin-top: 4px; font-size: .74rem; line-height: 1.55; }

/* audit line */
.audit-line { font-size: .74rem; padding: 6px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.audit-line:last-child { border-bottom: none; }
.audit-line .at { font-family: var(--mono); color: var(--muted); white-space: nowrap; }

/* quick actions */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-actions .btn { font-size: .74rem; }
.quick-verify { margin-left: auto; }

/* donut / rings / hbars */
.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut-total { font-size: 1.5rem; font-weight: 800; font-family: var(--mono); }
.rings { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ring { display: grid; grid-template-columns: 84px 1fr; gap: 10px; align-items: center; font-size: .76rem; }
.ring-num { font-family: var(--mono); font-weight: 700; text-align: right; }
.ring-goal { color: var(--muted); font-size: .7rem; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 88px 1fr 42px; gap: 10px; align-items: center; font-size: .74rem; }
.hbar-l { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-v { font-family: var(--mono); text-align: right; }
.hbar-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--line); }
.hbar-track i { display: block; height: 100%; background: var(--grad); border-radius: 99px; box-shadow: 0 0 10px rgba(var(--teal-rgb), .6); transition: width .6s ease; }

/* line chart / legend (generic spark) */
.line-chart { width: 100%; height: 90px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .72rem; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* week stats */
.week-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.week-stat { padding: 12px; border-radius: 13px; background: var(--surface-3); border: 1px solid var(--line); text-align: center; }
.week-stat .num { font-size: 1.4rem; font-weight: 800; display: block; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.light-ui .week-stat .num { -webkit-text-fill-color: transparent; }
.week-stat .lbl { font-size: .7rem; color: var(--muted); margin-top: 3px; display: block; }

/* compare */
.cmp-wrap { overflow-x: auto; }
.cmp-table { border-collapse: collapse; width: 100%; font-size: .78rem; }
.cmp-table th, .cmp-table td { padding: 9px 12px; border: 1px solid var(--line); vertical-align: top; text-align: left; }
.cmp-table th { background: var(--surface-2); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cmp-table td:first-child { color: var(--muted); white-space: nowrap; font-weight: 600; }

/* outreach / meet cards */
.outreach-grid, .meet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.outreach-card, .meet-card {
  background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .25s, border-color .2s;
}
.outreach-card:hover, .meet-card:hover { transform: translateY(-3px); border-color: rgba(var(--teal-rgb), .45); box-shadow: var(--shadow), var(--glow-soft); }
.outreach-card h4, .meet-card h4 { font-size: .92rem; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.outreach-card .sub, .meet-card .sub { margin-bottom: 8px; }
.outreach-draft-btn { font-size: .7rem; padding: 3px 9px; border-radius: 8px; background: var(--violet-tint); color: var(--violet); border: 1px solid rgba(var(--violet-rgb), .35); cursor: pointer; transition: all .18s; }
.outreach-draft-btn:hover { box-shadow: 0 0 12px -4px rgba(var(--violet-rgb), .8); }
.meet-date { font-size: .78rem; font-family: var(--mono); color: var(--teal); margin: 6px 0; }
.meet-status { margin-left: auto; }
.meet-attendee { font-size: .76rem; margin: 4px 0; }
.meet-purpose { font-size: .76rem; color: var(--ink-soft); line-height: 1.55; margin: 6px 0; }
.meet-notes { font-size: .76rem; margin-top: 8px; }
.meet-form { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.meet-form input { flex: 1; min-width: 120px; font-family: var(--sans); font-size: .76rem; padding: 6px 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); outline: none; }
.meet-form input:focus { border-color: var(--teal); }
.meet-save { font-size: .74rem; }

/* news */
.news-tabs { display: flex; gap: 3px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.news-tabs::-webkit-scrollbar { display: none; }
.news-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.news-list { display: flex; flex-direction: column; gap: 10px; }
.news-stories { display: flex; flex-direction: column; gap: 10px; }
.news-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.story-card {
  background: var(--surface); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .25s, border-color .2s;
}
.story-card:hover { transform: translateY(-2px); border-color: rgba(var(--teal-rgb), .4); box-shadow: var(--shadow), var(--glow-soft); }
.story-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 5px; }
.story-rank { font-family: var(--mono); font-weight: 800; color: var(--teal); font-size: .86rem; }
.story-head { font-size: .9rem; font-weight: 700; }
.story-head-en { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.story-sum { font-size: .78rem; color: var(--ink-soft); line-height: 1.6; margin-top: 7px; }
.story-meta { font-size: .7rem; color: var(--muted); margin-top: 7px; display: flex; gap: 8px; flex-wrap: wrap; }
.story-note { font-size: .74rem; color: var(--amber); margin-top: 6px; }
.story-top .lane { font-size: .66rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.lane.memoria { background: var(--teal-tint); color: var(--teal); }
.lane.corehawk { background: var(--violet-tint); color: var(--violet); }
.lane.general { background: var(--slate-tint); color: var(--slate); }
.lane.cross-brand { background: var(--amber-tint); color: var(--amber); }
.ev.type { display: inline-flex; }
.why-chip { font-size: .68rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); color: var(--muted); }

/* drafts */
.draft-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.draft-tab { font-size: .74rem; padding: 5px 11px; border-radius: 9px; border: 1px solid var(--line); background: transparent; color: var(--ink-soft); cursor: pointer; font-weight: 600; transition: all .18s; }
.draft-tab.active { background: var(--grad); color: #04121a; border-color: transparent; }
body.light-ui .draft-tab.active { color: #fff; }
.draft-body { display: flex; flex-direction: column; gap: 10px; }
.draft-card {
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px;
}
.draft-subj { font-weight: 700; font-size: .82rem; margin-bottom: 6px; }
.draft-lang { font-size: .68rem; color: var(--muted); margin-bottom: 4px; }
.draft-text { font-size: .78rem; line-height: 1.65; color: var(--ink-soft); white-space: pre-wrap; }
.draft-copy { font-size: .72rem; }

/* providers list (settings) */
.prov-list { display: flex; flex-direction: column; gap: 9px; }
.prov-row { display: flex; gap: 10px; align-items: center; padding: 10px 13px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line); font-size: .78rem; flex-wrap: wrap; }
.prov-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.prov-row.on .prov-dot { background: var(--green); box-shadow: 0 0 10px rgba(var(--green-rgb), .9); }
.prov-model { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.prov-last { font-size: .7rem; color: var(--muted); }
.prov-test { margin-left: auto; }
.pipe-row { display: flex; gap: 8px; align-items: center; font-size: .78rem; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.pipe-row:last-child { border-bottom: none; }
.pipe-row .st { font-family: var(--mono); font-size: .7rem; color: var(--muted); min-width: 130px; }
.pipe-row .status { font-weight: 700; }
.pipe-row .status.on { color: var(--green); }
.pipe-row .status.off { color: var(--muted); }

/* queue progress (settings) */
.queue-progress { margin: 8px 0; }
.qp-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; border: 1px solid var(--line); }
.qp-bar i { display: block; height: 100%; background: var(--grad); transition: width .5s; }

/* settings */
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.setting-row:last-child { border-bottom: none; }
.setting-row .lbl { font-size: .8rem; font-weight: 600; }
.setting-row .sub { font-size: .72rem; }

/* admin */
.admin-body { display: flex; flex-direction: column; gap: 12px; }
.acc-item p { margin-top: 4px; }

/* ── Modals ── */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 96; width: min(680px, 94vw); max-height: 84vh; display: flex; flex-direction: column;
  background: var(--surface); backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .7);
  animation: popIn .24s cubic-bezier(.22, .9, .3, 1) both;
}
body.light-ui .modal { box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .35); }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.modal-sm { width: min(440px, 94vw); }
.modal-wide { width: min(1080px, 96vw); }
.modal-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: .98rem; font-weight: 800; }
.modal-body { padding: 16px 18px; overflow-y: auto; }

/* ── Toasts ── */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 9px; }
.toast {
  padding: 11px 16px; border-radius: 13px; font-size: .8rem; font-weight: 600;
  background: var(--surface); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: toastIn .25s cubic-bezier(.22, .9, .3, 1) both; max-width: 340px;
}
.toast.ok { border-color: rgba(var(--green-rgb), .5); box-shadow: 0 8px 30px -10px rgba(var(--green-rgb), .6); }
.toast.err { border-color: rgba(var(--red-rgb), .5); box-shadow: 0 8px 30px -10px rgba(var(--red-rgb), .6); }
.toast.info { border-color: rgba(var(--blue-rgb), .5); }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* ── Login ── */
.login {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center;
  background:
    radial-gradient(800px 480px at 78% 12%, rgba(var(--teal-rgb), .16), transparent 60%),
    radial-gradient(700px 460px at 10% 85%, rgba(129, 140, 248, .14), transparent 60%),
    var(--paper);
}
.login-card {
  width: min(380px, 92vw); padding: 30px 28px; border-radius: 24px;
  background: var(--surface); backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid var(--line); box-shadow: 0 30px 90px -24px rgba(0, 0, 0, .7);
  animation: popIn .3s cubic-bezier(.22, .9, .3, 1) both;
}
body.light-ui .login-card { box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .3); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .brand-mark { width: 60px; height: 60px; border-radius: 18px; margin: 0 auto 14px; }
.login-brand .brand-mark svg { width: 36px; height: 36px; }
.login-brand h1 { font-family: var(--serif); font-size: 1.25rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-brand .sub { margin-top: 6px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; }
.login-card input[type="password"] {
  font-family: var(--sans); font-size: .9rem; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.login-card input[type="password"]:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-tint); }
.login-err { font-size: .76rem; color: var(--red); text-align: center; }
.login-hint { font-size: .7rem; color: var(--muted); text-align: center; margin-top: 14px; }

/* ── misc ── */
.news-preview-pane { margin: 10px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.news-preview-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: .8rem; }
.news-preview-frame { width: 100%; height: 60vh; border: none; background: #fff; }
.reason-text { font-size: .76rem; color: var(--ink-soft); line-height: 1.55; }
.reason-text .sub { display: block; margin-top: 2px; }
.triage-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 14px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; }
.triage-reason { font-size: .74rem; color: var(--ink-soft); line-height: 1.5; }
.triage-chk { accent-color: var(--teal); }
.v1-research { background: var(--amber-tint); border-color: rgba(var(--amber-rgb), .4); }
.warn-note { font-size: .76rem; color: var(--amber); background: var(--amber-tint); border: 1px solid rgba(var(--amber-rgb), .35); padding: 9px 12px; border-radius: 11px; line-height: 1.55; }
.hist-diff { font-size: .74rem; color: var(--blue); background: var(--blue-tint); border: 1px solid rgba(var(--blue-rgb), .35); padding: 9px 12px; border-radius: 11px; line-height: 1.55; white-space: pre-wrap; }
.arch { opacity: .65; }
.danger { color: var(--red); }
.warn { color: var(--amber); }
.on { color: var(--green); }
.off { color: var(--muted); }
.zh { font-family: var(--serif); }
.en { font-family: var(--sans); }
.tm { font-size: .7rem; font-family: var(--mono); color: var(--muted); }
.lbl { font-size: .72rem; color: var(--muted); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ── Responsive ── */
@media (max-width: 900px) {
  .app { padding: 12px 14px 60px; }
  .viewnav { position: static; }
  .topbar { position: static; }
  .brand-text p { display: none; }
  .viewnav-hint { display: none; }
  .dash-grid, .opps-grid, .outreach-grid, .meet-grid, .news-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 92px 1fr; }
  .drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Warm theme (legacy cycle keeps working) ── */
/* ── v14.8: B–D full evaluation rows ── */
.bd-why {
  font-size: .76rem; color: var(--amber); margin-top: 5px; line-height: 1.55;
  background: var(--amber-tint); border-radius: 9px; padding: 6px 9px;
  border: 1px solid rgba(var(--amber-rgb), .25);
}
.bd-impact {
  font-size: .76rem; color: var(--red); margin-top: 5px; line-height: 1.55;
  background: var(--red-tint); border-radius: 9px; padding: 6px 9px;
  border: 1px solid rgba(var(--red-rgb), .25);
}
.bd-card.done .bd-why, .bd-card.done .bd-impact { opacity: .55; }

/* ═══════════════ v17 — bell, clock, contacts, notes, health, heatmap + polish ═══════════════ */

/* ── topbar: gradient hairline + clock + bell ── */
.topbar { border-bottom: 1px solid transparent; background-image: linear-gradient(var(--surface), var(--surface)), linear-gradient(90deg, rgba(var(--teal-rgb),.5), rgba(56,189,248,.35), rgba(var(--violet-rgb),.5)); background-origin: border-box; background-clip: padding-box, border-box; }
.hk-clock { font-size: .74rem; color: var(--ink-soft); letter-spacing: .08em; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-3); box-shadow: inset 0 0 12px -6px var(--teal-tint); }
.bell-btn { position: relative; }
.bell-dot { position: absolute; top: -3px; right: -3px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 99px; background: var(--grad); color: #fff; font-size: .58rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 10px rgba(var(--teal-rgb),.8); animation: bellPulse 2s ease-in-out infinite; }
@keyframes bellPulse { 0%,100% { box-shadow: 0 0 6px rgba(var(--teal-rgb),.5); } 50% { box-shadow: 0 0 14px rgba(var(--teal-rgb),1); } }
.bell-panel { position: fixed; top: 58px; right: 14px; width: min(400px, calc(100vw - 28px)); max-height: min(520px, 70vh); overflow-y: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow), 0 20px 60px -20px rgba(0,0,0,.6); z-index: 60; backdrop-filter: blur(18px); padding: 10px; animation: popIn .18s ease; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px; border-radius: 12px; transition: background .15s ease; }
.bell-item:hover { background: var(--surface-3); }
.bell-item.unread { background: var(--teal-tint); }
.bell-item.unread .bell-title { color: var(--ink); }
.bell-ic { font-size: 1rem; line-height: 1.4; }
.bell-body { flex: 1; min-width: 0; }
.bell-title { font-size: .8rem; font-weight: 600; color: var(--ink-soft); line-height: 1.45; }
.bell-sub { font-size: .72rem; color: var(--muted); margin-top: 2px; }
.bell-at { font-size: .66rem; color: var(--muted); margin-top: 3px; opacity: .8; }
.bell-empty { padding: 26px 10px; text-align: center; color: var(--muted); font-size: .8rem; }

/* ── viewnav: scrollable + active gradient pill ── */
.viewnav { overflow-x: auto; scrollbar-width: none; }
.viewnav::-webkit-scrollbar { display: none; }
.viewnav-btn.active { background: var(--grad-soft); border-color: rgba(var(--teal-rgb),.45); box-shadow: inset 0 -2px 0 var(--teal); }

/* ── dashboard cards: hover lift + stagger entrance ── */
.dash-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; animation: fadeUp .4s ease both; }
.dash-card:nth-child(2) { animation-delay: .04s; } .dash-card:nth-child(3) { animation-delay: .08s; }
.dash-card:nth-child(4) { animation-delay: .12s; } .dash-card:nth-child(5) { animation-delay: .16s; }
.dash-card:nth-child(6) { animation-delay: .2s; } .dash-card:nth-child(7) { animation-delay: .24s; }
.dash-card:nth-child(8) { animation-delay: .28s; }
.dash-card:hover { transform: translateY(-2px); border-color: rgba(var(--teal-rgb),.35); box-shadow: var(--shadow), 0 12px 34px -14px rgba(var(--teal-rgb),.35); }

/* ── coverage grid ── */
.coverage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.cov-row { display: grid; grid-template-columns: 74px 1fr 44px 40px; gap: 8px; align-items: center; padding: 6px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-3); cursor: pointer; text-align: left; font-family: var(--sans); color: var(--ink); transition: all .15s ease; }
.cov-row:hover { border-color: rgba(var(--teal-rgb),.5); box-shadow: var(--glow-soft); transform: translateY(-1px); }
.cov-name { font-size: .72rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cov-track { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.cov-track i { display: block; height: 100%; border-radius: 99px; transition: width .5s ease; }
.cov-num { font-size: .7rem; color: var(--ink-soft); font-family: var(--mono); text-align: right; }
.cov-pct { font-size: .66rem; font-weight: 800; text-align: right; font-family: var(--mono); }
.cov-pct.ok { color: var(--green); } .cov-pct.mid { color: var(--teal); } .cov-pct.low { color: var(--amber); }

/* ── research heatmap ── */
.heatmap-wrap { overflow-x: auto; padding-bottom: 4px; }
.heatmap { display: flex; gap: 3px; }
.hm-col { display: flex; flex-direction: column; gap: 3px; }
.hm-cell { width: 11px; height: 11px; border-radius: 3px; background: var(--surface-3); border: 1px solid var(--line); transition: transform .12s ease; }
.hm-cell:hover { transform: scale(1.35); }
.hm-cell.l1 { background: rgba(var(--teal-rgb),.35); border-color: rgba(var(--teal-rgb),.5); }
.hm-cell.l2 { background: rgba(var(--teal-rgb),.65); border-color: rgba(var(--teal-rgb),.8); box-shadow: 0 0 6px rgba(var(--teal-rgb),.5); }
.hm-cell.l3 { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 9px rgba(var(--teal-rgb),.85); }
.hm-legend { display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; font-size: .66rem; color: var(--muted); }
.hm-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; background: var(--surface-3); border: 1px solid var(--line); }
.hm-legend i:nth-child(2) { background: rgba(var(--teal-rgb),.35); border-color: rgba(var(--teal-rgb),.5); }
.hm-legend i:nth-child(3) { background: rgba(var(--teal-rgb),.65); }
.hm-legend i:nth-child(4) { background: var(--teal); box-shadow: 0 0 6px rgba(var(--teal-rgb),.8); }

/* ── contacts hub ── */
.contact-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.contact-stat { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; animation: fadeUp .35s ease both; }
.contact-stat:nth-child(2) { animation-delay: .05s; } .contact-stat:nth-child(3) { animation-delay: .1s; } .contact-stat:nth-child(4) { animation-delay: .15s; }
.cs-ic { font-size: 1.15rem; }
.cs-num { font-size: 1.3rem; font-weight: 800; font-family: var(--mono); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cs-lbl { font-size: .68rem; color: var(--muted); }
.contacts-cell { display: flex; flex-wrap: wrap; gap: 5px; max-width: 260px; }
.ct-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-family: var(--mono); padding: 3px 8px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--line); cursor: pointer; transition: all .13s ease; max-width: 100%; }
.ct-chip i { font-style: normal; opacity: .55; font-size: .64rem; }
.ct-chip:hover { border-color: rgba(var(--teal-rgb),.55); color: var(--teal); box-shadow: var(--glow-soft); }
.ct-chip.ct-link:hover { color: var(--blue); border-color: rgba(var(--blue-rgb),.55); }

/* ── notes feed ── */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.note-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; animation: fadeUp .35s ease both; display: flex; flex-direction: column; gap: 9px; }
.note-card:hover { transform: translateY(-2px); border-color: rgba(var(--teal-rgb),.4); box-shadow: var(--shadow), 0 10px 30px -14px rgba(var(--teal-rgb),.35); }
.note-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.note-body { font-size: .8rem; color: var(--ink-soft); line-height: 1.6; white-space: pre-wrap; word-break: break-word; background: var(--surface-3); border-radius: 10px; padding: 9px 11px; border: 1px solid var(--line); }
.note-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; }
.meet-chip { font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.meet-chip.booked { color: var(--blue); background: var(--blue-tint); border: 1px solid rgba(var(--blue-rgb),.4); }
.meet-chip.done { color: var(--green); background: var(--green-tint); border: 1px solid rgba(var(--green-rgb),.4); }
.meet-chip.draft { color: var(--slate); background: var(--slate-tint); border: 1px solid var(--line); }
.meet-chip.nointerest { color: var(--red); background: var(--red-tint); border: 1px solid rgba(var(--red-rgb),.4); }

/* ── admin health ── */
.health-rows { display: grid; gap: 6px; }
.health-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: .76rem; padding: 7px 10px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line); }
.health-row > span:first-child { color: var(--muted); font-weight: 600; }
.health-val { color: var(--ink-soft); text-align: right; }
.health-logs { margin-top: 10px; }
.health-logs b { font-size: .7rem; color: var(--muted); letter-spacing: .05em; }
.health-logs .audit-line { font-size: .68rem; color: var(--ink-soft); padding: 3px 0; border-bottom: 1px dashed var(--line); }
.health-card h4 { justify-content: space-between; }

/* ── queue row quick actions + deep chip ── */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .15s ease; }
tr:hover .row-actions { opacity: 1; }
.qa-btn { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-3); color: var(--ink-soft); font-size: .72rem; text-decoration: none; cursor: pointer; transition: all .13s ease; }
.qa-btn:hover { color: var(--teal); border-color: rgba(var(--teal-rgb),.5); box-shadow: var(--glow-soft); transform: translateY(-1px); }
a.qa-btn[href^="mailto"]:hover { color: var(--amber); border-color: rgba(var(--amber-rgb),.5); }
.deep-chip { display: inline-block; font-size: .6rem; font-weight: 700; color: var(--violet); background: var(--violet-tint); border: 1px solid rgba(var(--violet-rgb),.4); border-radius: 99px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }

/* ── drawer sparkline ── */
.spark-blk h4 { margin-bottom: 6px; }
.spark-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--line); }
.spark-row svg { max-width: 100%; height: auto; }
.spark-delta { display: flex; flex-direction: column; font-size: .74rem; }
.spark-delta b { font-family: var(--mono); }
.spark-delta span { font-size: .68rem; font-weight: 800; }
.spark-delta.good span { color: var(--green); }
.spark-delta.bad span { color: var(--red); }
.spark-delta.flat span { color: var(--muted); }

/* ── table polish: row hover glow + focus rings ── */
.tbl tbody tr { transition: background .14s ease, box-shadow .14s ease; }
.tbl tbody tr:hover { background: var(--teal-tint); box-shadow: inset 3px 0 0 var(--teal); }
.clickable-row { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid rgba(var(--teal-rgb),.6); outline-offset: 2px; border-radius: 8px; }
.topbar .brand-mark { animation: markGlow 3.5s ease-in-out infinite; }
@keyframes markGlow { 0%,100% { filter: drop-shadow(0 0 4px rgba(var(--teal-rgb),.45)); } 50% { filter: drop-shadow(0 0 12px rgba(var(--teal-rgb),.9)); } }

/* ── contacts table: fixed columns, truncating chips ── */
.contact-tbl { table-layout: fixed; }
.contact-tbl th, .contact-tbl td { overflow: hidden; }
.contact-tbl td { vertical-align: top; }
.contacts-cell { display: table-cell !important; max-width: 100%; }
.ct-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 1px 2px 1px 0; vertical-align: middle; }
.contact-tbl .row-arrow { text-align: right; }

/* ═══════════════ v18 — AI assistant, voice notes, TTS, cover art ═══════════════ */
.ai-panel { position: fixed; top: 58px; right: 62px; width: min(430px, calc(100vw - 28px)); max-height: min(600px, 76vh); display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow), 0 20px 60px -20px rgba(0,0,0,.6); z-index: 60; backdrop-filter: blur(18px); animation: popIn .18s ease; overflow: hidden; }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(var(--teal-rgb),.08), rgba(var(--violet-rgb),.08)); }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.ai-chip { font-size: .72rem; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-3); color: var(--ink-soft); cursor: pointer; transition: all .13s ease; }
.ai-chip:hover { color: var(--teal); border-color: rgba(var(--teal-rgb),.5); box-shadow: var(--glow-soft); }
.ai-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.ai-hint { font-size: .78rem; color: var(--muted); text-align: center; padding: 24px 10px; }
.ai-msg { max-width: 92%; padding: 8px 12px; border-radius: 12px; font-size: .8rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.ai-msg.user { align-self: flex-end; background: var(--teal-tint); border: 1px solid rgba(var(--teal-rgb),.35); border-bottom-right-radius: 4px; }
.ai-msg.bot { align-self: flex-start; background: var(--surface-3); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-think { color: var(--muted); font-style: italic; }
.ai-ans { color: var(--ink); }
.ai-srcs { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.ai-src { font-size: .68rem; padding: 2px 9px; border-radius: 99px; border: 1px solid rgba(var(--teal-rgb),.4); background: var(--teal-tint); color: var(--teal); cursor: pointer; transition: all .13s ease; }
.ai-src:hover { box-shadow: var(--glow-soft); }
.ai-meta { margin-top: 6px; font-size: .62rem; color: var(--muted); }
.ai-input-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.ai-input-row input { flex: 1; font-size: .82rem; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); outline: none; }
.ai-input-row input:focus { border-color: rgba(var(--teal-rgb),.6); box-shadow: var(--glow-soft); }
.ai-dot { position: absolute; top: -2px; right: -2px; min-width: 15px; height: 15px; border-radius: 99px; background: var(--violet); color: #fff; font-size: .58rem; font-weight: 800; display: grid; place-items: center; padding: 0 3px; box-shadow: 0 0 10px rgba(var(--violet-rgb),.8); }
.btn.recording { background: var(--red-tint, rgba(248,113,113,.15)); color: var(--red); border-color: rgba(248,113,113,.5); animation: recPulse 1.2s ease-in-out infinite; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(248,113,113,.35); } 50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); } }
.btn.speaking { color: var(--teal); border-color: rgba(var(--teal-rgb),.6); box-shadow: var(--glow-soft); }
.news-cover { width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ═══════════════════════════════════════════════════════════════
   v20 — beauty pass: SVG icon set, command palette, KPI hero,
   needs-attention panel, recent strip, skeletons, micro-motion
   ═══════════════════════════════════════════════════════════════ */

/* ── unified icon sizing ── */
.viewnav-btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; }
.bell-btn, .ai-btn { position: relative; }
.viewnav-btn { position: relative; }
.viewnav-btn.active svg { stroke: currentColor; }
/* active tile: subtle raised look */
.viewnav-btn.active::after {
  content: ""; position: absolute; inset: -1px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,.25), transparent 55%);
  pointer-events: none; opacity: .5;
}

/* ── command palette (Ctrl+K) ── */
.palette-scrim {
  position: fixed; inset: 0; z-index: 140; background: rgba(2, 6, 16, .55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .15s ease both;
}
.palette {
  position: fixed; top: 12vh; left: 50%; transform: translateX(-50%);
  width: min(620px, 94vw); z-index: 141; border-radius: 20px; overflow: hidden;
  background: var(--surface-2); backdrop-filter: blur(26px) saturate(1.5);
  -webkit-backdrop-filter: blur(26px) saturate(1.5);
  border: 1px solid var(--line); box-shadow: 0 34px 90px -22px rgba(0, 0, 0, .75);
  animation: paletteIn .2s cubic-bezier(.22, .9, .3, 1) both;
}
body.light-ui .palette { box-shadow: 0 30px 80px -26px rgba(15, 23, 42, .35); }
@keyframes paletteIn { from { opacity: 0; transform: translate(-50%, -10px) scale(.98); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
.palette-input-wrap {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.palette-input-wrap svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette-input-wrap input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: var(--sans); font-size: .95rem; color: var(--ink);
}
.palette-input-wrap input::placeholder { color: var(--muted); }
.palette-input-wrap kbd {
  font-family: var(--mono); font-size: .66rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; background: var(--surface-3);
}
.palette-input-wrap kbd { margin-left: auto; }
.palette-groups { max-height: 52vh; overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.palette-groups::-webkit-scrollbar { width: 5px; }
.palette-groups::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; }
.palette-group-label {
  font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 10px 10px 4px;
}
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; color: var(--ink); cursor: pointer; font-family: var(--sans); font-size: .82rem;
  transition: background .12s ease;
}
.palette-item:hover { background: var(--surface-3); }
.palette-item.sel { background: var(--teal-tint); border-color: rgba(var(--teal-rgb), .35); }
.palette-item .pi-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--surface-3); color: var(--teal); }
.palette-item .pi-ico svg { width: 14px; height: 14px; }
.palette-item .pi-main { flex: 1; min-width: 0; line-height: 1.45; }
.palette-item .pi-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-sub { font-size: .7rem; color: var(--ink-soft); opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-kbd { font-family: var(--mono); font-size: .66rem; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; flex: none; }
.palette-group-label .pi-count { font-family: var(--mono); font-size: .64rem; color: var(--teal); background: var(--teal-tint); border-radius: 99px; padding: 1px 7px; margin-left: 4px; }
.palette-hint {
  display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line);
  font-size: .68rem; color: var(--muted);
}
.palette-hint span::before { content: ""; display: none; }

/* ── dashboard KPI hero ── */
.kpi-hero {
  grid-column: 1 / -1; display: grid; gap: 12px; margin-bottom: 2px;
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 1100px) { .kpi-hero { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); } }
.kpi-card {
  position: relative; overflow: hidden; border-radius: 18px; padding: 15px 16px 13px;
  background: var(--surface); backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.kpi-card:hover { transform: translateY(-3px); border-color: rgba(var(--teal-rgb), .4); box-shadow: var(--glow-soft); }
.kpi-card .kpi-num { font-size: 1.55rem; font-weight: 800; font-family: var(--mono); letter-spacing: -.02em; }
.kpi-card .kpi-lbl { font-size: .72rem; color: var(--muted); margin-top: 2px; font-weight: 600; }
.kpi-card .kpi-ico { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; background: var(--grad-soft); color: var(--teal); }
.kpi-card.kpi-green .kpi-ico { background: var(--green-tint); color: var(--green); }
.kpi-card.kpi-red .kpi-ico { background: var(--red-tint); color: var(--red); }
.kpi-card.kpi-blue .kpi-ico { background: var(--blue-tint); color: var(--blue); }
.kpi-card.kpi-slate .kpi-ico { background: var(--slate-tint); color: var(--slate); }
.kpi-card .kpi-ico svg { width: 15px; height: 15px; }
.kpi-card.kpi-teal .kpi-num { color: var(--teal); }
.kpi-card.kpi-green .kpi-num { color: var(--green); }
.kpi-card.kpi-amber .kpi-num { color: var(--amber); }
.kpi-card.kpi-red .kpi-num { color: var(--red); }
.kpi-card.kpi-blue .kpi-num { color: var(--blue); }
.kpi-card.kpi-violet .kpi-num { color: var(--violet); }
.kpi-card::after { /* sheen sweep on hover */
  content: ""; position: absolute; top: 0; left: -80%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.09), transparent);
  transform: skewX(-18deg); transition: left .5s ease; pointer-events: none;
}
.kpi-card:hover::after { left: 130%; }

/* ── needs-attention panel ── */
.attention-card { grid-column: 1 / -1; }
.attention-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.att-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-3); cursor: pointer; font-family: var(--sans); font-size: .8rem;
  transition: border-color .15s ease, transform .15s ease;
}
.att-row .att-id { min-width: 118px; }
.att-row:hover { border-color: rgba(var(--red-rgb), .45); transform: translateX(3px); }
.att-row .att-id { font-family: var(--mono); font-size: .7rem; color: var(--muted); flex: none; }
.att-row .att-name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-row .att-reason { font-size: .68rem; color: var(--amber); flex: none; }
.att-row .att-score { font-family: var(--mono); font-size: .7rem; color: var(--red); flex: none; font-weight: 700; }
.att-empty { font-size: .78rem; color: var(--muted); padding: 12px 4px; }

/* ── recent-viewed strip ── */
.recent-strip { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 2px 0 0; }
.recent-strip .recent-lbl { font-size: .72rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.recent-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  font-size: .74rem; font-weight: 600; color: var(--ink-soft); cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--line);
  transition: all .15s ease;
}
.recent-chip:hover { color: var(--teal); border-color: rgba(var(--teal-rgb), .45); transform: translateY(-1px); }
.recent-chip .rc-ico { font-size: .8rem; }

/* ── category donut row ── */
.type-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.type-row .type-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.type-row .type-name { flex: 1; font-size: .78rem; }
.type-row .type-count { font-family: var(--mono); font-size: .8rem; font-weight: 700; }

/* ── skeleton loading ── */
.skel {
  position: relative; overflow: hidden; background: var(--surface-3);
  border-radius: 12px; min-height: 72px;
}
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.07) 50%, transparent 70%);
  animation: skelShine 1.4s infinite;
}
@keyframes skelShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ── drawer star (kept separate from .star-btn to avoid table rebinding) ── */
.drawer-star { background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--ink-soft); padding: 2px; transition: transform .15s; }
.drawer-star:hover { transform: scale(1.2); color: var(--amber); }
[data-theme="dark"] .drawer-star { color: var(--slate); }
[data-theme="dark"] .drawer-star:hover, .drawer-star.on { color: var(--amber); }
.drawer-star.on { color: var(--amber); text-shadow: 0 0 12px rgba(var(--amber-rgb), .6); }

/* ── card hover lift (dashboard cards) ── */
.dash-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.dash-card:hover { transform: translateY(-2px); border-color: rgba(var(--teal-rgb), .32); }

/* ── toast icons + progress ── */
.toast { display: flex; align-items: flex-start; gap: 8px; position: relative; overflow: hidden; }
.toast .t-ico { font-size: .9rem; line-height: 1.3; flex: none; }
.toast::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--teal); transform-origin: left; animation: toastBar 4.2s linear both;
}
.toast.ok::after { background: var(--green); }
.toast.err::after { background: var(--red); }
.toast.info::after { background: var(--blue); }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ── print stylesheet: briefs export cleanly ── */
@media print {
  body { background: #fff !important; color: #000 !important; }
  header, .viewnav, .toasts, .palette, .palette-scrim, .drawer-kbhint,
  .topbar-right, .pipeline-chip, .icon-btn, .btn, .row-actions { display: none !important; }
  body::before, body::after { display: none !important; }
  .view { display: block !important; animation: none !important; }
  .drawer { position: static !important; transform: none !important; width: 100% !important;
    box-shadow: none !important; border: none !important; background: #fff !important; }
  .dash-card, .stat-card, .kpi-card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; background: #fff !important; }
  a { color: #000 !important; text-decoration: none; }
  .mono, .cell-sub { color: #333 !important; }
}

/* ═══════════════════════════════════════════════════════════════
   v21 — 10-theme system. Each theme defines its own palette, rgb
   triplets (for rgba(var(--x-rgb), a) glows) and aurora backdrop.
   dark-ui / light-ui classes on <body> drive component tweaks.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Midnight 午夜 (default, deep-space neon) ── */
[data-theme="midnight"] {
  --paper: #060a14; --surface: rgba(15, 23, 42, .66); --surface-2: #0d1526; --surface-3: rgba(30, 41, 66, .5);
  --ink: #e8edf7; --ink-soft: #a8b3cc; --muted: #66718c; --line: rgba(148, 163, 205, .16);
  --teal: #2dd4bf; --teal-deep: #14b8a6; --teal-tint: rgba(var(--teal-rgb), .13);
  --amber: #fbbf24; --amber-tint: rgba(var(--amber-rgb), .13);
  --green: #34d399; --green-tint: rgba(var(--green-rgb), .13);
  --red: #fb7185; --red-tint: rgba(var(--red-rgb), .13);
  --slate: #93a4c3; --slate-tint: rgba(var(--slate-rgb), .13);
  --blue: #60a5fa; --blue-tint: rgba(var(--blue-rgb), .13);
  --violet: #a78bfa; --violet-tint: rgba(var(--violet-rgb), .13);
  --teal-rgb: 45, 212, 191; --amber-rgb: 251, 191, 36; --green-rgb: 52, 211, 153;
  --red-rgb: 251, 113, 133; --blue-rgb: 96, 165, 250; --violet-rgb: 167, 139, 250; --slate-rgb: 148, 163, 205;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45), 0 14px 44px -14px rgba(0, 0, 0, .65);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .35), 0 0 26px -6px rgba(var(--teal-rgb), .6);
  --glow-soft: 0 8px 30px -10px rgba(var(--teal-rgb), .4);
  --grad: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 45%, #818cf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .16), rgba(var(--violet-rgb), .16));
  --aurora-1: rgba(45, 212, 191, .16); --aurora-2: rgba(129, 140, 248, .14); --aurora-3: rgba(56, 189, 248, .1);
  color-scheme: dark;
}

/* ── 2. Aurora 極光 (deep teal-emerald) ── */
[data-theme="aurora"] {
  --paper: #04110e; --surface: rgba(13, 34, 30, .72); --surface-2: #081f1a; --surface-3: rgba(20, 48, 42, .5);
  --ink: #e4f5ef; --ink-soft: #9ec4b8; --muted: #5f8a7d; --line: rgba(110, 190, 165, .16);
  --teal: #34d399; --teal-deep: #10b981; --teal-tint: rgba(var(--teal-rgb), .13);
  --amber: #fbbf24; --amber-tint: rgba(var(--amber-rgb), .12);
  --green: #4ade80; --green-tint: rgba(var(--green-rgb), .13);
  --red: #fb7185; --red-tint: rgba(var(--red-rgb), .12);
  --slate: #8fb3a8; --slate-tint: rgba(var(--slate-rgb), .12);
  --blue: #38bdf8; --blue-tint: rgba(var(--blue-rgb), .12);
  --violet: #a78bfa; --violet-tint: rgba(var(--violet-rgb), .12);
  --teal-rgb: 52, 211, 153; --amber-rgb: 251, 191, 36; --green-rgb: 74, 222, 128;
  --red-rgb: 251, 113, 133; --blue-rgb: 56, 189, 248; --violet-rgb: 167, 139, 250; --slate-rgb: 143, 179, 168;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 44px -14px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .35), 0 0 26px -6px rgba(var(--teal-rgb), .55);
  --glow-soft: 0 8px 30px -10px rgba(var(--teal-rgb), .4);
  --grad: linear-gradient(135deg, #10b981 0%, #34d399 45%, #38bdf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .15), rgba(56, 189, 248, .14));
  --aurora-1: rgba(52, 211, 153, .17); --aurora-2: rgba(45, 212, 191, .12); --aurora-3: rgba(56, 189, 248, .09);
  color-scheme: dark;
}

/* ── 3. Ocean 深海 (navy blue) ── */
[data-theme="ocean"] {
  --paper: #04101f; --surface: rgba(13, 30, 52, .72); --surface-2: #081827; --surface-3: rgba(18, 40, 66, .5);
  --ink: #e3ecf8; --ink-soft: #9cb4d3; --muted: #5d7694; --line: rgba(130, 170, 215, .16);
  --teal: #22d3ee; --teal-deep: #06b6d4; --teal-tint: rgba(var(--teal-rgb), .13);
  --amber: #fbbf24; --amber-tint: rgba(var(--amber-rgb), .12);
  --green: #34d399; --green-tint: rgba(var(--green-rgb), .12);
  --red: #fb7185; --red-tint: rgba(var(--red-rgb), .12);
  --slate: #8fb0d0; --slate-tint: rgba(var(--slate-rgb), .12);
  --blue: #3b82f6; --blue-tint: rgba(var(--blue-rgb), .14);
  --violet: #818cf8; --violet-tint: rgba(var(--violet-rgb), .12);
  --teal-rgb: 34, 211, 238; --amber-rgb: 251, 191, 36; --green-rgb: 52, 211, 153;
  --red-rgb: 251, 113, 133; --blue-rgb: 59, 130, 246; --violet-rgb: 129, 140, 248; --slate-rgb: 143, 176, 208;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 44px -14px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(var(--blue-rgb), .35), 0 0 26px -6px rgba(var(--blue-rgb), .55);
  --glow-soft: 0 8px 30px -10px rgba(var(--blue-rgb), .4);
  --grad: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #818cf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .14), rgba(var(--blue-rgb), .15));
  --aurora-1: rgba(34, 211, 238, .15); --aurora-2: rgba(59, 130, 246, .15); --aurora-3: rgba(129, 140, 248, .1);
  color-scheme: dark;
}

/* ── 4. Royal 皇家 (classy black + gold, serif) ── */
[data-theme="royal"] {
  --paper: #0b0906; --surface: rgba(26, 21, 14, .72); --surface-2: #171209; --surface-3: rgba(46, 38, 24, .5);
  --ink: #f2ead8; --ink-soft: #c9b896; --muted: #8a7a5c; --line: rgba(212, 175, 55, .16);
  --teal: #d4af37; --teal-deep: #b8952a; --teal-tint: rgba(var(--teal-rgb), .12);
  --amber: #f0b429; --amber-tint: rgba(var(--amber-rgb), .12);
  --green: #7cb87c; --green-tint: rgba(var(--green-rgb), .12);
  --red: #d9896f; --red-tint: rgba(var(--red-rgb), .12);
  --slate: #b0a184; --slate-tint: rgba(var(--slate-rgb), .12);
  --blue: #9db8d9; --blue-tint: rgba(var(--blue-rgb), .12);
  --violet: #c3a8e0; --violet-tint: rgba(var(--violet-rgb), .12);
  --teal-rgb: 212, 175, 55; --amber-rgb: 240, 180, 41; --green-rgb: 124, 184, 124;
  --red-rgb: 217, 137, 111; --blue-rgb: 157, 184, 217; --violet-rgb: 195, 168, 224; --slate-rgb: 176, 161, 132;
  --shadow: 0 1px 2px rgba(0, 0, 0, .6), 0 16px 48px -14px rgba(0, 0, 0, .8);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .35), 0 0 26px -6px rgba(var(--teal-rgb), .5);
  --glow-soft: 0 8px 30px -10px rgba(var(--teal-rgb), .35);
  --grad: linear-gradient(135deg, #d4af37 0%, #f0b429 45%, #b8952a 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .13), rgba(195, 168, 224, .1));
  --aurora-1: rgba(212, 175, 55, .12); --aurora-2: rgba(160, 120, 40, .08); --aurora-3: rgba(120, 90, 40, .08);
  color-scheme: dark;
}
[data-theme="royal"] .brand-text h1, [data-theme="royal"] .login-brand h1 { font-family: var(--serif); letter-spacing: .06em; }

/* ── 5. Graphite 石墨 (monochrome dark) ── */
[data-theme="graphite"] {
  --paper: #0b0c0e; --surface: rgba(24, 26, 30, .7); --surface-2: #131417; --surface-3: rgba(38, 40, 45, .5);
  --ink: #eceef1; --ink-soft: #a6abb3; --muted: #6c7178; --line: rgba(160, 166, 175, .14);
  --teal: #c9ccd2; --teal-deep: #a5a9b0; --teal-tint: rgba(var(--teal-rgb), .1);
  --amber: #d8dbe0; --amber-tint: rgba(var(--amber-rgb), .1);
  --green: #b8bcc4; --green-tint: rgba(var(--green-rgb), .1);
  --red: #e0a3a3; --red-tint: rgba(var(--red-rgb), .1);
  --slate: #9aa0a8; --slate-tint: rgba(var(--slate-rgb), .12);
  --blue: #aeb4bd; --blue-tint: rgba(var(--blue-rgb), .1);
  --violet: #b6bac2; --violet-tint: rgba(var(--violet-rgb), .1);
  --teal-rgb: 201, 204, 210; --amber-rgb: 216, 219, 224; --green-rgb: 184, 188, 196;
  --red-rgb: 224, 163, 163; --blue-rgb: 174, 180, 189; --violet-rgb: 182, 186, 194; --slate-rgb: 154, 160, 168;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 44px -14px rgba(0, 0, 0, .7);
  --glow: 0 0 0 1px rgba(var(--slate-rgb), .3), 0 0 22px -8px rgba(var(--slate-rgb), .45);
  --glow-soft: 0 8px 26px -10px rgba(var(--slate-rgb), .35);
  --grad: linear-gradient(135deg, #8b9098 0%, #c9ccd2 50%, #6c7178 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--slate-rgb), .14), rgba(var(--slate-rgb), .08));
  --aurora-1: rgba(150, 156, 165, .1); --aurora-2: rgba(120, 126, 135, .07); --aurora-3: rgba(100, 106, 115, .06);
  color-scheme: dark;
}

/* ── 6. Porcelain 瓷白 (clean modern light) ── */
[data-theme="porcelain"] {
  --paper: #f4f6fb; --surface: rgba(255, 255, 255, .82); --surface-2: #ffffff; --surface-3: rgba(240, 243, 250, .85);
  --ink: #141a2a; --ink-soft: #4a5468; --muted: #8b95a9; --line: rgba(20, 26, 42, .1);
  --teal: #0e9384; --teal-deep: #0b6e63; --teal-tint: rgba(var(--teal-rgb), .1);
  --amber: #b45309; --amber-tint: rgba(var(--amber-rgb), .1);
  --green: #15803d; --green-tint: rgba(var(--green-rgb), .1);
  --red: #dc2626; --red-tint: rgba(var(--red-rgb), .09);
  --slate: #64748b; --slate-tint: rgba(var(--slate-rgb), .1);
  --blue: #2563eb; --blue-tint: rgba(var(--blue-rgb), .09);
  --violet: #7c3aed; --violet-tint: rgba(var(--violet-rgb), .09);
  --teal-rgb: 14, 147, 132; --amber-rgb: 180, 83, 9; --green-rgb: 21, 128, 61;
  --red-rgb: 220, 38, 38; --blue-rgb: 37, 99, 235; --violet-rgb: 124, 58, 237; --slate-rgb: 100, 116, 139;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 14px 40px -16px rgba(15, 23, 42, .16);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .3), 0 6px 22px -8px rgba(var(--teal-rgb), .4);
  --glow-soft: 0 8px 26px -12px rgba(var(--teal-rgb), .32);
  --grad: linear-gradient(135deg, #0e9384 0%, #2563eb 50%, #7c3aed 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .1), rgba(var(--violet-rgb), .1));
  --aurora-1: rgba(14, 147, 132, .09); --aurora-2: rgba(124, 58, 237, .07); --aurora-3: rgba(37, 99, 235, .06);
  color-scheme: light;
}

/* ── 7. Sand 暖沙 (warm cream) ── */
[data-theme="sand"] {
  --paper: #f4efe6; --surface: rgba(255, 252, 245, .84); --surface-2: #fffdf7; --surface-3: rgba(240, 233, 218, .65);
  --ink: #2b2720; --ink-soft: #5c5649; --muted: #93897a; --line: rgba(107, 91, 61, .15);
  --teal: #1e5f5a; --teal-deep: #164b47; --teal-tint: rgba(var(--teal-rgb), .1);
  --amber: #b45309; --amber-tint: rgba(var(--amber-rgb), .1);
  --green: #3d7a52; --green-tint: rgba(var(--green-rgb), .1);
  --red: #b3483a; --red-tint: rgba(var(--red-rgb), .09);
  --slate: #6b7280; --slate-tint: rgba(var(--slate-rgb), .1);
  --blue: #3a6a8f; --blue-tint: rgba(var(--blue-rgb), .09);
  --violet: #7c5cbf; --violet-tint: rgba(var(--violet-rgb), .09);
  --teal-rgb: 30, 95, 90; --amber-rgb: 180, 83, 9; --green-rgb: 61, 122, 82;
  --red-rgb: 179, 72, 58; --blue-rgb: 58, 106, 143; --violet-rgb: 124, 92, 191; --slate-rgb: 107, 114, 128;
  --shadow: 0 1px 2px rgba(43, 39, 32, .05), 0 14px 40px -16px rgba(43, 39, 32, .18);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .3), 0 6px 22px -8px rgba(var(--teal-rgb), .4);
  --glow-soft: 0 8px 26px -12px rgba(var(--teal-rgb), .32);
  --grad: linear-gradient(135deg, #1e5f5a 0%, #3a6a8f 55%, #7c5cbf 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .1), rgba(var(--violet-rgb), .1));
  --aurora-1: rgba(30, 95, 90, .11); --aurora-2: rgba(124, 92, 191, .09); --aurora-3: rgba(192, 136, 43, .08);
  color-scheme: light;
}

/* ── 8. Sakura 櫻粉 (soft pink) ── */
[data-theme="sakura"] {
  --paper: #faf0f4; --surface: rgba(255, 250, 252, .86); --surface-2: #fffbfd; --surface-3: rgba(248, 232, 240, .7);
  --ink: #33222c; --ink-soft: #6d5362; --muted: #a1899a; --line: rgba(190, 110, 150, .14);
  --teal: #c2568f; --teal-deep: #a04073; --teal-tint: rgba(var(--teal-rgb), .1);
  --amber: #b45309; --amber-tint: rgba(var(--amber-rgb), .09);
  --green: #3d7a52; --green-tint: rgba(var(--green-rgb), .09);
  --red: #d43d6f; --red-tint: rgba(var(--red-rgb), .09);
  --slate: #8a7283; --slate-tint: rgba(var(--slate-rgb), .1);
  --blue: #7a8fd0; --blue-tint: rgba(var(--blue-rgb), .09);
  --violet: #9d6bc4; --violet-tint: rgba(var(--violet-rgb), .1);
  --teal-rgb: 194, 86, 143; --amber-rgb: 180, 83, 9; --green-rgb: 61, 122, 82;
  --red-rgb: 212, 61, 111; --blue-rgb: 122, 143, 208; --violet-rgb: 157, 107, 196; --slate-rgb: 138, 114, 131;
  --shadow: 0 1px 2px rgba(51, 34, 44, .06), 0 14px 40px -16px rgba(51, 34, 44, .18);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .3), 0 6px 22px -8px rgba(var(--teal-rgb), .4);
  --glow-soft: 0 8px 26px -12px rgba(var(--teal-rgb), .32);
  --grad: linear-gradient(135deg, #c2568f 0%, #e879a9 50%, #9d6bc4 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .1), rgba(var(--violet-rgb), .1));
  --aurora-1: rgba(224, 121, 169, .12); --aurora-2: rgba(157, 107, 196, .09); --aurora-3: rgba(240, 171, 199, .08);
  color-scheme: light;
}

/* ── 9. Forest 森林 (calm green light) ── */
[data-theme="forest"] {
  --paper: #eef4ec; --surface: rgba(250, 253, 249, .86); --surface-2: #fbfdf9; --surface-3: rgba(230, 240, 228, .7);
  --ink: #1d2b20; --ink-soft: #4d6254; --muted: #84978b; --line: rgba(60, 110, 75, .13);
  --teal: #2f7d4f; --teal-deep: #25643e; --teal-tint: rgba(var(--teal-rgb), .1);
  --amber: #a16207; --amber-tint: rgba(var(--amber-rgb), .1);
  --green: #3f9142; --green-tint: rgba(var(--green-rgb), .1);
  --red: #b8453a; --red-tint: rgba(var(--red-rgb), .09);
  --slate: #64748b; --slate-tint: rgba(var(--slate-rgb), .1);
  --blue: #3b6e8f; --blue-tint: rgba(var(--blue-rgb), .09);
  --violet: #6d5d9e; --violet-tint: rgba(var(--violet-rgb), .09);
  --teal-rgb: 47, 125, 79; --amber-rgb: 161, 98, 7; --green-rgb: 63, 145, 66;
  --red-rgb: 184, 69, 58; --blue-rgb: 59, 110, 143; --violet-rgb: 109, 93, 158; --slate-rgb: 100, 116, 139;
  --shadow: 0 1px 2px rgba(29, 43, 32, .05), 0 14px 40px -16px rgba(29, 43, 32, .16);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .3), 0 6px 22px -8px rgba(var(--teal-rgb), .38);
  --glow-soft: 0 8px 26px -12px rgba(var(--teal-rgb), .3);
  --grad: linear-gradient(135deg, #2f7d4f 0%, #3f9142 50%, #6d5d9e 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .1), rgba(var(--violet-rgb), .08));
  --aurora-1: rgba(47, 125, 79, .1); --aurora-2: rgba(109, 93, 158, .07); --aurora-3: rgba(63, 145, 66, .07);
  color-scheme: light;
}

/* ── 10. Ember 餘燼 (bold sunset dark) ── */
[data-theme="ember"] {
  --paper: #160b08; --surface: rgba(40, 18, 14, .72); --surface-2: #1f0e0a; --surface-3: rgba(58, 28, 20, .5);
  --ink: #f8e9e0; --ink-soft: #d0a898; --muted: #96705f; --line: rgba(235, 130, 90, .15);
  --teal: #fb923c; --teal-deep: #ea6a20; --teal-tint: rgba(var(--teal-rgb), .12);
  --amber: #fbbf24; --amber-tint: rgba(var(--amber-rgb), .12);
  --green: #86c77e; --green-tint: rgba(var(--green-rgb), .12);
  --red: #f87171; --red-tint: rgba(var(--red-rgb), .12);
  --slate: #c09b8a; --slate-tint: rgba(var(--slate-rgb), .12);
  --blue: #8fb8e8; --blue-tint: rgba(var(--blue-rgb), .12);
  --violet: #d9a4e8; --violet-tint: rgba(var(--violet-rgb), .12);
  --teal-rgb: 251, 146, 60; --amber-rgb: 251, 191, 36; --green-rgb: 134, 199, 126;
  --red-rgb: 248, 113, 113; --blue-rgb: 143, 184, 232; --violet-rgb: 217, 164, 232; --slate-rgb: 192, 155, 138;
  --shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 14px 44px -14px rgba(0, 0, 0, .75);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .35), 0 0 26px -6px rgba(var(--teal-rgb), .55);
  --glow-soft: 0 8px 30px -10px rgba(var(--teal-rgb), .4);
  --grad: linear-gradient(135deg, #fb923c 0%, #f43f5e 50%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .14), rgba(var(--violet-rgb), .12));
  --aurora-1: rgba(251, 146, 60, .15); --aurora-2: rgba(244, 63, 94, .12); --aurora-3: rgba(168, 85, 247, .1);
  color-scheme: dark;
}

/* light-family component tweaks (body gets .light-ui via JS) */
body.light-ui .scrim { background: rgba(15, 23, 42, .35); }
body.light-ui .drawer { box-shadow: -24px 0 70px -30px rgba(15, 23, 42, .4); }
body.light-ui .modal { box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .35); }
body.light-ui .login-card { box-shadow: 0 30px 80px -30px rgba(15, 23, 42, .3); }
body.light-ui .palette { box-shadow: 0 30px 80px -26px rgba(15, 23, 42, .35); }

/* ── theme picker panel ── */
.theme-picker-scrim { position: fixed; inset: 0; z-index: 145; background: rgba(2, 6, 16, .5); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fadeIn .15s ease both; }
.theme-picker {
  position: fixed; top: 74px; right: 14px; width: min(560px, 96vw); z-index: 146;
  border-radius: 20px; overflow: hidden; background: var(--surface-2);
  backdrop-filter: blur(26px) saturate(1.5); -webkit-backdrop-filter: blur(26px) saturate(1.5);
  border: 1px solid var(--line); box-shadow: 0 34px 90px -22px rgba(0, 0, 0, .75);
  animation: popIn .2s cubic-bezier(.22, .9, .3, 1) both; padding: 16px;
}
.theme-picker h3 { font-size: .9rem; font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.theme-picker .tp-sub { font-size: .72rem; color: var(--muted); margin-bottom: 12px; }
.tp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
@media (max-width: 640px) { .tp-grid { grid-template-columns: repeat(3, 1fr); } }
.tp-card {
  border-radius: 14px; border: 2px solid var(--line); overflow: hidden; cursor: pointer; text-align: left;
  background: var(--paper); transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; padding: 0;
}
.tp-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.tp-card.active { border-color: var(--teal); box-shadow: var(--glow); background: var(--teal-tint); }
.tp-card.active .tp-name { color: var(--teal); }
.tp-swatch { height: 44px; display: flex; }
.tp-swatch i { flex: 1; }
.tp-name { font-size: .68rem; font-weight: 700; padding: 6px 8px 7px; color: var(--ink); }
.tp-name small { display: block; font-weight: 500; color: var(--muted); font-size: .62rem; margin-top: 1px; }

/* ── 11. Neon 霓虹 (cyberpunk dark) ── */
[data-theme="neon"] {
  --paper: #050014; --surface: rgba(26, 10, 46, .74); --surface-2: #12082a; --surface-3: rgba(48, 20, 82, .5);
  --ink: #eef0ff; --ink-soft: #b7b2e8; --muted: #776f9e; --line: rgba(190, 140, 255, .18);
  --teal: #22d3ee; --teal-deep: #06b6d4; --teal-tint: rgba(var(--teal-rgb), .14);
  --amber: #fbbf24; --amber-tint: rgba(var(--amber-rgb), .12);
  --green: #34d399; --green-tint: rgba(var(--green-rgb), .12);
  --red: #fb7185; --red-tint: rgba(var(--red-rgb), .12);
  --slate: #b9a8e8; --slate-tint: rgba(var(--slate-rgb), .12);
  --blue: #38bdf8; --blue-tint: rgba(var(--blue-rgb), .14);
  --violet: #e879f9; --violet-tint: rgba(var(--violet-rgb), .15);
  --teal-rgb: 34, 211, 238; --amber-rgb: 251, 191, 36; --green-rgb: 52, 211, 153;
  --red-rgb: 251, 113, 133; --blue-rgb: 56, 189, 248; --violet-rgb: 232, 121, 249; --slate-rgb: 185, 168, 232;
  --shadow: 0 1px 2px rgba(0, 0, 0, .55), 0 14px 44px -14px rgba(10, 0, 30, .85);
  --glow: 0 0 0 1px rgba(var(--violet-rgb), .4), 0 0 26px -4px rgba(var(--violet-rgb), .65);
  --glow-soft: 0 8px 30px -10px rgba(var(--violet-rgb), .45);
  --grad: linear-gradient(135deg, #22d3ee 0%, #8b5cf6 50%, #e879f9 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .16), rgba(var(--violet-rgb), .18));
  --aurora-1: rgba(34, 211, 238, .16); --aurora-2: rgba(139, 92, 246, .17); --aurora-3: rgba(232, 121, 249, .12);
  color-scheme: dark;
}

/* ── 12. Mint 薄荷 (fresh pastel light) ── */
[data-theme="mint"] {
  --paper: #eefaf5; --surface: rgba(250, 255, 252, .88); --surface-2: #f8fffc; --surface-3: rgba(226, 245, 238, .75);
  --ink: #15332b; --ink-soft: #3f6258; --muted: #7fa298; --line: rgba(20, 120, 100, .13);
  --teal: #0d9488; --teal-deep: #0f766e; --teal-tint: rgba(var(--teal-rgb), .1);
  --amber: #b45309; --amber-tint: rgba(var(--amber-rgb), .09);
  --green: #16a34a; --green-tint: rgba(var(--green-rgb), .09);
  --red: #dc2626; --red-tint: rgba(var(--red-rgb), .09);
  --slate: #5c7a72; --slate-tint: rgba(var(--slate-rgb), .1);
  --blue: #0284c7; --blue-tint: rgba(var(--blue-rgb), .09);
  --violet: #6d5dd4; --violet-tint: rgba(var(--violet-rgb), .09);
  --teal-rgb: 13, 148, 136; --amber-rgb: 180, 83, 9; --green-rgb: 22, 163, 74;
  --red-rgb: 220, 38, 38; --blue-rgb: 2, 132, 199; --violet-rgb: 109, 93, 212; --slate-rgb: 92, 122, 114;
  --shadow: 0 1px 2px rgba(21, 51, 43, .05), 0 14px 40px -16px rgba(21, 51, 43, .16);
  --glow: 0 0 0 1px rgba(var(--teal-rgb), .3), 0 6px 22px -8px rgba(var(--teal-rgb), .38);
  --glow-soft: 0 8px 26px -12px rgba(var(--teal-rgb), .3);
  --grad: linear-gradient(135deg, #0d9488 0%, #0284c7 55%, #6d5dd4 100%);
  --grad-soft: linear-gradient(135deg, rgba(var(--teal-rgb), .1), rgba(var(--violet-rgb), .09));
  --aurora-1: rgba(13, 148, 136, .1); --aurora-2: rgba(2, 132, 199, .08); --aurora-3: rgba(125, 211, 252, .08);
  color-scheme: light;
}

/* ── system auto-switch toggle ── */
.sys-theme-row {
  display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; padding: 8px 10px;
  border-radius: 10px; background: rgba(var(--slate-rgb), .08); border: 1px solid var(--line);
  font-size: .74rem; color: var(--ink-soft);
}
.sys-theme-row .switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: none; }
.sys-theme-row .switch input { opacity: 0; width: 0; height: 0; }
.sys-theme-row .slider {
  position: absolute; cursor: pointer; inset: 0; border-radius: 19px;
  background: rgba(var(--slate-rgb), .35); transition: .2s;
}
.sys-theme-row .slider::before {
  content: ""; position: absolute; height: 15px; width: 15px; left: 2px; top: 2px; border-radius: 50%;
  background: var(--surface-2); box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: .2s;
}
.sys-theme-row .switch input:checked + .slider { background: var(--teal); }
.sys-theme-row .switch input:checked + .slider::before { transform: translateX(15px); }

/* ── map view ── */
.map-wrap { margin-top: 10px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface-2); }
.map-canvas { height: 560px; width: 100%; background: #0f1520; }
.map-canvas .leaflet-tile { filter: saturate(.8) brightness(.9) contrast(1.02); }
[data-theme="midnight"] .map-canvas .leaflet-tile, [data-theme="aurora"] .map-canvas .leaflet-tile, [data-theme="ocean"] .map-canvas .leaflet-tile, [data-theme="neon"] .map-canvas .leaflet-tile, [data-theme="ember"] .map-canvas .leaflet-tile, [data-theme="graphite"] .map-canvas .leaflet-tile, [data-theme="royal"] .map-canvas .leaflet-tile { filter: invert(1) hue-rotate(180deg) saturate(.72) brightness(.92) contrast(.95); }
.map-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: .72rem; color: var(--ink-soft); }
.map-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.map-legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.map-pin i { display: block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--surface-2); box-shadow: 0 0 8px rgba(0,0,0,.5); }
.leaflet-popup-content { font-size: .78rem; color: #1a2233; }
.leaflet-popup-content .muted { color: #64748b; }
