/* =============================================================
   Compliance OS — design system
   Editorial fintech: dense typography, mono accents, restrained
   color, regulator/legal-document feel — but agentic.
   ============================================================= */

:root {
  /* Surfaces */
  --bg: #f7f5f0;            /* warm paper */
  --bg-2: #efece5;
  --bg-3: #e6e2d8;
  --panel: #ffffff;
  --ink: #0e0d0b;
  --ink-2: #38362f;
  --ink-3: #6f6c63;
  --ink-4: #9c9890;
  --line: #d9d4c7;
  --line-2: #c2bcab;

  /* Brand: deep ink + a single accent */
  --accent: #1a3a8f;        /* deep regulator blue */
  --accent-2: #2452c4;
  --accent-soft: #e3e8f4;

  /* Semantic */
  --ok: #1f6b3a;
  --ok-d: #144a26;
  --ok-soft: #dceadf;
  --warn: #a06b00;
  --warn-d: #6e4a00;
  --warn-soft: #f3e7c6;
  --bad: #a52323;
  --bad-d: #791717;
  --bad-soft: #f3dcdc;
  --info: #1a3a8f;
  --info-soft: #e3e8f4;

  /* Agent palette (used in sidebar, badges, traces) */
  --ag-feed: #1a3a8f;
  --ag-impact: #6b1f6b;
  --ag-classifier: #1a6b6b;
  --ag-gap: #a52323;
  --ag-precedent: #6b4f1a;
  --ag-remediation: #1f6b3a;

  --rad: 4px;
  --shadow-1: 0 1px 0 rgba(0,0,0,0.04);
  --shadow-2: 0 4px 16px rgba(20,18,12,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter Tight', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}

.mono { font-family: 'JetBrains Mono', monospace; font-feature-settings: 'zero'; }
.muted { color: var(--ink-3); }
.dim { color: var(--ink-4); }
.ok { color: var(--ok-d); }
.warn { color: var(--warn-d); }
.bad { color: var(--bad-d); }
.hi { color: var(--accent); font-weight: 500; }
.uc { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; font-weight: 500; }
.num { font-family: 'JetBrains Mono', monospace; font-variant-numeric: tabular-nums; }

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.grow { flex: 1; }

/* ============ APP SHELL ============ */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 44px 1fr;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 0 16px;
  gap: 12px;
  position: relative;
  z-index: 5;
}
.topbar .logo {
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.topbar .logo .mark {
  width: 18px; height: 18px;
  background: var(--ink);
  border-radius: 2px;
  display: grid; place-items: center;
  color: var(--bg);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; font-weight: 700;
}
.topbar .org {
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 12px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}
.topbar .crumb { color: var(--ink-3); font-size: 12px; }
.topbar .crumb b { color: var(--ink); font-weight: 500; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar .pulse {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-3);
}
.topbar .pulse .dot {
  width: 8px; height: 8px; border-radius: 99px;
  background: var(--ok); box-shadow: 0 0 0 0 var(--ok);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(31,107,58,0.5); }
  70% { box-shadow: 0 0 0 8px rgba(31,107,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,107,58,0); }
}
.topbar .avatar {
  width: 26px; height: 26px; border-radius: 99px;
  background: linear-gradient(135deg, #c4b8a3, #8a7e63);
  display: grid; place-items: center;
  color: white; font-size: 11px; font-weight: 600;
}

/* sidebar */
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  overflow-y: auto;
  padding: 12px 0 24px;
}
.nav-section {
  padding: 10px 16px 4px;
}
.nav-section .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  font-weight: 500;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  color: var(--ink-2);
}
.nav-item:hover { background: var(--bg-3); }
.nav-item.active {
  background: var(--bg);
  color: var(--ink);
  font-weight: 500;
}
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--ink);
}
.nav-item .count {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
  background: var(--bg-3);
  padding: 1px 6px;
  border-radius: 99px;
}
.nav-item.active .count { background: var(--bg-2); color: var(--ink-2); }

.agent-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 16px;
  font-size: 11px;
  color: var(--ink-3);
}
.agent-row .agent-dot {
  width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0;
}
.agent-row .name { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: 0.02em; flex: 1; }
.agent-row .load { font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--ink-4); }

/* main */
.main {
  overflow-y: auto;
  background: var(--bg);
  position: relative;
}

.page-head {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: relative;
}
.page-head h1 {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.15;
}
.page-head .page-sub {
  color: var(--ink-3);
  font-size: 12px;
  margin-top: 4px;
}
.page-head .page-actions {
  position: absolute;
  right: 24px; top: 20px;
  display: flex; gap: 6px;
}

/* ============ CARDS / TABLES ============ */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.card-head h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}
.card-body { padding: 14px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table thead th {
  text-align: left;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: var(--ink-3);
  padding: 8px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }

/* ============ PILLS / BADGES ============ */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid;
}
.pill.ok { background: var(--ok-soft); color: var(--ok-d); border-color: rgba(31,107,58,0.25); }
.pill.warn { background: var(--warn-soft); color: var(--warn-d); border-color: rgba(160,107,0,0.25); }
.pill.bad { background: var(--bad-soft); color: var(--bad-d); border-color: rgba(165,35,35,0.25); }
.pill.info { background: var(--info-soft); color: var(--accent); border-color: rgba(26,58,143,0.25); }
.pill.neutral { background: var(--bg-2); color: var(--ink-2); border-color: var(--line-2); }

.sev {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px;
  font-weight: 500;
}
.sev .glyph {
  width: 10px; height: 10px;
  display: inline-block;
  border-radius: 1px;
}
.sev.critical { color: var(--bad-d); }
.sev.critical .glyph { background: var(--bad); }
.sev.high { color: var(--warn-d); }
.sev.high .glyph { background: var(--warn); }
.sev.medium { color: var(--accent); }
.sev.medium .glyph { background: var(--accent); }
.sev.low { color: var(--ink-3); }
.sev.low .glyph { background: var(--ink-3); }

/* progress */
.bar {
  flex: 1;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--ink);
  transition: width 0.3s;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--rad);
  cursor: pointer;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.1s;
}
.btn:hover { background: var(--bg-2); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn.sm { padding: 3px 8px; font-size: 11px; }
.btn.danger { color: var(--bad-d); border-color: rgba(165,35,35,0.3); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-2); }

/* ============ TRACE FEED (the agent reasoning UI) ============ */
.trace {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--rad);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--ink-2);
}
.trace .line {
  display: flex; gap: 10px;
  padding: 2px 0;
  align-items: flex-start;
}
.trace .line .t { color: #6f6c63; flex-shrink: 0; }
.trace .line .ag {
  flex-shrink: 0;
  font-weight: 600;
  letter-spacing: 0.02em;
  width: 64px;
}
.trace .line .ag.feed { color: #8aa3e8; }
.trace .line .ag.impact { color: #d39de1; }
.trace .line .ag.classifier { color: #8ddada; }
.trace .line .ag.gap { color: #f0908a; }
.trace .line .ag.precedent { color: #e8c489; }
.trace .line .ag.remediation { color: #98d6a7; }
.trace .line .ag.drafter { color: #e8a989; }
.trace .line .ag.system { color: #bbb6a8; }
.trace .line .msg { flex: 1; word-break: break-word; }
.trace .line .msg .hi { color: #f7f5f0; font-weight: 500; }
.trace .line .msg .ok { color: #98d6a7; }
.trace .line .msg .bad { color: #f0908a; }
.trace .line .msg .warn { color: #e8c489; }
.trace .line .msg .dim { color: #6f6c63; }

/* cursor blink */
.trace .cursor::after {
  content: "▍";
  margin-left: 2px;
  opacity: 0.7;
  animation: blink 1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* agent badge */
.agent-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.agent-badge .dot { width: 8px; height: 8px; border-radius: 99px; }

/* dividers */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.divider.thick { height: 1px; background: var(--line-2); }

/* drawer */
.drawer-bg {
  position: fixed; inset: 0;
  background: rgba(20,18,12,0.18);
  z-index: 50;
  animation: fade 0.15s ease;
}
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 580px; max-width: 90vw;
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: 51;
  display: flex; flex-direction: column;
  box-shadow: -10px 0 30px rgba(20,18,12,0.1);
  animation: slide 0.18s ease;
}
@keyframes slide { from { transform: translateX(20px); opacity: 0; } }
.drawer-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-head .sub { color: var(--ink-3); font-size: 11px; margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.drawer-close {
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--ink-3); font-size: 18px; line-height: 1;
}

/* Icons */
.ico {
  display: inline-block;
  width: 14px; height: 14px;
  vertical-align: -2px;
}
.ico path, .ico line, .ico circle, .ico polyline, .ico polygon, .ico rect {
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Map */
.map-wrap { padding: 14px; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.jur {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: var(--rad);
  font-size: 11px;
  pointer-events: none;
  box-shadow: var(--shadow-2);
  white-space: nowrap;
}

/* misc */
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
input[type="checkbox"] { accent-color: var(--ink); }
input[type="text"], input[type="search"], textarea {
  font-family: inherit; font-size: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  padding: 6px 10px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}
input:focus { border-color: var(--ink); }

/* Tweaks button */
.tweaks-fab {
  position: fixed; bottom: 16px; right: 16px;
  z-index: 30;
}

/* ============ ONBOARDING / SETUP MODE ============ */
.setup-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(26,58,143,0.25);
  padding: 3px 9px;
  border-radius: 99px;
}
.setup-pill .dot {
  width: 6px; height: 6px; border-radius: 99px;
  background: var(--accent);
  animation: pulse-blue 1.6s ease-out infinite;
}
@keyframes pulse-blue {
  0%   { box-shadow: 0 0 0 0 rgba(26,58,143,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(26,58,143,0); }
  100% { box-shadow: 0 0 0 0 rgba(26,58,143,0); }
}

.nav-item.disabled {
  color: var(--ink-4);
  cursor: not-allowed;
  opacity: 0.55;
}
.nav-item.disabled:hover { background: transparent; }
.nav-item .lock-mark {
  margin-left: auto;
  display: inline-flex;
  color: var(--ink-4);
}
.nav-item .lock-mark svg path {
  stroke: currentColor; stroke-width: 1.5; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ============ STEPPER ============ */
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--rad);
}
.step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-4);
  font-weight: 500;
  white-space: nowrap;
}
.step .step-num {
  width: 20px; height: 20px;
  display: inline-grid; place-items: center;
  border-radius: 99px;
  background: var(--bg-2);
  color: var(--ink-3);
  border: 1px solid var(--line-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
}
.step.active {
  color: var(--ink);
}
.step.active .step-num {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.step.done {
  color: var(--ink-2);
}
.step.done .step-num {
  background: var(--ok);
  color: white;
  border-color: var(--ok);
}
.step-divider {
  flex: 1;
  height: 1px;
  background: var(--line);
  min-width: 12px;
}

/* form bits used by onboarding */
.input, .textarea, .select {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--rad);
  padding: 6px 10px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); }
.textarea { resize: vertical; font-family: inherit; }
.label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 4px;
}
[data-history-density="compact"] .table td, [data-history-density="compact"] .table th { padding-top: 4px; padding-bottom: 4px; font-size: 11px; }
[data-history-density="comfy"] .table td, [data-history-density="comfy"] .table th { padding-top: 14px; padding-bottom: 14px; }
.btn.success { background: var(--ok); color: white; border-color: var(--ok); }
.btn.success:hover { background: var(--ok-d); border-color: var(--ok-d); }


/* ============ SENTINEL CHAT ============ */
.sentinel-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px 9px 11px;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 99px;
  font: 500 12px/1 'Inter Tight', sans-serif;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20,18,12,0.22), 0 1px 0 rgba(255,255,255,0.04) inset;
  z-index: 90;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.sentinel-fab:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(20,18,12,0.28); }
.sentinel-fab-glyph {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
}
.sentinel-fab-label { font-weight: 500; }
.sentinel-fab-badge {
  margin-left: 4px;
  background: var(--bad);
  color: #fff;
  font: 500 10px/1 'JetBrains Mono', monospace;
  padding: 3px 6px;
  border-radius: 99px;
}

.sentinel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 380px;
  height: min(620px, calc(100vh - 80px));
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(20,18,12,0.22), 0 2px 6px rgba(20,18,12,0.08);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  z-index: 90;
  overflow: hidden;
  font-family: 'Inter Tight', sans-serif;
}
.sentinel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--ink);
  color: #efece5;
  border-bottom: 1px solid var(--ink);
}
.sentinel-head-left { display: flex; align-items: center; gap: 10px; }
.sentinel-mark {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
}
.sentinel-title .name { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.sentinel-title .sub  { font-size: 9.5px; color: rgba(239,236,229,0.55); letter-spacing: 0.05em; text-transform: uppercase; margin-top: 1px; }
.sentinel-head-right { display: flex; align-items: center; gap: 6px; }
.sentinel-status {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 10px/1 'JetBrains Mono', monospace;
  color: rgba(239,236,229,0.7);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding-right: 4px;
}
.sentinel-status .dot {
  width: 6px; height: 6px; border-radius: 99px;
  background: #6ed197; box-shadow: 0 0 6px #6ed197;
}
.sentinel-iconbtn {
  width: 24px; height: 24px;
  display: inline-grid; place-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  color: #efece5;
  cursor: pointer;
}
.sentinel-iconbtn:hover { background: rgba(255,255,255,0.12); }
.sentinel-iconbtn.is-active {
  background: rgba(255,255,255,0.16);
  color: #fff;
}
.sentinel-iconbtn.ghost {
  color: var(--ink-2);
  border-color: var(--line);
}
.sentinel-iconbtn.ghost:hover { background: var(--bg-2); color: var(--ink); }

.sentinel-info {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px 10px;
  font-family: 'Inter Tight', sans-serif;
  animation: sentinel-info-in 160ms ease;
}
@keyframes sentinel-info-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sentinel-info-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.sentinel-info-title {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink);
}
.sentinel-info-body {
  font-size: 12px; line-height: 1.5;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.sentinel-info-list {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.sentinel-info-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-2);
  padding: 3px 0;
  border-top: 1px dashed var(--line);
}
.sentinel-info-list li:first-child { border-top: 0; }
.sentinel-info-list .cap {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.sentinel-info-foot {
  display: flex; gap: 14px;
  padding-top: 8px; margin-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sentinel-body {
  overflow-y: auto;
  padding: 14px 12px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
.sentinel-row { display: flex; }
.sentinel-row.user { justify-content: flex-end; }
.sentinel-row.agent { justify-content: flex-start; }
.sentinel-bubble {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.sentinel-bubble.user {
  background: var(--ink);
  color: var(--bg);
  border-bottom-right-radius: 2px;
}
.sentinel-bubble.agent {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-bottom-left-radius: 2px;
}
.sentinel-text { white-space: pre-wrap; }

.sentinel-trace {
  margin-top: 8px;
  padding: 6px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--ink-2);
}
.sentinel-trace-line { display: flex; gap: 8px; padding: 1px 0; }
.sentinel-trace-line .ag { color: var(--accent); font-weight: 500; min-width: 54px; }
.sentinel-trace-line .msg { color: var(--ink-3); }

.sentinel-cards { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sentinel-card {
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.sentinel-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.sentinel-card-title { font-size: 12px; font-weight: 500; line-height: 1.35; }
.sentinel-card .dim { color: var(--ink-3); }

.sentinel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sentinel-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  font: 500 11px/1 'Inter Tight', sans-serif;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  cursor: pointer;
}
.sentinel-action:hover { background: var(--bg-2); }
.sentinel-action.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.sentinel-action.primary:hover { background: var(--accent-2); }

.sentinel-typing { display: inline-flex; gap: 3px; vertical-align: middle; }
.sentinel-typing i {
  width: 5px; height: 5px; border-radius: 99px;
  background: var(--ink-3);
  animation: sentinel-bounce 1.1s infinite;
}
.sentinel-typing i:nth-child(2) { animation-delay: 0.15s; }
.sentinel-typing i:nth-child(3) { animation-delay: 0.30s; }
@keyframes sentinel-bounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.sentinel-suggest {
  padding: 8px 12px 4px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.sentinel-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
.sentinel-chip {
  padding: 5px 9px;
  font: 500 11px/1 'Inter Tight', sans-serif;
  background: var(--bg-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
}
.sentinel-chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.sentinel-input {
  display: flex;
  padding: 10px 10px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  gap: 6px;
}
.sentinel-input input {
  flex: 1;
  padding: 8px 10px;
  font: 400 12.5px/1.3 'Inter Tight', sans-serif;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: none;
}
.sentinel-input input:focus { border-color: var(--accent); background: var(--panel); }
.sentinel-send {
  width: 32px;
  display: inline-grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
}
.sentinel-send:disabled { opacity: 0.4; cursor: not-allowed; }
.sentinel-send:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }

.sentinel-foot {
  display: flex; gap: 14px;
  padding: 6px 12px 8px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sentinel-foot span:last-child { margin-left: auto; color: var(--ink-3); text-transform: none; letter-spacing: 0.02em; font-size: 10px; }

/* ============ DRAFTING ============ */
.tmpl-card {
  border: 1px solid var(--line);
  border-radius: var(--rad);
  background: var(--panel);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
  display: flex; flex-direction: column;
  min-height: 124px;
}
.tmpl-card:hover { border-color: var(--ink-3); background: var(--bg-2); }
.tmpl-card .kind {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
}
.tmpl-card .ttl {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.35;
  color: var(--ink);
}
.tmpl-card .meta {
  margin-top: auto;
  padding-top: 10px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
}

/* Document excerpt — renders like a real doc page */
.doc-excerpt {
  background: #fdfcf8;
  border: 1px solid var(--line);
  border-radius: var(--rad);
  padding: 22px 26px;
  font-family: "Iowan Old Style", "Charter", "Georgia", serif;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink);
  position: relative;
  box-shadow: 0 1px 0 rgba(0,0,0,0.03), inset 0 0 0 1px rgba(255,255,255,0.4);
}
.doc-excerpt h4 {
  font-family: 'Inter Tight', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 14px 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.doc-excerpt h4:first-child { margin-top: 0; }
.doc-excerpt p { margin: 0 0 9px; }
.doc-excerpt p.cite {
  background: var(--info-soft);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--ink-2);
  font-style: italic;
  position: relative;
}
.doc-excerpt p.cite::after {
  content: attr(data-cite);
  position: absolute;
  top: 4px; right: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.doc-excerpt .page-mark {
  position: absolute;
  top: 14px; right: 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Citation chip stack on the right rail */
.cite-rail { display: flex; flex-direction: column; gap: 8px; }
.cite-rail .cite-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--rad);
  padding: 8px 10px;
}
.cite-rail .cite-card .src {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.cite-rail .cite-card .body {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2);
}
.cite-rail .cite-card .ref {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  color: var(--ink-3);
  margin-top: 4px;
}

/* Drafting tab strip */
.tab-strip {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.tab-strip .tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-strip .tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.tab-strip .tab:hover:not(.active) { color: var(--ink-2); }
.tab-strip .tab .count {
  margin-left: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-4);
}
