/* Centrica Pulse — Operating Console */
:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --ink: #1F1A2E;
  --ink-2: rgba(31,26,46,0.72);
  --ink-3: #6B6483;
  --ink-4: #9B95AC;
  --line: rgba(31,26,46,0.08);
  --line-2: rgba(31,26,46,0.04);

  --accent: #664FAD;
  --accent-ink: #FFFFFF;
  --accent-soft: #EFEAF7;
  --accent-softer: #F6F2FB;
  --accent-line: rgba(102,79,173,0.22);

  --ok: #29B263;
  --ok-soft: #E8F6EE;
  --warn: #F97316;
  --warn-soft: #FEF0E5;
  --danger: #DC2626;
  --danger-soft: #FDECEC;

  --magenta: #D03E9D;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 14px rgba(31,26,46,0.06), 0 1px 2px rgba(31,26,46,0.04);
  --shadow-lg: 0 12px 40px rgba(31,26,46,0.12), 0 2px 8px rgba(31,26,46,0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  /* density — comfortable (default) */
  --rail-w: 248px;
  --right-w: 320px;
  --row-pad-y: 12px;
  --row-pad-x: 14px;
  --card-pad: 18px;
  --gap: 14px;
  --title-size: 22px;
  --body-size: 14px;
  --meta-size: 12px;
}

[data-density="compact"] {
  --rail-w: 232px;
  --right-w: 300px;
  --row-pad-y: 8px;
  --row-pad-x: 12px;
  --card-pad: 14px;
  --gap: 10px;
  --title-size: 20px;
  --body-size: 13px;
  --meta-size: 11px;
}

[data-density="terminal"] {
  --rail-w: 220px;
  --right-w: 288px;
  --row-pad-y: 5px;
  --row-pad-x: 10px;
  --card-pad: 10px;
  --gap: 6px;
  --title-size: 18px;
  --body-size: 12.5px;
  --meta-size: 11px;
  --radius: 6px;
  --radius-lg: 8px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: var(--body-size);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
#root { min-height: 100vh; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }

/* Default icon sizing — SVGs without an explicit size fall back to 14px.
   Prevents the occasional un-sized svg blowing up to container width. */
.search > svg, .wiki-search > svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--ink-3); }

.mono { font-family: 'Menlo', 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; letter-spacing: 0.2px; }
.muted { color: var(--ink-3); }
.kicker { font-family: 'Menlo', ui-monospace, monospace; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }

/* ── App shell ─────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr var(--right-w);
  grid-template-rows: 56px 1fr;
  height: 100vh;
  min-height: 680px;
  background: var(--bg);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px 0 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  z-index: 5;
  position: sticky; top: 0;
}

.brand {
  width: var(--rail-w);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 100%;
  border-right: 1px solid var(--line);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, 0 1px 2px rgba(0,0,0,0.2);
}
.brand-mark svg { width: 15px; height: 15px; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.2px; }
.brand-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

.tabs { display: flex; gap: 2px; background: var(--surface); padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.tab {
  border: 0; background: transparent; padding: 5px 12px;
  font-size: 13px; color: var(--ink-2); border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab[aria-current="true"] { background: var(--bg); color: var(--ink); box-shadow: var(--shadow-sm); }

.search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--ink-3);
  font-size: 13px;
}
.search > svg { width: 14px; height: 14px; flex-shrink: 0; }
.wiki-search > svg { width: 14px; height: 14px; flex-shrink: 0; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; color: var(--ink); font-size: 13px; }
.kbd {
  font-family: 'Menlo', ui-monospace, monospace;
  font-size: 10.5px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--ink-3);
  background: var(--bg);
}

.reminder { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12px; }
.reminder-dot { width: 14px; height: 14px; color: var(--ok); }
.reminder b { color: var(--ink); font-weight: 500; }

.checkin-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--ok);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 1px 3px rgba(41,178,99,0.4);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.checkin-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 0 rgba(255,255,255,0.25) inset, 0 4px 10px rgba(41,178,99,0.35); }
.checkin-btn .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 0 rgba(255,255,255,0.7);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.8); }
  50% { box-shadow: 0 0 0 6px rgba(255,255,255,0); }
}

/* ── Left rail ─────────────────────────────────────────────── */
.rail {
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto;
  background: var(--bg);
}
.rail-section { padding: 16px 12px 6px; }
.rail-heading {
  font-family: 'Menlo', ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 8px 6px;
  display: flex; justify-content: space-between; align-items: center;
}

.scope-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: var(--row-pad-y) var(--row-pad-x);
  border: 0; background: transparent;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  letter-spacing: -0.1px;
  transition: background 100ms ease;
}
.scope-item:hover { background: rgba(102,79,173,0.06); color: var(--ink); }
.scope-item[aria-current="true"] {
  background: #E4D9F8;
  color: var(--ink);
}
.scope-item .scope-icon { width: 16px; height: 16px; color: var(--ink-3); flex-shrink: 0; }
.scope-item[aria-current="true"] .scope-icon { color: var(--accent); }
.scope-item .scope-label { flex: 1; }
.scope-item .scope-meta { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.scope-bar {
  width: 36px; height: 5px; background: rgba(31,26,46,0.08); border-radius: 99px; overflow: hidden;
}
.scope-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.user-card {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}

/* ── Right rail ────────────────────────────────────────────── */
.right-rail {
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px 14px 18px;
  background: var(--bg);
  display: flex; flex-direction: column; gap: 16px;
}
.rr-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.rr-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rr-head svg { width: 14px; height: 14px; color: var(--accent); }
.rr-title { font-size: 13px; font-weight: 600; letter-spacing: -0.2px; }

.goal { margin-bottom: 12px; }
.goal:last-child { margin-bottom: 0; }
.goal-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; letter-spacing: -0.1px; }
.goal-head .pct { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; }
.goal-bar { height: 4px; background: rgba(31,26,46,0.06); border-radius: 99px; overflow: hidden; }
.goal-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--magenta) 100%);
  border-radius: 99px;
}
.goal-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.todo { display: flex; gap: 9px; padding: 6px 0; font-size: 13px; align-items: flex-start; line-height: 1.4; }
.todo input[type=checkbox] { accent-color: var(--accent); margin-top: 2px; }
.todo label { flex: 1; cursor: pointer; color: var(--ink-2); letter-spacing: -0.1px; }
.todo input:checked + label { color: var(--ink-4); text-decoration: line-through; }
.todo .from { color: var(--ink-4); font-size: 11px; margin-top: 2px; display: block; }

.senti-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.senti-cell { aspect-ratio: 1; border-radius: 4px; background: #E4D9F8; }
.senti-legend { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); margin-top: 8px; }

/* ── Main panel ────────────────────────────────────────────── */
.main {
  overflow-y: auto;
  padding: 24px 28px 40px;
  scroll-behavior: smooth;
}
.main-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
}
.main-title { font-size: var(--title-size); font-weight: 600; letter-spacing: -0.6px; }
.main-title .sub { font-size: 13px; font-weight: 400; color: var(--ink-3); margin-left: 10px; letter-spacing: -0.1px; }
.main-meta { font-size: 12px; color: var(--ink-3); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--card-pad);
  margin-bottom: var(--gap);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

/* Today's check-ins */
.checkins-card { padding: 18px; }
.checkins-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.checkins-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.checkins-pct {
  display: flex; align-items: center; gap: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 600;
}
.checkins-bar { width: 108px; height: 6px; background: rgba(31,26,46,0.06); border-radius: 99px; overflow: hidden; }
.checkins-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 500ms ease; }
.member-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.member {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  background: var(--surface);
  font-size: 13px;
  transition: background 120ms ease, border-color 120ms ease;
}
.member.done { border-color: rgba(41,178,99,0.28); background: rgba(41,178,99,0.05); }
.member.you { border-color: rgba(102,79,173,0.3); background: rgba(102,79,173,0.04); }
.member .name { flex: 1; font-weight: 500; letter-spacing: -0.1px; }
.member .time { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.member .dot-done { width: 14px; height: 14px; color: var(--ok); }
.member .dot-todo { width: 14px; height: 14px; color: var(--ink-4); }

/* AI summary */
.ai-card {
  background: var(--accent-softer);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
}
.ai-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--accent); letter-spacing: -0.1px; }
.ai-label svg { width: 14px; height: 14px; }
.ai-source { font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.ai-body { color: var(--ink); font-size: 14px; line-height: 1.55; letter-spacing: -0.1px; }
.ai-body ul { margin: 6px 0 0; padding-left: 18px; }
.ai-body li { margin: 3px 0; }

/* Filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--gap); }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 99px;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 500;
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}
.chip svg { width: 12px; height: 12px; }
.chip .count { font-variant-numeric: tabular-nums; color: var(--ink-4); font-size: 11px; margin-left: 2px; }
.chip[aria-pressed="true"] .count { color: var(--accent); }

/* Update cards */
.update {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: var(--gap);
}
.update-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.update-head .meta { flex: 1; }
.update-head .who { font-size: 14px; font-weight: 600; letter-spacing: -0.1px; }
.update-head .role { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.update-head .time { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.update-title { font-size: 15px; font-weight: 600; margin: 4px 0 6px; letter-spacing: -0.2px; }
.update-body { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; letter-spacing: -0.05px; }
.update-foot { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}
.tag.decision { background: var(--warn-soft); color: var(--warn); }
.tag.blocker { background: var(--danger-soft); color: var(--danger); }
.tag.idea { background: var(--accent-soft); color: var(--accent); }
.tag.outcome { background: var(--ok-soft); color: var(--ok); }
.tag.article { background: var(--accent-softer); color: var(--accent); border: 1px solid var(--accent-line); }
.tag.ghost { background: transparent; color: var(--ink-3); border: 1px solid var(--line); }

.link-pill svg { width: 13px; height: 13px; flex-shrink: 0; }
.link-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--accent-softer);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}
.link-pill .arrow { color: var(--accent); opacity: 0.8; }

/* Avatar */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--magenta) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px rgba(31,26,46,0.04);
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; border-width: 0; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }

/* Voice note player */
.voice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 10px;
}
.voice-play {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff;
  border: 0; display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(102,79,173,0.35);
}
.voice-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; }
.voice-wave span {
  flex: 1; background: var(--accent); opacity: 0.35;
  border-radius: 1.5px; min-height: 3px; max-height: 100%;
  transition: opacity 60ms linear;
}
.voice-wave span.on { opacity: 1; }
.voice-meta { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; min-width: 40px; text-align: right; }
.voice-tag { font-size: 10.5px; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; }
.voice-transcript {
  font-size: 12.5px; color: var(--ink-3);
  margin-top: 8px; line-height: 1.55;
  padding: 10px 12px;
  background: rgba(102,79,173,0.04);
  border-radius: 8px;
  border-left: 2px solid var(--accent-line);
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(31,26,46,0.35);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 180ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 40px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: slideUp 220ms cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head .t { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.modal-head .t .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.modal-head .when { font-size: 12px; color: var(--ink-3); margin-left: 4px; font-weight: 400; }
.modal-close { background: transparent; border: 0; color: var(--ink-3); padding: 6px; border-radius: 6px; display: grid; place-items: center; }
.modal-close:hover { background: var(--bg); color: var(--ink); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.1px; }
.field textarea {
  width: 100%; min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  resize: vertical;
  outline: none;
  letter-spacing: -0.05px;
  transition: border-color 120ms ease, background 120ms ease;
}
.field textarea:focus { border-color: var(--accent-line); background: var(--surface); box-shadow: 0 0 0 3px rgba(102,79,173,0.08); }

.rec-btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  transition: all 120ms ease;
}
.rec-btn:hover { border-color: var(--ok); background: var(--ok-soft); }
.rec-btn.recording { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.rec-btn .mic {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ok); color: #fff; display: grid; place-items: center;
  box-shadow: 0 1px 2px rgba(41,178,99,0.3);
}
.rec-btn.recording .mic { background: var(--danger); }

.sentiment-row { display: flex; gap: 6px; flex-wrap: wrap; }
.sentiment-row button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
.sentiment-row button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.sentiment-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; }

.ai-preview {
  background: var(--accent-softer);
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  padding: 14px;
  margin-top: 6px;
}
.ai-preview .ph { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--accent); font-weight: 600; margin-bottom: 8px; letter-spacing: -0.1px; }
.ai-preview .ph svg { width: 13px; height: 13px; }
.ai-preview .row { font-size: 13px; color: var(--ink); padding: 5px 0; display: flex; align-items: flex-start; gap: 10px; line-height: 1.5; letter-spacing: -0.05px; }
.ai-preview .row .t { font-family: 'Menlo', ui-monospace, monospace; font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--surface); color: var(--ink-3); font-weight: 600; margin-top: 1px; flex-shrink: 0; border: 1px solid var(--line); letter-spacing: 0.3px; }
.ai-preview .row .t.dec { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.ai-preview .row .t.blk { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.ai-preview .row .t.wk { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.ai-preview .row .t.tsk { color: var(--ink); }
.ai-preview .empty { font-size: 12.5px; color: var(--ink-3); font-style: italic; padding: 8px 2px; }

.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.modal-foot .l { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.modal-foot .r { display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--ok); color: #fff; border-color: var(--ok); font-weight: 600; }
.btn.primary:hover { background: #239858; }
.btn.primary:disabled { background: var(--ink-4); border-color: var(--ink-4); cursor: not-allowed; }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.accent:hover { background: #573e98; }

.btn .sp { display: inline-block; width: 12px; height: 12px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; margin-right: 6px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast-wrap {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--ink); color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  min-width: 280px;
  animation: toastIn 280ms cubic-bezier(0.2,0.9,0.3,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.toast b { font-weight: 600; }
.toast .lk { color: #C9BFE3; margin-left: auto; font-size: 12px; text-decoration: underline; cursor: pointer; }

/* Fanout animation */
@keyframes fanIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
.fan-new { animation: fanIn 420ms cubic-bezier(0.2, 0.9, 0.3, 1); }
.fan-highlight {
  position: relative;
}
.fan-highlight::before {
  content: ""; position: absolute; inset: -2px;
  border-radius: inherit;
  box-shadow: 0 0 0 2px var(--accent);
  pointer-events: none;
  animation: highlight 1.6s ease-out;
  opacity: 0;
}
@keyframes highlight {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Wiki layout ───────────────────────────────────────── */
.wiki-layout {
  display: grid;
  grid-template-columns: 188px 1fr;
  gap: 20px;
  align-items: start;
  min-width: 0;
}

.wiki-nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}
.wiki-nav-item {
  display: flex;
  width: 100%;
  align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 0; background: transparent;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  margin-bottom: 1px;
  box-sizing: border-box;
  cursor: pointer;
}
.wiki-nav-item:hover { background: var(--bg); color: var(--ink); }
.wiki-nav-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }

.wiki-badge {
  margin-left: auto;
  min-width: 18px; height: 18px;
  background: var(--warn-soft); color: var(--warn);
  border-radius: 99px; font-size: 10.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
  flex-shrink: 0;
}

.wiki-stat-row {
  display: flex;
  justify-content: space-between; align-items: center;
  padding: 3px 10px;
  font-size: 12px; color: var(--ink-3);
}
.wiki-stat-row span:last-child { font-family: 'Menlo', ui-monospace, monospace; font-size: 11px; }

.wiki-content { min-width: 0; }

.wiki-cat-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line); padding-bottom: 10px;
  flex-wrap: wrap;
}
.wiki-cat-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  cursor: pointer;
}
.wiki-cat-tab:hover { background: var(--bg); color: var(--ink); }
.wiki-cat-tab[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border-color: var(--line); }

.wiki-section-group { margin-bottom: 22px; }
.wiki-group-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px; padding: 0 4px;
}

.decision-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 100ms ease;
}
.decision-row:hover { border-color: rgba(102,79,173,0.3); }
.decision-row-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
}
.decision-title { font-size: 14px; font-weight: 600; letter-spacing: -0.15px; line-height: 1.4; }
.decision-body {
  padding: 12px 16px 14px 40px;
  border-top: 1px solid var(--line);
}

.wiki-status {
  font-size: 10.5px; font-weight: 500; padding: 2px 8px;
  border-radius: 99px; white-space: nowrap;
  flex-shrink: 0;
}
.wiki-status.live { background: var(--ok-soft); color: var(--ok); }
.wiki-status.draft { background: var(--warn-soft); color: var(--warn); }
.wiki-status.archived { background: var(--bg); color: var(--ink-4); border: 1px solid var(--line); }

/* ── Wiki ──────────────────────────────────────────────── */
.wiki-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 14px;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.wiki-search input { border: 0; outline: 0; background: transparent; flex: 1; color: var(--ink); font-size: 13.5px; }
.wiki-item { display: flex; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.wiki-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent);
}
.wiki-icon.outcome { background: var(--ok-soft); color: var(--ok); }
.wiki-icon.decision { background: var(--warn-soft); color: var(--warn); }
.wiki-icon.file { background: var(--bg); color: var(--ink-3); border: 1px solid var(--line); }
.wiki-body { flex: 1; }
.wiki-title { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.wiki-desc { font-size: 13px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.wiki-foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.wiki-foot .tags { margin-left: auto; display: flex; gap: 5px; }
.wiki-foot .tag { font-size: 11px; background: var(--bg); color: var(--ink-3); border: 1px solid var(--line); padding: 2px 8px; }
.wiki-type { font-size: 11px; border: 1px solid var(--line); padding: 2px 8px; border-radius: 99px; color: var(--ink-3); text-transform: capitalize; }

/* ── Person profile ───────────────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; border: 0; background: transparent; padding: 0; margin-bottom: 16px; }
.back:hover { color: var(--ink); }
.person-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.person-name { font-size: 24px; font-weight: 600; letter-spacing: -0.6px; }
.person-role { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.person-actions { display: flex; gap: 8px; margin-top: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--ink-3); }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -0.8px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value.ok { color: var(--ok); }
.stat-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }

.heatmap { display: flex; flex-wrap: wrap; gap: 3px; margin: 10px 0; }
.heat { width: 10px; height: 18px; border-radius: 2px; background: rgba(31,26,46,0.06); }
.heat.lv1 { background: var(--ok); }
.heat.lv2 { background: var(--warn); }
.heat.lv3 { background: var(--danger); }
.heat.lv4 { background: var(--accent); }

.heatmap-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); align-items: center; }
.heatmap-legend .swatches { display: flex; gap: 4px; }
.heatmap-legend .sw { width: 10px; height: 10px; border-radius: 2px; }

/* ── History (My Check-Ins) ──────────────────────────── */
.hist-row {
  display: grid; grid-template-columns: 92px 1fr auto;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.hist-date { font-family: 'Menlo', ui-monospace, monospace; font-size: 11.5px; color: var(--ink-3); padding-top: 2px; }
.hist-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.hist-title { font-weight: 600; color: var(--ink); font-size: 14px; letter-spacing: -0.1px; }
.hist-tags { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; max-width: 220px; }

/* Misc */
.hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.nowrap { white-space: nowrap; }

/* Scrollbars */
.main::-webkit-scrollbar, .rail::-webkit-scrollbar, .right-rail::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb, .rail::-webkit-scrollbar-thumb, .right-rail::-webkit-scrollbar-thumb { background: rgba(31,26,46,0.1); border-radius: 99px; }
.main::-webkit-scrollbar-thumb:hover, .rail::-webkit-scrollbar-thumb:hover { background: rgba(31,26,46,0.2); }
