/* ============================================================
   Tend — UX mockup v3 · quiet precise product UI · 2026-07-04
   Reference class: Linear / Attio / Stripe Dashboard.
   Hairlines + whitespace divide; almost nothing is a card.
   One accent. No tints, no traffic lights, no grain.
   ============================================================ */

:root {
  --bg: #FCFCFB;
  --surface: #FFFFFF;

  --ink: #17181A;
  --ink-2: #6E6E6B;
  --ink-3: #9C9C97;

  --line: #ECEBE8;
  --hover: #F6F5F3;
  --fill-quiet: #F4F3F1;

  --accent: #2D5A3D;
  --accent-rail: #4E8B66;   /* accent lifted for the dark rail only */
  --red: #B54334;

  --rail-bg: #17181A;
  --rail-dim: #8A8A85;
  --rail-mid: #C9C9C5;

  --rail-w: 240px;
  --rail-w-collapsed: 56px;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'IBM Plex Serif', Georgia, serif;
  --mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;

  --shadow-pane: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 8px 24px rgba(23, 24, 26, 0.10), 0 1px 2px rgba(23, 24, 26, 0.06);

  --r-btn: 6px;
  --r-card: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
button:active { transform: translateY(1px); }
.pane-divider:active, .thread-row:active, .nav-item:active { transform: none; }

input {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(45, 90, 61, 0.15); }

/* light-area scrollbars */
.view-scroll::-webkit-scrollbar,
.chat-scroll::-webkit-scrollbar,
.pane-scroll::-webkit-scrollbar { width: 10px; }
.view-scroll::-webkit-scrollbar-thumb,
.chat-scroll::-webkit-scrollbar-thumb,
.pane-scroll::-webkit-scrollbar-thumb {
  background: #DDDCD8;
  border-radius: 5px;
  border: 3px solid var(--bg);
}

/* the one small-caps structural label */
.mono-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ============ BUTTONS ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }

.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFFFFF;
}
.btn.primary:hover { background: #2A2B2E; border-color: #2A2B2E; }

.btn.good {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}
.btn.good:hover { background: #264F35; border-color: #264F35; }

.btn.subtle {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn.subtle:hover { background: var(--hover); color: var(--ink); }

/* text-style inline links */
.linklike, .tl-link {
  display: inline;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
}
.linklike:hover, .tl-link:hover { text-decoration: underline; }

/* status dots — tiny, quiet */
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex-shrink: 0;
}
.status-dot.g { background: var(--accent); }
.status-dot.w { background: var(--ink-3); }
.status-dot.i { background: transparent; box-shadow: inset 0 0 0 1.2px var(--ink-3); }

.kind-pip {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex-shrink: 0;
}

.spacer { flex: 1; }

/* ============ APP FRAME ============ */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns 0.18s ease;
}
.app.rail-collapsed { grid-template-columns: var(--rail-w-collapsed) 1fr; }

/* ============ RAIL (dark) ============ */

.rail {
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  color: var(--rail-dim);
}

.rail ::-webkit-scrollbar { width: 8px; }
.rail ::-webkit-scrollbar-thumb {
  background: #35363A;
  border-radius: 4px;
  border: 2px solid var(--rail-bg);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 8px;
  flex-shrink: 0;
}

.wordmark {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #FFFFFF;
}
.wordmark .dot { color: var(--accent-rail); }
.wordmark .word-min { display: none; }
.app.rail-collapsed .wordmark .word-min { display: inline; }
@media (max-width: 800px) { .app.rail-collapsed .wordmark .word-min { display: none; } }

.rail-toggle {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn);
  color: var(--rail-dim);
  flex-shrink: 0;
}
.rail-toggle:hover { background: rgba(255, 255, 255, 0.06); color: #FFFFFF; }

.rail-nav { padding: 8px 0; flex-shrink: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 450;
  color: var(--rail-dim);
  border-left: 2px solid transparent;
  text-align: left;
}
.nav-item:hover { color: var(--rail-mid); background: rgba(255, 255, 255, 0.04); }
.nav-item.active {
  color: #FFFFFF;
  border-left-color: var(--accent-rail);
  background: rgba(255, 255, 255, 0.05);
}
.nav-item svg { flex-shrink: 0; }

/* thread list — Chats only */
.rail-threads {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 8px;
  display: none;
  min-height: 0;
}
.rail-threads.visible { display: block; }
.app.rail-collapsed .rail-threads { display: none; }

.thread-group { margin-bottom: 16px; }
.thread-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px 4px;
}
.thread-group-head .mono-label { color: #6B6B67; font-size: 10px; }

.proj-head-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #6B6B67;
}
.proj-head-btn:hover .mono-label { color: var(--rail-mid); }
.proj-caret {
  display: inline-flex;
  transition: transform 0.15s ease;
  color: #6B6B67;
}
.thread-group.collapsed .proj-caret { transform: rotate(-90deg); }
.thread-group.collapsed .thread-rows { display: none; }

.info-dot {
  position: relative;
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid #3A3B3E;
  color: #6B6B67;
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
}
.info-dot:hover { color: var(--rail-mid); border-color: #55565A; }
.info-dot .tooltip {
  display: none;
  position: absolute;
  top: 20px; right: -8px;
  width: 230px;
  background: #FFFFFF;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  box-shadow: var(--shadow-pop);
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
  padding: 8px 10px;
  z-index: 60;
}
.info-dot:hover .tooltip { display: block; }

.thread-row {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 16px;
  border-left: 2px solid transparent;
}
.thread-row:hover { background: rgba(255, 255, 255, 0.04); }
.thread-row.active {
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--accent-rail);
}
.thread-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.thread-title {
  font-size: 12.5px;
  font-weight: 450;
  color: var(--rail-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-row.active .thread-title { color: #FFFFFF; }
.pin-glyph { color: #6B6B67; font-size: 10px; margin-right: 5px; }
.thread-time {
  font-family: var(--mono);
  font-size: 10px;
  color: #6B6B67;
  flex-shrink: 0;
}
.thread-ghost {
  font-size: 11.5px;
  color: #6B6B67;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.art-dot {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-rail);
  margin-right: 5px;
  vertical-align: 1px;
}

.rail-foot {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px;
  flex-shrink: 0;
}

.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  font-size: 12.5px;
  color: var(--rail-dim);
  border-radius: var(--r-btn);
  text-align: left;
}
.settings-link:hover { color: var(--rail-mid); background: rgba(255, 255, 255, 0.04); }

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--r-btn);
  text-align: left;
}
.identity:hover { background: rgba(255, 255, 255, 0.04); }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #2A2B2E;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.identity-meta { line-height: 1.35; min-width: 0; }
.identity-name { font-size: 12.5px; font-weight: 500; color: var(--rail-mid); }
.identity-sub {
  font-size: 10.5px;
  color: #6B6B67;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 150px;
}

.app.rail-collapsed .wordmark .word,
.app.rail-collapsed .nav-label,
.app.rail-collapsed .identity-meta,
.app.rail-collapsed .settings-label { display: none; }
.app.rail-collapsed .rail-head { justify-content: center; padding: 16px 6px 8px; }
.app.rail-collapsed .nav-item { justify-content: center; padding: 9px 0; }
.app.rail-collapsed .identity { justify-content: center; padding: 6px 0; }
.app.rail-collapsed .settings-link { justify-content: center; padding: 8px 0; }

/* ============ MAIN ============ */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.hamburger { display: none; }

.workspace-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-name .sep { color: var(--ink-3); margin: 0 7px; font-weight: 400; }
.view-crumb { color: var(--ink-2); font-weight: 400; }

.topbar-spacer { flex: 1; }

.demo-chip {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 4px 8px;
}
.demo-chip:hover { background: var(--hover); color: var(--ink-2); }

/* bell + tray */
.bell-wrap { position: relative; }
.bell-btn {
  position: relative;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn);
  color: var(--ink-2);
}
.bell-btn:hover { background: var(--hover); color: var(--ink); }
.bell-badge {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 14px; height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--ink);
  color: #FFFFFF;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  line-height: 14px;
  text-align: center;
}

.tray {
  display: none;
  position: absolute;
  top: 38px; right: 0;
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  z-index: 50;
  overflow: hidden;
}
.tray.open { display: block; }

.tray-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.tray-head h3 { font-size: 13px; font-weight: 600; }

.tray-item { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.tray-item:last-child { border-bottom: none; }
.tray-item-kind { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.tray-item.approval .kind-pip { background: var(--accent); }
.tray-item.confirm .kind-pip { background: var(--ink); }
.tray-item.done .kind-pip { background: var(--ink-3); }
.tray-item-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.tray-item-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.tray-actions { display: flex; gap: 8px; margin-top: 10px; }
.tray-actions .btn { height: 28px; font-size: 12px; }

/* blocking status bar */
.blocking-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 24px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 12.5px;
  flex-shrink: 0;
}
.blocking-bar.visible { display: flex; }
.blocking-bar strong { font-weight: 600; }
.spinner {
  width: 12px; height: 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar-dismiss {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  line-height: 1;
  width: 22px; height: 22px;
  border-radius: 4px;
}
.bar-dismiss:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.1); }

/* ============ VIEWS SCAFFOLD ============ */

.views { flex: 1; min-height: 0; position: relative; }
.view { display: none; height: 100%; overflow: hidden; position: relative; }
.view.active { display: block; }
.view-scroll { height: 100%; overflow-y: auto; }

/* ============ ARTIFACT DOCUMENT REGISTER ============ */

.artifact-doc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}
.artifact-doc h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 40px 0 16px;
}
.artifact-doc h4 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 40px 0 12px;
}

.report-header { margin-bottom: 32px; }
.report-kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.report-header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  max-width: 560px;
}
/* serif survives in exactly one place: the morning-brief headline */
.today-sheet .report-header h1 {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.3;
}
.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
}
.report-meta strong { font-weight: 500; color: var(--ink-2); }

/* stat row — no cards, hairline verticals */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 32px 0;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { padding: 0 24px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { padding-left: 0; border-left: none; }
/* tints are dead — the classes remain in markup, they mean nothing now */
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.4;
  display: flex;
  align-items: flex-end;
  min-height: 28px;
}
.stat-value {
  font-size: 30px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  margin-top: 6px;
}
.stat-value small {
  font-size: 16px;
  font-weight: 450;
  color: var(--ink-3);
  margin-left: 1px;
}
.stat-note { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.stat-note.up { color: var(--accent); }
.stat-note.down { color: var(--red); }

/* callout — 2px rule + text, never a box */
.callout {
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 16px;
  margin: 24px 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 620px;
}
.callout.bad { border-left-color: var(--red); }
.callout strong { color: var(--ink); font-weight: 500; }
.callout-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

/* timeline */
.timeline { margin: 16px 0; }
.tl-item { display: grid; grid-template-columns: 44px 16px 1fr; gap: 0 12px; }
.tl-date {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 3px;
  text-align: right;
  white-space: nowrap;
}
.tl-track {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5px;
}
.tl-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid #C9C8C4;
  flex-shrink: 0;
}
.tl-dot.done { background: var(--accent); border-color: var(--accent); }
.tl-dot.active { border-color: var(--ink); }
.tl-dot.pending { border-color: #C9C8C4; }
.tl-line { flex: 1; width: 1px; background: var(--line); margin: 3px 0; }
.tl-body { padding-bottom: 18px; min-width: 0; }
.tl-title { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.tl-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; line-height: 1.55; }

/* margin bars — 3px, ink fill, no traffic lights */
.bars { margin: 16px 0 8px; }
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 44px;
  align-items: center;
  gap: 16px;
  padding: 7px 0;
}
.bar-row-label { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.bar-track {
  display: block;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.bar-fill { display: block; height: 100%; background: var(--ink); border-radius: 2px; }
/* good/info/warn/bad fills all render ink — meaning lives in the text */
.bar-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  text-align: right;
}

/* compare panel */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.compare-col { padding: 20px 24px 20px 0; }
.compare-col + .compare-col {
  border-left: 1px solid var(--line);
  padding-left: 24px;
  padding-right: 0;
}
.compare-col h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
  line-height: 1.45;
}
.rec {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-left: 6px;
  white-space: nowrap;
}
.compare-col ul { list-style: none; }
.compare-col li {
  position: relative;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  padding: 3px 0 3px 16px;
}
.compare-col li::before {
  content: '·';
  position: absolute;
  left: 2px;
  color: var(--ink-3);
}
.compare-col li.li-good::before { content: '+'; color: var(--accent); font-weight: 600; }
.compare-col li.li-bad::before { content: '\2212'; color: var(--red); }
.verdict {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding: 16px 0 4px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}
.verdict strong { color: var(--ink); font-weight: 500; }

/* capacity meters */
.capacity { margin: 8px 0 16px; }
.cap-row { padding: 8px 0; }
.cap-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cap-name { font-size: 12.5px; color: var(--ink); font-weight: 500; }
.cap-name span { color: var(--ink-3); font-weight: 400; }
.cap-pct { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.cap-pct.over { color: var(--red); }
.cap-pct.high { color: var(--ink); }
.cap-track {
  display: block;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.cap-fill { display: block; height: 100%; background: var(--ink); border-radius: 2px; }

/* version banner */
.version-banner {
  display: none;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 24px;
  background: var(--fill-quiet);
  border-radius: var(--r-btn);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
}
.version-banner svg { flex-shrink: 0; margin-top: 2px; }
.pane-paper.v1 .version-banner { display: flex; }
.pane-paper.v1 .v2-only { display: none; }

/* ============ TODAY ============ */

.today-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 32px 140px;
}

.today-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pane);
  padding: 48px 56px;
}

/* needs list — rows, not boxes */
.needs-list { border-top: 1px solid var(--line); }
.needs-item {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.needs-item:hover { background: var(--hover); }
.needs-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}
.needs-body { flex: 1; min-width: 0; line-height: 1.45; }
.needs-title { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.needs-sub { font-size: 12px; color: var(--ink-3); }
.needs-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
}
.needs-arrow { color: var(--ink-3); flex-shrink: 0; }
.needs-item:hover .needs-arrow { color: var(--ink); }

/* composer — one of the three true cards */
.composer-dock {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 32px 24px;
  background: linear-gradient(to top, var(--bg) 60%, rgba(252, 252, 251, 0));
  pointer-events: none;
}
.composer-dock .composer { max-width: 736px; margin: 0 auto; }

.composer {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pane);
  padding: 6px 6px 6px 16px;
  pointer-events: auto;
}
.composer:focus-within { border-color: #D5D4D0; }
.composer input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-size: 13px;
  color: var(--ink);
  padding: 6px 0;
}
.composer input::placeholder { color: var(--ink-3); }

.mic-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn);
  color: var(--ink-3);
  flex-shrink: 0;
}
.mic-btn:hover { background: var(--hover); color: var(--ink); }

.send-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-btn);
  background: var(--accent);
  color: #FFFFFF;
  flex-shrink: 0;
}
.send-btn:hover { background: #264F35; }

/* ============ CHATS ============ */

.chat-layout { display: flex; height: 100%; min-width: 0; }
.chat-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.chat-layout.pane-open .chat-col { flex: 0 0 auto; }

.chat-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 32px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.chat-head-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.chat-head-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 32px 32px 140px;
}
.chat-msgs { max-width: 640px; margin: 0 auto; }

.msg { margin-bottom: 32px; }
.msg-who {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.msg-body { font-size: 14px; line-height: 1.65; color: var(--ink); }
.msg-body strong { font-weight: 600; }

.msg.user .msg-body {
  display: inline-block;
  background: var(--fill-quiet);
  border-radius: var(--r-card);
  padding: 10px 16px;
  max-width: 90%;
}

.activity-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.activity-chip .tick { color: var(--accent); margin-right: 4px; }

/* inline artifact reference */
.artifact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  text-align: left;
}
.artifact-card:hover { background: var(--hover); }
.ac-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--ink-2);
  flex-shrink: 0;
  background: var(--surface);
}
.ac-meta { flex: 1; min-width: 0; line-height: 1.4; }
.ac-title { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.ac-sub { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }
.ac-open { font-size: 12px; font-weight: 500; color: var(--accent); flex-shrink: 0; }

/* inline approval */
.approval-card {
  max-width: 470px;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.approval-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.approval-head .kind-pip { background: var(--accent); }
.approval-body { padding: 14px 16px; }
.approval-title { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.approval-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.approval-draft {
  margin-top: 12px;
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.6;
}
.approval-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.approval-foot .btn { height: 28px; font-size: 12px; }
.approval-note { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); }

.chat-composer-dock {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 32px 20px;
  background: linear-gradient(to top, var(--bg) 60%, rgba(252, 252, 251, 0));
  pointer-events: none;
}
.chat-composer-dock .composer { max-width: 640px; margin: 0 auto; }

/* divider */
.pane-divider {
  flex: 0 0 7px;
  cursor: col-resize;
  position: relative;
  display: none;
  z-index: 10;
}
.chat-layout.pane-open .pane-divider { display: block; }
.pane-divider::before {
  content: '';
  position: absolute;
  left: 3px; top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}
.pane-divider::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 3px; height: 36px;
  border-radius: 2px;
  background: transparent;
}
.pane-divider:hover::after, .pane-divider.dragging::after { background: var(--ink-3); }
body.dragging-divider { cursor: col-resize; user-select: none; }
body.dragging-divider iframe { pointer-events: none; }

/* ============ ARTIFACT PANE ============ */

.artifact-pane {
  flex: 0 0 46%;
  min-width: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.chat-layout.pane-open .artifact-pane { display: flex; }
.chat-layout.pane-fullscreen .chat-col { display: none; }
.chat-layout.pane-fullscreen .pane-divider { display: none; }
.chat-layout.pane-fullscreen .artifact-pane { flex: 1 1 100%; }

.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.pane-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.version-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  overflow: hidden;
  flex-shrink: 0;
}
.version-chip button {
  width: 22px; height: 22px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1;
}
.version-chip button:hover:not(:disabled) { background: var(--hover); }
.version-chip button:disabled { color: #D5D4D0; cursor: default; }
.v-label {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
  padding: 0 6px;
}

.pane-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
}
.icon-btn {
  width: 26px; height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-btn);
  color: var(--ink-2);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.text {
  width: auto;
  gap: 5px;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.pane-scroll { flex: 1; overflow-y: auto; padding: 24px; }
.pane-paper {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pane);
  padding: 48px;
  max-width: 720px;
  margin: 0 auto;
}

/* ============ DATA — the Librarian ============ */

.data-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 40px 32px 64px;
}

.librarian-hero {
  padding-bottom: 32px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.lib-head-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.librarian-mark {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--accent);
  background: var(--surface);
  flex-shrink: 0;
}
.librarian-id { line-height: 1.4; }
.librarian-name { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }
.librarian-role { display: block; font-size: 12px; color: var(--ink-3); }
.librarian-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

.librarian-says {
  margin: 20px 0 20px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 720px;
}

.librarian-composer { max-width: 720px; }

.call-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  flex-shrink: 0;
}
.call-btn:hover { background: var(--hover); }
.call-btn.calling { color: var(--red); }
.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.call-btn.calling .pulse-dot {
  background: var(--red);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.data-cols {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 64px;
  align-items: start;
}
.data-main, .data-side { min-width: 0; }

.data-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 40px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.data-main .data-sec-head:first-child,
.data-side .data-sec-head:first-child { margin-top: 0; }
.data-h {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.data-sec-head .mono-label { font-size: 10px; }

/* open questions — rows, not cards */
.dq-item { padding: 18px 0; border-bottom: 1px solid var(--line); }
.dq-q { font-size: 14px; font-weight: 500; color: var(--ink); line-height: 1.5; }
.dq-why { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin-top: 4px; max-width: 560px; }
.dq-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.dq-resolved {
  display: none;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--accent);
}
.dq-item.resolved .dq-actions { display: none; }
.dq-item.resolved .dq-resolved { display: flex; }
.dq-item.resolved .dq-q { color: var(--ink-2); }

/* night pass summary */
.night-chips {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 14px 0 6px;
}
.n-chip {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.n-chip strong { font-size: 13px; font-weight: 500; color: var(--ink); margin-right: 4px; letter-spacing: 0; }
.n-chip.flag strong { color: var(--red); }

/* ledger — true table rhythm */
.night-ledger { margin-top: 4px; }
.ledger-row {
  display: grid;
  grid-template-columns: 48px 88px 1fr;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.ledger-row:last-child { border-bottom: none; }
.ledger-time { font-family: var(--mono); font-size: 11px; color: var(--ink-3); padding-top: 1px; }
.ledger-src { font-family: var(--mono); font-size: 11px; color: var(--ink-3); padding-top: 1px; }
.ledger-row.edge { color: var(--ink-3); }
.flag-mark { color: var(--ink); font-weight: 500; }

/* coverage — 3px bars, text says what's low */
.cov-list { padding-top: 8px; }
.cov-row { padding: 10px 0; }
.cov-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cov-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.cov-pct { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.cov-track {
  display: block;
  height: 3px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.cov-fill { display: block; height: 100%; background: var(--ink); border-radius: 2px; }
/* .mid / .low keep the ink fill — the note carries the meaning */
.cov-note { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.5; }

/* sources */
.src-list { padding-top: 4px; }
.src-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  margin: 0 -8px;
  border-radius: var(--r-btn);
  text-align: left;
}
.src-row:hover { background: var(--hover); }
.src-tile {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  flex-shrink: 0;
}
.src-meta { flex: 1; min-width: 0; line-height: 1.4; }
.src-name { display: block; font-size: 13px; font-weight: 500; color: var(--ink); }
.src-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.src-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  flex-shrink: 0;
}

.src-connect {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 8px;
  margin: 4px -8px 0;
  border-radius: var(--r-btn);
  text-align: left;
}
.src-connect:hover { background: var(--hover); }
.src-connect .src-tile { border-style: dashed; color: var(--ink-3); }
.src-connect-title { display: block; font-size: 13px; font-weight: 500; color: var(--accent); }
.src-connect-sub { display: block; font-size: 11px; color: var(--ink-3); }

/* raw-files peek */
.peek-block {
  margin-top: 48px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.peek-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 4px 0;
}
.peek-toggle:hover { color: var(--ink); }
.peek-caret { display: inline-flex; transition: transform 0.15s ease; color: var(--ink-3); }
.peek-block.open .peek-caret { transform: rotate(90deg); }
.peek-note { font-weight: 400; color: var(--ink-3); }

.file-table { display: none; margin-top: 12px; }
.peek-block.open .file-table { display: block; }
.file-row {
  display: grid;
  grid-template-columns: 220px 120px 1fr;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}
.file-row:last-child { border-bottom: none; }
.file-name { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.file-size { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.file-note { color: var(--ink-3); }

/* ============ LIBRARY ============ */

.page-wrap { max-width: 1020px; margin: 0 auto; padding: 40px 32px 64px; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.page-sub { font-size: 13px; color: var(--ink-2); margin-top: 4px; max-width: 640px; }

.filter-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 24px 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.chip {
  font-size: 12.5px;
  font-weight: 450;
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: var(--r-btn);
}
.chip:hover { background: var(--hover); color: var(--ink); }
.chip.active { background: var(--fill-quiet); color: var(--ink); font-weight: 500; }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px 24px;
}
.lib-card { display: block; text-align: left; }
.lib-thumb {
  display: flex;
  flex-direction: column;
  gap: 7px;
  aspect-ratio: 4 / 3;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  overflow: hidden;
}
.lib-card:hover .lib-thumb { border-color: #D5D4D0; background: var(--hover); }

/* mini artifact skeleton — grayscale only */
.mini-title { display: block; width: 62%; height: 6px; border-radius: 2px; background: #C9C8C4; }
.mini-sub { display: block; width: 38%; height: 4px; border-radius: 2px; background: #E7E6E2; }
.mini-stats { display: flex; gap: 6px; margin-top: 4px; }
.mini-stat { display: block; flex: 1; height: 16px; border-radius: 3px; background: #F0EFEC; border: 1px solid var(--line); }
.mini-stat.b, .mini-stat.g, .mini-stat.w { background: #E7E6E2; }
.mini-bars { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.mb { display: block; height: 3px; border-radius: 2px; background: #D5D4D0; }
.mb.g, .mb.bd, .mb.w { background: #A8A7A2; }
.mini-callout { display: block; width: 84%; height: 12px; border-radius: 3px; border-left: 2px solid #A8A7A2; background: #F0EFEC; margin-top: 4px; }
.mini-callout.b { border-left-color: #A8A7A2; }
.mini-compare { display: flex; gap: 8px; margin-top: 4px; flex: 1; min-height: 0; }
.mini-col { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 3px; }
.mini-col.pick { border-color: #A8A7A2; }
.mini-col i { display: block; height: 3px; border-radius: 2px; background: #E7E6E2; }
.mini-col.pick i { background: #D5D4D0; }
.mini-lines { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; }
.mini-lines i { display: block; height: 3px; border-radius: 2px; background: #E7E6E2; }
.mini-lines i:nth-child(1) { width: 92%; }
.mini-lines i:nth-child(2) { width: 78%; }
.mini-lines i:nth-child(3) { width: 85%; }
.mini-tl { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.mini-tl i { display: block; height: 4px; border-radius: 2px; background: #E7E6E2; }
.mini-tl i:nth-child(1) { width: 70%; }
.mini-tl i:nth-child(2) { width: 55%; }
.mini-tl i:nth-child(3) { width: 63%; }

.lib-meta { display: block; padding: 10px 2px 0; line-height: 1.45; }
.lib-title { display: block; font-size: 13px; font-weight: 500; color: var(--ink); }
.lib-sub {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 2px;
  flex-wrap: wrap;
}
.lib-proj {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-3);
  align-self: center;
}

/* ============ BUSINESS MAP ============ */

.lens-tabs {
  display: flex;
  gap: 24px;
  margin: 24px 0 0;
  border-bottom: 1px solid var(--line);
}
.lens-tab {
  padding: 8px 2px 10px;
  font-size: 13px;
  font-weight: 450;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.lens-tab:hover { color: var(--ink); }
.lens-tab.active {
  color: var(--ink);
  font-weight: 500;
  border-bottom-color: var(--accent);
}

.map-canvas {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 24px;
}
.map-canvas svg { display: block; width: 100%; height: auto; }

.map-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}
.map-foot .page-sub { margin-top: 0; }
.advanced-link {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
}
.advanced-link:hover { color: var(--ink); text-decoration: underline; }

/* pipeline lens */
.pipeline-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-top: 24px;
}
.pipe-col { min-width: 0; }
.pipe-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.pipe-count { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.pipe-card { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pipe-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
}
.pipe-card-val {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 2px;
  padding-left: 14px;
}

/* ============ AUTOMATIONS ============ */

.auto-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
}

/* automation cards — one of the three true cards */
.auto-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}

.auto-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
}
.auto-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--ink-2);
  flex-shrink: 0;
  background: var(--surface);
}
.auto-meta { flex: 1; min-width: 0; line-height: 1.45; }
.auto-name { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.auto-sched {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-2);
  margin-top: 3px;
}
.trigger-chip {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: var(--fill-quiet);
  border-radius: 4px;
  padding: 2px 6px;
}
.trigger-chip.event { color: var(--ink-2); background: var(--fill-quiet); }
.auto-next { text-align: right; line-height: 1.5; flex-shrink: 0; }
.auto-next .mono-label { display: block; font-size: 9.5px; }
.auto-next-time { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; }

.auto-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.auto-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
}
.auto-origin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.auto-origin:hover { color: var(--ink); text-decoration: underline; }
.auto-tab {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  padding: 4px 8px;
  border-radius: var(--r-btn);
}
.auto-tab:hover { background: var(--hover); color: var(--ink); }
.auto-tab.active { color: var(--ink); background: var(--fill-quiet); }

.auto-panel {
  display: none;
  border-top: 1px solid var(--line);
  padding: 8px 20px 16px;
}
.auto-panel.open { display: block; }

.run-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.run-row:last-child { border-bottom: none; }
.run-when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  flex: 0 0 96px;
  white-space: nowrap;
}
.run-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
  flex: 0 0 auto;
  min-width: 110px;
}
.run-out, .run-note { flex: 1; min-width: 200px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.run-out { color: var(--ink); font-weight: 500; }
.run-open { font-size: 12px; font-weight: 500; color: var(--accent); white-space: nowrap; }
.run-open:hover { text-decoration: underline; }
.run-row.attn .run-note { color: var(--ink-2); }

.conf-grid {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px 24px;
  align-items: center;
  padding: 12px 0 4px;
}
.conf-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.conf-value { font-size: 13px; color: var(--ink); }
.conf-value.select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  height: 28px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  font-size: 12.5px;
}
.conf-value.select:hover { background: var(--hover); }
.sel-caret { display: inline-flex; color: var(--ink-3); }
.conf-foot { display: flex; gap: 8px; padding-top: 14px; }

/* where automations come from */
.auto-birth {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 48px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.birth-copy .data-h { margin-bottom: 8px; }
.birth-copy p { font-size: 13px; color: var(--ink-2); line-height: 1.65; max-width: 400px; }

.birth-chat { min-width: 0; }
.bc-msg { font-size: 13px; line-height: 1.6; color: var(--ink); margin-bottom: 12px; }
.bc-who {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 8px;
}
.bc-msg.user { color: var(--ink-2); }

.schedule-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.sc-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  color: var(--ink-2);
  flex-shrink: 0;
}
.sc-meta { flex: 1; min-width: 0; line-height: 1.4; }
.sc-title { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.sc-sub { display: block; font-size: 11.5px; color: var(--ink-3); }
.sc-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  flex-shrink: 0;
}

/* ============ ABOUT OVERLAY ============ */

.about-foot {
  position: fixed;
  right: 12px; bottom: 10px;
  z-index: 30;
}
.about-link {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.about-link:hover { color: var(--ink); text-decoration: underline; }

.overlay-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 24, 26, 0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.overlay-backdrop.open { display: flex; }

.overlay-panel {
  position: relative;
  width: min(660px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  padding: 40px 44px;
}
.overlay-panel h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.overlay-sub { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin-top: 8px; }
.overlay-panel dl { margin-top: 20px; }
.overlay-panel dt { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 14px; }
.overlay-panel dd { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; margin-top: 2px; }
.ux-refs {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  line-height: 1.8;
}
.overlay-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: var(--r-btn);
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1;
}
.overlay-close:hover { background: var(--hover); color: var(--ink); }

/* ============ TOAST ============ */

.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translate(-50%, 8px);
  background: var(--ink);
  color: #FFFFFF;
  font-size: 12.5px;
  padding: 10px 16px;
  border-radius: var(--r-btn);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 200;
  max-width: min(480px, calc(100vw - 32px));
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* rail drawer scrim */
.rail-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 24, 26, 0.4);
  z-index: 39;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr !important; }
  .rail {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 270px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 80;
  }
  .app.rail-open .rail { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .app.rail-open .rail-scrim { display: block; z-index: 79; }
  .app.rail-collapsed .rail { width: 270px; }
  .app.rail-collapsed .wordmark .word,
  .app.rail-collapsed .nav-label,
  .app.rail-collapsed .identity-meta,
  .app.rail-collapsed .settings-label { display: initial; }
  .app.rail-collapsed .nav-item { justify-content: flex-start; padding: 7px 16px; }
  .app.rail-collapsed .rail-threads.visible { display: block; }
  .rail-toggle { display: none; }

  .hamburger {
    display: flex;
    width: 32px; height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-btn);
    color: var(--ink-2);
    margin-left: -8px;
  }
  .hamburger:hover { background: var(--hover); }

  .topbar { padding: 0 16px; }
  .workspace-name .sep, .workspace-name .view-crumb { display: none; }
  .demo-chip { display: none; }

  .today-wrap { padding: 16px 16px 120px; }
  .today-sheet { padding: 28px 20px; }
  .composer-dock { padding: 12px 16px 16px; }
  .page-wrap { padding: 24px 16px 56px; }
  .chat-scroll { padding: 24px 16px 120px; }
  .chat-head { padding: 12px 16px 10px; }
  .chat-composer-dock { padding: 12px 16px 14px; }

  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 0;
  }
  .stat { padding: 0 20px; }
  .stat:nth-child(odd) { padding-left: 0; border-left: none; }
  .stat-value { font-size: 26px; }
  .report-header h1 { font-size: 19px; }
  .today-sheet .report-header h1 { font-size: 21px; }
  .bar-row { grid-template-columns: 96px 1fr 40px; gap: 10px; }

  /* artifact pane becomes full overlay */
  .chat-layout.pane-open .chat-col { display: none; }
  .chat-layout.pane-open .pane-divider { display: none; }
  .chat-layout.pane-open .artifact-pane { flex: 1 1 100%; }
  .pane-scroll { padding: 12px; }
  .pane-paper { padding: 28px 20px; }

  .pipeline-cols { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .compare { grid-template-columns: 1fr; }
  .compare-col { padding: 16px 0; }
  .compare-col + .compare-col {
    border-left: none;
    border-top: 1px solid var(--line);
    padding-left: 0;
  }

  /* Data */
  .data-wrap { padding: 24px 16px 56px; }
  .librarian-state { margin-left: 0; flex-basis: 100%; }
  .librarian-composer { flex-wrap: wrap; padding: 8px 10px; }
  .librarian-composer input { min-width: 160px; }
  .data-cols { grid-template-columns: 1fr; gap: 8px; }
  .ledger-row { grid-template-columns: 42px 72px 1fr; gap: 10px; }
  .file-row { grid-template-columns: 1fr; gap: 2px; padding: 10px 0; }

  /* Automations */
  .auto-birth { grid-template-columns: 1fr; gap: 24px; }
  .conf-grid { grid-template-columns: 1fr; gap: 4px; }
  .conf-label { margin-top: 10px; }
  .run-when { flex-basis: 100%; }
  .auto-next { display: none; }

  .tray { width: min(360px, calc(100vw - 24px)); }
}
