/* Copyright 2026 John G Stroh. All rights reserved. */
/* Deliberation Village — shell styles (light, legible; MDSL-daylight kin to the Cockpit). */

:root {
  --dv-bg: #f1f5f9;
  --dv-surface: #ffffff;
  --dv-border: #e2e8f0;
  --dv-ink: #1f2937;
  --dv-muted: #64748b;
  --dv-accent: #1d4ed8;
}

* { box-sizing: border-box; }

/*
 * The page owns the viewport, not the shell.
 *
 * This stylesheet previously carried NO body or html rule at all, and `.dv-shell` claimed the full
 * 100vh. Anything placed outside the shell therefore landed one whole viewport down — measured
 * 2026-08-11 at top:824px against an 800px viewport — and inherited the browser's default serif,
 * rendering in Times New Roman while the shell did not.
 *
 * That is not cosmetic here: the element outside the shell is the te reo Māori provisional-
 * translation disclosure, which this page's own comment calls "the condition of shipping it at all".
 * A disclosure a full screen below the fold on an app shell that scrolls INTERNALLY is one nobody
 * scrolls to. CLAUDE.md already names this class — a gate cannot judge PROMINENCE, and a link 85%
 * down a page satisfied one while staying invisible.
 *
 * Fixed at the root rather than per-element: the body becomes the flex column, the shell takes the
 * remaining space, and every future element outside the shell inherits the page's own font and sits
 * where it was put.
 */
body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.dv-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;      /* without this a flex child refuses to shrink and the overflow returns */
  overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--dv-ink);
  background: var(--dv-bg);
}

.dv-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--dv-surface);
  border-bottom: 1px solid var(--dv-border);
  flex: 0 0 auto;
}
.dv-guide-link { font-size: 13px; }
.dv-brand { font-weight: 700; font-size: 17px; color: var(--dv-accent); }
.dv-session-pick { display: flex; align-items: center; gap: 8px; }
.dv-mapbuilder { display: flex; flex-direction: column; gap: 6px; max-width: 640px; margin-top: 12px; }
.dv-mapbuilder textarea { min-width: 0; width: 100%; font-family: inherit; }
.dv-newsession { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dv-newsession[hidden] { display: none; }
.dv-select {
  padding: 6px 10px; border: 1px solid var(--dv-border); border-radius: 8px;
  background: #fff; font-size: 14px; color: var(--dv-ink); min-width: 220px;
}
.dv-role { margin-left: auto; font-size: 13px; color: var(--dv-muted); text-transform: capitalize; }
.dv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.dv-main { flex: 1 1 auto; display: flex; min-height: 0; }

.dv-map-wrap { flex: 1 1 auto; padding: 16px; min-width: 0; }
.dv-map {
  width: 100%; height: 100%;
  background: var(--dv-surface);
  border: 1px solid var(--dv-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  overflow: hidden;
}
.dv-hint, .ck-empty { padding: 24px; color: var(--dv-muted); font-size: 14px; }

.dv-panel {
  flex: 0 0 320px;
  padding: 20px;
  background: var(--dv-surface);
  border-left: 1px solid var(--dv-border);
  overflow-y: auto;
}
.dv-panel-title { font-size: 16px; margin: 0 0 8px; }
.dv-panel-desc { font-size: 14px; color: var(--dv-muted); margin: 0 0 14px; line-height: 1.45; }
.dv-panel-state { font-size: 13px; margin-bottom: 14px; }
.dv-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: #e5e7eb; color: #334155;
}
.dv-panel-actions { display: flex; flex-direction: column; gap: 8px; }
.dv-btn {
  padding: 9px 14px; border: 0; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; background: var(--dv-accent); color: #fff;
}
.dv-btn:disabled { background: #cbd5e1; cursor: default; }
.dv-panel-msg { font-size: 13px; color: var(--dv-muted); margin-top: 12px; min-height: 18px; }

.cld-svg { width: 100%; height: 100%; }
.cld-node { outline: none; }
.cld-node:focus rect { stroke-width: 3; }

/* C3 — deliberation thread pane */
.dv-thread {
  display: flex; flex-direction: column; flex-basis: 340px; flex-shrink: 0;
  border-left: 1px solid var(--dv-border); background: #fff; min-height: 0;
}
.dv-thread-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--dv-border);
}
.dv-thread-title { font-size: 15px; margin: 0; }
.dv-btn-ghost { background: transparent; color: var(--dv-muted); padding: 4px 8px; }
.dv-thread-msgs { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.dv-msg { padding: 8px 10px; border-radius: 8px; background: #f1f5f9; font-size: 14px; line-height: 1.4; }
.dv-msg-system { background: transparent; color: var(--dv-muted); font-size: 12px; font-style: italic; padding: 2px 4px; }
.dv-msg-body { white-space: pre-wrap; word-break: break-word; }
.dv-thread-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--dv-border); }
.dv-thread-input {
  flex: 1; resize: vertical; border: 1px solid var(--dv-border); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 14px;
}

@media (max-width: 780px) {
  .dv-main { flex-direction: column; }
  .dv-panel { flex-basis: auto; border-left: 0; border-top: 1px solid var(--dv-border); }
  /*
   * 🔴 `.dv-thread`'s `flex-basis: 340px; flex-shrink: 0` was authored for the ROW axis — a 340px-wide
   * sidebar. This query flips `.dv-main` to a column and already resets `.dv-panel` for exactly that
   * reason; `.dv-thread` was missed, so 340px silently became a pinned HEIGHT that refuses to shrink.
   *
   * The shell is `overflow: hidden` with no outer scroll, so anything pushed past its edge is not
   * merely off-screen — it is GONE. Measured at 375x600 and 360x560: the reply box and Send button
   * sat 27px and 67px BELOW the clip edge, i.e. a member could not type or send into a thread at all.
   *
   * Latent until now: the old layout had zero slack (at 375x667 the shell's contents summed to 667px
   * exactly), and moving the te reo disclosure above the shell took ~130px off the top and tipped it
   * over. So the disclosure fix would have broken the app for te reo users on phones — precisely the
   * audience the disclosure exists for. Found by a pre-ship reviewer rendering below 780px, a width
   * my own render never visited.
   */
  .dv-thread { flex-basis: auto; flex-shrink: 1; min-height: 0; }
}

/* ─────────────────────────────────────────────────────────────────────────────
   C2-C5 CONSOLES — decision points, checkpoints, cross-checks, ratification.
   Four subsystems that were fully built on the server and reachable by nobody.
   One shared region, one open at a time: a fifth flex column would squeeze the
   map and thread below usability on a phone, which is exactly how the reply box
   ended up clipped out of reach on 2026-08-11.
   ───────────────────────────────────────────────────────────────────────────── */

.dv-tabs { display: flex; gap: 4px; margin-left: auto; margin-right: 12px; }

.dv-tab {
  font: inherit; font-size: 13px; padding: 5px 10px; cursor: pointer;
  background: transparent; color: var(--dv-ink);
  border: 1px solid var(--dv-border); border-radius: 6px;
}
.dv-tab:hover:not(:disabled) { background: rgba(0, 0, 0, 0.04); }
.dv-tab[aria-expanded="true"] { background: var(--dv-ink); color: #fff; border-color: var(--dv-ink); }
/* Not merely faded: a disabled tab must not read as "clickable but ignored". */
.dv-tab:disabled { opacity: 0.45; cursor: not-allowed; }
.dv-tab:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* Count badge — only rendered when the number is REAL and non-zero. Never a
   placeholder zero, which reads as "nothing to do" when it means "not loaded". */
.dv-tab-count {
  display: inline-block; margin-left: 6px; padding: 0 5px; min-width: 16px;
  font-size: 11px; line-height: 16px; text-align: center;
  background: #dc2626; color: #fff; border-radius: 8px;
}

.dv-console {
  display: flex; flex-direction: column; flex-basis: 380px; flex-shrink: 1;
  min-height: 0; min-width: 0;
  border-left: 1px solid var(--dv-border); background: #fff;
}
.dv-console[hidden] { display: none; }

.dv-console-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--dv-border); flex: 0 0 auto;
}
.dv-console-title { font-size: 15px; margin: 0; }
.dv-console-msg { margin: 0; padding: 8px 16px; font-size: 13px; color: #b45309; flex: 0 0 auto; }
.dv-console-msg:empty { display: none; }
.dv-console-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 16px; }

/* One card per item — decision point, checkpoint, coupling, ratification poll. */
.dv-card { border: 1px solid var(--dv-border); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.dv-card-title { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.dv-card-meta { font-size: 12px; color: #6b7280; margin: 0 0 8px; }
.dv-card-body { font-size: 13px; line-height: 1.55; margin: 0 0 10px; }
.dv-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Status pills carry the server's own status value — never a UI invention. */
.dv-pill {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; text-transform: none;
  background: #e5e7eb; color: #374151;
}
.dv-pill-open     { background: #dbeafe; color: #1e40af; }
.dv-pill-closed   { background: #e5e7eb; color: #374151; }
.dv-pill-agreed   { background: #dcfce7; color: #166534; }
.dv-pill-conflict { background: #fee2e2; color: #991b1b; }
.dv-pill-pending  { background: #fef9c3; color: #713f12; }

/* AI-derived content is ALWAYS labelled and ALWAYS editable before it is
   committed. A suggestion presented as a decision is a claim the member never
   made — see the AI-suggest confirm step. */
.dv-ai-note {
  font-size: 12px; color: #6b7280; font-style: normal;
  border-left: 3px solid #c7d2fe; padding-left: 8px; margin: 8px 0;
}
.dv-textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 13px;
  padding: 8px; border: 1px solid var(--dv-border); border-radius: 6px; resize: vertical;
}
.dv-empty { font-size: 13px; color: #6b7280; }

@media (max-width: 780px) {
  /* Same reason as .dv-thread: a fixed basis becomes a pinned HEIGHT in the
     column layout and the shell clips it away. */
  .dv-console { flex-basis: auto; flex-shrink: 1; min-height: 0; }
  .dv-tabs { margin: 0; flex-wrap: wrap; }
}
