/* Inherence · dashboard · cream theme
 *
 * Visual language pulled from inherence_overview_may11.pdf:
 *   - warm cream background, white panel cards
 *   - deep purple accent for the brand wordmark + headline emphasis
 *   - warm brown for "INHERENCE" wordmark
 *   - system serif headlines + mono labels (eyebrows with a 4-letter
 *     purple bar above)
 *   - no red, no green, no glow animations
 *   - allow vs blocked distinction via a thin purple left-bar on
 *     blocked rows and a `✗` glyph; allow rows are neutral
 *
 * Hero panel reserves min-height: 520px so the worst-case three-tier
 * expanded violation content never clips. Idle state has matching
 * vertical whitespace.
 */

:root {
  --bg:           #fbf5e7;
  --bg-card:      #ffffff;
  --bg-tan:       #f3ead4;
  --ink:          #2f2a23;
  --ink-muted:    #6e6357;
  --ink-faint:    #a39787;
  --brown:        #5b4c40;
  --accent:       #4d1e9c;
  --accent-soft:  #e8dcf6;
  --rule:         #ddd0b5;
  --rule-soft:    #ece5d4;

  --serif: Charter, "Source Serif Pro", "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.muted { color: var(--ink-muted); }
.mono  { font-family: var(--mono); }
.short-hash { font-size: 12px; }
.sep   { color: var(--ink-faint); margin: 0 6px; }

/* ── topbar ─────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 28px 14px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  flex: 0 0 auto;
}
.brand-block { display: flex; flex-direction: column; gap: 4px; }
.brand {
  font-family: var(--sans);
  font-weight: 800;
  font-style: italic;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--brown);
}
.brand-thin { color: var(--ink-faint); font-weight: 400; font-style: normal; font-size: 14px; letter-spacing: 0; margin-left: 2px; }
.brand-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-muted);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  font-size: 12px;
}
.meta-row { display: flex; align-items: center; gap: 8px; }
.meta-row-badges { gap: 10px; margin-top: 4px; }
.kv { display: inline-flex; align-items: baseline; gap: 6px; }
.meta-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.meta-val { color: var(--ink); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  color: var(--ink-muted);
}
.badge.mode-badge {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-card);
}
.mode-badge .mode-tag { font-weight: 700; }
.mode-badge .mode-sub { color: var(--ink-muted); font-weight: 400; }

.badge.conn.live { color: var(--accent); border-color: var(--accent); }
.badge.conn.warn { color: var(--brown); }

/* ── grid ───────────────────────────────────────────────────────── */

.grid {
  flex: 1 1 auto;
  display: grid;
  /* Hero occupies the full right column (rows 1–3). Left column
   * splits among the smaller panels: live tool calls (top, dominant),
   * small panels in a row (throughput / compliance / proof-gen), and
   * the timeline at the bottom. */
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: minmax(0, 1.6fr) minmax(0, auto) minmax(0, auto);
  grid-template-areas:
    "s s s s s s h h h h"
    "t t c c p p h h h h"
    "l l l l l l h h h h";
  gap: 14px;
  padding: 16px;
  min-height: 0;
}
.grid > .stream     { grid-area: s; }
.grid > .hero       { grid-area: h; }
.grid > .throughput { grid-area: t; }
.grid > .compliance { grid-area: c; }
.grid > .proof-gen  { grid-area: p; }
.grid > .timeline   { grid-area: l; }

/* ── mode toggle (DEMO / STREAM) ─────────────────────────────────── */
.mode-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  background: var(--bg-card);
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  padding: 3px 10px;
  cursor: pointer;
  text-transform: uppercase;
  font: inherit;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.active { background: var(--ink-muted); color: var(--bg); }

/* ── panel base ─────────────────────────────────────────────────── */

.panel {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 18px 20px 18px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.panel-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* eyebrow = mono uppercase label with a short purple bar above */
.eyebrow {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.eyebrow::before {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--accent);
}

/* ── live stream ────────────────────────────────────────────────── */

.stream-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 12px;
}
.stream-list li {
  display: grid;
  grid-template-columns: 76px 1fr 80px;
  align-items: baseline;
  gap: 14px;
  padding: 8px 10px 8px 12px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink);
  transition: opacity 0.4s ease;
}
.stream-list li .ts        { color: var(--ink-faint); }
.stream-list li .label     {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--sans);
  font-size: 13px;
}
.stream-list li .verdict   {
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--ink-muted);
}
.stream-list li.allow .verdict   { color: var(--ink-muted); }
.stream-list li.blocked          { border-left-color: var(--accent); }
.stream-list li.blocked .verdict { color: var(--accent); font-weight: 600; }
.stream-list li.blocked .label::before {
  content: "✗  ";
  color: var(--accent);
  font-weight: 700;
}
.stream-list li.fade { opacity: 0.45; }

/* ── hero panel ─────────────────────────────────────────────────── */

.hero {
  /* Reserve enough vertical space for the worst-case (multi-tier
   * violation receipt). Idle state simply gets more whitespace. */
  min-height: 520px;
  overflow-y: auto;
}

.hero-idle {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 36px 16px;
  gap: 12px;
}
.hero-idle-num {
  font-family: var(--serif);
  font-size: 80px;
  font-weight: 400;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.hero-idle-cap {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-muted);
  max-width: 320px;
}
.hero-idle-tag {
  margin-top: 14px;
  padding: 5px 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
}

.hero-receipt {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: hero-fade-in 0.4s ease-out;
}
@keyframes hero-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.tier {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tier + .tier {
  border-top: 1px solid var(--rule-soft);
  padding-top: 12px;
}

.tier-sub {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.tier-sub::before {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: var(--accent);
}

/* Tier 1 — the event */
.tier-event { gap: 8px; }
.tier-headline {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.005em;
  color: var(--accent);
}
.tier-vector {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}
.tier-when {
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Tier 2 — enforcement */
.tier-caught {
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink);
}
.tier-caught-lbl {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-right: 6px;
  text-transform: lowercase;
}
.tier-narrative {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

/* Tier 3 — proven receipt */
.tier-line {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.tier-line .tier-line-lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  text-transform: uppercase;
  min-width: 50px;
}
.tier-line .mono { color: var(--ink); font-size: 12px; }
.tier-line .bullet { color: var(--ink-faint); margin: 0 4px; }
.tier-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.tier-foot .check {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

/* ── small panels (row 2 — compact) ────────────────────────────── */

.panel.small {
  padding: 12px 14px;
  min-height: 0;
}
.panel.small .panel-head { margin-bottom: 6px; }

.throughput-num,
.compliance-num {
  font-family: var(--serif);
  font-size: 30px;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.throughput-unit,
.compliance-unit {
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-muted);
  font-style: italic;
}
.throughput-cap,
.compliance-cap {
  margin-top: 1px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: var(--ink-muted);
}

.throughput-bd,
.compliance-bd,
.proof-list {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.throughput-bd li,
.compliance-bd li,
.proof-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--ink);
}
.bd-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.bd-val {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.compliance-foot,
.proof-foot {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: 10.5px;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* ── timeline ──────────────────────────────────────────────────── */

.timeline-svg {
  width: 100%;
  height: 56px;
  display: block;
}
.timeline-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 4px;
}

/* ── responsive ─────────────────────────────────────────────────── */
/*
 * The dashboard's primary form factor is desktop / iframe-embedded.
 * On a phone (portrait or landscape) the 10-column grid collapses to
 * a single column, the topbar stacks, body becomes scrollable, and
 * fixed pixel widths inside list rows fluid up. The data + visual
 * language stays the same; only the layout reflows.
 */
@media (max-width: 720px) {
  /* Allow vertical scroll on the page itself — the default desktop
     mode disables it because the dashboard is sized to viewport. */
  html, body { overflow: auto; height: auto; }
  body { min-height: 100vh; }

  /* Topbar: stack brand-block above brand-meta and align left. Saves
     the metadata row from getting truncated by the desktop
     justify-content: space-between push. */
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px 12px;
  }
  .brand { font-size: 19px; }
  .brand-tagline { font-size: 12px; }
  .brand-meta { align-items: flex-start; width: 100%; }
  .meta-row { flex-wrap: wrap; }
  .meta-row-badges { gap: 6px; }
  .meta-val { word-break: break-word; }
  .short-hash { font-size: 11px; }
  .badge { padding: 3px 8px; }

  /* The big grid collapses to a single column. Visual order matches
     the desktop reading order: hero (the headline event) leads,
     then the live stream, then the small panels, then the timeline. */
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "h"
      "s"
      "t"
      "c"
      "p"
      "l";
    gap: 12px;
    padding: 12px;
  }

  /* Hero drops its hard min-height — content drives vertical size. */
  .hero { min-height: 0; }
  .hero-idle { padding: 28px 12px; }
  .hero-idle-num { font-size: 56px; }
  .tier-headline { font-size: 19px; }

  /* Stream rows: the 76 / 1fr / 80 fixed-column layout fits when there
     is 600+px to work with; on a 360–400px phone it crowds and
     truncates the label. Stack timestamp + verdict above the label so
     each row reads as: [ts · verdict] / [label]. */
  .stream-list li {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "ts verdict"
      "label label";
    column-gap: 10px;
    row-gap: 2px;
    padding: 8px 10px;
  }
  .stream-list li .ts      { grid-area: ts; font-size: 11px; }
  .stream-list li .verdict { grid-area: verdict; text-align: right; }
  .stream-list li .label   { grid-area: label; white-space: normal; }

  /* Panels: tighten padding so the cream borders don't dominate. */
  .panel { padding: 14px 14px; }
  .panel.small { padding: 12px 14px; }

  /* Tier 3 receipt lines: let the lbl + value stack on narrow rows
     instead of overflow-wrapping mid-token. */
  .tier-line .tier-line-lbl { min-width: 0; }
}

