:root {
  --dark:    #EDE4DA;   /* warm taupe canvas — body bg */
  --dark2:   #FAF5F0;   /* warm off-white — cards, main content area */
  --dark3:   #E8DED4;   /* warm mid surface — nav, sidebar, inset bg */
  --ink:     #2C2019;   /* warm dark brown — text-primary */
  --ink2:    #3D2D22;   /* warm brown — text-secondary */
  --ink3:    #7A6B5D;   /* warm taupe — text-muted */
  --ink4:    #A89888;   /* warm sand — text-faint, meta, timestamps */
  --ink-inv: #FAF5F0;   /* invariant light text on dark/moss buttons */
  --moss:    #5A6B48;
  --moss-mid:#7A9469;
  --moss-lt: #94AE88;
  --moss-pale: rgba(90,107,72,0.14);   /* accent-dim — tag/badge bg */
  --terra:   #B04E28;
  --terra-mid:#C76C4A;
  --terra-lt:#DC9878;
  --terra-pale: rgba(176,78,40,0.12);
  --rose:    #C4636A;
  --border:   rgba(44,32,25,0.13);    /* border-medium */
  --border-lt: rgba(44,32,25,0.07);   /* border-subtle */
  --accent:   #5A6B48;

  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', monospace;

  --shadow-tile: 0 8px 28px rgba(44,32,25,0.13), 0 1px 4px rgba(44,32,25,0.07);
  --shadow-card: 0 2px 10px rgba(44,32,25,0.09);

  --sidebar-w: 200px;
  --sidebar-w-collapsed: 48px;
  --chat-w: 360px;
}

/* graph view inherits light theme — no dark override */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font-sans);
  background: var(--dark);
  color: var(--ink2);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Auth ────────────────────────────────────────────────────────────────── */

#auth-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--dark);
  background-image: radial-gradient(ellipse 70% 60% at 55% 35%, rgba(90,107,72,0.10) 0%, transparent 70%),
                    radial-gradient(ellipse 50% 45% at 25% 80%, rgba(176,78,40,0.06) 0%, transparent 60%),
                    radial-gradient(ellipse 40% 30% at 80% 75%, rgba(196,99,106,0.05) 0%, transparent 55%);
  z-index: 1000;
}

.auth-card {
  width: 420px;
  text-align: center;
  padding: 60px 52px 52px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--dark2);
  box-shadow: var(--shadow-tile);
}

.auth-mark { margin-bottom: 28px; display: flex; justify-content: center; }

.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--moss);
  margin-bottom: 14px;
}

.auth-title {
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 300;
  font-variation-settings: 'opsz' 48, 'SOFT' 0;
  color: var(--ink);
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.auth-sub {
  font-size: 14px;
  color: var(--ink3);
  line-height: 1.65;
  margin-bottom: 36px;
  max-width: 290px;
  margin-left: auto;
  margin-right: auto;
}

.auth-msg {
  font-size: 13px;
  color: var(--terra);
  line-height: 1.5;
}
.auth-msg:not(:empty) { margin-bottom: 14px; }

.auth-btn {
  display: block;
  padding: 14px 24px;
  background: var(--moss);
  color: var(--ink-inv);
  text-decoration: none;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 0.2s, box-shadow 0.2s;
  margin-bottom: 22px;
  box-shadow: 0 3px 12px rgba(90,107,72,0.35);
}
.auth-btn:hover { background: var(--moss-mid); box-shadow: 0 4px 16px rgba(90,107,72,0.4); }

.auth-note {
  font-size: 12px;
  color: var(--ink4);
  line-height: 1.6;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--dark3);
  border-right: 1px solid var(--border);
  transition: width 0.22s ease;
  overflow: hidden;
  z-index: 100;
}

#app-shell.sidebar-collapsed #sidebar { width: var(--sidebar-w-collapsed); }
#app-shell.sidebar-collapsed .sidebar-title,
#app-shell.sidebar-collapsed .sidebar-link-text,
#app-shell.sidebar-collapsed .sidebar-user-name { display: none; }
#app-shell.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
#app-shell.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px 0; }
#app-shell.sidebar-collapsed .sidebar-user { justify-content: center; padding: 10px 0; }
#app-shell.sidebar-collapsed .sidebar-header { padding: 16px 0; justify-content: center; }
#app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; }
#app-shell.sidebar-collapsed .sidebar-toggle { display: none; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 14px 14px;
  border-bottom: 1px solid var(--border-lt);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 9px;
  min-width: 0;
}

.sidebar-mark-icon { flex-shrink: 0; }

.sidebar-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink2);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.sidebar-toggle {
  background: none; border: none;
  color: var(--ink4); cursor: pointer;
  padding: 4px;
  border-radius: 5px;
  display: flex; align-items: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.sidebar-toggle:hover { color: var(--ink2); background: rgba(44,32,25,0.07); }
.sidebar-toggle svg { transition: transform 0.22s ease; }

.sidebar-nav {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 12px 8px;
  overflow-y: auto;
}

.sidebar-link {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: none;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  min-width: 0;
  color: var(--ink3);
}
.sidebar-link:hover { background: rgba(44,32,25,0.06); color: var(--ink2); }
.sidebar-link.active { background: rgba(90,107,72,0.12); color: var(--moss); }
.sidebar-link.active .sidebar-link-desc { color: var(--moss); opacity: 0.65; }

.sidebar-icon { flex-shrink: 0; opacity: 0.75; }
.sidebar-link.active .sidebar-icon { opacity: 1; }
.sidebar-link:hover .sidebar-icon { opacity: 0.9; }

.sidebar-link-text {
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
  overflow: hidden;
}

.sidebar-link-name {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  font-weight: 400;
}

.sidebar-link-desc {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--ink4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid var(--border-lt);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--moss-lt);
  border: none; cursor: pointer;
  margin: 4px auto;
  transition: background 0.2s;
}
.sidebar-status-dot.amber { background: #C4A038; }
.sidebar-status-dot.pulsing { animation: pulse 1.4s ease-in-out infinite; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: none;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink4);
  transition: background 0.15s, color 0.15s;
}
.sidebar-user:hover { background: rgba(44,32,25,0.06); color: var(--ink3); }

.sidebar-user-name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

#app-shell { display: flex; flex-direction: row; height: 100%; }

#main-area {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

#view-container { height: 100%; }

/* ── Chat panel ──────────────────────────────────────────────────────────── */

#chat-panel {
  width: var(--chat-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--dark2);
  border-left: 1px solid var(--border);
  overflow: hidden;
}

.chat-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-left { display: flex; flex-direction: column; gap: 2px; }

.chat-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 300;
  color: var(--ink);
}

.chat-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--moss-lt);
  opacity: 0.7;
}

.chat-close {
  background: none; border: none;
  color: var(--ink4);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 4px;
  line-height: 1;
}
.chat-close:hover { color: var(--ink2); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg { display: flex; flex-direction: column; gap: 4px; }
.chat-msg.user { align-items: flex-end; }
.chat-msg.assistant { align-items: flex-start; }

.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.65;
}

.chat-msg.user .chat-bubble {
  background: var(--moss-pale);
  border: 1px solid rgba(90,107,72,0.28);
  color: var(--ink2);
}

.chat-msg.assistant .chat-bubble {
  background: var(--dark3);
  border: 1px solid var(--border-lt);
  color: var(--ink2);
}

.chat-msg.assistant .chat-bubble code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(90,107,72,0.12);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--moss-lt);
}

.chat-create-block {
  background: rgba(90,107,72,0.10);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: pre-wrap;
  color: var(--ink2);
}

.chat-create-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 12px;
  background: var(--moss);
  color: var(--ink-inv);
  border: none;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-create-btn:hover { background: var(--moss-mid); }
.chat-create-btn:disabled { opacity: 0.5; cursor: default; }

.chat-thinking {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  letter-spacing: 0.06em;
  padding: 6px 0;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse { 0%,100%{opacity:0.3} 50%{opacity:0.8} }

.chat-input-wrap {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#chat-input {
  flex: 1;
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.15s;
}
#chat-input::placeholder { color: var(--ink4); }
#chat-input:focus { border-color: rgba(90,107,72,0.45); }

#chat-send-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  background: var(--moss);
  border: none;
  border-radius: 8px;
  color: var(--ink-inv);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
#chat-send-btn:hover { background: var(--moss-mid); }
#chat-send-btn:disabled { opacity: 0.4; cursor: default; }

.chat-hint {
  padding: 8px 14px 12px;
  text-align: center;
}
.chat-hint a {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--terra-lt);
  text-decoration: none;
}
.chat-hint a:hover { color: var(--terra-mid); }

/* ── Story view ──────────────────────────────────────────────────────────── */

.story-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 48px 96px;
}

.story-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--moss-lt);
  margin-bottom: 16px;
  opacity: 0.7;
}

.story-name {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 300;
  line-height: 0.92;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 32px;
}

.story-lede {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 300;
  font-style: italic;
  color: var(--ink3);
  line-height: 1.55;
  margin-bottom: 56px;
  max-width: 560px;
}

.story-divider {
  width: 48px;
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

.story-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 24px;
}

.story-section-label.state { color: var(--moss-lt); opacity: 0.8; }
.story-section-label.flux  { color: var(--terra-lt); opacity: 0.8; }

.story-section-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 300;
  color: var(--ink2);
  margin-bottom: 24px;
  line-height: 1.2;
}

.story-nodes { display: flex; flex-direction: column; gap: 0; }

.story-node {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-lt);
}
.story-node:last-child { border-bottom: none; }

.story-node-schema {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.story-node-schema.belief { color: var(--moss-lt); }
.story-node-schema.value  { color: var(--moss-mid); }
.story-node-schema.goal   { color: var(--terra-lt); }
.story-node-schema.self   { color: var(--ink3); }
.story-node-schema.percept{ color: var(--terra-mid); }
.story-node-schema.act    { color: var(--terra-lt); }
.story-node-schema.learn  { color: var(--moss-lt); }

.story-node-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.25;
}

.story-node-body {
  font-size: 13px;
  color: var(--ink3);
  line-height: 1.7;
}

.story-node-meta {
  display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap;
}

.story-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: 4px;
}
.story-tag.moss { background: var(--moss-pale); color: var(--moss-lt); }
.story-tag.terra { background: var(--terra-pale); color: var(--terra-lt); }
.story-tag.muted { background: rgba(44,32,25,0.05); color: var(--ink4); }

.story-empty {
  padding: 40px 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-style: italic;
  color: var(--ink4);
}

.story-add-btn {
  margin-top: 16px;
  background: none;
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink4);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.story-add-btn:hover { border-color: var(--moss-lt); color: var(--moss-lt); }

/* ── Graph view ──────────────────────────────────────────────────────────── */

.graph-wrap {
  display: flex;
  height: 100%;
  overflow: hidden;
}

#graph-canvas {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#graph-svg { width: 100%; height: 100%; }

#graph-tooltip {
  position: absolute;
  background: rgba(30,21,16,0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--ink2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  white-space: nowrap;
  z-index: 20;
}

.graph-controls {
  position: absolute;
  top: 16px; left: 16px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10;
}

.graph-search-wrap {
  display: flex; align-items: center; gap: 8px;
}

.graph-search {
  background: rgba(30,21,16,0.92);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink2);
  outline: none;
  width: 200px;
  transition: border-color 0.15s;
}
.graph-search::placeholder { color: var(--ink4); }
.graph-search:focus { border-color: rgba(148,174,136,0.5); }

.graph-search-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--moss-lt);
  letter-spacing: 0.08em;
}

.graph-filters {
  display: flex; gap: 6px; flex-wrap: wrap;
}

.graph-filter-btn {
  background: rgba(26,18,12,0.9);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink4);
  cursor: pointer;
  transition: all 0.15s;
}
.graph-filter-btn:hover { border-color: var(--moss-lt); color: var(--ink2); }
.graph-filter-btn.active { border-color: var(--moss-lt); color: var(--moss-lt); background: var(--moss-pale); }

#graph-side-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--dark2);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 22px 48px;
}

.gsp-hint {
  font-family: var(--font-serif);
  font-size: 15px;
  font-style: italic;
  color: var(--ink4);
  line-height: 1.6;
  margin-top: 8px;
}

.gsp-schema {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.gsp-schema.belief  { color: var(--moss-lt); }
.gsp-schema.value   { color: var(--moss-mid); }
.gsp-schema.goal    { color: var(--terra-lt); }
.gsp-schema.self    { color: var(--ink3); }
.gsp-schema.state   { color: var(--moss-lt); }
.gsp-schema.flux    { color: var(--terra-mid); }
.gsp-schema.percept,.gsp-schema.act { color: var(--terra-mid); }
.gsp-schema.learn   { color: var(--moss-lt); }
/* 4-layer tier classes */
.gsp-schema.world   { color: var(--moss-lt); }
.gsp-schema.history { color: #C8A064; }
.gsp-schema.loop    { color: var(--terra-mid); }

.gsp-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-lt);
}

.gsp-field { margin-bottom: 14px; }
.gsp-field-key {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 4px;
}
.gsp-field-val {
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.6;
}

.graph-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  font-family: var(--font-serif);
  font-size: 18px;
  font-style: italic;
  color: var(--ink4);
  gap: 16px;
  text-align: center;
  padding: 48px;
}

/* ── Loading spinner ─────────────────────────────────────────────────────── */

.loading {
  display: flex; align-items: center; justify-content: center;
  height: 200px;
}

.spinner {
  width: 20px; height: 20px;
  border: 1.5px solid var(--border);
  border-top-color: var(--moss-lt);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Context menu ────────────────────────────────────────────────────────── */

.context-menu {
  position: fixed;
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 0;
  z-index: 999;
  min-width: 160px;
  box-shadow: var(--shadow-tile);
  overflow: hidden;
}
.context-menu button {
  display: block; width: 100%;
  padding: 7px 14px;
  background: none; border: none;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  color: var(--ink2);
  cursor: pointer;
}
.context-menu button:hover { background: var(--moss-pale); }
.context-menu button.danger { color: var(--terra-lt); }
.context-menu button.danger:hover { background: var(--terra-pale); }
.context-menu .divider { height: 1px; background: var(--border); margin: 3px 0; }


/* ── Story (sc-*) redesign cards ─────────────────────────────────────────── */

.sc-hero {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}
.sc-hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--ink3);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.sc-hero-name {
  font-family: var(--font-serif);
  font-size: 52px;
  font-weight: 300;
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 18px;
}
.sc-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.sc-stat {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  letter-spacing: 0.04em;
}
.sc-hero-actions {
  display: flex;
  gap: 10px;
}
.sc-action-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 18px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink3);
  transition: all 0.15s;
}
.sc-action-btn:hover { color: var(--ink); border-color: var(--moss-mid); }
.sc-action-btn.primary {
  background: rgba(90,107,72,0.12);
  border-color: rgba(90,107,72,0.4);
  color: var(--moss);
}
.sc-action-btn.primary:hover { background: var(--moss); color: var(--ink-inv); }

.sc-section {
  margin-bottom: 52px;
}
.sc-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 6px;
}
.sc-section-label.state { color: var(--moss-mid); }
.sc-section-label.flux  { color: var(--terra-mid); }
.sc-section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 300;
  color: var(--ink2);
  margin-bottom: 20px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.sc-flux-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  font-weight: 300;
}
.sc-more-link {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink3);
  margin-top: 14px;
  cursor: pointer;
  letter-spacing: 0.04em;
}
.sc-more-link:hover { color: var(--moss); }

/* Belief cards */
.sc-beliefs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.sc-belief {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  background: var(--dark2);
  cursor: default;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-card);
}
.sc-belief:hover { border-color: var(--moss-mid); box-shadow: 0 4px 14px rgba(44,32,25,0.10); }
.sc-belief-claim {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink);
  margin-bottom: 10px;
}
.sc-belief-meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* Value cards */
.sc-values-list { display: flex; flex-direction: column; gap: 0; }
.sc-value {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-lt);
  cursor: default;
}
.sc-value:last-child { border-bottom: none; }
.sc-value-mark {
  font-size: 10px;
  flex-shrink: 0;
  color: var(--moss-mid);
}
.sc-value.instrumental .sc-value-mark { color: var(--ink3); }
.sc-value-rule {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.35;
  flex: 1;
}
.sc-value-valence {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink4);
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Goal cards */
.sc-goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.sc-goal {
  border: 1px solid var(--border);
  border-left: 2px solid var(--terra-mid);
  border-radius: 4px;
  padding: 14px 16px;
  background: var(--dark2);
  cursor: default;
}
.sc-goal-top { margin-bottom: 8px; }
.sc-goal-horizon {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--terra-lt);
  text-transform: uppercase;
}
.sc-goal-desc {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.4;
  color: var(--ink);
}

/* Learn cards */
.sc-learns-list { display: flex; flex-direction: column; gap: 10px; }
.sc-learn {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--dark2);
  cursor: default;
}
.sc-learn-shift {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: var(--ink4);
}
.sc-learn-shift.big-shift { color: var(--terra-lt); }
.sc-learn-shift.small-shift { color: var(--moss-mid); }
.sc-learn-shift.confirm { color: var(--ink3); }
.sc-learn-insight {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink);
}

/* Tags */
.sc-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink3);
  border: 1px solid var(--border-lt);
  border-radius: 4px;
  padding: 2px 6px;
}
.sc-tag.certainty { color: var(--moss); border-color: rgba(90,107,72,0.22); }
.sc-tag.muted { color: var(--ink4); }

/* ── Identity view (idc-*) ────────────────────────────────────────────────── */

/* Full-screen identity chat */
.idc-fullscreen {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Minimal whisper header — no border, no weight */
.idc-chat-header {
  padding: 22px 0 8px;
  flex-shrink: 0;
  text-align: center;
}
.idc-chat-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--ink3);
  font-weight: 300;
}
.idc-chat-sub {
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--ink4);
  margin-top: 4px;
}

/* Messages */
.idc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.idc-msg {
  display: flex;
  padding: 0 10%;
}
.idc-msg.user { justify-content: flex-end; }
.idc-msg.assistant { justify-content: flex-start; }

/* Assistant: open text, no chrome — reads like a letter */
.idc-msg.assistant .idc-bubble {
  max-width: 100%;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.72;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
}

/* User: warm soft pill */
.idc-msg.user .idc-bubble {
  max-width: 72%;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(90,107,72,0.16);
  border: none;
  border-radius: 20px 20px 4px 20px;
  padding: 11px 18px;
}

/* Thinking indicator */
.idc-thinking {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink4);
  font-style: italic;
  animation: idc-pulse 1.8s ease-in-out infinite;
}
@keyframes idc-pulse { 0%,100%{opacity:0.3} 50%{opacity:0.8} }

/* Input area — floating, no hard border-top */
.idc-input-wrap {
  padding: 12px 10% 28px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.idc-input {
  flex: 1;
  background: rgba(44,32,25,0.05);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  padding: 11px 18px;
  resize: none;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
}
.idc-input::placeholder { color: var(--ink4); }
.idc-input:focus { border-color: rgba(90,107,72,0.5); }
.idc-send-btn {
  background: var(--moss);
  border: none;
  color: var(--ink-inv);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 1px;
  transition: background 0.15s;
}
.idc-send-btn:hover:not(:disabled) { background: var(--moss-mid); }
.idc-send-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* Markdown inside assistant bubbles */
.idc-bubble h1, .idc-bubble h2, .idc-bubble h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  margin: 10px 0 4px;
  line-height: 1.3;
}
.idc-bubble h1 { font-size: 18px; }
.idc-bubble h2 { font-size: 16px; }
.idc-bubble h3 { font-size: 15px; color: var(--ink2); }
.idc-bubble ul { margin: 6px 0; padding-left: 20px; }
.idc-bubble li { margin: 4px 0; }
.idc-bubble code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(44,32,25,0.07);
  padding: 1px 5px;
  border-radius: 4px;
}
.idc-bubble pre {
  background: rgba(44,32,25,0.05);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 12px;
}
.idc-bubble pre code { background: none; padding: 0; }

/* Choice buttons — gentle pills, not rectangles */
.idc-widget-choice {
  margin: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.idc-widget-title {
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--ink3);
  margin-bottom: 4px;
  font-style: italic;
}
.idc-choice-btn {
  display: inline-block;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink2);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.idc-choice-btn:hover {
  border-color: var(--moss-mid);
  color: var(--ink);
  background: var(--moss-pale);
}

/* Actions: collapsible node-action log */
.idc-actions { margin: 14px 0 2px; }
.idc-actions-summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-family: var(--font-sans);
  color: var(--moss);
  cursor: pointer;
  user-select: none;
  list-style: none;
  outline: none;
  padding: 3px 10px 3px 7px;
  border: 1px solid var(--moss-pale);
  border-radius: 20px;
  background: var(--moss-pale);
  opacity: 0.75;
  transition: opacity 0.15s;
}
.idc-actions-summary:hover { opacity: 1; }
.idc-actions-summary::-webkit-details-marker { display: none; }
.idc-actions-summary::before {
  content: '▸';
  font-size: 8px;
  transition: transform 0.15s;
  display: inline-block;
}
.idc-actions[open] .idc-actions-summary::before { transform: rotate(90deg); }
.idc-actions-body {
  margin-top: 8px;
  padding: 10px 14px;
  background: rgba(90,107,72,0.09);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.idc-action-item {
  font-size: 11px;
  color: var(--moss-lt);
  font-family: var(--font-sans);
  line-height: 1.5;
  opacity: 0.8;
}

/* ── Nav status dot ──────────────────────────────────────────────────────── */

.nav-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--moss-mid);
  flex-shrink: 0;
  padding: 0;
  transition: background 0.3s;
}
.nav-status-dot.green   { background: var(--moss-lt); }
.nav-status-dot.amber   { background: #E8A04A; }
.nav-status-dot.pulsing {
  background: #E8A04A;
  animation: dot-pulse 1.2s ease-in-out infinite;
}
@keyframes dot-pulse { 0%,100%{opacity:0.4; transform:scale(0.9)} 50%{opacity:1; transform:scale(1.2)} }

/* ── Surface view ─────────────────────────────────────────────────────────── */

.surface-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.surface-header {
  padding: 22px 28px 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-shrink: 0;
}
.surface-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.surface-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 300;
  color: var(--ink2);
  letter-spacing: -0.01em;
}
.surface-meta {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink4);
  letter-spacing: 0.08em;
}
.surface-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.surface-count {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(232,160,74,0.2);
  color: #E8A04A;
}
.surface-process-btn {
  background: var(--moss);
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-inv);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(90,107,72,0.3);
}
.surface-process-btn:hover { background: var(--moss-mid); box-shadow: 0 3px 12px rgba(90,107,72,0.35); }
.surface-process-btn:disabled { opacity: 0.4; cursor: default; box-shadow: none; }
.surface-process-btn.small {
  padding: 5px 12px;
  font-size: 9px;
}

/* Progress bar (flex container with message) */
.surface-progress {
  margin: 12px 32px 0;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}
.surface-progress-bar {
  height: 2px;
  background: var(--moss-lt);
  width: 0%;
  border-radius: 1px;
  transition: width 0.4s ease;
  flex-shrink: 0;
}
#surface-progress-msg {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink4);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Clean state */
.surface-clean {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 48px;
  text-align: center;
}
.surface-clean-mark {
  font-size: 30px;
  color: var(--moss-lt);
  opacity: 0.55;
  line-height: 1;
}
.surface-clean-title {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 300;
  font-style: italic;
  color: var(--ink3);
}
.surface-clean-sub {
  font-size: 14px;
  color: var(--ink4);
  max-width: 400px;
  line-height: 1.7;
}

/* Columns */
.surface-columns {
  flex: 1;
  display: flex;
  overflow: hidden;
  margin-top: 0;
  padding: 12px 16px 16px;
  gap: 12px;
}
.surface-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--dark2);
  box-shadow: var(--shadow-card);
  min-width: 180px;
}
.surface-col-label {
  padding: 13px 16px 11px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-lt);
  flex-shrink: 0;
  color: var(--ink4);
  background: rgba(44,32,25,0.02);
  border-radius: 14px 14px 0 0;
}
.surface-col-label.contradiction { color: #E8A04A; border-bottom-color: rgba(232,160,74,0.2); }
.surface-col-label.pattern       { color: var(--moss); border-bottom-color: rgba(90,107,72,0.2); }
.surface-col-label.redundancy    { color: var(--ink3); }
.surface-col-label.stale         { color: var(--ink4); }
.surface-col-items, .surface-col > .surface-card {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px;
}

/* Cards */
.surface-card {
  padding: 16px 16px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--dark2);
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.surface-card:last-child { margin-bottom: 0; }
.surface-card.contradiction-card {
  border-color: rgba(232,160,74,0.25);
  background: rgba(232,160,74,0.04);
}
.surface-card.pattern-card {
  border-color: rgba(148,174,136,0.22);
  background: rgba(90,107,72,0.05);
}
.surface-card.redundancy-card { background: var(--dark2); }
.surface-card.stale-card { background: var(--dark2); opacity: 0.75; }
.surface-card-body { margin-bottom: 10px; }
.surface-card-desc {
  font-size: 13px;
  color: var(--ink3);
  line-height: 1.65;
  margin-top: 10px;
}
.surface-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.surface-tension {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.surface-tension-vs {
  font-size: 12px;
  color: #E8A04A;
  opacity: 0.7;
}
.surface-node-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--dark3);
  border: 1px solid var(--border);
  color: var(--ink3);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}
.surface-pattern-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 4px;
}
.surface-node-refs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-top: 6px;
}
.surface-node-ref {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink4);
  background: var(--dark3);
  border: 1px solid var(--border-lt);
  border-radius: 4px;
  padding: 1px 5px;
}

/* Action buttons */
.surface-action-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 11px;
  color: var(--ink3);
  cursor: pointer;
  transition: all 0.15s;
}
.surface-action-btn:hover { color: var(--ink); border-color: var(--ink3); }
.surface-action-btn.resolve {
  border-color: rgba(232,160,74,0.4);
  color: #E8A04A;
}
.surface-action-btn.resolve:hover { background: rgba(232,160,74,0.1); }
.surface-action-btn.accept {
  border-color: rgba(90,107,72,0.35);
  color: var(--moss);
}
.surface-action-btn.accept:hover { background: var(--moss-pale); }
.surface-action-btn.muted { color: var(--ink4); }

/* Synthesis modal */
.synthesis-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(44,32,25,0.65);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.synthesis-modal {
  width: 620px;
  max-height: 82vh;
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-tile);
}
.synthesis-modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.synthesis-modal-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 300;
  color: var(--ink);
}
.synthesis-modal-close {
  background: none; border: none;
  color: var(--ink4); cursor: pointer;
  font-size: 13px; padding: 2px 4px;
}
.synthesis-modal-close:hover { color: var(--ink2); }
.synthesis-modal-focus {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(232,160,74,0.04);
  flex-shrink: 0;
}
.synthesis-focus-type {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #E8A04A;
  margin-bottom: 4px;
}
.synthesis-focus-desc {
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.55;
}
.synthesis-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}
.synthesis-proposal {}
.synthesis-insight {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.synthesis-integration-type {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(90,107,72,0.10);
  color: var(--moss);
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.synthesis-insight-text {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 300;
  color: var(--ink);
  line-height: 1.5;
}
.synthesis-changes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.synthesis-change {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--dark3);
}
.synthesis-change-action {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex-shrink: 0;
  padding: 1px 6px;
  border-radius: 4px;
}
.synthesis-change-action.update { background: var(--moss-pale); color: var(--moss-lt); }
.synthesis-change-action.create { background: rgba(232,160,74,0.15); color: #E8A04A; }
.synthesis-change-action.archive { background: rgba(44,32,25,0.06); color: var(--ink3); }
.synthesis-change-desc {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.5;
}
.synthesis-proposal-actions {
  display: flex; gap: 10px; align-items: center;
}

/* ── Home layout (three-panel: signal | surface | identity) ─────────────── */

.home-layout {
  display: grid;
  grid-template-columns: 220px 1fr 268px;
  height: 100%;
  overflow: hidden;
  gap: 0;
}

.home-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
  background: var(--dark2);
  transition: background 0.2s;
}
.home-panel:last-child { border-right: none; }

.home-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border-lt);
  flex-shrink: 0;
  background: rgba(44,32,25,0.02);
}

.home-panel-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 4px;
}

.home-panel-sublabel {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink4);
  letter-spacing: 0.02em;
}

.home-panel-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  color: var(--ink3);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.home-panel-btn:hover { color: var(--ink); border-color: var(--ink3); }

.home-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
}

/* Empty states */
.home-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  gap: 10px;
}
.home-empty-mark {
  font-size: 22px;
  color: var(--ink4);
  line-height: 1;
  opacity: 0.5;
}
.home-empty-text {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 300;
  font-style: italic;
  color: var(--ink3);
}
.home-empty-sub {
  font-size: 13px;
  color: var(--ink4);
  line-height: 1.65;
  max-width: 200px;
}
.home-empty-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  color: var(--ink3);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 4px;
}
.home-empty-btn:hover { color: var(--ink); border-color: var(--moss); }

/* Signal cards (left panel) */
.signal-card {
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-lt);
  background: var(--dark2);
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow-card);
}
.signal-card:last-child { margin-bottom: 0; }
.signal-card:hover { border-color: var(--border); box-shadow: 0 4px 16px rgba(44,32,25,0.11); }

.signal-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.signal-schema {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--dark3);
  color: var(--ink4);
  border: 1px solid var(--border-lt);
}
.signal-schema.state    { color: var(--moss);      border-color: rgba(90,107,72,0.28);  background: var(--moss-pale); }
.signal-schema.question { color: #5E8A9A;           border-color: rgba(94,138,154,0.28); background: rgba(94,138,154,0.08); }
.signal-schema.need     { color: #9A6A38;           border-color: rgba(154,106,56,0.28); background: rgba(154,106,56,0.08); }
.signal-schema.pattern  { color: var(--terra);      border-color: rgba(176,78,40,0.28);  background: var(--terra-pale); }

.signal-hypothesis {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink4);
  letter-spacing: 0.06em;
  font-style: italic;
}

.signal-text {
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.65;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Identity panel (right panel) */
.home-identity-self {
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--border-lt);
  margin-bottom: 18px;
}
.home-identity-name {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 300;
  color: var(--ink);
}

.home-identity-section {
  margin-bottom: 22px;
}
.home-identity-section:last-child { margin-bottom: 0; }

.home-identity-section-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-lt);
}
.home-identity-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink4);
}
.home-identity-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  opacity: 0.7;
}

.home-identity-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-lt);
}
.home-identity-item:last-child { border-bottom: none; }

.home-identity-dot {
  font-size: 8px;
  color: var(--moss);
  opacity: 0.7;
  flex-shrink: 0;
  margin-top: 4px;
}

.home-identity-valence {
  font-size: 11px;
  flex-shrink: 0;
  margin-top: 2px;
}
.home-identity-valence.toward { color: var(--moss); }
.home-identity-valence.away   { color: var(--terra); }

.home-identity-text {
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.55;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.home-identity-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Talk view ───────────────────────────────────────────────────────────── */

.talk-wrap {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.talk-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.talk-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px 10% 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.talk-msg { display: flex; }
.talk-msg.user     { justify-content: flex-end; }
.talk-msg.assistant { flex-direction: column; align-items: flex-start; }

.talk-msg.assistant .talk-bubble {
  max-width: 100%;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.72;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
}
.talk-msg.user .talk-bubble {
  max-width: 72%;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(90,107,72,0.18);
  border-radius: 20px 20px 4px 20px;
  padding: 11px 18px;
}
.talk-thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 6px 2px;
}
.talk-thinking-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink4);
  animation: talk-dot-bounce 1.2s ease-in-out infinite;
}
.talk-thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.talk-thinking-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes talk-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-4px); opacity: 0.9; }
}

.talk-bubble.streaming::after {
  content: '▋';
  color: var(--moss-lt);
  animation: talk-cursor-blink 0.75s step-end infinite;
  margin-left: 1px;
}
@keyframes talk-cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.talk-reasoning { margin-bottom: 4px; }
.talk-reasoning-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink4);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.talk-reasoning-toggle::before {
  content: '▸';
  font-size: 9px;
  transition: transform 0.15s;
}
.talk-reasoning.open .talk-reasoning-toggle::before { transform: rotate(90deg); }
.talk-reasoning-steps {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin-top: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--border-lt);
  margin-left: 4px;
}
.talk-reasoning.open .talk-reasoning-steps { display: flex; }
.talk-tool-step {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink4);
  padding: 2px 0;
}

/* inline node citation chips */
.talk-node-ref {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--moss);
  background: rgba(90,107,72,0.10);
  border: 1px solid rgba(90,107,72,0.25);
  border-radius: 4px;
  padding: 1px 5px;
  margin: 0 1px;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.4;
  transition: background 0.12s;
}
.talk-node-ref:hover { background: rgba(90,107,72,0.20); }
.talk-node-ref::before { content: '↗'; font-size: 8px; opacity: 0.6; }

.talk-widget-choice {
  margin-top: 12px;
}
.talk-widget-title {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink3);
  margin-bottom: 8px;
}
.talk-widget-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.talk-choice-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.talk-choice-btn:hover {
  background: var(--moss-pale);
  border-color: var(--moss-lt);
  color: var(--moss);
}
.talk-choice-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.talk-session-divider {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink4);
  padding: 12px 0 4px;
  opacity: 0.6;
}

.talk-session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  margin-bottom: 8px;
  background: var(--moss-pale);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink3);
  letter-spacing: 0.02em;
}
.talk-new-conv-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink4);
  cursor: pointer;
}
.talk-new-conv-btn:hover { color: var(--ink2); border-color: var(--border); }

.focus-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.focus-modal {
  background: var(--dark2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 440px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-tile);
}
.focus-modal-title { font-family: var(--font-serif); font-size: 20px; color: var(--ink); }
.focus-modal-sub { font-size: 13px; color: var(--ink3); line-height: 1.5; }
.focus-modal-input {
  width: 100%;
  background: var(--dark3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.5;
}
.focus-modal-input::placeholder { color: var(--ink4); }
.focus-modal-input:focus { outline: none; border-color: var(--accent); }
.focus-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.focus-modal-cancel {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink3);
  cursor: pointer;
}
.focus-modal-cancel:hover { color: var(--ink2); }
.focus-modal-run {
  padding: 8px 18px;
  background: var(--accent);
  color: var(--ink-inv);
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.focus-modal-run:hover { opacity: 0.85; }

.agent-auth-banner {
  margin: 0 10% 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}
.agent-auth-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.agent-auth-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink2); }
.agent-auth-text strong { color: var(--ink1); font-weight: 600; }
.agent-auth-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.agent-auth-btn:hover { opacity: 0.85; }

.talk-input-wrap {
  padding: 12px 10% 28px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.talk-input {
  flex: 1;
  background: rgba(44,32,25,0.05);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  padding: 11px 18px;
  resize: none;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.2s;
}
.talk-input::placeholder { color: var(--ink4); }
.talk-input:focus { border-color: rgba(90,107,72,0.5); }
.talk-send-btn {
  background: var(--moss);
  border: none;
  color: var(--ink-inv);
  border-radius: 50%;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 1px;
  transition: background 0.15s;
}
.talk-send-btn:hover:not(:disabled) { background: var(--moss-mid); }
.talk-send-btn:disabled { opacity: 0.25; cursor: not-allowed; }

/* Capture sidebar */
.talk-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--dark2);
  border-left: 1px solid var(--border);
  overflow: hidden;
}
.talk-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.talk-sidebar-tab {
  flex: 1;
  padding: 12px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink4);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.talk-sidebar-tab.active {
  color: var(--ink2);
  border-bottom-color: var(--moss);
}
.talk-tab-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.talk-tab-panel.active { display: flex; }

.talk-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.talk-history-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.12s;
}
.talk-history-item:hover { background: var(--dark3); }
.talk-history-item.active { background: var(--moss-pale); }
.talk-history-title {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.talk-history-item.active .talk-history-title { color: var(--moss); }
.talk-history-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  flex-shrink: 0;
}

.talk-captures {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.talk-captures-empty {
  font-family: var(--font-serif);
  font-size: 14px;
  font-style: italic;
  color: var(--ink4);
  line-height: 1.65;
  padding: 8px 4px;
}
.talk-capture-item {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(44,32,25,0.03);
  border: 1px solid var(--border-lt);
}
.talk-capture-action {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 1px 7px;
  flex-shrink: 0;
}
.talk-capture-action.added   { background: rgba(90,107,72,0.16); color: var(--moss); }
.talk-capture-action.updated { background: rgba(176,78,40,0.12); color: var(--terra); }
.talk-capture-action.linked  { background: rgba(44,32,25,0.05); color: var(--ink3); }
.talk-capture-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.talk-capture-value {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.5;
}
.talk-capture-raw {
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.4;
}
.talk-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.talk-process-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  letter-spacing: 0.03em;
  line-height: 1.5;
}

/* ── Log view ─────────────────────────────────────────────────────────────── */

.log-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 48px 80px;
}
.log-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 40px;
}
.log-title {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 300;
  color: var(--ink2);
  letter-spacing: -0.01em;
}
.log-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink4);
}
.log-run-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink3);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.log-run-btn:hover { border-color: var(--moss-lt); color: var(--moss-lt); }

.log-empty {
  text-align: center;
  padding: 80px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.log-empty-icon {
  font-size: 32px;
  color: var(--ink4);
  line-height: 1;
}
.log-empty-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 300;
  font-style: italic;
  color: var(--ink3);
}
.log-empty-sub {
  font-size: 13px;
  color: var(--ink4);
  max-width: 380px;
  line-height: 1.65;
}

/* Timeline */
.log-timeline {
  position: relative;
  padding-left: 28px;
}
.log-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}
.log-entry {
  position: relative;
  margin-bottom: 32px;
}
.log-entry-dot {
  position: absolute;
  left: -24px;
  top: 6px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--dark);
}
.log-entry-dot.consolidation {
  background: var(--moss-pale);
  border-color: var(--moss);
}
.log-entry-dot.synthesis {
  background: rgba(232,160,74,0.2);
  border-color: #E8A04A;
}
.log-entry-content {}
.log-entry-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.log-entry-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink3);
  letter-spacing: 0.04em;
}
.log-entry-type {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 4px;
}
.log-entry-type.consolidation { background: var(--moss-pale); color: var(--moss); }
.log-entry-type.synthesis { background: rgba(232,160,74,0.15); color: #B07830; }
.log-entry-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  letter-spacing: 0.03em;
}
.log-entry-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.log-summary-item {
  font-size: 13px;
  color: var(--ink3);
}
.log-dot {
  color: var(--ink4);
  font-size: 10px;
}
.log-entry-toggle {
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--ink4);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.log-entry-toggle:hover { color: var(--ink3); }
.log-detail {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--dark2);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.log-detail-section {}
.log-detail-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink4);
  margin-bottom: 6px;
}
.log-detail-item {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--border-lt);
  margin-bottom: 4px;
}
.log-detail-item.contradiction { border-color: rgba(232,160,74,0.2); background: rgba(232,160,74,0.04); }
.log-detail-item.pattern       { border-color: rgba(148,174,136,0.22); background: rgba(90,107,72,0.05); }
.log-detail-item.redundancy    { border-color: var(--border); }
.log-detail-item.stale         { border-color: var(--border-lt); opacity: 0.7; }
.log-detail-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 3px;
}
.log-detail-desc {
  font-size: 12px;
  color: var(--ink3);
  line-height: 1.55;
  display: block;
}

/* ── Graph status bar ─────────────────────────────────────────────────────── */

.graph-status-bar {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: rgba(30,21,16,0.92);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(8px);
  z-index: 10;
  white-space: nowrap;
}
.graph-status-warn {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #E8A04A;
}
.graph-status-ok {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--moss-lt);
}
.graph-status-sep {
  font-size: 9px;
  color: var(--ink4);
}
.graph-status-time {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--ink4);
}
.graph-consolidate-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--ink3);
  cursor: pointer;
  transition: all 0.15s;
}
.graph-consolidate-btn:hover { border-color: var(--moss-lt); color: var(--moss-lt); }


/* ── Structure view ─────────────────────────────────────────────────────��──── */

.str-root { height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--dark); }
.str-header { flex-shrink: 0; padding: 56px 48px 32px 0; border-bottom: 1px solid var(--border); display: flex; }
.str-header-spacer { flex: 0 0 180px; border-right: 1px solid var(--border); }
.str-header-inner { max-width: 800px; padding-left: 40px; flex: 1; }
.str-title { font-family: var(--font-serif); font-size: 36px; font-weight: 300; color: var(--ink); margin: 0 0 8px; letter-spacing: -0.02em; }
.str-subtitle { font-family: var(--font-serif); font-size: 16px; font-weight: 300; font-style: italic; color: var(--ink3); margin: 0; }
.str-layout { display: flex; flex: 1; overflow: hidden; min-height: 0; }
.str-outline { flex: 0 0 180px; height: 100%; padding: 32px 16px 32px 20px; border-right: 1px solid var(--border); overflow-y: auto; box-sizing: border-box; }
.str-ol-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink3); opacity: 0.5; padding: 0 8px 12px; display: block; }
.str-ol-item { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.02em; color: var(--ink3); padding: 7px 10px 7px 10px; cursor: pointer; border-left: 2px solid transparent; margin-bottom: 2px; line-height: 1.3; transition: color 0.12s, border-color 0.12s, background 0.12s; border-radius: 0 4px 4px 0; }
.str-ol-item:hover { color: var(--ink2); background: rgba(44,32,25,0.04); }
.str-ol-item.str-ol-active { color: var(--ink); border-left-color: var(--accent); background: rgba(44,32,25,0.05); }
.str-body { flex: 1; min-width: 0; max-width: 800px; padding: 0 48px 80px 40px; overflow-y: auto; height: 100%; }
@media (max-width: 860px) { .str-outline { display: none; } .str-header-spacer { display: none; } .str-header-inner { padding-left: 0; } .str-header { padding-left: 32px; } .str-body { padding-left: 32px; } }
.str-section { padding: 40px 0 0; border-top: 1px solid var(--border); margin-top: 40px; }
.str-section:first-child { border-top: none; margin-top: 32px; }
.str-section-title { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink3); margin: 0 0 20px; font-weight: 400; }
.str-prose { font-family: var(--font-serif); font-size: 17px; font-weight: 300; color: var(--ink2); line-height: 1.65; margin: 0 0 16px; }
.str-prose-sm { font-size: 14px; color: var(--ink3); }
.str-claim { padding-top: 32px; }

/* Layers */
.str-layers { display: flex; flex-direction: column; gap: 28px; margin-top: 24px; }
.str-layer { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.str-layer-header { display: flex; align-items: baseline; gap: 14px; padding: 14px 18px; background: rgba(44,32,25,0.03); border-bottom: 1px solid var(--border); }
.str-layer-name { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; color: var(--ink3); font-weight: 500; }
.str-layer[data-layer="self"]    .str-layer-name { color: #A5BA98; }
.str-layer[data-layer="world"]   .str-layer-name { color: #DC9878; }
.str-layer[data-layer="history"] .str-layer-name { color: #C8A064; }
.str-layer[data-layer="loop"]    .str-layer-name { color: #C76C4A; }
.str-layer-desc { font-family: var(--font-serif); font-size: 13px; font-style: italic; color: var(--ink4); }
.str-layer-note { font-family: var(--font-serif); font-size: 13px; font-style: italic; color: var(--ink4); margin: 14px 18px 8px; line-height: 1.55; }
.str-schema-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }

/* Schema cards */
.str-schema-card { border-radius: 4px; overflow: hidden; transition: background 0.1s; }
.str-schema-card:hover { background: rgba(44,32,25,0.04); }
.str-card-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; user-select: none; }
.str-card-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; opacity: 0.85; }
.str-card-ns { font-family: var(--font-mono); font-size: 10px; color: var(--ink4); letter-spacing: 0.02em; }
.str-card-name { font-family: var(--font-mono); font-size: 11px; color: var(--ink2); letter-spacing: 0.04em; flex: 1; }
.str-card-chevron { color: var(--ink4); transition: transform 0.15s; flex-shrink: 0; }
.str-card-open .str-card-chevron { transform: rotate(180deg); }
.str-card-body { display: none; padding: 0 12px 14px 27px; }
.str-card-open .str-card-body { display: block; }
.str-card-desc { font-family: var(--font-serif); font-size: 13px; font-weight: 300; color: var(--ink3); line-height: 1.6; margin: 0 0 12px; }
.str-fields { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.str-field-row { display: flex; gap: 12px; align-items: baseline; }
.str-field-name { font-family: var(--font-mono); font-size: 10px; color: var(--ink3); min-width: 130px; }
.str-field-type { font-family: var(--font-mono); font-size: 9px; color: var(--ink4); letter-spacing: 0.02em; }
.str-card-note { font-family: var(--font-serif); font-size: 12px; font-style: italic; color: var(--moss-lt); line-height: 1.55; margin: 4px 0 0; padding: 8px 10px; background: rgba(90,107,72,0.10); border-left: 2px solid var(--moss); border-radius: 0 4px 4px 0; }

/* Sediment rule */
.str-rule-block { margin: 16px 0; padding: 16px 20px; border-left: 3px solid var(--moss); background: rgba(90,107,72,0.08); border-radius: 0 4px 4px 0; }
.str-rule-quote { font-family: var(--font-serif); font-size: 16px; font-style: italic; color: var(--ink2); margin: 0; line-height: 1.6; }
.str-mechanics { margin-top: 20px; }
.str-mech-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.str-mech-box { font-family: var(--font-mono); font-size: 10px; padding: 6px 12px; border-radius: 8px; letter-spacing: 0.04em; }
.str-mech-old   { background: rgba(176,78,40,0.12);   color: #C76C4A; border: 1px solid rgba(176,78,40,0.22); }
.str-mech-new   { background: rgba(148,174,136,0.14); color: #94AE88; border: 1px solid rgba(148,174,136,0.24); }
.str-mech-learn { background: rgba(90,107,72,0.12);   color: #7A9469; border: 1px solid rgba(90,107,72,0.22); }
.str-mech-arrow { font-family: var(--font-mono); font-size: 10px; color: var(--ink4); }
.str-mech-label { color: var(--ink4); font-size: 9px; }

/* Integration types */
.str-int-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.str-int-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: 4px; }
.str-int-card p { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); margin: 6px 0 0; line-height: 1.55; }
.str-int-strong { border-color: rgba(148,174,136,0.25); }
.str-int-name { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink2); }

/* Relationships */
.str-rel-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.str-rel-row { display: flex; align-items: baseline; gap: 16px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 4px; }
.str-rel-type { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink2); min-width: 90px; }
.str-rel-desc { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); line-height: 1.5; }

/* Provenance */
.str-prov-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.str-prov-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: 4px; }
.str-prov-card p { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); margin: 8px 0 0; line-height: 1.55; }
.str-prov-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; padding: 4px 8px; border-radius: 8px; display: inline-block; }
.str-prov-human { background: rgba(148,174,136,0.14); color: #94AE88; }
.str-prov-ai    { background: rgba(176,78,40,0.10);  color: #C76C4A; }

/* Three modes */
.str-mode-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.str-mode-row { display: flex; gap: 20px; align-items: baseline; padding: 12px 16px; border: 1px solid var(--border); border-radius: 4px; }
.str-mode-name { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--ink3); min-width: 64px; padding-top: 2px; }
.str-mode-desc { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); line-height: 1.6; }

/* Stack */
.str-stack { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.str-stack-row { display: grid; grid-template-columns: 24px 160px 1fr; gap: 16px; align-items: baseline; padding: 10px 14px; border-radius: 4px; }
.str-stack-active { background: rgba(90,107,72,0.10); border: 1px solid rgba(90,107,72,0.25); }
.str-stack-dim { border: 1px solid var(--border); opacity: 0.6; }
.str-stack-level { font-family: var(--font-mono); font-size: 9px; color: var(--ink4); text-align: center; }
.str-stack-name { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; color: var(--ink2); }
.str-stack-active .str-stack-name { color: var(--moss-lt); }
.str-stack-detail { font-family: var(--font-serif); font-size: 12px; color: var(--ink4); line-height: 1.5; }
/* updated stack for apex/domain/signal labels */
.str-stack-row { grid-template-columns: 52px 160px 1fr; }

/* Large opening prose */
.str-prose-lg { font-size: 20px; line-height: 1.6; color: var(--ink); font-weight: 300; }

/* Einstein / epigraph block */
.str-einstein { margin-top: 28px; padding: 20px 24px; border-left: 2px solid rgba(148,174,136,0.28); }
.str-einstein-quote { font-family: var(--font-serif); font-size: 16px; font-weight: 300; font-style: italic; color: var(--ink3); line-height: 1.65; margin: 0 0 10px; }
.str-einstein-attr { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; color: var(--ink4); }

/* Type grid: belief / value / goal */
.str-type-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 20px; }
@media (max-width: 700px) { .str-type-grid { grid-template-columns: 1fr; } }
.str-type-card { border: 1px solid var(--border); border-radius: 4px; padding: 16px 18px; }
.str-type-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.str-type-schema { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--moss-lt); }
.str-type-mode { font-family: var(--font-serif); font-size: 11px; font-style: italic; color: var(--ink4); }
.str-type-body { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); line-height: 1.62; margin: 0; }

/* Field test block */
.str-test-block { margin-top: 20px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.str-test-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink4); padding: 7px 14px; border-bottom: 1px solid var(--border); }
.str-test-row { display: flex; align-items: baseline; gap: 16px; padding: 9px 14px; border-bottom: 1px solid rgba(44,32,25,0.04); flex-wrap: wrap; }
.str-test-row:last-child { border-bottom: none; }
.str-test-q { font-family: var(--font-serif); font-size: 13px; font-style: italic; color: var(--ink3); flex: 1; min-width: 200px; }
.str-test-a { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--moss-lt); white-space: nowrap; }

/* Loop diagram */
.str-loop-diagram { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding: 18px 20px; background: rgba(44,32,25,0.03); border: 1px solid var(--border); border-radius: 4px; }
.str-loop-node { display: flex; flex-direction: column; gap: 4px; }
.str-loop-schema { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; color: var(--terra-lt); }
.str-loop-desc { font-family: var(--font-serif); font-size: 11px; font-style: italic; color: var(--ink4); }
.str-loop-arrow { font-family: var(--font-mono); font-size: 13px; color: var(--ink4); }
.str-loop-return { font-size: 10px; font-style: italic; margin-left: auto; color: var(--ink4); }
.str-loop-note { margin-top: 14px; font-family: var(--font-serif); font-size: 13px; color: var(--ink4); line-height: 1.6; font-style: italic; padding: 10px 14px; border-left: 2px solid var(--border); }
.str-loop-note strong { color: var(--ink3); font-style: normal; font-weight: 400; }

/* Depth grid */
.str-depth-grid { display: flex; flex-direction: column; gap: 1px; margin-top: 20px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.str-depth-row { display: grid; grid-template-columns: 130px 1fr 160px; gap: 16px; padding: 12px 16px; background: rgba(44,32,25,0.02); border-bottom: 1px solid rgba(44,32,25,0.04); align-items: start; }
.str-depth-row:last-child { border-bottom: none; }
@media (max-width: 700px) { .str-depth-row { grid-template-columns: 1fr; } }
.str-depth-dim { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink3); padding-top: 2px; }
.str-depth-why { font-family: var(--font-serif); font-size: 13px; color: var(--ink4); line-height: 1.6; }
.str-depth-schema { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.04em; color: var(--moss-lt); opacity: 0.8; text-align: right; padding-top: 2px; }
@media (max-width: 700px) { .str-depth-schema { text-align: left; } }

/* Schema group labels */
.str-schema-group-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink4); padding: 6px 12px 0; }

/* Assemblage DAG */
.str-asm-dag { margin-top: 20px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.str-asm-layer { display: grid; grid-template-columns: 80px 1fr; }
.str-asm-layer + .str-asm-layer { border-top: 1px solid var(--border); }
.str-asm-left { padding: 16px 12px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border-right: 1px solid var(--border); }
.str-asm-apex .str-asm-left  { background: rgba(90,107,72,0.12); border-right-color: rgba(90,107,72,0.3); }
.str-asm-domain .str-asm-left { background: rgba(44,32,25,0.03); }
.str-asm-signal .str-asm-left { background: transparent; }
.str-asm-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink4); }
.str-asm-apex .str-asm-label { color: var(--moss-lt); }
.str-asm-sub { font-family: var(--font-mono); font-size: 8px; color: var(--ink4); opacity: 0.5; }
.str-asm-right { padding: 14px 16px; background: rgba(44,32,25,0.02); }
.str-asm-apex .str-asm-right { background: rgba(90,107,72,0.06); }
.str-asm-desc { font-family: var(--font-serif); font-size: 12.5px; color: var(--ink3); line-height: 1.6; margin-bottom: 10px; }
.str-asm-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.str-asm-chip { font-family: var(--font-mono); font-size: 9.5px; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); color: var(--ink4); background: rgba(44,32,25,0.03); }
.str-asm-chip-m { border-color: rgba(148,174,136,0.35); color: var(--moss-lt); background: rgba(90,107,72,0.10); }
.str-asm-chip-t { border-color: rgba(220,152,120,0.35); color: var(--terra-lt); background: rgba(176,78,40,0.1); }
.str-asm-chip-s { border-color: rgba(200,160,100,0.35); color: #C8A064; background: rgba(200,160,100,0.08); }
.str-asm-arrow { display: grid; grid-template-columns: 80px 1fr; border-top: 1px solid var(--border); background: rgba(44,32,25,0.015); }
.str-asm-arrow-left { border-right: 1px solid var(--border); padding: 6px 12px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.str-asm-up { color: var(--moss-lt); font-size: 15px; line-height: 1; }
.str-asm-down { color: var(--ink4); font-size: 15px; line-height: 1; }
.str-asm-arrow-right { padding: 6px 16px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.str-asm-up-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; color: var(--moss-lt); }
.str-asm-down-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; color: var(--ink4); }

/* Full trace chain */
.str-trace { margin-top: 20px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 4px; background: rgba(44,32,25,0.02); }
.str-trace-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink4); margin-bottom: 12px; }
.str-trace-chain { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.str-trace-node { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); font-style: italic; }
.str-trace-mono { font-family: var(--font-mono); font-size: 10px; font-style: normal; color: var(--moss-lt); }
.str-trace-active { font-family: var(--font-mono); font-size: 10px; font-style: normal; color: var(--moss-lt); background: rgba(90,107,72,0.13); padding: 2px 8px; border-radius: 4px; border: 1px solid rgba(90,107,72,0.28); }
.str-trace-arrow { font-family: var(--font-mono); font-size: 11px; color: var(--ink4); }
.str-trace-note { font-family: var(--font-serif); font-size: 12.5px; color: var(--ink4); line-height: 1.6; margin: 0; }
.str-trace-note code { font-family: var(--font-mono); font-size: 10.5px; color: var(--moss-lt); }

/* Three operations */
.str-ops { display: flex; flex-direction: column; gap: 1px; margin-top: 20px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.str-op { padding: 18px 20px; border-bottom: 1px solid var(--border); background: rgba(44,32,25,0.02); }
.str-op:last-child { border-bottom: none; }
.str-op-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 10px; }
.str-op-name { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; color: var(--ink2); }
.str-op-mode { font-family: var(--font-serif); font-size: 12px; font-style: italic; color: var(--ink4); }
.str-op-body { font-family: var(--font-serif); font-size: 13px; color: var(--ink3); line-height: 1.62; margin: 0; }
.str-op-body code { font-family: var(--font-mono); font-size: 10px; color: var(--moss-lt); }
.str-op-list { margin: 10px 0; display: flex; flex-direction: column; gap: 6px; padding-left: 8px; }
.str-op-list-item { display: flex; gap: 12px; align-items: baseline; font-family: var(--font-serif); font-size: 13px; color: var(--ink4); line-height: 1.55; }
.str-op-bullet { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.08em; color: var(--ink3); min-width: 80px; padding-top: 1px; flex-shrink: 0; }

/* ── Access panel ─────────────────────────────────────────────────────────── */

.access-panel-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(44,32,25,0.22);
  z-index: 900;
}
.access-panel {
  position: fixed; top: 0; right: -340px; bottom: 0;
  width: 300px;
  background: var(--dark2);
  border-left: 1px solid var(--border);
  z-index: 901;
  display: flex; flex-direction: column;
  transition: right 0.22s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -6px 0 32px rgba(44,32,25,0.12);
}
.access-panel.open { right: 0; }
.access-panel.open + .access-panel-backdrop { display: block; }

/* Header */
.ap-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border-lt);
  flex-shrink: 0;
}
.ap-title {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink3);
}
.ap-close {
  background: none; border: none; cursor: pointer;
  font-size: 11px; color: var(--ink4); padding: 2px 4px; line-height: 1;
}
.ap-close:hover { color: var(--ink2); }

/* Scrollable body */
.ap-body {
  flex: 1; overflow-y: auto;
  padding: 18px 18px 0;
  display: flex; flex-direction: column; gap: 16px;
}

/* User block */
.ap-user { padding-bottom: 2px; }
.ap-user-name {
  font-family: var(--font-serif); font-size: 18px; font-weight: 300;
  color: var(--ink); line-height: 1.2;
}
.ap-user-id {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink4);
  margin-top: 3px; word-break: break-all;
}

/* Status pill */
.ap-status {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 7px;
  font-family: var(--font-sans); font-size: 11px;
}
.ap-status-active { background: rgba(90,107,72,0.12); color: var(--moss); }
.ap-status-none   { background: var(--terra-pale); color: var(--terra-mid); }
.ap-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ap-status-active .ap-status-dot { background: var(--moss); }
.ap-status-none   .ap-status-dot { background: var(--terra-mid); }
.ap-expiry { margin-left: auto; font-family: var(--font-mono); font-size: 9px; opacity: 0.72; }

/* Tag / node scope summary pills */
.ap-tag-node-scope { display: flex; flex-wrap: wrap; gap: 5px; }
.ap-scope-pill {
  font-family: var(--font-mono); font-size: 9px;
  background: var(--dark3); color: var(--ink3);
  padding: 3px 8px; border-radius: 5px;
}

/* Resource section (NODES / TAGS / RELATIONSHIPS) */
.ap-resource { display: flex; flex-direction: column; }
.ap-resource-hdr {
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink4);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border-lt);
  margin-bottom: 2px;
}

/* Verb rows */
.ap-vrow {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-lt);
  font-family: var(--font-sans); font-size: 13px;
}
.ap-vrow:last-of-type { border-bottom: none; }
.ap-vcheck {
  font-family: var(--font-mono); font-size: 11px;
  width: 14px; flex-shrink: 0; text-align: center;
}
.ap-granted .ap-vcheck { color: var(--moss); }
.ap-denied  .ap-vcheck { color: var(--ink4); }
.ap-vlabel  { flex: 1; }
.ap-granted .ap-vlabel { color: var(--ink2); }
.ap-denied  .ap-vlabel { color: var(--ink4); text-decoration: line-through; text-decoration-color: var(--border); }

/* Schema scope sub-row (under Read nodes) */
.ap-scope-sub {
  padding: 0 0 8px 24px;
}
.ap-scope-count {
  font-family: var(--font-mono); font-size: 9px; color: var(--ink4);
  display: block; margin-bottom: 6px;
}
.ap-schema-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ap-schema-chip {
  font-family: var(--font-mono); font-size: 9px;
  background: var(--moss-pale); color: var(--moss);
  padding: 2px 7px; border-radius: 4px;
}

/* No EP state */
.ap-empty {
  display: flex; flex-direction: column; gap: 12px;
  font-family: var(--font-serif); font-size: 14px; color: var(--ink3); line-height: 1.6;
}
.ap-reconnect-btn {
  display: inline-block; padding: 9px 16px;
  background: var(--moss); color: var(--ink-inv);
  border-radius: 8px; font-family: var(--font-sans); font-size: 12px;
  text-decoration: none; text-align: center;
}
.ap-reconnect-btn:hover { background: var(--moss-mid); }

/* Footer */
.ap-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-lt);
  flex-shrink: 0;
  margin-top: 4px;
}
.ap-disconnect-btn {
  background: none; border: 1px solid var(--border);
  color: var(--terra-mid); cursor: pointer;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 8px 14px; border-radius: 6px; width: 100%;
}
.ap-disconnect-btn:hover { background: var(--terra-pale); border-color: var(--terra-lt); }

/* ── Node modal fields ──────────────────────────────────────────────────────── */
.nm-field {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-lt);
  font-family: var(--font-mono);
  font-size: 11px;
  align-items: baseline;
}
.nm-field:last-child { border-bottom: none; }
.nm-key {
  color: var(--ink4);
  min-width: 100px;
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nm-val { color: var(--ink2); word-break: break-word; }

/* ── Log modal sections ─────────────────────────────────────────────────────── */
.lm-section { margin-bottom: 20px; }
.lm-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-lt);
}
.lm-section-label.contradiction { color: var(--terra-mid); }
.lm-section-label.pattern       { color: var(--moss-mid); }
.lm-section-label.redundancy    { color: var(--ink3); }
.lm-section-label.stale         { color: var(--ink4); }
.lm-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-lt);
  font-size: 12px;
}
.lm-item:last-child { border-bottom: none; }
.lm-tension {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.lm-pattern-name {
  font-family: var(--font-serif);
  font-size: 13px;
  color: var(--ink2);
  margin-bottom: 3px;
}
.lm-desc {
  color: var(--ink3);
  font-size: 12px;
  font-style: italic;
  margin-top: 3px;
  line-height: 1.5;
}
.lm-tension-arrow { color: var(--ink4); padding: 0 4px; }
.lm-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.lm-item-resolved { opacity: 0.5; }
.lm-new-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--terra-pale);
  color: var(--terra);
  padding: 2px 6px;
  border-radius: 4px;
}
.lm-resolved-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 9px;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--moss-pale);
  color: var(--moss);
  padding: 2px 6px;
  border-radius: 4px;
}
.lm-diff-bar {
  padding: 6px 24px;
  background: var(--moss-pale);
  border-bottom: 1px solid var(--border-lt);
}
.lm-diff-line {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--moss);
}
.lm-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink4);
  margin-top: 2px;
}
.lm-clean {
  padding: 32px 0;
  text-align: center;
  color: var(--moss);
  font-family: var(--font-mono);
  font-size: 13px;
}
.lm-modal { max-width: 560px; max-height: 82vh; display: flex; flex-direction: column; }
.lm-body { padding: 0 24px 24px; overflow-y: auto; flex: 1; }

/* ── Talk context card (shown when entering talk via "talk about this →") ──── */
.talk-context-card {
  margin: 0 0 16px 0;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.talk-context-inner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}
.talk-context-left { flex: 1; min-width: 0; }
.talk-context-schema {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink4);
  background: var(--surface3, var(--border-lt));
  padding: 2px 7px;
  border-radius: 3px;
  margin-bottom: 6px;
}
.talk-context-text {
  font-family: var(--font-serif);
  font-size: 14px;
  color: var(--ink2);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.talk-context-dismiss {
  background: none;
  border: none;
  color: var(--ink4);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0.6;
}
.talk-context-dismiss:hover { opacity: 1; color: var(--ink2); }

/* ── Toast notifications ─────────────────────────────────────────────────────── */
#toast-rack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  background: var(--moss);
  color: var(--ink-inv, #fff);
}
.toast-error {
  background: var(--terra);
  color: #fff;
}
