/* 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;
    --paper: #121716; --panel: #1a2120; --ink: #e3e9e5; --muted: #98a5a1; --line: #2c3634;
    --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 as a graph in lanes (#147): the frontier is a region, not only a node colour. */
.lanes-view { display: grid; gap: 10px; }
.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; }
.focus-bar { align-items: center; }
.canvas { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: auto; max-height: min(70vh, 760px); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.canvas svg { display: block; }
.canvas text { fill: var(--ink); font-family: var(--body); }
.canvas .lane-bg { fill: var(--paper); }
.canvas .lane-title { font: 700 14px var(--display); }
.canvas .lane-dest, .canvas .n-sub { font-size: 10px; fill: var(--muted); }
.canvas .n-title { font-size: 11.5px; font-weight: 600; }
.canvas .band rect { fill: var(--accent-soft); opacity: 0.55; }
.canvas .band text { font-size: 11px; font-weight: 700; fill: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.canvas .band .band-map { fill: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.canvas .arrow { fill: var(--blocked); }
.canvas .edge { stroke: var(--blocked); stroke-width: 1.3; fill: none; opacity: 0.75; }
.canvas .edge.cross { stroke: var(--agent); stroke-dasharray: 5 4; opacity: 0.9; }
.canvas .edge.hot { stroke: var(--accent); stroke-width: 2.2; opacity: 1; }
.canvas .edge.hot.cross { stroke: var(--agent); }
/* #260: a line to work already done is history, not a block. */
.canvas .edge.hist { opacity: 0.22; stroke-width: 1; }
.canvas .arrow.hot { fill: var(--accent); }
.canvas .arrow.cross { fill: var(--agent); }
.canvas .lane-head-bg { fill: var(--paper); opacity: 0.92; }
.canvas .lane-bg.operations { fill: var(--panel); stroke: var(--line); stroke-dasharray: 1.5 3; }
/* 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. */
.map-menu { display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  position: sticky; bottom: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 5; box-shadow: 0 4px 18px rgb(0 0 0 / 0.12); }
.keyboard-open .map-menu { bottom: 8px; }
.map-menu button { flex: 1; min-width: 0; display: grid; gap: 1px; text-align: left; border: 0; border-radius: 0; background: transparent; color: var(--ink); padding: 8px 12px; }
.map-menu button + button { border-left: 1px solid var(--line); }
.map-menu small { color: var(--muted); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.map-menu span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.canvas .ref { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 1.5 3.5; stroke-linecap: round; fill: none; }
.canvas .dim { opacity: 0.18; }
.canvas .edge.dim { opacity: 0.08; }
.canvas .node { cursor: pointer; }
.canvas .node:focus { outline: none; }
.canvas .node:focus-visible .box { stroke: var(--accent); stroke-width: 3; }
.canvas .box { fill: var(--panel); stroke: var(--line); stroke-width: 1.4; }
.canvas .node.frontier .box { fill: var(--accent-soft); stroke: var(--accent); }
.canvas .node.blocked .box { fill: var(--panel); stroke: var(--blocked); stroke-dasharray: 4 3; }
.canvas .node.held .box { fill: var(--panel); stroke: var(--ink); }
.canvas .node.agent .box { fill: var(--agent-soft); stroke: var(--agent); }
.canvas .node.done .box { fill: var(--done-soft); stroke: var(--done); }
.canvas .node.dropped { opacity: 0.55; }
.canvas .node.dropped .n-title { text-decoration: line-through; }
.canvas .node.deadline .box { fill: var(--urgent-soft); stroke: var(--urgent); stroke-width: 1.8; }
.canvas .n-sub.due { fill: var(--urgent); font-weight: 600; }
.canvas .n-sub.foreign { font-style: italic; fill: var(--agent); }
.canvas .node.sel .box { stroke-width: 3; }
.canvas .tag-dot { fill: var(--tag); }
.canvas .op .box { fill: var(--panel); stroke: var(--muted); stroke-dasharray: 1.5 3; }
.canvas .op.gone { opacity: 0.6; }
.legend { font-size: 0.8rem; }

/* Creating maps and tickets (#153). */
.canvas .lane-add { cursor: pointer; }
.canvas .lane-add rect { fill: var(--panel); stroke: var(--accent); stroke-width: 1.4; }
.canvas .lane-add text { fill: var(--accent); font-size: 20px; font-weight: 600; }
.canvas .lane-add:focus { outline: none; }
.canvas .lane-add:focus-visible rect, .canvas .lane-add:hover rect { fill: var(--accent-soft); }

/* 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. */
.canvas .node.scenario .box { stroke: var(--fog); stroke-dasharray: 6 3; fill: var(--fog-soft); }
.canvas .node.scenario.deadline .box { stroke: var(--fog); }
.canvas .n-sub.scenario { font-style: italic; fill: var(--fog); }
.canvas .node.overridden .box { opacity: 0.55; }
.canvas .node.overridden .n-title { text-decoration: line-through; }
.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. */
.canvas .lane-cause { font-size: 10px; font-weight: 600; fill: var(--muted); }
/* 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);
}
