:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --text: #e7e9ee;
  --muted: #8a93a3;
  --line: #262b36;
  --accent: #4f8cff;
  --ok: #28a745;
  --err: #e35d6a;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, sans-serif; }
a { color: var(--accent); text-decoration: none; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; letter-spacing: 0.3px; }
.topbar nav a { margin-right: 14px; color: var(--muted); }
.container { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.card.narrow { max-width: 420px; margin: 10vh auto; }
h1 { font-size: 1.35rem; margin: 0 0 6px; }
h2 { font-size: 1.05rem; margin: 18px 0 8px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
label { display: block; margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
input, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; font: inherit;
}
button, .button {
  display: inline-block; margin-top: 12px; padding: 8px 14px;
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  font: inherit; cursor: pointer;
}
.button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.linklike { background: transparent; color: var(--muted); border: 0; cursor: pointer; font: inherit; }
.error { color: var(--err); margin-top: 8px; }
.list { margin-top: 16px; }
.row { display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: var(--panel-2); }
.row-title { font-weight: 600; }
.row-actions { display: flex; gap: 8px; }
.pane { background: var(--panel-2); border: 1px dashed var(--line); border-radius: 8px;
  padding: 16px; min-height: 120px; }
.foot { display: flex; justify-content: space-between; padding: 10px 20px; color: var(--muted);
  border-top: 1px solid var(--line); margin-top: 40px; font-size: 0.85rem; }
.badge { padding: 2px 8px; border-radius: 999px; font-size: 0.8rem; }
.badge-on { background: #1e3a2a; color: var(--ok); }
.badge-off { background: #2a1e22; color: var(--err); }
details.new summary { cursor: pointer; color: var(--accent); margin-bottom: 6px; }

/* transcript pane */
.transcript-pane {
    max-height: 60vh;
    overflow-y: auto;
    padding: 12px 16px;
}
.seg { padding: 8px 0; border-bottom: 1px solid var(--line); }
.seg:last-child { border-bottom: 0; }
.seg-meta { font-variant-numeric: tabular-nums; }
.seg-text { white-space: pre-wrap; }

/* two-column meeting console */
.console {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 16px;
    margin-top: 12px;
}
@media (max-width: 900px) {
    .console { grid-template-columns: 1fr; }
}
.col-left, .col-right { min-width: 0; }

/* right pane blocks */
#state-pane .pane-block {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
#state-pane .pane-block h2 {
    font-size: 0.95rem;
    margin: 0 0 6px;
    color: var(--muted);
}
#state-pane .state-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
#state-pane .state-list li {
    padding: 6px 0;
    border-bottom: 1px dashed var(--line);
}
#state-pane .state-list li:last-child { border-bottom: 0; }
.li-head { font-size: 0.85rem; }
.li-body { margin-top: 2px; }
.pill {
    display: inline-block;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 0.72rem;
    background: var(--line);
    color: var(--text);
}
.pill-confirmed   { background: #1e3a2a; color: #7ee0a0; }
.pill-tentative   { background: #3a3320; color: #e0c67e; }
.pill-disputed    { background: #3a1e22; color: #e08f9b; }
.pill-superseded  { background: #22262e; color: #8a93a3; }
.pill-inferred    { background: #1f2a3a; color: #8cb0e0; }
.pill-unresolved  { background: #2a1f3a; color: #c9a0e0; }
.pill-open        { background: #1f2a3a; color: #8cb0e0; }
.pill-proposed    { background: #3a3320; color: #e0c67e; }
.pill-risk        { background: #3a1e22; color: #e08f9b; }
.pill-issue       { background: #3a1e22; color: #e08f9b; }
.pill-new         { background: #1e3a2a; color: #7ee0a0; }
.conf {
    color: var(--muted);
    font-size: 0.78rem;
    margin-left: 4px;
}
a.prov {
    color: var(--muted);
    font-size: 0.78rem;
    margin-left: 6px;
    text-decoration: underline dotted;
}
a.prov:hover { color: var(--accent); }

/* liveness banner */
.liveness-banner {
    background: #3a3320;
    color: #e0c67e;
    border: 1px solid #5c4f2a;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

/* ---------------------------------------------------------------- */
/* Phase E — right pane restructuring                               */
/* ---------------------------------------------------------------- */

/* Meeting Pulse */
.pulse-block .pulse-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px; flex-wrap: wrap;
}
.mode-badge {
    display: inline-block; padding: 2px 8px;
    background: #22262e; color: #8a93a3;
    border: 1px solid var(--line);
    border-radius: 999px; font-size: 0.72rem; letter-spacing: 0.3px;
}
.mode-badge.mode-set { background: #1f2a3a; color: #8cb0e0; border-color: #2a3a55; }
.objective-text { color: var(--muted); font-size: 0.85rem; }
.pulse-understanding { line-height: 1.4; }
.pulse-flags { margin-top: 8px; }
.pulse-flag {
    display: inline-block; margin-right: 6px; padding: 1px 6px;
    border-radius: 6px; font-size: 0.75rem;
    background: #2a1e22; color: #e08f9b;
}

/* What Changed (delta) */
.delta-block h2 { color: #e0c67e; }
.delta-body { display: flex; flex-direction: column; gap: 6px; }
.delta-group {
    background: #1e222b; border: 1px solid var(--line);
    border-radius: 6px; padding: 8px 10px;
}
.delta-group .delta-group-head {
    font-weight: 600; font-size: 0.85rem;
    color: #e0c67e; margin-bottom: 4px;
}
.delta-item { display: flex; gap: 8px; align-items: baseline; margin: 2px 0; }
.delta-tag {
    display: inline-block; min-width: 62px; text-align: center;
    font-size: 0.7rem; letter-spacing: 0.5px;
    padding: 1px 6px; border-radius: 4px;
    background: #22262e; color: #8a93a3;
}
.delta-tag.NEW    { background: #1e3a2a; color: #7ee0a0; }
.delta-tag.UPDATE { background: #1f2a3a; color: #8cb0e0; }
.delta-tag.ACTION { background: #3a3320; color: #e0c67e; }
.delta-tag.CHANGE { background: #3a1e22; color: #e08f9b; }
.delta-tag.RESOLVED { background: #1e222b; color: #8a93a3; }

/* Action Tracker */
.action-block .action-item {
    display: flex; align-items: baseline; gap: 8px;
    padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.action-block .action-item:last-child { border-bottom: 0; }
.action-block .action-body-main { flex: 1; min-width: 0; }
.action-block .action-text { font-weight: 500; }
.action-block .action-meta {
    color: var(--muted); font-size: 0.8rem; margin-top: 2px;
}
.action-block .action-thread {
    color: #8cb0e0; font-size: 0.75rem;
}
.action-status-pill {
    display: inline-block; padding: 0 6px;
    border-radius: 999px; font-size: 0.7rem;
}
.action-status-open    { background: #1f2a3a; color: #8cb0e0; }
.action-status-done    { background: #1e3a2a; color: #7ee0a0; }
.action-status-superseded { background: #22262e; color: #8a93a3; }

/* Thread cards */
.thread-card {
    background: #1e222b; border: 1px solid var(--line);
    border-radius: 6px; padding: 10px 12px; margin-bottom: 8px;
}
.thread-card .thread-title {
    font-weight: 600; font-size: 0.9rem;
}
.thread-card .thread-summary {
    color: var(--muted); font-size: 0.82rem; margin-top: 3px;
}
.thread-card .thread-counts {
    margin-top: 6px; font-size: 0.75rem; color: var(--muted);
}
.thread-card .thread-counts span { margin-right: 8px; }
.thread-status {
    display: inline-block; padding: 0 6px; margin-left: 6px;
    border-radius: 999px; font-size: 0.7rem;
}
.thread-status-open     { background: #1f2a3a; color: #8cb0e0; }
.thread-status-resolved { background: #1e3a2a; color: #7ee0a0; }
.thread-status-dormant  { background: #22262e; color: #8a93a3; }

/* Questions */
.q-item {
    padding: 6px 0; border-bottom: 1px dashed var(--line);
}
.q-item:last-child { border-bottom: 0; }
.q-text { font-weight: 500; }
.q-meta { color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.q-rationale { color: #8cb0e0; font-size: 0.78rem; margin-top: 2px; }
.q-rel { color: #e0c67e; font-size: 0.78rem; margin-top: 2px; }

/* Relevance pills on facts */
.relevance-pill {
    display: inline-block; margin-left: 4px;
    padding: 0 6px; border-radius: 999px; font-size: 0.68rem;
}
.relevance-critical   { background: #3a1e22; color: #e08f9b; }
.relevance-relevant   { background: #1f2a3a; color: #8cb0e0; }
.relevance-contextual { background: #2a2a20; color: #e0c67e; }
.relevance-incidental { background: #22262e; color: #8a93a3; }
.relevance-null       { background: #22262e; color: #8a93a3; }

/* Incidental toggle */
.incidental-toggle {
    display: inline-block; margin: 4px 0 8px; cursor: pointer;
    user-select: none;
}
.incidental-toggle input { margin-right: 4px; vertical-align: middle; }
#incidental-note { margin-left: 6px; }

/* Provenance modal */
.prov-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.prov-modal {
    background: #171a21; border: 1px solid var(--line);
    border-radius: 10px; max-width: 640px; width: 90%;
    max-height: 80vh; overflow-y: auto;
    padding: 16px 20px;
}
.prov-modal h3 { margin: 0 0 6px; font-size: 1rem; }
.prov-modal .prov-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 8px; }
.prov-modal .prov-source-text {
    background: #1e222b; border: 1px solid var(--line);
    border-radius: 6px; padding: 10px 12px; margin: 8px 0;
    white-space: pre-wrap;
}
.prov-modal .prov-close {
    margin-top: 12px; padding: 6px 12px;
    background: var(--accent); color: #fff;
    border: 0; border-radius: 6px; cursor: pointer;
}
a.prov { cursor: pointer; }

/* Export dropdown (Phase F.2) */
.export-menu { position: relative; display: inline-block; }
.export-dropdown {
    position: absolute; right: 0; top: calc(100% + 4px);
    background: #171a21; border: 1px solid var(--line);
    border-radius: 8px; min-width: 260px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    z-index: 100; padding: 6px 0;
}
.export-dropdown a {
    display: block; padding: 8px 14px; color: var(--text);
    text-decoration: none; font-size: 0.9rem;
    white-space: nowrap;
}
.export-dropdown a:hover { background: #1e222b; color: var(--accent); }
.export-dropdown a + a { border-top: 1px solid #1e222b; }

/* Context Review card (Phase G6) */
.context-review-block { border-left: 3px solid #e0c67e; }
.context-review-block h2 { color: #e0c67e; }
.cr-gap {
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
}
.cr-gap:last-child { border-bottom: 0; }
.cr-gap .cr-head {
    display: flex; align-items: baseline; gap: 8px;
    font-size: 0.75rem; letter-spacing: 0.5px;
    text-transform: uppercase;
}
.cr-gap .cr-kind {
    color: var(--muted);
}
.cr-gap .cr-text {
    margin-top: 3px;
    font-weight: 500;
}
.cr-gap .cr-rationale {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.85rem;
}
.urgency-pill {
    display: inline-block; padding: 0 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.urgency-critical { background: #4a1a1e; color: #ff8d99; }
.urgency-high     { background: #3a1e22; color: #e08f9b; }
.urgency-medium   { background: #3a3320; color: #e0c67e; }
.urgency-low      { background: #1f2a3a; color: #8cb0e0; }
#context-review-show-all {
    background: none; border: 0; padding: 4px 0;
    color: var(--accent); cursor: pointer;
}

/* Modal for "show all" */
.cr-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.cr-modal {
    background: #171a21; border: 1px solid var(--line);
    border-radius: 10px; max-width: 720px; width: 92%;
    max-height: 82vh; overflow-y: auto;
    padding: 16px 20px;
}
.cr-modal h3 { margin: 0 0 10px; font-size: 1rem; }
.cr-modal .prov-close {
    margin-top: 14px; padding: 6px 12px;
    background: var(--accent); color: #fff;
    border: 0; border-radius: 6px; cursor: pointer;
}

/* ---------- Topic Intelligence card (Stage A) ---------- */

.topic-intelligence-block { border-left: 3px solid #7aa7e0; }
.topic-intelligence-block h2 { color: #7aa7e0; }

.topic-intelligence-block .ti-topic {
    padding: 8px 0;
    border-top: 1px solid var(--line);
}
.topic-intelligence-block .ti-topic:first-child { border-top: 0; padding-top: 0; }

.topic-intelligence-block .ti-head {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
    margin-bottom: 4px;
}
.topic-intelligence-block .ti-name { font-weight: 600; }

.topic-intelligence-block .ti-badge {
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.72rem;
    background: var(--panel-2);
    color: var(--muted);
    border: 1px solid var(--line);
}
.topic-intelligence-block .ti-rel-high  { color: var(--ok); }
.topic-intelligence-block .ti-rel-medium{ color: #e0c67e; }
.topic-intelligence-block .ti-rel-low   { color: var(--muted); }
.topic-intelligence-block .ti-status-done    { color: var(--ok); }
.topic-intelligence-block .ti-status-pending { color: var(--muted); }
.topic-intelligence-block .ti-status-failed  { color: var(--err); }
.topic-intelligence-block .ti-status-unknown { color: var(--muted); font-style: italic; }

.topic-intelligence-block .ti-provenance {
    font-size: 0.78rem;
    margin: 2px 0 4px;
}
.topic-intelligence-block .ti-model-only {
    color: #e0c67e;
    font-weight: 600;
}

.topic-intelligence-block .ti-summary {
    margin: 4px 0 6px;
    line-height: 1.35;
}

.topic-intelligence-block .ti-sources {
    list-style: disc;
    margin: 4px 0 4px 18px;
    padding: 0;
    font-size: 0.85rem;
}
.topic-intelligence-block .ti-source-claim {
    color: var(--muted);
    font-size: 0.78rem;
    margin-left: 4px;
}

.topic-intelligence-block .ti-diagram {
    margin-top: 4px;
}
