/* Latch console. One stylesheet, no framework, no web fonts. */
:root {
  --bg: #f7f8fa; --panel: #ffffff; --panel-2: #fbfcfd; --line: #e3e6ea; --line-2: #eef0f3;
  --ink: #14171a; --ink-2: #4a5259; --ink-3: #79838c;
  --accent: #1b6ef3; --accent-ink: #ffffff;
  --allow: #0a7c42; --allow-bg: #e7f6ed;
  --deny: #b3261e; --deny-bg: #fdeceb;
  --escalate: #8a5a00; --escalate-bg: #fdf3e0;
  --reroute: #1a5fb4; --reroute-bg: #e9f1fd;
  --shadow-tone: #5b6570; --shadow-bg: #eef0f3;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d10; --panel: #13161a; --panel-2: #171b20; --line: #262b31; --line-2: #1d2227;
    --ink: #e8eaed; --ink-2: #a8b1ba; --ink-3: #79838c;
    --accent: #5b9dff; --accent-ink: #08121f;
    --allow: #59d98b; --allow-bg: #10261a;
    --deny: #ff8a80; --deny-bg: #2a1413;
    --escalate: #f0c26b; --escalate-bg: #27200f;
    --reroute: #8ab8ff; --reroute-bg: #101d2f;
    --shadow-tone: #9aa4ae; --shadow-bg: #1c2126;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d10; --panel: #13161a; --panel-2: #171b20; --line: #262b31; --line-2: #1d2227;
  --ink: #e8eaed; --ink-2: #a8b1ba; --ink-3: #79838c;
  --accent: #5b9dff; --accent-ink: #08121f;
  --allow: #59d98b; --allow-bg: #10261a;
  --deny: #ff8a80; --deny-bg: #2a1413;
  --escalate: #f0c26b; --escalate-bg: #27200f;
  --reroute: #8ab8ff; --reroute-bg: #101d2f;
  --shadow-tone: #9aa4ae; --shadow-bg: #1c2126;
}

* { box-sizing: border-box; }

/*
 * A display rule beats the `hidden` attribute, so `.gate { display: grid }` and
 * `.view { display: block }` below would keep hidden elements on screen -- the sign-in
 * card stayed up after signing in, with every view stacked underneath it.
 */
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; } h2 { font-size: 15px; } code { font-family: var(--mono); font-size: 12.5px; }
a { color: var(--accent); }
.muted { color: var(--ink-2); } .fine { color: var(--ink-3); font-size: 12.5px; }
.pad { padding: 14px 20px; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1; }

button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 7px 12px; }
button:hover { border-color: var(--ink-3); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.primary:hover { filter: brightness(1.06); border-color: transparent; }
/*
 * A disabled control has to read as disabled.
 *
 * There was no :disabled rule at all, so a disabled `.primary` kept its accent fill, its
 * pointer cursor and its hover brighten -- indistinguishable from a live button, and
 * clicking it did nothing. The "Ask the AI engine" button is disabled whenever every
 * shape is already scored, which is the ordinary steady state, so the ordinary steady
 * state looked like a broken button. Placed after .primary:hover so it wins on order as
 * well as on specificity.
 */
button:disabled { opacity: .5; cursor: not-allowed; }
button:disabled:hover { filter: none; border-color: var(--line); }
.primary:disabled:hover { border-color: transparent; }
.ghost { background: transparent; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; width: 100%; }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; letter-spacing: 0.02em; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* Sign-in */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.gate-card { width: 100%; max-width: 380px; padding: 26px; }
.gate-card label { margin-top: 14px; }
.gate-card .primary { width: 100%; margin-top: 14px; }
.gate-card .fine { margin: 14px 0 0; }
.elevate { margin-top: 14px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.elevate summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
.elevate label { margin-top: 10px; }
.upstream { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.upstream:last-child { border-bottom: 0; }
.error { color: var(--deny); background: var(--deny-bg); border-radius: 8px; padding: 8px 10px; margin: 12px 0 0; font-size: 13px; }

/* Shell */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.01em; }
/*
 * The thrown bolt: a bar driven home into its keeper. It takes currentColor, so it
 * inverts with the theme without a second asset, and it stands on its own rather
 * than sitting in a tile -- a letter needed the tile to read as a mark; this does not.
 */
.mark { width: 23px; height: 23px; color: var(--ink); flex: 0 0 auto; display: block; }
.env-chip { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; }
/* ---------- app shell ---------- */
/*
 * A row of eleven flat tabs does not scale and says nothing about how the product is
 * organised. The sidebar groups the surfaces by what they are for -- observing,
 * governing, connecting -- so the shape of the product is legible from the nav.
 */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.content { display: flex; flex-direction: column; min-width: 0; }

.sidenav {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: 14px 10px 10px; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
}
.sidenav-brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 14px; }
.sidenav-name { font-weight: 640; letter-spacing: -0.01em; }
.sidenav-foot { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line-2); }
/* Who is signed in: its own line above the buttons, so a long email cannot squeeze them. */
.sidenav-foot .who { flex: 1 1 100%; order: -1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidenav-foot button { flex: 1; }

.nav-group {
  margin: 14px 0 4px; padding: 0 9px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3);
}
.nav-group:first-of-type { margin-top: 4px; }
.nav-ico { width: 16px; display: inline-block; text-align: center; color: var(--ink-3); flex: 0 0 auto; }

/*
 * Hidden on desktop. The sidebar already carries the brand, the tenant and the active
 * view, which left this bar holding nothing but a chip -- a full row of chrome above
 * the content for one pill. It comes back below 960px, where it is the only home for
 * the menu button and the name of the current view.
 */
.topbar { display: none; position: sticky; top: 0; z-index: 5; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
/*
 * On desktop the sidebar already shows which view is active and the page carries its
 * own title, so the crumb was the third copy of the same word. It earns its place
 * only once the sidebar is a drawer.
 */
.crumb { font-weight: 600; font-size: 14px; display: none; }
.nav-toggle { display: none; }
.nav-scrim { position: fixed; inset: 0; z-index: 44; background: rgba(8, 11, 15, 0.34); }
.topbar-right { display: flex; gap: 8px; }
.tabs { display: flex; flex-direction: column; gap: 1px; }
.tabs button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink-2); padding: 8px 9px;
  border-radius: 8px; font-weight: 520; font-size: 13.5px; white-space: nowrap;
}
.tabs button:hover { background: var(--panel-2); color: var(--ink); }
.tabs button.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tabs button.active .nav-ico { color: var(--accent-ink); }

/*
 * Inside the page now, under its title. As a full-bleed strip above the heading it
 * read as chrome belonging to the app rather than controls belonging to the view --
 * and it sat between the crumb and the page title, which is nowhere.
 */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 10px 12px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
}
.field { min-width: 132px; } .field-actions { display: flex; gap: 8px; }
.range-presets { display: flex; gap: 4px; }
.chip { padding: 6px 10px; font-size: 12.5px; color: var(--ink-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: transparent; }

.notice { margin: 0; padding: 9px 20px; background: var(--escalate-bg); color: var(--escalate); border-bottom: 1px solid var(--line); font-size: 13px; }
main { padding: 16px 20px 40px; }
.view { display: block; }

/*
 * These were the obvious way to filter the table and did nothing at all. They are
 * buttons now. The two groups are separated because they answer different questions:
 * what the gate decided, and whether it was enforcing.
 */
.tally { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.tally-sep { width: 1px; align-self: stretch; background: var(--line); margin: 2px 4px; }
.stat {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 13px 6px 9px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.stat:hover { border-color: var(--ink-3); color: var(--ink); }
.stat b { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat[aria-pressed="true"] { border-color: var(--accent); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--accent); }
.stat[data-empty="true"] { opacity: 0.5; }
.stat:disabled { cursor: default; }
.filter-clear { font-size: 12.5px; color: var(--ink-3); background: none; border: 0; text-decoration: underline; padding: 6px 4px; }
.filter-clear:hover { color: var(--ink); }

/*
 * The table gets the whole width. The detail panel used to hold a third of the screen
 * open to say "select a decision"; now it arrives as a drawer when there is something
 * to show, and gives the space back when there is not.
 */
.split { display: block; }
@media (max-width: 1080px) {
  /* The drawer is fixed at every width; only its share of the viewport changes. */
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel-2); }
tbody tr[aria-selected="true"] { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
tbody tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.table-foot { display: flex; justify-content: space-between; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 12.5px; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.t-allow { color: var(--allow); background: var(--allow-bg); }
.t-deny { color: var(--deny); background: var(--deny-bg); }
.t-escalate { color: var(--escalate); background: var(--escalate-bg); }
.t-reroute { color: var(--reroute); background: var(--reroute-bg); }
.t-shadow { color: var(--shadow-tone); background: var(--shadow-bg); }
.t-neutral { color: var(--ink-2); background: var(--shadow-bg); }
.badge { display: inline-block; font: 600 11px/1.4 var(--mono); border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; color: var(--ink-2); }

.detail {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 92vw);
  z-index: 40; padding: 18px 20px 28px; overflow: auto;
  border-radius: 0; border-right: 0; border-top: 0; border-bottom: 0;
  background: var(--panel); box-shadow: -18px 0 48px rgba(8, 11, 15, 0.18);
  transform: translateX(100%); transition: transform 180ms ease;
  visibility: hidden;
}
.detail[data-open="true"] { transform: translateX(0); visibility: visible; }
@media (prefers-reduced-motion: reduce) { .detail { transition: none; } }

.detail-scrim {
  position: fixed; inset: 0; z-index: 35; background: rgba(8, 11, 15, 0.34);
  opacity: 0; transition: opacity 180ms ease; pointer-events: none;
}
.detail-scrim[data-open="true"] { opacity: 1; pointer-events: auto; }

.detail-close {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2);
  width: 30px; height: 30px; border-radius: 8px; line-height: 1; font-size: 16px; flex: 0 0 auto;
}
.detail-close:hover { color: var(--ink); border-color: var(--ink-3); }
.detail h2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kv { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 5px 12px; margin: 12px 0 0; }
.kv dt { color: var(--ink-3); font-size: 12px; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.detail section { border-top: 1px solid var(--line-2); margin-top: 14px; padding-top: 12px; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { padding: 26px 16px; color: var(--ink-3); text-align: center; font-size: 13px; }

.tree { margin-bottom: 12px; padding: 0; overflow: hidden; }
.tree > summary { cursor: pointer; padding: 11px 14px; display: flex; gap: 10px; align-items: center; background: var(--panel-2); }
.tree > summary::-webkit-details-marker { display: none; }
.tree[open] > summary { border-bottom: 1px solid var(--line); }
.tree ol { list-style: none; margin: 0; padding: 6px 0; }
.tree li { display: flex; gap: 10px; align-items: center; padding: 7px 14px; }
.tree li + li { border-top: 1px solid var(--line-2); }
.depth { display: inline-block; color: var(--ink-3); font-family: var(--mono); font-size: 12px; }

.usage-head { display: flex; gap: 32px; padding: 14px 16px; margin-bottom: 12px; }
.usage-head > div { display: flex; flex-direction: column; gap: 2px; }
.usage-head strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--accent); min-width: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.practice { padding: 16px; display: grid; gap: 10px; max-width: 640px; }
.practice .primary { justify-self: start; }
.warn { background: var(--escalate-bg); color: var(--escalate); border-radius: 8px; margin: 0 0 12px; }
.ops { padding: 16px; margin-bottom: 12px; }
.ops ul { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); }
.ops li { margin: 4px 0; }

.bg-banner { background: var(--deny-bg); color: var(--deny); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bg-banner button { margin-left: auto; }
.notice[data-kind="error"] { background: var(--deny-bg); color: var(--deny); }
.notice[data-kind="ok"] { background: var(--allow-bg); color: var(--allow); }
/* Reporting an outcome. Stacked buttons, because each carries a sentence of its own. */
.outcome-question { margin: 8px 0 10px; color: var(--ink-2); font-size: 13px; }
.outcome-options { display: grid; gap: 8px; }
.outcome-option {
  display: block; width: 100%; text-align: left; padding: 10px 12px; line-height: 1.4;
  background: var(--panel-2); border-color: var(--line);
}
.outcome-option:hover:not(:disabled) { border-color: var(--accent); background: var(--panel); }
.outcome-option:disabled { opacity: 0.55; cursor: default; }
.outcome-label { display: block; font-weight: 600; margin-bottom: 2px; }
.outcome-option .fine { display: block; }
.outcome-status:empty { display: none; }
.outcome-status { margin: 10px 0 0; }

.detail pre { margin: 8px 0 0; font-size: 12px; max-height: 320px; overflow: auto; }
.codes button.badge { cursor: pointer; }
.codes button.badge:hover { border-color: var(--ink-3); }
#keyBody td, #bgBody td { vertical-align: middle; }


/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 10px 14px; padding: 10px 14px; }
  .tabs { order: 3; width: 100%; margin: 0 -14px; padding: 0 14px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .topbar-right { margin-left: auto; }
  main { padding: 14px; }
  .pad { padding: 12px 14px; }
  .notice { padding: 9px 14px; }
  .filters { padding: 12px 14px; gap: 8px; }
  .field { min-width: 0; flex: 1 1 140px; }
  .field-actions { flex: 1 1 100%; }
  .field-actions button { flex: 1; }
  .grid2 { grid-template-columns: 1fr; }
  .usage-head { flex-wrap: wrap; gap: 16px 28px; }
}

/*
 * Below this a seven-column table is unreadable on a phone, and side-scrolling an audit
 * list is worse than useless. Rows become stacked cards; each cell carries its own
 * label, so nothing is hidden to make it fit.
 */
@media (max-width: 640px) {
  body { font-size: 15px; }
  .topbar { gap: 8px 10px; }
  /* The wordmark goes; the mark stays. It is an <svg> now, so the old :not(.mark)
     guard on a span selector no longer had anything to exclude. */
  .brand span:not(.env-chip) { display: none; }
  .tabs button { padding: 9px 12px; }

  /* Tap targets: 7px of padding is not a finger. */
  button, input, select { min-height: 42px; }
  .tabs button, .chip, .badge { min-height: 0; }
  .chip { padding: 9px 12px; min-height: 38px; }

  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  /* The row chevron is a pointer affordance for a cursor. A tap target does not
     need one, and stacked it would be a bare glyph with no header. */
  td.row-go { display: none; }
  tbody tr { padding: 11px 13px; border-bottom: 1px solid var(--line); }
  tbody tr:hover { background: transparent; }
  tbody tr[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--accent); }
  td { border: 0; padding: 4px 0; display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  td:not([data-label])::before { content: none; }
  td > .fine, td > div { text-align: right; }
  /* Action cells carry no label, so give their buttons the full row. */
  td:not([data-label]) { justify-content: flex-end; gap: 8px; padding-top: 8px; }
  td:not([data-label]) button { flex: 1; }
  .table-foot { flex-direction: column; gap: 4px; }

  .tally { gap: 6px; }
  .stat { padding: 6px 11px; }
  .kv { grid-template-columns: 96px minmax(0, 1fr); }
  .detail { padding: 14px; }
  .tree > summary { flex-wrap: wrap; gap: 8px; }
  .tree li { flex-wrap: wrap; gap: 6px 10px; }
  .usage-head strong { font-size: 19px; }
  .gate-card { padding: 22px; }
}

/* ---------- view header ---------- */
/*
 * Every view opened straight into a control bar, so nothing on the page said what
 * the page was. A title and one line of context cost little and orient a reader who
 * has never seen the product before -- which, at a demo, is everyone.
 */
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 2px 0 14px; flex-wrap: wrap; }
.view-head h1 { font-size: 19px; font-weight: 640; letter-spacing: -0.01em; margin: 0 0 3px; }
.view-head p { margin: 0; color: var(--ink-3); font-size: 13px; max-width: 62ch; }
.view-head-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- table refinements ---------- */
/* The proposal is what the row is about; everything else is context for it. */
.cell-primary { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.cell-context { font-size: 12px; color: var(--ink-2); }
.cell-context .sep { color: var(--ink-3); margin: 0 5px; }

tbody tr { position: relative; }
tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A row that opens something should look like it does. */
td.row-go { width: 26px; color: var(--ink-3); opacity: 0; transition: opacity 120ms ease; }
tbody tr:hover td.row-go, tbody tr:focus-visible td.row-go { opacity: 1; }

/* ---------- filters ---------- */
.filters-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.search { position: relative; flex: 1 1 240px; min-width: 180px; max-width: 340px; }
.search input { width: 100%; padding-left: 30px; }
.search::before {
  content: "⌕"; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); font-size: 15px; pointer-events: none;
}
/*
 * The manual range and the presets were two controls for one job, side by side and
 * equally loud. Presets lead; the exact range is here when someone wants it.
 */
.custom-range { font-size: 12.5px; }
.custom-range > summary { cursor: pointer; color: var(--ink-2); padding: 7px 10px; border-radius: 8px; list-style: none; border: 1px solid var(--line); background: var(--panel); }
.custom-range > summary::-webkit-details-marker { display: none; }
.custom-range > summary:hover { color: var(--ink); border-color: var(--ink-3); }
.custom-range[open] > summary { border-color: var(--accent); color: var(--ink); }
.custom-range-body { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 0 2px; width: 100%; }

@media (max-width: 860px) {
  .detail { width: 100%; }
  .view-head h1 { font-size: 17px; }
  .search { max-width: none; }
}

.detail-head-right { display: inline-flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* ---------- overview ---------- */
/*
 * Landing on thirty rows of a table is a firehose with no orientation. The overview
 * answers "what happened, and what needs me" first; the full list is one click away
 * and lives on its own page.
 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; }
.metric-label { font-size: 12px; color: var(--ink-3); display: block; margin-bottom: 7px; }
.metric-value { font-size: 26px; font-weight: 640; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.metric.alert .metric-value { color: var(--deny); }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { margin: 0; font-size: 13.5px; font-weight: 620; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 12.5px; font-weight: 550; padding: 2px 0; }
.link-btn:hover { text-decoration: underline; }

/* Proportion at a glance, without a chart library. */
.obar { display: grid; grid-template-columns: 82px minmax(0, 1fr) 42px; align-items: center; gap: 10px; margin-bottom: 9px; }
.obar:last-child { margin-bottom: 0; }
.obar-track { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.obar-fill { height: 100%; border-radius: 999px; }
.obar-n { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink-2); }
.obar-fill.t-allow { background: var(--allow); }
.obar-fill.t-deny { background: var(--deny); }
.obar-fill.t-escalate { background: var(--escalate); }
.obar-fill.t-reroute { background: var(--reroute); }

.attn { display: flex; align-items: flex-start; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.attn:last-child { border-bottom: 0; }
.attn-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: var(--ink-3); }
.attn-dot.warn { background: var(--escalate); }
.attn-dot.bad { background: var(--deny); }
.attn-body { min-width: 0; }
.attn-title { font-size: 13px; font-weight: 550; }
.attn-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.attn-go { margin-left: auto; flex: 0 0 auto; }

@media (max-width: 960px) {
  /* The sidebar becomes a drawer; the hamburger is the only way in. */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav {
    position: fixed; top: 0; left: 0; bottom: 0; width: 248px; z-index: 45;
    transform: translateX(-100%); transition: transform 170ms ease;
  }
  .sidenav[data-open="true"] { transform: translateX(0); }
  @media (prefers-reduced-motion: reduce) { .sidenav { transition: none; } }
  .topbar { display: flex; }
  .nav-toggle { display: inline-flex; }
  .crumb { display: block; }
  .topbar { padding: 10px 14px; }
}

.sidenav-tenant { padding: 0 8px 12px; }
.sidenav-tenant:empty { display: none; }

/* ---------- utilities ---------- */
/*
 * The console sends `style-src 'self'` with no 'unsafe-inline', so a style attribute
 * is silently dropped by the browser: no error, no warning, the declaration simply
 * never applies. Every inline style in this app was doing nothing -- the outcome bars
 * all rendered full width because `width: 55%` never landed, and a sprite that was
 * meant to be out of flow sat in it. These classes carry what those attributes did.
 *
 * A dynamic width cannot be a class. It is set through the CSSOM instead, which a
 * script already allowed by `script-src 'self'` may do.
 */
.stack-sm { margin-top: 10px; }
.stack { margin-top: 12px; }
.stack-lg { margin-top: 14px; }
.inset { padding: 14px; }
.inset-lg { padding: 16px; }
.self-end { align-self: end; }
.span-all { grid-column: 1 / -1; }
.wrap-any { white-space: pre-wrap; overflow-wrap: anywhere; }
.readout {
  white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--panel-2); padding: 10px; border-radius: 8px;
}
.readout.tall { max-height: 300px; overflow: auto; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- landing ---------- */
/*
 * What someone sees before they sign in. The console is behind a passcode, so the only
 * public surface is this one -- it has to explain the product to a reader who has never
 * heard of it, which the passcode form on its own never did.
 */
.landing { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.landing-wrap { max-width: 1000px; margin: 0 auto; padding-inline: 20px; }

.landing-top { display: flex; align-items: center; gap: 11px; padding-block: 22px; }
.landing-word { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.landing-by { color: var(--ink-3); font-size: 13px; margin-left: 3px; align-self: center; }
.landing-cta { margin-left: auto; }

.landing-hero { padding-block: 30px 6px; }
.landing-kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-3); margin: 0 0 14px;
}
.landing h1 {
  font-size: clamp(30px, 5.4vw, 50px); line-height: 1.05; letter-spacing: -0.032em;
  font-weight: 700; margin: 0 0 18px; max-width: 19ch; text-wrap: balance;
}
.landing-lede { font-size: clamp(16px, 2vw, 19px); color: var(--ink-2); max-width: 60ch; margin: 0; line-height: 1.55; }

/* the flow diagram */
.stage { padding: 24px 20px 20px; margin-block: 34px 18px; }
.stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.stage-head h2 { font-size: 14.5px; font-weight: 600; margin: 0; }
.stage-head .tick { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

.flow { display: grid; grid-template-columns: minmax(0, 1fr) 44px auto 44px minmax(0, 1.05fr); gap: 12px; align-items: center; }
.fnode { border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); padding: 13px 14px; min-width: 0; }
.fnode-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); display: block; margin-bottom: 8px; }
/*
 * The proposal's kind, so a reader sees a model hop answered by the same rules as the
 * tool calls. A bordered tag rather than another line of uppercase mono: .fnode-label
 * above it already uses that treatment, and a second one reads as a stray caption.
 */
.fkind {
  display: inline-block; margin-top: 9px; padding: 3px 7px;
  border: 1px solid var(--line); border-radius: 999px;
  font: 600 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-2); background: var(--panel);
}

.fproposal { font-family: var(--mono); font-size: 13.5px; font-weight: 500; }
.fargs { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; }

.fgate { display: grid; place-items: center; gap: 7px; padding: 16px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); min-width: 104px; }
.fgate svg { width: 32px; height: 32px; color: var(--ink); }
.fgate-name { font-weight: 600; font-size: 12.5px; }
.fgate.pulse { animation: gate-pulse 420ms ease; }
@keyframes gate-pulse {
  0% { box-shadow: 0 0 0 0 rgba(120, 130, 145, .34); }
  100% { box-shadow: 0 0 0 15px rgba(120, 130, 145, 0); }
}

.wire { position: relative; height: 2px; background: var(--line); border-radius: 2px; }
.packet { position: absolute; top: 50%; left: 0; width: 9px; height: 9px; border-radius: 50%; background: currentColor; margin-top: -4.5px; opacity: 0; }
.wire.run .packet { animation: packet-travel 720ms cubic-bezier(.45, 0, .2, 1); }
@keyframes packet-travel {
  0% { left: 0; opacity: 0; transform: scale(.4); }
  12% { opacity: 1; transform: scale(1); }
  88% { opacity: 1; transform: scale(1); }
  100% { left: 100%; opacity: 0; transform: scale(.4); }
}

.lanes { display: grid; gap: 6px; }
.lane {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px 11px; border-radius: 9px; border: 1px solid transparent; background: var(--panel-2);
  opacity: .45; transition: opacity 200ms ease, border-color 200ms ease, background 200ms ease;
}
.lane.on { opacity: 1; }
.lane-verb { font-weight: 600; font-size: 13.5px; }
.lane-why { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); text-align: right; }
.lane.t-allow .lane-verb { color: var(--allow); }
.lane.t-deny .lane-verb { color: var(--deny); }
.lane.t-escalate .lane-verb { color: var(--escalate); }
.lane.t-reroute .lane-verb { color: var(--reroute); }
.lane.on.t-allow { background: var(--allow-bg); border-color: var(--allow); }
.lane.on.t-deny { background: var(--deny-bg); border-color: var(--deny); }
.lane.on.t-escalate { background: var(--escalate-bg); border-color: var(--escalate); }
.lane.on.t-reroute { background: var(--reroute-bg); border-color: var(--reroute); }

.stage-foot {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-2);
  display: flex; gap: 8px 24px; flex-wrap: wrap; font-family: var(--mono); font-size: 11px; color: var(--ink-3);
}
.stage-foot b { color: var(--ink-2); font-weight: 500; }

.landing-band { padding-block: 38px; border-top: 1px solid var(--line); }
.landing-band h2 { font-size: clamp(22px, 3.2vw, 30px); letter-spacing: -0.022em; font-weight: 700; margin: 0 0 12px; text-wrap: balance; }
.landing-body { color: var(--ink-2); max-width: 64ch; margin: 0 0 12px; line-height: 1.6; }
.landing-body strong { color: var(--ink); font-weight: 600; }
.landing-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 22px; }
.lcard { padding: 16px 17px; }
.lcard h3 { font-size: 14.5px; font-weight: 600; margin: 0 0 6px; }
.lcard p { font-size: 14px; color: var(--ink-2); margin: 0; }
.v-allow { color: var(--allow); }
.v-deny { color: var(--deny); }
.v-escalate { color: var(--escalate); }
.v-reroute { color: var(--reroute); }

.budget { margin-top: 20px; }
.budget-row { display: grid; grid-template-columns: 116px minmax(0, 1fr) 60px; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.budget-track { height: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.budget-fill { height: 100%; border-radius: 999px; background: var(--ink-3); }
.budget-fill.good { background: var(--allow); }
.budget-n { font-family: var(--mono); color: var(--ink-2); text-align: right; }

.loop { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 11px; margin-top: 22px; }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; }
.step-n { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); display: block; margin-bottom: 6px; }
.step b { font-size: 14px; display: block; margin-bottom: 3px; }
.step span { font-size: 13px; color: var(--ink-2); }

.landing-foot { padding-block: 34px 56px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13.5px; }
.one-liner { font-weight: 600; font-size: 18px; color: var(--ink); margin: 0 0 10px; max-width: 46ch; text-wrap: balance; }
.landing-foot button { margin-top: 14px; }

.gate-back { margin-top: 10px; width: 100%; }

@media (max-width: 760px) {
  .flow { grid-template-columns: 1fr; }
  .wire { height: 24px; width: 2px; justify-self: center; }
  .wire .packet { left: 50%; margin-left: -4.5px; top: 0; }
  .wire.run .packet { animation: packet-travel-v 720ms cubic-bezier(.45, 0, .2, 1); }
  @keyframes packet-travel-v {
    0% { top: 0; opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { top: 100%; opacity: 0; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .wire.run .packet, .fgate.pulse { animation: none; }
  .packet { opacity: 1; left: 50%; }
}

/* ---------- suggested rules ---------- */
/*
 * A suggestion is a draft with its evidence attached. The evidence is shown beside the
 * rule, not behind a link, because the whole question an operator has is "on what
 * grounds" -- and for a shape nobody has reported on, the honest answer is "none yet".
 */
.sug { padding: 15px 16px; border-bottom: 1px solid var(--line-2); }
.sug:last-child { border-bottom: 0; }
.sug-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.sug-name { font-family: var(--mono); font-size: 13.5px; font-weight: 500; }
.sug-strength {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-3);
}
.sug-strength.strong { color: var(--allow); border-color: var(--allow); }
.sug-strength.moderate { color: var(--escalate); border-color: var(--escalate); }
.sug-strength.insufficient { color: var(--deny); border-color: var(--deny); }
.sug-why { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; max-width: 72ch; }
/*
 * The suggested rule, rendered the way the Policies surface renders a rule.
 *
 * This was a `<pre>` of JSON.stringify(rule). The console already had describeRule --
 * "each rule as a sentence, because that is what anyone is actually checking" -- and
 * used it everywhere except the one card that puts a rule in front of someone who has
 * to decide about it. Two surfaces disagreeing about what a rule looks like, and the
 * one showing the raw object was the one on the demo path.
 */
.sug-rule-line {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 11px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px;
}
/* Beside the strength chip, which counts something else entirely. */
.sug-conf { margin-left: auto; font-variant-numeric: tabular-nums; }
.sug-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.sug-lint { font-size: 12.5px; color: var(--deny); }

/* A view that is showing less than it looks like it is showing says so in this colour. */
.warnish { color: var(--escalate); }

/* ---------- the learning loop, animated ---------- */
/*
 * The claim is that the gate gets better over time, which is hard to picture from a
 * list of steps. So the picture is coverage: every dot is a decision, a pale one had
 * no rule and failed closed, and one turns solid each time a rule is published. The
 * loop runs until nothing is failing closed, then starts again.
 */
.learn { padding: 18px 18px 16px; margin-top: 24px; }
.learn-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 15px; }
.learn-steps { display: flex; gap: 5px; flex-wrap: wrap; }
.lstep {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--ink-3); transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.lstep.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.lstep.done { color: var(--ink-2); border-color: var(--ink-3); }
.learn-say { font-size: 13px; color: var(--ink-2); }

.learn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(22px, 1fr)); gap: 7px; margin-bottom: 16px; }
.ldot {
  aspect-ratio: 1 / 1; border-radius: 6px; background: var(--panel-2);
  border: 1px solid var(--line); transition: background 420ms ease, border-color 420ms ease, transform 300ms ease;
}
.ldot.covered { background: var(--allow-bg); border-color: var(--allow); }
.ldot.gap { background: var(--deny-bg); border-color: var(--deny); }
.ldot.picked { transform: scale(1.18); }
.ldot.just-covered { animation: dot-land 620ms ease; }
@keyframes dot-land {
  0% { transform: scale(1.3); }
  60% { transform: scale(.94); }
  100% { transform: scale(1); }
}

.learn-stats { display: flex; gap: 10px 30px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--line-2); }
.lstat { display: grid; gap: 2px; }
.lstat span { font-size: 11.5px; color: var(--ink-3); }
.lstat b { font-size: 17px; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  .ldot, .lstep { transition: none; }
  .ldot.just-covered { animation: none; }
}

/* ---------- page header ---------- */
/* One header for every view, above the controls that narrow it. */
.page-head { margin: 2px 0 14px; }
.page-head h1 { font-size: 21px; font-weight: 650; letter-spacing: -0.018em; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--ink-3); font-size: 13.5px; max-width: 70ch; }
.page-head p:empty { display: none; }

/* ---------- progressive disclosure on the landing ---------- */
/*
 * Less on the page, more a click away. A reader who wants the argument can open it;
 * one who wants the shape of the thing is not made to read past it.
 */
.more { margin-top: 4px; }
.more > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13.5px; color: var(--accent); padding: 4px 0;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "+"; font-family: var(--mono); font-size: 14px; line-height: 1; }
.more[open] > summary::before { content: "\2212"; }
.more > summary:hover { text-decoration: underline; }
.more > *:not(summary) { padding-top: 8px; }

/* ---------- live demo ---------- */
/*
 * A transcript, not a table. Each line says who spoke: the agent proposing, Latch
 * answering, the agent reacting, and where it escalates, a person deciding. The
 * reaction lines are the point -- they show the gate steering the agent rather than
 * just recording it.
 */
.demo-setup { padding: 16px 17px; margin-bottom: 14px; }
.demo-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.demo-tape { padding: 6px 0; min-height: 80px; }
.demo-tape:empty::after {
  content: "Nothing has run yet.";
  display: block; padding: 22px 18px; color: var(--ink-3); font-size: 13.5px;
}

.tape-line {
  display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 12px; align-items: baseline;
  padding: 8px 18px; animation: tape-in 220ms ease;
}
@keyframes tape-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tape-line { animation: none; } }

.tape-who {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); text-align: right;
}
.tape-who.latch { color: var(--ink); font-weight: 600; }
.tape-who.human { color: var(--escalate); font-weight: 600; }
.tape-who.bad { color: var(--deny); font-weight: 600; }
.tape-who.done { color: var(--allow); font-weight: 600; }
.tape-body { font-size: 14px; min-width: 0; overflow-wrap: anywhere; }

.tape-line.ask { color: var(--ink-2); }
.tape-line.react { color: var(--ink-2); }
.tape-line.held { background: var(--escalate-bg); border-block: 1px solid var(--escalate); }
.tape-line.done { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px; }
.tape-btn { margin-left: 8px; padding: 4px 11px; font-size: 12.5px; }

@media (max-width: 560px) {
  .tape-line { grid-template-columns: 1fr; gap: 3px; }
  .tape-who { text-align: left; }
}

/* ---------- drafting a scenario ---------- */
.demo-new { padding: 0; margin-bottom: 14px; }
.demo-new > summary {
  cursor: pointer; list-style: none; padding: 14px 17px; font-weight: 550; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.demo-new > summary::-webkit-details-marker { display: none; }
.demo-new > summary::before { content: "+"; font-family: var(--mono); color: var(--ink-3); }
.demo-new[open] > summary::before { content: "\2212"; }
.demo-new[open] > summary { border-bottom: 1px solid var(--line-2); }
.demo-new-body { padding: 15px 17px 17px; }

/* The steps, listed so they are read before they are run in front of a customer. */
.draft-steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 7px; }
.draft-steps li { font-size: 13.5px; }
.draft-steps li span { display: block; color: var(--ink-2); }
.draft-steps li code { font-size: 12px; color: var(--ink-3); }

/* ---------- rule builder and live validation ---------- */
.builder { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 14px; }
.builder > summary {
  cursor: pointer; list-style: none; padding: 13px 16px; font-weight: 550; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.builder > summary::-webkit-details-marker { display: none; }
.builder > summary::before { content: "+"; font-family: var(--mono); color: var(--ink-3); }
.builder[open] > summary::before { content: "\2212"; }
.builder[open] > summary { border-bottom: 1px solid var(--line-2); }
.builder-body { padding: 15px 16px 16px; }
.builder-cond { margin: 12px 0; padding: 11px 13px; border: 1px dashed var(--line); border-radius: 9px; }
.builder-cond > summary { cursor: pointer; font-size: 13px; color: var(--ink-2); }

.doc-status { margin: 10px 0 0; }
.doc-status p { margin: 0 0 5px; }
.doc-status .ok-note { font-size: 13px; color: var(--allow); }

/* The document in words, so it can be checked without being read as JSON. */
.doc-plain { margin: 10px 0 0; }
.plain-rules { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 4px; }
.plain-rules li { font-size: 13.5px; color: var(--ink-2); }

/* ---------- policy rules, as a list ---------- */
.rule-row {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 11px;
  align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line-2);
}
.rule-row:last-child { border-bottom: 0; }
.rule-n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); min-width: 14px; }
.rule-what { font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.rule-id { display: block; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.rule-acts { display: flex; gap: 4px; }
.rule-acts button { padding: 3px 8px; font-size: 13px; line-height: 1.2; }
.rule-acts button:disabled { opacity: .35; }

.pe-publish { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.pe-publish .field { min-width: 120px; }

.advanced { margin-top: 14px; }
.advanced > summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); list-style: none; }
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "+ "; font-family: var(--mono); }
.advanced[open] > summary::before { content: "\2212 "; }

/* ---------- task trees ---------- */
/*
 * Indentation carries the depth, because "d1" carried nothing. The instance id is on
 * the row's title rather than in it: an operator checking a tree wants to see what the
 * agents did, not to read the same identifier six times.
 */
.tree-title { font-weight: 600; font-size: 14px; }
.tree-row {
  display: grid; grid-template-columns: 96px auto minmax(0, 1fr); gap: 11px;
  align-items: center; padding: 7px 0;
}
.tree-row[data-depth="1"] { padding-left: 26px; }
.tree-row[data-depth="2"] { padding-left: 52px; }
.tree-row[data-depth="3"] { padding-left: 78px; }
.tree-row[data-depth="1"], .tree-row[data-depth="2"], .tree-row[data-depth="3"] {
  border-left: 2px solid var(--line); margin-left: 8px;
}
.tree-who { font-size: 12px; color: var(--ink-3); }
.tree-name { font-size: 13px; min-width: 0; overflow-wrap: anywhere; }

/* The demo's own row, set apart from the traffic it is not part of. */
.usage-demo-row td { color: var(--ink-3); }

/* ---------- users ---------- */
.users-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.users-bar p { margin: 0; }
#view-users > .card { margin-bottom: 14px; }
.stack-form { display: grid; gap: 16px; }
.field.narrow { max-width: 420px; }
.field-label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 2px; letter-spacing: 0.02em; }

/* A role is a card you select: its name, and what it lets a person change. */
.role-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 10px; }
.role-picker.single { grid-template-columns: 1fr; gap: 6px; margin-top: 0; max-width: 380px; }
.role-option { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); cursor: pointer; font-weight: 500; color: var(--ink); font-size: 13px; letter-spacing: 0; }
.role-option.compact { padding: 7px 10px; }
.role-option:hover { border-color: var(--ink-3); }
.role-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.role-option input { width: auto; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.role-text { display: grid; gap: 2px; }
.role-name { font-weight: 600; }

.role-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.role-chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink-2); white-space: nowrap; }

.users-table td { vertical-align: middle; }
.users-table tr.editing td { vertical-align: top; background: var(--panel-2); }
.person { font-weight: 600; }
.you { font-size: 11px; font-weight: 600; color: var(--accent); border: 1px solid currentColor; border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions button { padding: 5px 10px; font-size: 12.5px; margin-left: 4px; }
.row-actions .danger { color: var(--deny); }

.invite-card { margin-bottom: 14px; border-color: var(--accent); }
.invite-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.invite-head h2 { margin: 0; font-size: 15px; }
.invite-link { display: flex; gap: 8px; margin-top: 10px; }
.invite-link input { flex: 1; min-width: 0; }

.event-list { list-style: none; padding: 0; margin: 0; }
.event-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.event-list li:last-child { border-bottom: 0; }
.event-text .fine { margin-left: 6px; }

/* Who is signed in: email over roles, above the footer buttons. */
.sidenav-foot .who { display: grid; gap: 1px; }
.who-email { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-roles { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 720px) {
  .row-actions { text-align: left; white-space: normal; }
  .row-actions button { margin: 4px 4px 0 0; }
  .invite-link { flex-direction: column; }
}

/* Decisions paging: the count, the pager, and the page size, on one line that wraps. */
.pager-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 8px; }
.pager button { padding: 5px 10px; font-size: 12.5px; }
.page-size { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; }
.page-size select { width: auto; padding: 4px 8px; }

/* ---------- practice ---------- */
.practice { display: grid; gap: 18px; padding: 18px; max-width: 880px; }
.practice-scope { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 12px; align-items: start; }
/* Every label on one line; the mode switch is taller than a select, so fields align to the top. */
.practice-scope .field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 0 0 4px; letter-spacing: 0.02em; }
.practice-scope .field input { margin-top: 6px; }
.practice-proposal { display: grid; grid-template-columns: minmax(170px, 0.6fr) 1.4fr; gap: 12px; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented label { flex: 1; margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 10px; text-align: center; font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.segmented small { display: block; font-weight: 400; font-size: 11px; color: var(--ink-3); }
.segmented input:checked + span { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.segmented label + label { border-left: 1px solid var(--line); }

.example-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.example-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; background: var(--panel-2); }
.example-chip[aria-pressed="true"] { border-color: var(--accent); }

.kv-editor { border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; margin: 0; background: var(--panel-2); }
.kv-editor legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; }
details.kv-editor > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; }
.kv-editor > .fine { margin: 2px 0 10px; }
.kv-rows { display: grid; gap: 8px; }
.kv-row { display: grid; grid-template-columns: minmax(120px, 1fr) 128px minmax(140px, 1.4fr) 34px; gap: 8px; align-items: center; }
.kv-row .kv-hint { grid-column: 1 / -1; margin: -2px 0 2px; }
.kv-remove { padding: 6px 0; font-size: 16px; line-height: 1; }
.kv-empty { margin: 0; }
.kv-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.kv-editor textarea { width: 100%; }

.practice-answer { margin-top: 14px; max-width: 880px; }
.practice-answer h2 { display: flex; align-items: center; gap: 10px; margin: 4px 0; font-size: 17px; }
.pill-lg { font-size: 14px; padding: 5px 12px; }

@media (max-width: 720px) {
  .practice-scope, .practice-proposal { grid-template-columns: 1fr; }
  .kv-row { grid-template-columns: 1fr 1fr 34px; }
  .kv-row [data-field="value"] { grid-column: 1 / 3; }
}

/* Which rule decided, under the verdict. */
.rule-line { margin: 8px 0 4px; font-size: 13.5px; color: var(--ink); }
.rule-line code { font-family: var(--mono); font-size: 12.5px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line); }

/* ---------- keys: pick, don't type ---------- */
.chip-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip-toggle { border-radius: 999px; padding: 5px 12px; font-family: var(--mono); font-size: 12.5px; background: var(--panel-2); }
.chip-toggle[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--ink); }
.chip-add { display: flex; gap: 8px; margin-top: 8px; max-width: 420px; }
.chip-add input { flex: 1; min-width: 0; }
.check-line { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 0; font-weight: 500; font-size: 13px; color: var(--ink); letter-spacing: 0; }
.check-line input { width: auto; accent-color: var(--accent); }
.env-checks { display: flex; flex-wrap: wrap; gap: 4px 20px; }
th { white-space: nowrap; }

/* ---------- break-glass banner, one line on a phone ---------- */
.bg-short { display: none; }
@media (max-width: 720px) {
  .bg-long { display: none; }
  .bg-short { display: inline; }
}
.demo-warn { margin: 12px 0 0; }
.demo-warn p { margin: 0 0 10px; }
.demo-warn .fine { color: inherit; opacity: 0.85; }
#view-keys > .card { margin-bottom: 14px; }

/* LatchOn rule builder: one condition or example per row on a wide screen. */
.rb-cond, .rb-example { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-bottom: 8px; }
.rb-cond .field-actions, .rb-example .field-actions { justify-content: flex-end; }
.rb-draft-rule { border-bottom: 1px solid var(--line); padding: 10px 0; }
.rb-proposal { display: flex; gap: 12px; align-items: flex-start; justify-content: flex-start; cursor: pointer; font-weight: 400; text-align: left; }
.rb-proposal input[type="checkbox"] { width: auto; flex: none; margin-top: 4px; }
.rb-proposal > span { flex: 1; min-width: 0; }
#rbRuleForm textarea { font-family: inherit; }
