/* GuardRadar Operator — matched to marketing site palette */
:root {
  --ink: #0a0a0a;
  --ink-2: #0c0c12;
  --panel: #14141c;
  --panel-2: #1c1c26;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --copper: #8B5CF6;
  --copper-hot: #a78bfa;
  --stone: #d1d5db;
  --stone-dim: #9ca3af;
  --text: #f5f5f7;
  --signal: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --purple-soft: rgba(139, 92, 246, 0.15);
  --green-soft: rgba(34, 197, 94, 0.15);
  --amber-soft: rgba(245, 158, 11, 0.15);
  --red-soft: rgba(239, 68, 68, 0.2);
  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--stone);
  background: var(--ink);
  min-height: 100vh;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='2' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% -5%, rgba(139, 92, 246, 0.18), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 100%, rgba(34, 197, 94, 0.06), transparent 50%),
    radial-gradient(ellipse 40% 30% at 70% 20%, rgba(255, 255, 255, 0.03), transparent 60%);
}
.atmosphere::after {
  content: "";
  position: absolute;
  width: min(70vw, 720px);
  height: min(70vw, 720px);
  right: -12%;
  top: 8%;
  border: 1px solid rgba(139, 92, 246, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgba(139, 92, 246, 0.04),
    0 0 0 96px rgba(139, 92, 246, 0.02);
  animation: pulse-ring 12s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

.gate, .app, .drawer { position: relative; z-index: 1; }
.gate[hidden], .app[hidden], .drawer[hidden] { display: none !important; }

/* ── Login ── */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.gate-inner {
  width: min(440px, 100%);
  padding: 36px 32px;
  background: rgba(20, 20, 28, 0.72);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 64px -24px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: rise 0.7s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.eyebrow {
  margin: 0 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--copper-hot);
  font-weight: 600;
}
.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 800;
  line-height: 0.96;
  color: var(--text);
  letter-spacing: -0.04em;
}
.lede {
  margin: 18px 0 36px;
  color: var(--stone-dim);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 34ch;
}
.login-form label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone-dim);
  margin-bottom: 8px;
  font-weight: 600;
}
.login-form input {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  margin-bottom: 16px;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.login-form input:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

/* ── Buttons ── */
.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--stone);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 11px 18px;
  cursor: pointer;
  border-radius: var(--radius);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { border-color: var(--copper); color: var(--copper-hot); }
.btn.primary {
  background: var(--copper);
  border-color: var(--copper);
  color: #fff;
  width: 100%;
  box-shadow: 0 8px 24px -8px rgba(139, 92, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn.primary:hover {
  background: var(--copper-hot);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(139, 92, 246, 0.55);
}
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(239, 68, 68, 0.45); color: var(--danger); }
.btn.danger:hover { background: var(--red-soft); }

.error { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* ── App shell ── */
.app { min-height: 100vh; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  background: rgba(10, 10, 10, 0.78);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--copper-hot);
  font-weight: 600;
}
.topbar-actions { display: flex; gap: 8px; }
.topbar-actions .btn { width: auto; }

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 80px;
  animation: rise 0.55s var(--ease) both;
}

.hero-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
}
.hero-strip .btn.primary { width: auto; }
.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.035em;
}
.section-copy {
  margin: 8px 0 0;
  color: var(--stone-dim);
  font-size: 0.95rem;
  max-width: 48ch;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 28px;
}
.metric {
  background: var(--panel);
  padding: 20px 22px;
}
.metric-val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.85rem;
  color: var(--text);
  line-height: 1;
  margin-bottom: 8px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.metric.warn .metric-val { color: var(--warn); }
.metric-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone-dim);
  font-weight: 600;
}

.auth-banner {
  background: var(--amber-soft);
  border-bottom: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--warn);
  padding: 10px 28px;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.auth-banner strong { color: var(--copper-hot); }

.trends {
  border: 1px solid var(--line);
  background: rgba(20, 20, 28, 0.9);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  margin-bottom: 28px;
}
.trends-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.trends-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.trends-meta {
  margin: 0;
  font-size: 12px;
  color: var(--stone-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
.trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 88px;
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 6px;
}
.trend-bar {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, var(--copper-hot), rgba(139, 92, 246, 0.35));
  border-radius: 6px 6px 0 0;
  min-height: 4px;
  transition: height 0.35s var(--ease);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
}
.trend-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stone-dim);
  font-weight: 600;
}
.trend-val {
  font-size: 11px;
  color: var(--stone);
}

.checklist {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 8px;
  margin: 8px 0 16px;
  background: rgba(10, 10, 10, 0.35);
}
.checklist legend {
  padding: 0 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--copper-hot);
  font-weight: 600;
}
.checklist-progress {
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--stone-dim);
}
.ops-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
}
.ops-row .btn { width: auto; }
.health-status {
  font-size: 12px;
  color: var(--stone-dim);
  letter-spacing: 0.04em;
}
.health-status.up { color: var(--signal); }
.health-status.down { color: var(--danger); }

.pill.health-up { color: var(--signal); border-color: rgba(34, 197, 94, 0.4); background: var(--green-soft); }
.pill.health-down { color: var(--danger); border-color: rgba(239, 68, 68, 0.4); background: var(--red-soft); }
.pill.health-unknown { color: var(--stone-dim); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}
.toolbar input[type="search"] {
  flex: 1 1 240px;
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease);
}
.toolbar input:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 3px var(--purple-soft);
}
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--stone-dim);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 999px;
  font-weight: 600;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
}
.chip.active, .chip:hover {
  border-color: var(--copper);
  color: var(--copper-hot);
  background: var(--purple-soft);
}

.ledger-wrap {
  border: 1px solid var(--line);
  overflow: auto;
  background: rgba(20, 20, 28, 0.9);
  border-radius: var(--radius);
}
.ledger {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
.ledger th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone-dim);
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  background: rgba(12, 12, 18, 0.6);
}
.ledger td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.ledger tbody tr {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.ledger tbody tr:hover { background: rgba(139, 92, 246, 0.06); }
.ledger .empty {
  text-align: center;
  color: var(--stone-dim);
  padding: 48px 16px;
  cursor: default;
}
.company-cell strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 4px;
}
.company-cell span {
  font-size: 12px;
  color: var(--stone-dim);
}
.pill {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
}
.pill.live { color: var(--signal); border-color: rgba(34, 197, 94, 0.4); background: var(--green-soft); }
.pill.setup { color: var(--copper-hot); border-color: rgba(139, 92, 246, 0.4); background: var(--purple-soft); }
.pill.paused { color: var(--warn); border-color: rgba(245, 158, 11, 0.4); background: var(--amber-soft); }
.pill.churned { color: var(--stone-dim); }
.pill.premium { color: var(--copper-hot); border-color: rgba(139, 92, 246, 0.45); }
.comp-dots { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--stone-dim); }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--stone-dim);
}
.dot.on { background: var(--signal); box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); }
.dot.off { background: var(--danger); opacity: 0.7; }

/* ── Drawer ── */
.drawer[hidden] { display: none !important; }
.drawer {
  position: fixed;
  inset: 0;
  z-index: 20;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  animation: fade 0.2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100%);
  background: var(--ink-2);
  border-left: 1px solid var(--line-strong);
  padding: 24px;
  overflow: auto;
  animation: slide 0.28s var(--ease);
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.45);
}
@keyframes slide {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.drawer-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.drawer-head .btn { width: auto; }

.account-form label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone-dim);
  margin-bottom: 14px;
  font-weight: 600;
}
.account-form input,
.account-form select,
.account-form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease);
}
.account-form textarea { resize: vertical; }
.account-form input:focus,
.account-form select:focus,
.account-form textarea:focus {
  outline: none;
  border-color: var(--copper);
  box-shadow: 0 0 0 3px var(--purple-soft);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}
.check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 13px !important;
  color: var(--stone) !important;
  margin: 8px 0 18px !important;
}
.check input { width: auto !important; margin: 0 !important; }
.quick-links {
  display: flex;
  gap: 8px;
  margin: 8px 0 20px;
}
.quick-links .btn { width: auto; flex: 1; }
.drawer-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.drawer-actions .btn.primary { width: auto; flex: 1; }
.drawer-actions .btn.danger { width: auto; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 18px;
  z-index: 40;
  font-size: 13px;
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  animation: rise 0.25s var(--ease);
}

/* ── Nav tabs ── */
.main-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--stone-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-tab:hover { color: var(--copper-hot); }
.nav-tab.active {
  color: var(--copper-hot);
  border-color: rgba(139, 92, 246, 0.35);
  background: var(--purple-soft);
}
.view[hidden] { display: none !important; }

/* ── Today board ── */
.today-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.today-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 8px;
  min-height: 160px;
}
.today-panel-wide { grid-column: 1 / -1; }
.today-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.today-panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.today-count {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--copper-hot);
  font-weight: 700;
}
.today-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.today-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.today-item:hover { background: rgba(139, 92, 246, 0.06); }
.today-item strong {
  grid-column: 1;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.today-item span {
  grid-column: 1;
  color: var(--stone-dim);
  font-size: 12px;
}
.today-item em {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-style: normal;
  font-size: 12px;
  color: var(--warn);
  font-weight: 600;
}
#today-overdue .today-item em { color: var(--danger); }
.today-empty {
  padding: 18px 4px;
  color: var(--stone-dim);
  font-size: 13px;
}

.pill.stage-new { color: #93c5fd; border-color: rgba(147, 197, 253, 0.35); }
.pill.stage-contacted { color: var(--copper-hot); border-color: rgba(139, 92, 246, 0.4); }
.pill.stage-demo { color: #c4b5fd; border-color: rgba(196, 181, 253, 0.4); }
.pill.stage-quote { color: var(--signal); border-color: rgba(34, 197, 94, 0.35); }
.pill.stage-won { color: var(--signal); background: var(--green-soft); }
.pill.stage-lost { color: var(--stone-dim); }

.due-overdue { color: var(--danger); font-weight: 600; }
.due-today { color: var(--warn); font-weight: 600; }

.email-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 28px;
  margin-top: 8px;
}
.email-compose label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone-dim);
  margin-bottom: 14px;
  font-weight: 600;
}
.email-compose input,
.email-compose select,
.email-compose textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  border-radius: var(--radius);
}
.email-compose textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.45;
}
.email-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 18px;
}
.email-actions .btn { width: auto; }
.email-log {
  border-left: 1px solid var(--line);
  padding-left: 24px;
}
.comms-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}
.comms-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comms-list li strong { color: var(--text); font-size: 14px; font-weight: 600; }
.comms-list li span { color: var(--stone-dim); font-size: 12px; }
.comms-list .empty { color: var(--stone-dim); border: 0; }

.quote-summary {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: var(--purple-soft);
  color: var(--copper-hot);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
}
#q-body[readonly] { opacity: 0.95; }

.kb-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.3fr;
  gap: 20px;
  margin-top: 8px;
  min-height: 420px;
}
.kb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  max-height: 70vh;
  overflow: auto;
}
.kb-list li {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.kb-list li:hover,
.kb-list li.active { background: var(--purple-soft); }
.kb-list li strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.kb-list li span {
  display: block;
  margin-top: 4px;
  color: var(--stone-dim);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}
.kb-detail {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 22px 24px;
}
.kb-detail h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.kb-detail .kb-meta {
  color: var(--stone-dim);
  font-size: 12px;
  margin-bottom: 16px;
}
.kb-detail pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  color: var(--stone);
}
.kb-detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.kb-detail-actions .btn { width: auto; }

.cal-nav { display: flex; gap: 8px; align-items: center; }
.cal-nav .btn { width: auto; min-width: 44px; }

.cal-month-wrap {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px 18px 12px;
  margin-bottom: 20px;
}
.cal-month-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  gap: 12px;
}
.cal-month-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.cal-month-meta { margin: 0; color: var(--stone-dim); font-size: 13px; }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stone-dim);
  padding: 4px 0;
  font-weight: 600;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.cal-cell {
  min-height: 92px;
  border: 1px solid var(--line);
  background: var(--ink);
  padding: 8px;
  text-align: left;
  font: inherit;
  color: inherit;
  border-radius: var(--radius);
}
.cal-cell.pad { background: transparent; border-color: transparent; min-height: 92px; }
button.cal-cell.day {
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
button.cal-cell.day:hover {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.06);
}
.cal-cell.is-today {
  border-color: var(--copper);
  box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.35);
}
.cal-cell.is-selected {
  border-color: var(--copper-hot);
  background: var(--purple-soft);
}
.cal-cell.is-past .cal-day-num { color: var(--stone-dim); }
.cal-cell.has-items { border-color: rgba(34, 197, 94, 0.28); }
.cal-day-num {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.cal-cell-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-chip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.3;
  padding: 2px 5px;
  background: var(--purple-soft);
  color: var(--copper-hot);
  border-radius: 4px;
  font-weight: 600;
}
.cal-chip.more { background: transparent; color: var(--stone-dim); padding-left: 0; }

.cal-side {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}
.cal-day-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 14px 16px 8px;
  min-height: 140px;
}
.cal-day-panel.is-overdue { border-color: rgba(239, 68, 68, 0.45); }
.cal-day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.cal-day-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.cal-day-head span { color: var(--stone-dim); font-size: 12px; }

#comp-metrics { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
#comp-body[readonly] {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.45;
  opacity: 0.95;
}

@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  #comp-metrics { grid-template-columns: 1fr 1fr; }
  .email-layout { grid-template-columns: 1fr; }
  .email-log { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .today-grid { grid-template-columns: 1fr; }
  .kb-layout { grid-template-columns: 1fr; }
  .cal-side { grid-template-columns: 1fr; }
  .cal-cell { min-height: 72px; }
}
@media (max-width: 800px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .hero-strip { flex-direction: column; align-items: flex-start; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { padding: 16px; flex-wrap: wrap; gap: 12px; }
  .main-nav { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .gate-inner { padding: 28px 22px; }
  .cal-chip { display: none; }
  .cal-cell.has-items .cal-day-num::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: var(--signal);
    vertical-align: middle;
  }
}
