/* HQ design system. Dark is the default theme; light is a full first-class
   theme (parity rule). Tokens follow projects/_dashboard-uplift/DESIGN-BAR.md:
   deep navy canvas, surface-step cards, one cyan-violet accent used sparingly,
   red reserved for security. */

/* ---------------------------------------------------------------- tokens -- */
:root {
  --canvas: #0a0d16;
  --canvas-2: #0b0e1a;
  --card: #11151f;
  --card-2: #131826;
  --card-3: #182034;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.11);
  --text: #e8ecf4;
  --text-muted: #8b94a7;
  --text-dim: #5c6579;
  --accent: #22d3ee;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #22d3ee, #8b5cf6);
  --accent-soft: rgba(34, 211, 238, 0.12);
  --ok: #22c55e;
  --ok-soft: rgba(34, 197, 94, 0.13);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.13);
  --danger: #f87171;
  --danger-strong: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.13);
  --violet-soft: rgba(139, 92, 246, 0.14);
  --shadow-card: none;
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.5);
  --glow: 0 0 24px rgba(34, 211, 238, 0.18);
  --radius: 14px;
  --radius-lg: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  /* agent palette */
  --c-blue: #3b82f6;   --c-purple: #a855f7; --c-amber: #f59e0b;
  --c-green: #22c55e;  --c-accent: #22d3ee; --c-red: #ef4444;
  --c-cyan: #06b6d4;   --c-rose: #f43f5e;   --c-lime: #84cc16;
  --c-pink: #ec4899;   --c-violet: #8b5cf6; --c-orange: #fb923c;
}

[data-theme="light"] {
  --canvas: #eef1f7;
  --canvas-2: #e9edf5;
  --card: #ffffff;
  --card-2: #f4f6fb;
  --card-3: #eceff7;
  --border: rgba(20, 30, 60, 0.07);
  --border-strong: rgba(20, 30, 60, 0.13);
  --text: #111827;
  --text-muted: #6b7280;
  --text-dim: #9aa2b1;
  --accent: #6d5ef2;
  --accent-2: #8b5cf6;
  --accent-grad: linear-gradient(135deg, #6d5ef2, #8b5cf6);
  --accent-soft: rgba(109, 94, 242, 0.1);
  --ok: #16a34a;
  --ok-soft: rgba(22, 163, 74, 0.11);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-strong: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.09);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.09);
  --violet-soft: rgba(109, 94, 242, 0.1);
  --shadow-card: 0 8px 30px rgba(20, 30, 60, 0.08);
  --shadow-pop: 0 24px 60px rgba(20, 30, 60, 0.18);
  --glow: none;
}

/* ------------------------------------------------------------------ base -- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(139, 92, 246, 0.09), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(34, 211, 238, 0.05), transparent 55%),
    var(--canvas);
  background-attachment: fixed;
  min-height: 100vh;
}
[data-theme="light"] body {
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(109, 94, 242, 0.07), transparent 60%),
    var(--canvas);
  background-attachment: fixed;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.015em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { display: block; }
::selection { background: rgba(139, 92, 246, 0.35); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }

@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); } 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); } }
@keyframes pulse-dot-red { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); } 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes typing-b { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ----------------------------------------------------------------- shell -- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--canvas-2) 72%, transparent);
  backdrop-filter: blur(14px);
  z-index: 40;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-grad);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: var(--glow);
}
.logo-name { font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; }
.logo-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--text-muted); font-weight: 500; font-size: 14px;
  transition: background 160ms ease, color 160ms ease;
}
.nav a svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav a:hover { background: var(--card-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav a.active svg { color: var(--accent); opacity: 1; }
.nav .nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--danger-soft); color: var(--danger);
  border-radius: 99px; padding: 1px 7px;
}

.side-foot { display: flex; flex-direction: column; gap: 10px; padding: 10px 8px 0; border-top: 1px solid var(--border); }
.runtime-pill { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.runtime-pill .dot { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); animation: pulse-dot 2.4s infinite; }
.powered { font-size: 11px; color: var(--text-dim); }

.theme-toggle {
  display: flex; align-items: center; gap: 8px;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 10px;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: color 160ms ease, border-color 160ms ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 14px; height: 14px; }

.main { min-width: 0; padding: 26px 32px 60px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.page-sub { color: var(--text-muted); margin-top: 3px; font-size: 13.5px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; padding-top: 4px; }

.hamburger { display: none; }

/* ----------------------------------------------------------------- cards -- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 22px 24px; }
.card-hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.micro-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-muted);
}
.card-link { font-size: 12.5px; font-weight: 600; color: var(--accent); }
.card-link:hover { text-decoration: underline; }

.lift { transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease; }
.lift:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-pop); }

/* ----------------------------------------------------------------- chips -- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 2.5px 9px; border-radius: 99px;
  background: var(--card-2); color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.violet { background: var(--violet-soft); color: var(--accent-2); }
[data-theme="light"] .chip.violet { color: #6d5ef2; }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip .chip-dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.chip.breathing .chip-dot { animation: pulse-dot 2.2s infinite; }

/* ----------------------------------------------------------------- stats -- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.stat-value {
  font-size: 34px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value.grad {
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-value.red { color: var(--danger); }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 550; }
.stat-note { font-size: 12px; color: var(--text-dim); }
.stat-icon {
  position: absolute; right: 16px; top: 16px;
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px;
  background: var(--card-2); border: 1px solid var(--border);
}
.stat.alert { border-color: color-mix(in srgb, var(--danger-strong) 35%, transparent); }
.stat.alert .stat-icon { background: var(--danger-soft); border-color: transparent; }

/* ---------------------------------------------------------------- banner -- */
.banner {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--danger-strong) 40%, transparent);
  background: linear-gradient(90deg, var(--danger-soft), transparent 70%), var(--card);
  margin-bottom: 22px;
  animation: fade-up 300ms ease;
}
.banner .b-dot { width: 9px; height: 9px; border-radius: 99px; background: var(--danger-strong); animation: pulse-dot-red 2s infinite; flex: none; }
.banner .b-text { flex: 1; min-width: 0; font-size: 13.5px; }
.banner .b-text strong { font-weight: 700; }
.banner .b-actions { flex: none; display: flex; gap: 8px; }

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border-strong);
  background: var(--card-2); color: var(--text);
  font-size: 13px; font-weight: 600;
  padding: 7px 14px; border-radius: 10px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.btn:hover { border-color: var(--text-dim); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary {
  background: var(--accent-grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 18px rgba(109, 94, 242, 0.35);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4.5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ crew -- */
.crew-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.crew-card { padding: 16px 18px; display: flex; gap: 13px; align-items: flex-start; cursor: pointer; position: relative; }
.avatar-wrap { position: relative; flex: none; }
.avatar { width: 46px; height: 46px; border-radius: 14px; object-fit: cover; border: 1px solid var(--border-strong); background: var(--card-2); }
.avatar.lg { width: 62px; height: 62px; border-radius: 18px; }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; }
.avatar.xs { width: 20px; height: 20px; border-radius: 7px; }
.status-dot {
  position: absolute; right: -3px; bottom: -3px;
  width: 11px; height: 11px; border-radius: 99px;
  border: 2.5px solid var(--card);
  background: var(--text-dim);
}
.status-dot.working { background: var(--ok); animation: pulse-dot 2.2s infinite; }
.status-dot.scheduled { background: var(--accent-2); }
.status-dot.off { background: var(--text-dim); opacity: 0.5; }
.crew-body { min-width: 0; flex: 1; }
.crew-name { font-weight: 650; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.crew-role { font-size: 12px; color: var(--text-muted); font-weight: 550; }
.crew-step { font-size: 12.5px; color: var(--text-muted); margin-top: 7px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.crew-card.working .crew-step { color: var(--text); }
.crew-meta { margin-top: 9px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ feed -- */
.feed { display: flex; flex-direction: column; }
.feed-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 4px; border-bottom: 1px solid var(--border);
  animation: fade-up 260ms ease;
}
.feed-row:last-child { border-bottom: 0; }
.feed-body { flex: 1; min-width: 0; }
.feed-line { font-size: 13.5px; }
.feed-line .who { font-weight: 650; }
.feed-sub { display: flex; gap: 8px; align-items: center; margin-top: 3px; }
.feed-ts { flex: none; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; padding-top: 2px; }
.kind-tag { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); }
.kind-tag.security_check, .kind-tag.escalation, .kind-tag.error { color: var(--danger); }
.kind-tag.publish, .kind-tag.review { color: var(--ok); }

/* ----------------------------------------------------------------- board -- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; scrollbar-width: thin; }
.board::after {
  content: ""; position: sticky; right: 0; align-self: stretch;
  flex: 0 0 36px; margin-left: -36px;
  background: linear-gradient(90deg, transparent, var(--canvas));
  pointer-events: none;
}
.col { flex: 0 0 264px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.col-hd {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text-muted);
  padding: 0 4px;
}
.col-hd .count { margin-left: auto; font-size: 11.5px; background: var(--card-2); border-radius: 99px; padding: 1px 8px; }
.col-empty {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 18px 10px; text-align: center;
  font-size: 12px; color: var(--text-dim);
}
.task-card { padding: 14px 15px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.task-title { font-size: 13.5px; font-weight: 620; line-height: 1.35; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-src { font-size: 11.5px; color: var(--text-dim); }
.route-dots { display: flex; gap: 4px; align-items: center; }
.route-dots .rd { width: 7px; height: 7px; border-radius: 99px; background: var(--card-3); border: 1px solid var(--border-strong); }
.route-dots .rd.past { background: var(--ok); border-color: transparent; }
.route-dots .rd.now { background: var(--accent); border-color: transparent; box-shadow: 0 0 8px rgba(34, 211, 238, 0.6); }
.bar { height: 4px; border-radius: 99px; background: var(--card-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent-grad); transition: width 600ms ease; }
.task-card.needs-you { border-color: color-mix(in srgb, var(--danger-strong) 45%, transparent); }
.task-card.review-gate { border-color: color-mix(in srgb, var(--accent-2) 55%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 25%, transparent); }
.task-actions { display: flex; gap: 8px; }
.task-q { font-size: 12.5px; color: var(--text-muted); background: var(--card-2); border-radius: 10px; padding: 9px 11px; }
.task-q strong { color: var(--text); }
textarea.answer {
  width: 100%; resize: vertical; min-height: 54px;
  background: var(--card-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-family: inherit; font-size: 13px; padding: 8px 10px;
}

/* -------------------------------------------------------------- findings -- */
.finding {
  padding: 16px 18px 16px 20px;
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 8px;
}
.finding::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--text-dim);
}
.finding.sev-info::before { background: var(--info); }
.finding.sev-warning::before { background: var(--warn); }
.finding.sev-critical::before { background: var(--danger-strong); }
.finding.red-alert {
  border-color: color-mix(in srgb, var(--danger-strong) 45%, transparent);
  background: linear-gradient(100deg, var(--danger-soft), transparent 55%), var(--card);
}
.finding-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.finding-title { font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.finding-detail { font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.reco {
  font-size: 13px; border-radius: 10px; padding: 10px 13px;
  background: var(--card-2); border: 1px solid var(--border);
}
.reco b { font-weight: 700; }
.finding-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.finding-foot .spacer, .row-spacer { flex: 1; }
.link-task { font-size: 12px; color: var(--accent); font-weight: 600; }

/* ----------------------------------------------------------- suggestions -- */
.idea { padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; }
.idea-title { font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.idea-detail { font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.impact-effort { display: flex; gap: 6px; }

/* ------------------------------------------------------------------ chat -- */
.chat-page { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }
.chat-scroll { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 6px 4px 18px; scrollbar-width: thin; }
.msg { display: flex; gap: 10px; max-width: 78%; animation: fade-up 240ms ease; }
.msg .bubble {
  padding: 11px 15px; border-radius: 16px;
  font-size: 14px; line-height: 1.55;
  background: var(--card); border: 1px solid var(--border);
}
.msg.atlas { align-self: flex-start; }
.msg.atlas .bubble { border-top-left-radius: 6px; }
.msg.you { align-self: flex-end; flex-direction: row-reverse; }
.msg.you .bubble {
  background: var(--accent-grad); color: #fff; border: 0;
  border-top-right-radius: 6px;
}
.msg-refs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.msg-ts { font-size: 11px; color: var(--text-dim); margin-top: 5px; }
.typing { display: inline-flex; gap: 4px; padding: 13px 16px; }
.typing i { width: 6px; height: 6px; border-radius: 99px; background: var(--text-muted); animation: typing-b 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
.composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px; border-radius: var(--radius-lg);
  background: var(--card); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
}
.composer textarea {
  flex: 1; border: 0; background: transparent; resize: none;
  color: var(--text); font-family: inherit; font-size: 14px;
  min-height: 22px; max-height: 120px; padding: 4px 6px; outline: none;
}
.composer .btn.primary { border-radius: 12px; }

/* -------------------------------------------------------------- schedule -- */
.night-strip { position: relative; height: 100px; margin: 8px 14px 2px; }
.night-axis { position: absolute; left: 0; right: 0; top: 48px; height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--card-3), var(--accent-soft), var(--card-3)); }
.night-run { position: absolute; top: 16px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.night-run.alt { top: 43px; }
.night-run .nr-dot { width: 13px; height: 13px; border-radius: 99px; border: 2.5px solid var(--card); background: var(--accent); flex: none; }
.night-run.disabled { opacity: 0.45; }
.night-run.disabled .nr-dot { background: var(--text-dim); }
.night-run img { width: 24px; height: 24px; border-radius: 8px; border: 1px solid var(--border-strong); }
.night-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); padding: 0 6px; }

.run-row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 6px; border-bottom: 1px solid var(--border);
}
.run-row:last-child { border-bottom: 0; }
.run-who { display: flex; align-items: center; gap: 10px; flex: 0 0 210px; min-width: 0; }
.run-name { font-weight: 640; font-size: 13.5px; }
.run-label { font-size: 12px; color: var(--text-muted); }
.run-time { flex: 0 0 52px; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.run-sum { flex: 1; min-width: 0; font-size: 13px; color: var(--text-muted); }
.run-sum b { color: var(--text); font-weight: 620; }

/* -------------------------------------------------------------- switches -- */
.switch { position: relative; width: 36px; height: 21px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .tr {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--card-3); border: 1px solid var(--border-strong);
  transition: background 160ms ease, border-color 160ms ease;
}
.switch .th {
  position: absolute; top: 3px; left: 3px; width: 15px; height: 15px;
  border-radius: 99px; background: var(--text-muted);
  transition: transform 180ms ease, background 180ms ease;
}
.switch input:checked ~ .tr { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.switch input:checked ~ .th { transform: translateX(15px); background: var(--accent); }
.switch input:focus-visible ~ .tr { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ----------------------------------------------------------- side panel -- */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 6, 12, 0.55); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity 200ms ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: min(430px, 94vw);
  background: var(--card); border-left: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop);
  transform: translateX(102%); transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
}
.panel.open { transform: none; }
.panel-hd { display: flex; align-items: center; gap: 13px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.panel-body { flex: 1; overflow-y: auto; padding: 18px 22px 30px; scrollbar-width: thin; }
.panel-x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--card-2);
  color: var(--text-muted); font-size: 15px; cursor: pointer;
  display: grid; place-items: center;
}
.panel-x:hover { color: var(--text); }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 550; }
.setting-sub { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 1px; }
.setting-group { margin-top: 18px; }
.setting-group > .micro-label { display: block; margin-bottom: 6px; }
select.input, input.input {
  background: var(--card-2); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 9px;
  font-family: inherit; font-size: 13px; padding: 6px 10px;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-toggle {
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-strong); border-radius: 99px;
  background: var(--card-2); color: var(--text-muted);
  padding: 4px 12px; cursor: pointer;
  transition: all 150ms ease;
}
.tag-toggle.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* ---------------------------------------------------------------- filter -- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-chip {
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border-strong); border-radius: 99px;
  background: transparent; color: var(--text-muted);
  padding: 5px 13px; cursor: pointer; transition: all 150ms ease;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.on { background: var(--card); color: var(--text); border-color: var(--text-dim); }
.filter-chip.on.red { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger-strong) 45%, transparent); }

/* ----------------------------------------------------------------- misc -- */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.section-gap { margin-top: 22px; }
.empty { padding: 34px 16px; text-align: center; color: var(--text-dim); font-size: 13px; }
.empty .e-ico { font-size: 26px; margin-bottom: 8px; opacity: 0.7; }
.brief {
  font-size: 14px; line-height: 1.65; color: var(--text-muted);
}
.brief .hi { color: var(--text); font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(80px);
  background: var(--card); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-pop); border-radius: 12px;
  padding: 11px 18px; font-size: 13.5px; font-weight: 600;
  z-index: 80; transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast.show { transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--card-3); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------ responsive -- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 250px; height: 100dvh;
    transform: translateX(-104%); transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
    background: var(--canvas-2); border-right: 1px solid var(--border-strong);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .main { padding: 18px 16px 70px; }
  .hamburger {
    display: grid; place-items: center;
    width: 38px; height: 38px; border-radius: 11px;
    border: 1px solid var(--border-strong); background: var(--card);
    color: var(--text); cursor: pointer; flex: none;
  }
  .hamburger svg { width: 18px; height: 18px; }
  .topbar { align-items: center; }
  .page-title { font-size: 20px; }
  .card-link, .link-task { padding: 8px 0; margin: -8px 0; }
  .run-who { flex-basis: 150px; }
  .run-sum { display: none; }
  .chat-page { height: calc(100dvh - 190px); }
  .msg { max-width: 92%; }
}
@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 27px; }
  .crew-grid { grid-template-columns: 1fr; }
  .banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card-pad { padding: 17px 16px; }
  .col { flex-basis: 240px; }
}
