/* The Organization app's look is the #128 prototype's (#152): its tokens, light
   and dark, and its type. Every colour below is a token; nothing is hard-coded
   outside :root. */

/* Fonts, self-hosted: the page CSP allows no other origin. IBM Plex is IBM's own
   Latin-1 split, unmodified ("Plex" is a Reserved Font Name); Bricolage
   Grotesque is Fontsource's Latin subset. Both SIL OFL 1.1, licences beside them. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(bricolage-grotesque-latin-wght.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 400; src: url(plex-sans-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2074, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 500; src: url(plex-sans-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2074, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 600; src: url(plex-sans-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2074, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 700; src: url(plex-sans-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2074, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 400; src: url(plex-mono-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2074, U+20AC, U+2122, U+2212, U+FB01-FB02; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-display: swap; font-weight: 500; src: url(plex-mono-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+2074, U+20AC, U+2122, U+2212, U+FB01-FB02; }

:root {
  color-scheme: light;
  --paper: #f2f4ef; --panel: #ffffff; --ink: #1c2626; --muted: #5f6b68; --line: #d9ded6;
  --accent: #b45309; --accent-soft: #fbecd9; --urgent: #b8322b; --urgent-soft: #f8e3e1;
  --blocked: #87919a; --done: #5f7f67; --done-soft: #e3ece4; --fog: #9c8a58; --fog-soft: #f1ecdd;
  --agent: #6b4fa0; --agent-soft: #ece6f6;
  /* Tag tones: tags are free text, so `tags.ts` maps each to one of these. */
  --t-0: #a36f00; --t-1: #0b7f84; --t-2: #8b5a2b; --t-3: #b8386f; --t-4: #3a68b8; --t-5: #5f731d; --t-6: #b94f28; --t-7: #56606b;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* Federico, 2026-10-06: the background is round 1's console colour (#451); panels one step lighter, so they still stand apart. */
    --paper: #1a2120; --panel: #222b29; --ink: #e3e9e5; --muted: #98a5a1; --line: #313c3a;
    --accent: #f59e4a; --accent-soft: #3a2a17; --urgent: #f08a80; --urgent-soft: #3f2221;
    --blocked: #7d8891; --done: #8fb597; --done-soft: #1f2c23; --fog: #cbb77f; --fog-soft: #2e2a1d;
    --agent: #b9a2e6; --agent-soft: #2a2238;
    --t-0: #e0b04a; --t-1: #4cc3c7; --t-2: #d09a6a; --t-3: #ec7fae; --t-4: #86aaf0; --t-5: #aac35a; --t-6: #f08d62; --t-7: #a9b3bd;
  }
}
.tone-0 { --tag: var(--t-0); } .tone-1 { --tag: var(--t-1); } .tone-2 { --tag: var(--t-2); } .tone-3 { --tag: var(--t-3); }
.tone-4 { --tag: var(--t-4); } .tone-5 { --tag: var(--t-5); } .tone-6 { --tag: var(--t-6); } .tone-7 { --tag: var(--t-7); }

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; text-wrap: balance; }
h2 { font-size: 1.12rem; margin: 0 0 8px; }
code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-underline-offset: 3px; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.shell { max-width: 44rem; margin: 0 auto; padding: 12px 16px 48px; display: grid; gap: 14px; }
.who { color: var(--muted); font-size: 0.9rem; }

button { font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--paper); cursor: pointer; }
button.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
button.small { padding: 5px 10px; font-size: 0.85rem; }
button.danger { background: var(--urgent); border-color: var(--urgent); color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }
a.button { display: inline-block; padding: 5px 10px; border-radius: 8px; background: var(--accent); color: var(--paper); text-decoration: none; font-size: 0.85rem; font-weight: 500; }


ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; }
.card.urgent { border-color: var(--urgent); }
.card p { margin: 0; }
/* #315: a node's number, like an issue's. */
.item .num, .chip.number { font-variant-numeric: tabular-nums; color: var(--muted); }
.item .num { margin-right: 6px; font-weight: 500; }
.meta, .empty, .status { color: var(--muted); font-size: 0.9rem; margin: 0; }
.tool { font-size: 0.85rem; color: var(--muted); }
.actions { display: flex; gap: 8px; }
.actions.wrap { flex-wrap: wrap; }
.notice { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--urgent-soft); color: var(--urgent); }
.health { font-size: 0.85rem; }
.health.healthy { color: var(--done); } .health.degraded { color: var(--fog); } .health.unavailable, .health.unknown { color: var(--urgent); }
.args { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--paper); font: 0.8rem/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 16rem; overflow: auto; }

.signals { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.signals th, .signals td { text-align: left; padding: 0.25rem 0.5rem 0.25rem 0; }
.signals thead th { font-weight: 500; color: var(--muted); }
.signal.healthy { color: var(--done); } .signal.degraded { color: var(--fog); } .signal.unavailable { color: var(--urgent); }
.signal.unknown { color: var(--muted); }

/* A node in a list: a panel with a state stripe, the whole row opens its page. */
.item { display: grid; gap: 4px; padding: 10px 12px 10px 14px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; color: inherit; text-decoration: none; }
.item:hover, .item:focus-visible { border-color: var(--accent); }
.item.deadline { border-left-color: var(--urgent); }
.item .t { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 500 0.75rem/1 var(--body); padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip.tag { color: var(--tag, var(--muted)); border-color: var(--tag, var(--line)); background: transparent; }
.chip.tag::before, .dot { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tag, var(--muted)); flex: none; }
.chip.status.open { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.status.done { background: var(--done-soft); color: var(--done); border-color: transparent; }
.chip.status.dropped { text-decoration: line-through; }

/* A kind is a shape (the #128 prototype): it reads without colour. */
.glyph { width: 1em; height: 1em; flex: none; fill: currentColor; }
.glyph .stroke { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.glyph .dashed { stroke-dasharray: 3 2; }
.glyph.decision { color: var(--accent); }
.glyph.note { color: var(--fog); }
.glyph.unknown { color: var(--muted); }

/* The node page. */
.node { display: grid; gap: 14px; }
.node-head { display: grid; gap: 8px; }
.node-head h2 { font-size: 1.35rem; margin: 0; }
.node h3 { font-size: 1rem; margin: 0 0 6px; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 0.92rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.props dt { font: 500 0.72rem/1.9 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.props dd { margin: 0; }
ul.plain { gap: 4px; }
.related { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 0.9rem; }
.history .meta { font-family: var(--mono); font-size: 0.78rem; }
.form { gap: 10px; }
.form h3 { margin: 0; }
.form label { display: grid; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.form label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
.form label.check input { width: auto; }
.form details { display: grid; gap: 8px; }
.form details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
input, textarea, select { font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px; width: 100%; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
.picker .actions input { flex: 1 1 auto; }

/* A body: Markdown rendered as elements, never as HTML. */
.markdown { display: grid; gap: 8px; line-height: 1.55; overflow-wrap: anywhere; }
.markdown > * { margin: 0; }
.markdown ul, .markdown ol { list-style: revert; padding-left: 1.4rem; display: block; }
.markdown blockquote { border-left: 3px solid var(--line); padding-left: 10px; color: var(--muted); }
.markdown pre { padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); overflow: auto; font-size: 0.85rem; }
.markdown code { font-size: 0.9em; }
.wikilink.unresolved { color: var(--muted); border-bottom: 1px dashed currentColor; }

/* Maps (#492, decided in #459): the console's list and detail, the map drawn in pages, never panned. Flat: headings
   and hairlines; the list and the ticket's detail are outlined, as the console's are. */
.maps-page { display: grid; gap: 12px; }
.maps-split { display: grid; grid-template-columns: 17rem minmax(0, 1fr); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); min-height: 34rem; }
.maps-split.no-list { grid-template-columns: minmax(0, 1fr); }
.maps-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); min-width: 0; }
.maps-find { display: grid; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.maps-find select { width: 100%; padding: 5px 8px; font-size: 0.85rem; }
.maps-items { overflow-y: auto; max-height: 46rem; }
.maps-item { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; gap: 1px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.maps-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maps-item .meta { font-size: 0.78rem; display: flex; gap: 6px; align-items: center; }
.maps-item[aria-current="true"] { background: var(--paper); box-shadow: inset 3px 0 0 var(--ink); }
.maps-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.maps-list-foot { margin-top: auto; padding: 8px 10px; border-top: 1px solid var(--line); }
.avs { display: flex; margin-left: auto; }
.avs .av { width: 16px; height: 16px; font-size: 0.5rem; margin-left: -4px; border: 1.5px solid var(--panel); }
.av { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font: 700 0.6rem var(--body); color: #fff; flex: none; background: var(--blocked); }
.av.av-me { background: var(--accent); } .av.av-agent { background: var(--agent); }
.map-view { position: relative; display: grid; gap: 12px; align-content: start; padding: 14px 16px; min-width: 0; }
.map-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.map-head .map-title { margin: 0; font-size: 1.2rem; }
.map-head .map-actions { margin-left: auto; }
.map-pick { display: none; }
.menu-wrap { position: relative; }
.filter-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 8; width: 18rem; display: grid; gap: 2px; padding: 8px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px rgb(0 0 0 / 0.14); }
.filter-menu .label { padding: 6px 6px 2px; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.filter-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.menu-row { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 8px; font-size: 0.9rem; }
.menu-row:hover, .menu-row:focus-visible { background: var(--paper); }
.menu-row .tick { width: 14px; font-weight: 700; }
.menu-row .n { margin-left: auto; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.showing { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--muted); margin: 0; }
.showing b { color: var(--ink); font-weight: 600; }
.done-box { all: unset; cursor: pointer; display: grid; gap: 2px; padding: 10px; border-radius: 10px; background: var(--done-soft); border: 1.4px solid var(--done); color: var(--done); font-weight: 600; font-size: 0.86rem; }
.done-box span { color: var(--muted); font-weight: 400; font-size: 0.75rem; }
.map-page { min-width: 0; touch-action: pan-y; }
.map-page svg { display: block; }
.map-page text { fill: var(--ink); font-family: var(--body); }
.map-page .n-sub { font-size: 10px; fill: var(--muted); }
.map-page .col-head { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; fill: var(--muted); text-transform: uppercase; }
.map-page .n-title { font-size: 11.5px; font-weight: 600; }
.map-page .n-rank { font-weight: 700; fill: var(--accent); }
.map-page .band rect { fill: var(--accent-soft); }
.map-page .band text { font-size: 10.5px; font-weight: 700; fill: var(--accent); letter-spacing: 0.06em; text-transform: uppercase; }
.map-page .edge { stroke: var(--blocked); stroke-width: 1.3; fill: none; }
.map-page .edge.hot { stroke: var(--accent); stroke-width: 2.2; }
.map-page .arrow { fill: var(--blocked); } .map-page .arrow.hot { fill: var(--accent); }
.map-page .dim { opacity: 0.2; } .map-page .edge.dim { opacity: 0.12; }
.map-page .node { cursor: pointer; }
.map-page .node:focus { outline: none; }
.map-page .node:focus-visible .box { stroke: var(--accent); stroke-width: 3; }
.map-page .box { fill: var(--panel); stroke: var(--line); stroke-width: 1.4; }
.map-page .node.frontier .box { stroke: var(--accent); }
.map-page .node.blocked .box { stroke: var(--blocked); stroke-dasharray: 4 3; }
.map-page .node.scenario .box { stroke: var(--fog); stroke-dasharray: 5 3; }
.map-page .n-sub.scenario { fill: var(--fog); font-weight: 600; }
.map-page .node.sel .box { stroke-width: 3; stroke: var(--ink); }
.map-page .pin { fill: var(--ink); }
.map-page .avc { fill: var(--blocked); stroke: var(--panel); stroke-width: 1.5; } .map-page .avc.av-me { fill: var(--accent); } .map-page .avc.av-agent { fill: var(--agent); }
.map-page .avt { fill: #fff; font-size: 8px; font-weight: 700; }
.map-page .stub { cursor: pointer; }
.map-page .stub .box { fill: var(--done-soft); stroke: var(--done); }
.map-page .stub text { fill: var(--done); font-weight: 600; font-size: 11.5px; }
.map-page .stub .done-line { font-weight: 400; font-size: 10px; }
.map-page .fog .box { fill: var(--fog-soft); stroke: var(--fog); stroke-dasharray: 2 3; }
.map-page .fog .fog-head { fill: var(--fog); font-weight: 600; }
.map-page .fog .fog-line { fill: var(--ink); }
.map-pager { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }
.ticket-detail { position: absolute; top: 0; right: 0; bottom: 0; width: min(21rem, 100%); overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line);
  box-shadow: -10px 0 24px rgb(0 0 0 / 0.08); padding: 16px 18px; display: grid; gap: 12px; align-content: start; z-index: 6; border-radius: 0 12px 12px 0; }
.ticket-detail h2 { margin: 0; }
.ticket-detail ul { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; list-style: disc; }
.ticket-detail .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ticket-detail .fact { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; font-size: 0.9rem; }
.ticket-detail .fact.wide { grid-column: 1 / -1; }
.ticket-detail .label { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
@media (max-width: 900px) {
  .maps-split, .maps-split.no-list { grid-template-columns: 1fr; border: 0; background: transparent; min-height: 0; }
  .maps-list, .map-head .wider, .map-head .map-title, .map-head .map-dest { display: none; }
  .map-pick { display: block; width: auto; font: 700 1.25rem var(--display); border: 0; background: transparent; padding: 0; color: var(--ink); }
  .map-view { padding: 0; }
  .ticket-detail { position: fixed; top: auto; left: 0; width: auto; max-height: 70vh; border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -6px 30px rgb(0 0 0 / 0.18); z-index: 20; }
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters label.inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 0.9rem; }
.filters select { width: auto; padding: 5px 8px; background: var(--panel); }
.segmented { display: inline-flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; overflow-x: auto; }
.segmented button { border: none; border-radius: 7px; background: transparent; color: var(--ink); padding: 5px 10px; font-size: 0.85rem; white-space: nowrap; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--paper); }
button.chip.toggle { background: var(--panel); color: var(--ink); cursor: pointer; padding: 5px 9px; font-size: 0.8rem; }
button.chip.tag.toggle::before { content: none; }
button.chip.toggle[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
/* #260: a line to work already done is history, not a block. */
/* The map's menu (#260): two buttons under the drawing, each opening its own sheet. */
/* #316: pinned above the bottom bar while the page scrolls, so Map and Filter are always in reach. */

/* Notes, backlinks and promotions (#148). */
.body-field { display: grid; gap: 6px; }
.suggestions { gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.suggestions button { width: 100%; text-align: left; display: flex; gap: 6px; align-items: center; border: none; }
.suggestions button .meta { margin-left: auto; }
.card.proposal { border-color: var(--agent); background: var(--agent-soft); }
.fog-group { display: grid; gap: 6px; margin-bottom: 12px; }
.fog-group .item { border-left-color: var(--fog); }
.fog-head { justify-content: space-between; align-items: center; }
.fog-head h3 { margin: 0; font-size: 1rem; }

/* The shell (#161, built in #169): one Organization at a time, sections in a bottom bar. */
.shell.with-bar { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
.app-head { display: flex; align-items: center; gap: 10px; }
.app-head h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.org-switch { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--ink); }
.org-switch h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border: 0; border-radius: 999px;
  background: var(--urgent); color: var(--paper); font: 600 0.78rem var(--body); }
button.count { cursor: pointer; }
.account { position: relative; margin-left: auto; }
.account-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 8px; min-width: 220px; padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); }
.account-menu button { justify-self: start; }
/* Column by column: Platform and Actions on the left, Settings and Sign out on the right. */
.account-menu .menu-grid { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; gap: 8px; }
.account-menu .menu-grid button { justify-self: stretch; text-align: left; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; gap: 2px; max-width: 44rem; margin: 0 auto;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-top: 1px solid var(--line); }
.bottom-bar button { flex: 1; min-width: 0; padding: 10px 2px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 0.85rem; }
.bottom-bar button[aria-current="true"] { background: var(--ink); color: var(--paper); }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / 0.35); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; display: grid; gap: 8px; max-width: 44rem; max-height: 80vh; margin: 0 auto;
  overflow: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-radius: 16px 16px 0 0;
  box-shadow: 0 -6px 30px rgb(0 0 0 / 0.18); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head h2 { margin: 0; }
.sheet-row { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: transparent; color: var(--ink); border: 1px solid var(--line); }
.sheet-row[aria-current="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sheet-row .count { margin-left: auto; }
.sheet-row .meta { flex: none; }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: sheet-up 0.18s ease-out; } @keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } } }

/* Chat (ADR 0029, #166): a Conversation with the Agent. */
.chat, .conversation, .agent-settings { display: grid; gap: 12px; }
.turns { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.turn { display: grid; gap: 8px; }
.bubble { max-width: 88%; padding: 10px 12px; border-radius: 14px; overflow-wrap: anywhere; }
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble.mine { justify-self: end; background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.bubble.agent { justify-self: start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
/* Layout B (#183): the typing box pinned above the bottom bar, and above the phone's keyboard while it is open. */
:root { --bar-h: 58px; --keyboard: 0px; }
.bottom-bar { min-height: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); }
.composer.pinned { position: fixed; left: 0; right: 0; z-index: 9; max-width: 44rem; margin: 0 auto; display: grid; gap: 6px;
  bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); padding: 8px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.keyboard-open .composer.pinned { bottom: var(--keyboard); }
.keyboard-open .bottom-bar { display: none; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer-row textarea { flex: 1; resize: none; min-height: 42px; border-radius: 21px; padding: 10px 16px; line-height: 1.4; }
.composer .send { flex: none; width: 42px; height: 42px; padding: 0; border-radius: 50%; display: grid; place-items: center; font-size: 1.15rem; }
/* Attachments (#167): the buttons beside the box, the files about to go, and what a Turn carried. */
.composer .attach { flex: none; width: 36px; height: 42px; display: grid; place-items: center; color: var(--muted); cursor: pointer; border-radius: 10px; }
.composer .attach:hover { color: var(--ink); }
.composer .attach[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.composer .attach:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drafts { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; }
.draft { flex: none; display: flex; align-items: center; gap: 6px; max-width: 14rem; padding: 4px 4px 4px 6px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.draft img, .draft-kind { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; }
.draft-kind { display: grid; place-items: center; font: 600 0.62rem/1 var(--body); background: var(--line); color: var(--ink); }
.draft-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }
.bubble.agent.writing { opacity: 0.85; }
.bubble.agent.writing::after { content: "▍"; color: var(--muted); animation: caret 1s steps(2) infinite; }
@keyframes caret { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .bubble.agent.writing::after { animation: none; } }
.delegations { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 3px; font-size: 0.85rem; }
.created { list-style: none; margin: 0; padding: 0 0 0 4px; display: grid; gap: 3px; font-size: 0.85rem; }
.created a { color: var(--agent); }
.attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.attachments .photo { padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); display: block; }
.attachments .photo img { display: block; width: 120px; height: 120px; object-fit: cover; }
.attachments .photo.whole img { width: auto; height: auto; max-width: min(88vw, 40rem); max-height: 70vh; object-fit: contain; }
.attachments .photo.loading { width: 120px; height: 120px; }
.attachment-name { overflow-wrap: anywhere; text-align: left; }
/* Room below the page for the pinned box, so the newest message is never under it. */
.shell.with-bar:has(.composer.pinned) { padding-bottom: calc(var(--bar-h) + var(--composer-h, 76px) + 24px + env(safe-area-inset-bottom, 0px)); }
.chat .label { font: 500 0.72rem/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.conv-head { display: flex; gap: 10px; align-items: center; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--paper); padding-block: 6px; border-bottom: 1px solid var(--line); }
.conv-head .back { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.conv-title { display: grid; min-width: 0; flex: 1; }
.conv-head > button { flex: none; }
/* Filing (ADR 0030, #187): the Agent's drafts to keep, and what an archived Conversation became. */
.card.filing { border-color: var(--agent); background: var(--agent-soft); }
.drafts-to-keep { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.drafts-to-keep label.check { align-items: flex-start; }
.drafts-to-keep .draft-body { margin: 2px 0 0 26px; font-size: 0.9rem; }
.archive-link { justify-self: start; }
.filed-as ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.filed-as .label { font: 500 0.72rem/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.conv-title h2 { margin: 0; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-settings meter { width: 100%; height: 10px; }
.agent-settings .card > p { margin: 0; }

/* GFM tables in a body or a reply (#226): scrolled sideways inside their own box, never the page. */
.markdown .table-scroll { overflow-x: auto; max-width: 100%; margin: 6px 0; -webkit-overflow-scrolling: touch; }
.markdown .table-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.markdown table { border-collapse: collapse; font-size: 0.88rem; min-width: 100%; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.markdown thead th { background: var(--paper); font-weight: 600; white-space: nowrap; }
.markdown .align-center { text-align: center; }
.markdown .align-right { text-align: right; font-variant-numeric: tabular-nums; }

/* Platform (#271): the operator's page for the platform itself. */
.platform { display: grid; gap: 14px; }
.platform-status { display: flex; gap: 12px; align-items: center; }
.platform-status .big { font: 700 1.1rem var(--display); margin: 0; }
.platform-status .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--done); }
.platform-status .dot.warn { background: var(--fog); }
.platform .spend li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.platform .spend meter { grid-column: 1 / -1; width: 100%; }
.platform .spend .figures { font-variant-numeric: tabular-nums; }
/* ADR 0044 (#332): releases, keys, backup and rehearsals. What wants the operator is marked, never red unless it failed. */
.platform .card.warn { border-color: var(--fog); }
.platform .facts li:not(.card) { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.platform .facts li.warn .meta, .platform .meta.warn { color: var(--urgent); }
.platform .facts code, .platform .notice code { overflow-wrap: anywhere; }
.platform-chat { justify-self: start; }
.app-head .op { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--agent); background: var(--agent-soft); border-radius: 6px; padding: 3px 7px; }
.app-head .back { font-size: 1.2rem; padding: 2px 8px; }

/* ADR 0037 (#284): what the Agent made or changed. */
.chip.agent { color: var(--agent); border-color: var(--agent); }
.agent-changes .label { font: 500 0.72rem/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
/* ADR 0036: the text a passkey signs, shown as it is. */
.approval-text { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; }

/* Scenarios (ADR 0028, #136): a plan under a premise, shown as a layer on request and compared on its own page. */
.chip.scenario { color: var(--fog); border-color: var(--fog); }
.chip.drift { color: var(--urgent); border-color: var(--urgent); }
.card.scenario { border-color: var(--fog); }
.scenarios { display: grid; gap: 8px; margin-bottom: 12px; }
.scenarios details { margin-top: 4px; }
.compare { display: grid; gap: 8px; }
.compare .pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.compare .pair .arrow { color: var(--muted); }
.compare .pair .was { text-decoration: line-through; color: var(--muted); }
/* #312: the Agent's digest, folded under what can move. */
details.agent-changes { margin-top: 18px; }
details.agent-changes > summary { cursor: pointer; padding: 10px 0; }
/* #317: one + for a photo or a file. */
.attach-menu { position: relative; flex: none; }
.composer button.attach { font-size: 1.5rem; line-height: 1; background: transparent; border: 0; padding: 0; }
.attach-options { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20; display: grid; gap: 2px; min-width: 150px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.15); }
.attach-option { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.attach-option:hover, .attach-option:focus-within { background: var(--accent-soft); }
/* #330 (ADR 0043): why a map has nothing that can move. */
/* ADR 0045: the Agent's own work reads as a note to itself, not as the person's message. */
.bubble.own-work { background: var(--agent-soft); border-color: var(--agent); }

/* #397: waiting for the phone to approve. */
dialog.device-wait {
  max-width: 24rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 0.75rem;
  padding: 1.25rem;
}
dialog.device-wait::backdrop {
  background: rgb(0 0 0 / 0.4);
}

/* #463: Settings in sections, an index at the top, each section a heading with a hairline. */
.settings { display: grid; gap: 18px; }
.settings-index { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.settings-index a { font-weight: 500; font-size: 0.9rem; color: var(--ink); text-decoration: none; }
.settings-index a:hover { text-decoration: underline; }
.settings-section + .settings-section { border-top: 1px solid var(--line); padding-top: 14px; }
.settings-section { scroll-margin-top: 12px; }
/* #458: a pin beside a ticket on Today's frontier; pinned, it reads as on. */
li.with-aside { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
li.with-aside > .pin { order: 2; }
.pin[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 600; }
/* The console (ADR 0051, #454): a computer app, flat like the prototype's round 1 C. The background is the panel
   colour; sections are headings and hairlines; the list-and-detail panel and the fact boxes are outlined; a selection is
   pale with a thin ink bar. Scoped, so the company pages are untouched. */
.console { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 100vh; background: var(--panel); }
.console-side { display: flex; flex-direction: column; gap: 16px; padding: 16px 12px; border-right: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.console-brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px; }
.console-brand b { font-family: var(--display); font-size: 1.2rem; }
.console .op { font-size: 0.7rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; }
.console-group { display: grid; gap: 1px; }
.console .label { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; padding: 0 10px 4px; }
.console-nav { all: unset; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 0 8px 8px 0; font-weight: 500; }
.console-nav:hover { background: var(--paper); }
.console-nav[aria-current="page"] { background: var(--paper); box-shadow: inset 3px 0 0 var(--ink); }
.console-nav:focus-visible { outline: 2px solid var(--accent); }
.console-nav .count { margin-left: auto; }
.console-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; }
.console-main { padding: 22px 28px 48px; display: grid; gap: 18px; align-content: start; min-width: 0; max-width: 92rem; }
.console-main h1 { margin: 0; }
.console-main > section, .console-main > table { border-top: 1px solid var(--line); padding-top: 14px; }
.console .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.console .kpi { display: grid; gap: 2px; padding: 12px 18px; }
.console .kpi:first-child { padding-left: 0; }
.console .kpi + .kpi { border-left: 1px solid var(--line); }
.console .kpi .v { font-family: var(--display); font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.console .tasks .task { display: grid; grid-template-columns: 7rem minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.console .task .kind { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.console table { width: 100%; border-collapse: collapse; }
.console th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.8rem; padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); }
.console td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); }
.console .rows li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.console .split { display: grid; grid-template-columns: 19rem minmax(0, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 32rem; }
.console .list { display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.console .find { display: grid; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.console .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.console .chip-f { all: unset; cursor: pointer; font-size: 0.78rem; font-weight: 500; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.console .chip-f[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.console .chip-f b { margin-left: 4px; font-variant-numeric: tabular-nums; }
.console .items { overflow-y: auto; max-height: 40rem; }
.console .item { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.console .item[aria-current="true"] { background: var(--paper); box-shadow: inset 3px 0 0 var(--ink); }
.console .item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.console .pager { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.console .pager button:first-of-type { margin-left: auto; }
.console .detail { padding: 18px 22px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.console .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 10px; }
.console .fact { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 3px; }
.console .fact .label { padding: 0; }
.console .fact .v { font-weight: 600; }
.console .pill { justify-self: start; align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 500; }
.console .pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.console .pill.ok { color: var(--done); background: var(--done-soft); }
.console .pill.warn { color: var(--fog); background: var(--fog-soft); }
.console .pill.bad { color: var(--urgent); background: var(--urgent-soft); }
.console .empty-state { color: var(--muted); border-left: 2px solid var(--line); padding: 4px 0 4px 14px; max-width: 46rem; }
.console .warn { color: var(--fog); }
@media (max-width: 900px) {
  .console, .console .split { grid-template-columns: 1fr; }
  .console-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .console .kpis { grid-template-columns: 1fr 1fr; }
}
