@font-face { font-family: "Instrument Serif"; src: url("/fonts/InstrumentSerif-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("/fonts/Geist-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

:root {
  --accent: #2B45E0; --accent-ink: #ffffff; --accent-soft: #e8ebfc;
  --bg: #f6f7fb; --surface: #ffffff; --ink: #14161c; --muted: #5b6070; --rule: #dde1ea;
  --mine: #2B45E0; --mine-ink: #ffffff; --theirs: #ffffff; --theirs-ink: #14161c; --notice: #eef0f5;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #6f84ff; --accent-ink: #0b0d14; --accent-soft: #1d2340;
    --bg: #0d0f15; --surface: #161922; --ink: #eceef4; --muted: #9aa0b2; --rule: #262a36;
    --mine: #3d55e8; --mine-ink: #ffffff; --theirs: #1b1f2a; --theirs-ink: #eceef4; --notice: #151822;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 16px/1.45 "Geist", -apple-system, system-ui, sans-serif; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
/* The page itself never scrolls (iPhone would drag the whole app around under the keyboard); the thread does. */
/* 22 Oct 2026: a class (set by app.js), not body:has(), which made iPhone Safari re-check the whole page on changes. */
body.in-app { position: fixed; inset: 0; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }

/* Sized to the visible screen (app.js sets its height and offset from the iPhone's visual viewport, straight on this
   element, so the keyboard never covers the box). */
.app { position: fixed; top: 0; left: 0; right: 0; height: 100dvh;
  display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: var(--bg); }

.top { position: relative; display: flex; align-items: center; gap: 10px; padding: calc(8px + env(safe-area-inset-top)) 8px 8px 14px;
  background: var(--surface); border-bottom: 1px solid var(--rule); flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); }
.who { flex: 1; min-width: 0; }
.name { font-family: "Instrument Serif", Georgia, serif; font-size: 23px; line-height: 1; }
.state { font-size: 13px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.state span { overflow: hidden; text-overflow: ellipsis; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22a06b; flex: none; }
.state.busy { color: var(--accent); } .state.busy .live-dot { background: var(--accent); animation: blink 1.2s infinite; }
.state.warn { color: #a15c00; } .state.warn .live-dot { background: #e8a33d; }
.state.bad { color: #b42318; } .state.bad .live-dot { background: #e0353b; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); fill: currentColor; flex: none; }
.icon-btn:active { background: var(--notice); }
.menu { position: absolute; right: 10px; top: calc(56px + env(safe-area-inset-top)); background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,.14); padding: 6px; z-index: 20; min-width: 240px; }
.menu button { display: block; width: 100%; text-align: left; padding: 14px 14px; border-radius: 10px; font-size: 16px; }
.menu button:active, .menu button:hover { background: var(--notice); }

/* ───── thread ───── */
.thread { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.thread-inner { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 10px 10px; }
.older { display: block; margin: 6px auto 4px; font-size: 14px; color: var(--accent); padding: 10px 16px; min-height: 44px; }
.day { text-align: center; margin: 16px 0 4px; }
.day span { display: inline-block; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--rule);
  padding: 3px 11px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.msg { margin-top: 10px; }
.msg.cont { margin-top: 3px; }
/* the time shows once per run of messages: app.js marks the one before a follow-on (was .msg:has(+ .msg.cont), which
   cost ~40 ms per new message on a long thread in Safari and froze typing/scrolling) */
.msg.nometa > .meta { display: none; }
.row { display: flex; }
.msg.me .row { justify-content: flex-end; }
.bubble { max-width: min(86%, 600px); padding: 9px 14px; border-radius: 20px; overflow-wrap: anywhere; min-width: 0;
  background: var(--theirs); color: var(--theirs-ink); border: 1px solid var(--rule); }
.msg.me .bubble { background: var(--mine); color: var(--mine-ink); border-color: transparent; border-bottom-right-radius: 6px; }
.msg.me.cont .bubble { border-top-right-radius: 8px; }
.msg.agent .bubble { border-bottom-left-radius: 6px; }
.msg.agent.cont .bubble { border-top-left-radius: 8px; }
.msg.local.waiting .bubble, .msg.local.failed .bubble { opacity: .72; }
.msg.local.failed .bubble { box-shadow: 0 0 0 2px #e0353b; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg.agent .bubble a, .notice-card a { color: var(--accent); }
.bubble code { font-family: ui-monospace, Menlo, monospace; font-size: .88em; background: rgba(127,127,127,.14); padding: 1px 4px; border-radius: 5px; }
.md p { margin: 0 0 .55em; } .md > :last-child { margin-bottom: 0; }
.md ul, .md ol { margin: .15em 0 .6em; padding-left: 1.25em; } .md li { margin: .22em 0; } .md li::marker { color: var(--muted); }
.msg.me .md li::marker { color: inherit; }
.md h4 { font-size: 1em; margin: .7em 0 .3em; } .md h4:first-child { margin-top: 0; }
.md strong { font-weight: 600; }
.clip { position: relative; }
.clip.closed { max-height: 15em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.more { display: block; width: 100%; margin: 8px 0 2px; padding: 10px; min-height: 44px; border-radius: 12px; background: var(--accent-soft);
  color: var(--accent); font-weight: 600; font-size: 15px; }
.meta { font-size: 12px; color: var(--muted); padding: 3px 8px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg.me .meta { justify-content: flex-end; }
.via::before { content: "· "; }
.rcpt { display: none; } .msg.me.last .rcpt { display: inline; }
.rcpt::before { content: "· "; }
.rcpt .warn { color: #a15c00; } .rcpt .bad { color: #b42318; font-weight: 500; }
.acts { width: 100%; display: flex; justify-content: flex-end; gap: 8px; }
.msg .bubble.media { padding: 0; background: none; border: 0; }
.bubble.media .files { margin: 0; }
.act { padding: 8px 14px; min-height: 38px; border-radius: 19px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.msg.notice { display: flex; flex-direction: column; align-items: center; }
.notice-card { width: 100%; max-width: 600px; }
.bubble.n { max-width: 100%; background: var(--notice); border-radius: 14px; font-size: 15px; }
.bubble.n::before { content: "Update"; display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.msg.notice .meta { justify-content: center; }
.vn-label { font-size: 13px; opacity: .85; margin-bottom: 4px; }
.transcript { margin-top: 8px; font-size: 14px; line-height: 1.4; border-left: 3px solid currentColor; padding-left: 9px; opacity: .92; }
.transcript span { display: block; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; opacity: .75; margin-bottom: 2px; }

/* photos and videos in fixed frames: nothing jumps while they load */
.files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.md + .files, .vn-label + .files { margin-top: 8px; }
.bubble > .files:first-child { margin-top: 0; }
.ph { display: block; width: 240px; height: 240px; max-width: 100%; border-radius: 14px; overflow: hidden; background: rgba(127,127,127,.15); }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.files.grid { display: grid; grid-template-columns: 1fr 1fr; width: 240px; max-width: 100%; }
.files.grid .ph { width: 100%; height: 118px; }
.files.grid audio, .files.grid video, .files.grid .file-chip, .files.grid .vid { grid-column: 1 / -1; }
.files audio { width: 250px; max-width: 100%; height: 44px; display: block; }
/* voice notes (30 Oct 2026): a button and a bar, not a media player per message (app.js vnHtml) */
.vn { display: flex; align-items: center; gap: 10px; width: 230px; max-width: 100%; min-height: 44px; }
.vn-play { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; color: inherit;
  background: rgba(127,127,127,.18); }
.msg.me .vn-play { background: rgba(255,255,255,.22); }
.vn-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(127,127,127,.35); position: relative; overflow: hidden; }
.msg.me .vn-bar { background: rgba(255,255,255,.35); }
.vn-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: currentColor; }
.vn-len { font-size: 13px; font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; opacity: .85; }
.vn-label + .files .vn { margin-top: -2px; }
.vid { display: block; }
.vid video { width: 200px; height: 280px; object-fit: cover; border-radius: 14px; display: block; background: #000; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  background: rgba(127,127,127,.15); color: inherit; text-decoration: none; font-size: 14px; max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.agent .bubble a.file-chip, .msg.agent .bubble a.ph { color: inherit; text-decoration: none; }
.viewer-body video { width: 100%; max-height: 80vh; display: block; margin: 0 auto; border-radius: 10px; background: #000; }

/* Stirling typing */
.typing { margin-top: 10px; }
.typing .bubble { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.typing em { font-style: normal; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .3; animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.jump-wrap { position: sticky; bottom: 8px; height: 0; display: flex; justify-content: flex-end; z-index: 4; }
.jump { transform: translateY(-100%); display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: 20px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--rule); box-shadow: 0 4px 16px rgba(0,0,0,.14); font-size: 14px; font-weight: 500; }
.jump.new { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ───── composer ───── */
.attachments { display: flex; gap: 10px; padding: 10px 12px 2px; overflow-x: auto; background: var(--surface); border-top: 1px solid var(--rule); flex: none; }
.att { position: relative; flex: none; }
.att img, .att video { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; display: block; background: #000; }
.att .file-chip { height: 72px; max-width: 170px; }
.att button { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 15px; line-height: 26px; }
.attachments:not([hidden]) + .composer { border-top: 0; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--rule); flex: none; }
.composer textarea { flex: 1; min-width: 0; resize: none; max-height: 150px; min-height: 46px; padding: 11px 16px; border-radius: 23px;
  border: 1px solid var(--rule); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.4; outline: none;
  field-sizing: content; }
.composer textarea:focus { border-color: var(--accent); }
.attach { width: 46px; height: 46px; background: var(--notice); color: var(--ink); }
.big-btn { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none;
  box-shadow: 0 2px 8px rgba(43,69,224,.3); }
.big-btn:active { transform: scale(.94); }

/* ───── voice note: big buttons, one thumb ───── */
.recording { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 14px; background: var(--surface); border-top: 1px solid var(--rule); flex: none; }
.rec-row { display: flex; align-items: center; gap: 12px; }
.rec-cancel { width: 54px; height: 54px; border-radius: 50%; background: #fdecea; color: #c62828; display: grid; place-items: center; flex: none; }
.rec-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.rec-top { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #e0353b; animation: blink 1s infinite; flex: none; }
.rec-listen { margin-left: auto; padding: 0 14px; min-height: 40px; border-radius: 20px; background: var(--notice); font-size: 14px; font-weight: 500; white-space: nowrap; }
.rec-send { width: 66px; height: 66px; }
.rec-level { height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; display: block; }
.rec-level i { display: block; height: 100%; width: 0; background: #1f9d55; transition: width .1s linear; }
.rec-warn { background: #fff4e5; color: #8a4b00; border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.35; }
.review audio { width: 100%; height: 44px; }
.rec-actions { justify-content: space-between; }
.rec-actions .rec-label { flex: 1; text-align: center; color: var(--muted); font-size: 15px; }
.rec-btn { min-height: 50px; padding: 0 24px; border-radius: 25px; background: var(--notice); font-weight: 600; font-size: 16px; }
.rec-btn.primary { background: var(--accent); color: var(--accent-ink); }

.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-size: 15px; line-height: 1.35; max-width: min(92vw, 460px);
  box-shadow: 0 8px 28px rgba(0,0,0,.22); transition: opacity .2s, transform .2s; z-index: 70; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ───── in-app file viewer (transcripts, recordings, photos): never leaves the app ───── */
.viewer { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; }
.viewer-top { display: flex; align-items: center; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 6px 6px; background: var(--surface); border-bottom: 1px solid var(--rule); }
.viewer-top .back { font-size: 17px; color: var(--accent); padding: 0 12px; min-height: 44px; font-weight: 600; white-space: nowrap; }
.viewer-top .title { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.viewer-top .share { font-size: 16px; color: var(--accent); padding: 0 12px; min-height: 44px; }
.viewer-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.viewer-body pre { white-space: pre-wrap; word-wrap: break-word; font: 14px/1.5 ui-monospace, Menlo, monospace; margin: 0; color: var(--ink); }
.viewer-body img { max-width: 100%; display: block; margin: 0 auto; border-radius: 10px; }
.viewer-body audio { width: 100%; margin-top: 20px; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-body.frame { padding: 0; }
.pdf-pages img.pdf-page { width: 100%; max-width: 900px; height: auto; margin: 0 auto 12px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; }
.viewer-body .muted { text-align: center; margin-top: 30px; }

.signed-out { height: 100dvh; display: grid; place-content: center; text-align: center; padding: 24px; }
.signed-out img { border-radius: 50%; margin: 0 auto 12px; }
.signed-out h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 40px; margin: 0 0 6px; }
.muted { color: var(--muted); }

@media (max-width: 420px) { .bubble { max-width: 88%; } .ph { width: 220px; height: 220px; } .files.grid { width: 220px; } .files.grid .ph { height: 108px; } }

/* ───── views + tab bar ───── */
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.view[hidden] { display: none !important; }
.tabs { display: flex; background: var(--surface); border-top: 1px solid var(--rule); padding: 2px 4px calc(2px + env(safe-area-inset-bottom)); flex: none; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 50px; color: var(--muted); font-size: 11px; position: relative; }
.tabs button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.on { color: var(--accent); }
.tabs .badge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 16px; height: 16px; border-radius: 8px; background: #e0353b; color: #fff;
  font-size: 10px; font-style: normal; line-height: 16px; padding: 0 4px; }
/* 3 Nov 2026 (Matt: "my icons at the bottom aren't fitting properly"): with all 8 owner tabs on, a 375 px iPhone showed
   6 and pushed Backbone + Cloud off the edge (buttons wouldn't shrink below their label). Every tab now shares the width. */
.tabs button { min-width: 0; }
.tabs button span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 440px) {
  .tabs { padding-left: 0; padding-right: 0; }
  .tabs button { font-size: 9.5px; letter-spacing: -0.2px; padding: 0 1px; }
  .tabs button svg { width: 21px; height: 21px; }
}
/* keyboard up or recording: the tab bar steps aside so the thread keeps the room */
body.kb .tabs, body.recording-on .tabs { display: none; }
body:not(.kb) .composer, body:not(.kb) .recording { padding-bottom: 8px; }
body.recording-on .recording { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

/* ───── dashboards ───── */
.dash { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.dash-inner { padding: 14px 14px 24px; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 14px 14px 12px; }
.card.inner { border: 0; padding: 4px 0 0; background: none; }
.card h3 { margin: 0 0 10px; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 21px; line-height: 1.15;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card.inner h3 { font-family: "Geist", system-ui, sans-serif; font-size: 13px; font-weight: 600; color: var(--muted); }
.card h3 small { font-family: "Geist", system-ui, sans-serif; font-size: 12px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 8px; }
.kpi { background: var(--bg); border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; }
.kpi .kv { font-family: "Instrument Serif", Georgia, serif; font-size: 30px; line-height: 1.05; }
.kpi .kl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi .ks { font-size: 11.5px; margin-top: 3px; color: var(--muted); }
.kpi.warn .kv { color: #c2410c; }
.up { color: #1d7a4e; } .down { color: #c2410c; }
.chart { width: 100%; height: 90px; display: block; }
.chart rect { fill: var(--accent); }
.chart text { font-size: 4px; fill: var(--muted); font-family: "Geist", system-ui, sans-serif; }
.note, .empty { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 6px 8px; font-size: 14px; border-radius: 8px; overflow: hidden; }
.rank li i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; border-radius: 8px; }
.rank li span { position: relative; z-index: 1; } .rank .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .rank .v { font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 4px; border-bottom: 1px solid var(--rule); }
.tbl td { padding: 8px 4px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chips span { font-size: 11px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 1px 6px; }
.seg { display: flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg); }
.stack i, .legend i { display: inline-block; } .stack .a, .legend .a { background: var(--accent); } .stack .b, .legend .b { background: #9aa8f5; } .stack .c, .legend .c { background: #c9d0f8; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.hours { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; } .hours i { height: 26px; border-radius: 3px; background: var(--accent); }
.hlab { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.banner { border-radius: 16px; padding: 14px 16px; border: 1px solid; }
.banner.ok { background: #e3f2ea; border-color: #bfe0cc; color: #14532d; }
.banner.bad { background: #fdecea; border-color: #f5c2bd; color: #7f1d1d; }
.banner ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; } .banner small { display: block; margin-top: 6px; opacity: .75; font-size: 12px; }
.checks { list-style: none; margin: 0 0 6px; padding: 0; }
.checks li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: 14px; }
.checks li:last-child { border-bottom: 0; } .checks li span { margin-left: auto; color: var(--muted); font-size: 13px; text-align: right; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.ok { background: #22a06b; } .dot.bad { background: #e0353b; } .dot.warn { background: #e8a33d; }
.stamp { text-align: center; font-size: 12px; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 10px; }
.stamp button { color: var(--accent); font-size: 12px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .banner.ok { background: #0f2a1d; border-color: #1d4a33; color: #b7e4c7; }
  :root:not([data-theme="light"]) .banner.bad { background: #2c1214; border-color: #5c2226; color: #fecaca; }
  :root:not([data-theme="light"]) .stack .b, :root:not([data-theme="light"]) .legend .b { background: #4b5bb0; }
  :root:not([data-theme="light"]) .stack .c, :root:not([data-theme="light"]) .legend .c { background: #2c3570; }
}

.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ───── add-to-home-screen guide (iPhone) ───── */
.guide { position: fixed; inset: 0; z-index: 50; background: rgba(10,12,20,.55); display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
.guide-card { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 22px 20px 18px; max-width: 420px; width: 100%; text-align: center; }
.guide-card img { border-radius: 16px; border: 1px solid var(--rule); }
.guide-card h2 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 26px; margin: 10px 0 12px; }
.guide-card ol { list-style: none; padding: 0; margin: 0 0 12px; text-align: left; }
.guide-card li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; line-height: 1.4; }
.guide-card li:last-child { border-bottom: 0; }
.guide-card li svg { vertical-align: -4px; color: var(--accent); }
.guide-card .step { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 13px; display: grid; place-items: center; font-weight: 600; }
.guide-card .warn { background: #fff4e5; color: #8a4b00; border-radius: 10px; padding: 8px 10px; font-size: 14px; }
.guide-card .small { font-size: 12.5px; margin: 0 0 14px; }
.guide-card button.primary { width: 100%; padding: 12px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-size: 16px; }
.guide-arrow { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 34px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 8px); } }

/* ───── Engine tab (27 Oct 2026) ───── */
.engine-host { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; padding: 14px 16px;
  border-radius: 16px; background: var(--accent); color: var(--accent-ink); }
.engine-host b { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 24px; display: block; line-height: 1.1; }
.engine-host small { opacity: .85; font-size: 12.5px; }
.host-stats { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; opacity: .95; }
.meter { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.3); vertical-align: middle; margin: 0 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: currentColor; }
.svc { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--rule); }
.card h3 + .svc { border-top: 0; }
.svc-main { flex: 1; min-width: 0; }
.svc-main b, .agent b { display: block; font-weight: 600; font-size: 14.5px; }
.svc-main small, .agent small { display: block; color: var(--muted); font-size: 12px; }
.svc-stats { text-align: right; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; }
.svc-stats b { color: var(--ink); font-size: 14px; }
.pod { border: 1px solid var(--rule); border-radius: 14px; padding: 12px; background: var(--bg); }
.pod + .pod { margin-top: 10px; }
.pod-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pod-head > div { flex: 1; } .pod-head b { display: block; font-size: 16px; } .pod-head small { color: var(--muted); font-size: 12px; }
.pill { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; background: #e3f6ec; color: #17784e; font-weight: 600; }
.seal { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.seal li { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.agent { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 9px 10px 9px 26px; }
.agent .dot { position: absolute; left: 10px; top: 14px; }
.agent span { display: block; font-size: 12px; margin-top: 4px; color: var(--ink); }
.pod h4 { margin: 12px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.feed li { padding: 6px 0; border-top: 1px solid var(--rule); }
.feed li:first-child { border-top: 0; animation: feedin .6s ease; }
.feed time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 8px; font-size: 12px; }
.feed b { margin-right: 6px; }
@keyframes feedin { from { background: var(--accent-soft); } to { background: transparent; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill { background: #12392a; color: #6fe0a8; } }

.pod-open { margin-top: 10px; width: 100%; padding: 10px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px; }
.pod-modal { position: fixed; inset: 0; z-index: 50; background: rgba(8,10,16,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pod-sheet { width: 100%; max-width: 520px; height: min(640px, 90dvh); background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; display: flex; flex-direction: column; overflow: hidden; }
.pod-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--rule); }
.pod-top > div { flex: 1; } .pod-top b { display: block; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 22px; } .pod-top small { color: var(--muted); font-size: 12px; }
.pod-x { font-size: 18px; padding: 6px 10px; color: var(--muted); }
.pod-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pod-hint { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 8px; }
.pm { max-width: 82%; padding: 9px 12px; border-radius: 16px; font-size: 15px; white-space: pre-wrap; }
.pm.me { align-self: flex-end; background: var(--mine); color: var(--mine-ink); border-bottom-right-radius: 5px; }
.pm.agent { align-self: flex-start; background: var(--theirs); color: var(--theirs-ink); border: 1px solid var(--rule); border-bottom-left-radius: 5px; }
.pm.typing { opacity: .6; }
.pod-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--rule); }
.pod-form input { flex: 1; font: inherit; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
.pod-form button { padding: 0 16px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }

.procs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; }
.procs li { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.procs li b { flex: 1; font-weight: 600; } .procs li span { color: var(--muted); font-size: 12px; }
.ag-line { font-size: 13px; color: var(--muted); margin-bottom: 4px; } .ag-line b { color: var(--ink); font-size: 18px; font-family: "Instrument Serif", Georgia, serif; font-weight: 400; }

.procs li { padding: 0; }
.proc { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; text-align: left; border-radius: 10px; }
.proc:hover { background: var(--accent-soft); }
.proc b { flex: 1; font-weight: 600; } .proc span { color: var(--muted); font-size: 12px; }
.proc-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.proc-role { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.proc-body h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.proc-body h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.proc-body .kv .dot { vertical-align: middle; margin-right: 4px; }
.svc[data-svc] { cursor: pointer; border-radius: 8px; } .svc[data-svc]:hover { background: var(--accent-soft); }

.days { display: flex; gap: 6px; overflow-x: auto; margin-top: 10px; }
.days button { flex: 1; min-width: 70px; padding: 7px 6px; border: 1px solid var(--rule); border-radius: 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.days button b { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: 20px; color: var(--ink); }
.days button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; } .chips span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--rule); }

/* ═════ Desktop (28 Oct 2026, Matt: "the web version of backbone hq looks like an app for a phone. it needs to look like a
   proper web version and keep that look for the phone app"). EVERY rule below sits inside a min-width: 1024px (or 1440px)
   query, so the phone layout under 1024 px is untouched. Shared with the other module stylesheets: --side-w (the left
   sidebar), module views centred at max 1280 px with 24/32 px padding, full-screen sheets as a right-hand drawer
   (min(760px, 62vw), page dimmed behind, click outside or Esc closes), small dialogs centred at max 520 px. ═════ */
@media (min-width: 1024px) {
  :root { --side-w: 240px; }

  /* shell: the bottom tab bar becomes a left sidebar; the agent's name sits on top, the ⋯ menu at the bottom */
  .app { max-width: none; margin: 0; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto 62px;
    background: linear-gradient(to right, var(--surface) calc(var(--side-w) - 1px), var(--rule) calc(var(--side-w) - 1px), var(--rule) var(--side-w), var(--bg) var(--side-w)); }
  .top { grid-column: 1; grid-row: 1; position: static; padding: 20px 16px 16px; gap: 12px; background: none; border: 0; }
  .avatar { width: 42px; height: 42px; }
  .name { font-size: 25px; }
  .menu-btn { position: absolute; left: 10px; bottom: 11px; width: calc(var(--side-w) - 20px); height: 40px; border-radius: 10px; display: flex; align-items: center;
    justify-content: flex-start; gap: 12px; padding: 0 12px; }
  .menu-btn .side-label { display: inline !important; font-size: 14px; font-weight: 500; color: var(--ink); }
  .menu-btn:hover, .menu-btn:active { background: var(--notice); }
  .menu { top: auto; right: auto; left: 10px; bottom: 56px; width: calc(var(--side-w) - 20px); min-width: 0; border-radius: 12px; }
  .menu button { padding: 9px 12px; font-size: 14px; border-radius: 8px; }
  .tabs { grid-column: 1; grid-row: 2; flex-direction: column; gap: 2px; padding: 4px 10px 8px; background: none; border: 0; overflow-y: auto; min-height: 0; }
  body.kb .tabs, body.recording-on .tabs { display: flex; }
  .tabs button { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 10px;
    font-size: 14.5px; font-weight: 500; text-align: left; }
  .tabs button svg { width: 20px; height: 20px; flex: none; }
  .tabs button span { flex: 1; display: flex; align-items: center; gap: 8px; }
  .tabs button:hover { background: var(--notice); color: var(--ink); }
  .tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .tabs .badge { position: static; margin-left: auto; }
  .view { grid-column: 2; grid-row: 1 / -1; min-width: 0; }

  /* chat: the thread and the composer in one centred reading column */
  #view-chat .thread-inner { max-width: 820px; margin: 0 auto; padding: 20px 24px 16px; }
  #view-chat .composer, #view-chat .attachments, #view-chat .recording { padding-left: max(24px, calc((100% - 772px) / 2)); padding-right: max(24px, calc((100% - 772px) / 2)); }
  #view-chat .composer { padding-top: 12px; padding-bottom: 16px; }
  #view-chat .recording { padding-bottom: 16px; }
  .older { min-height: 36px; padding: 8px 14px; border-radius: 8px; }
  .older:hover { background: var(--accent-soft); }
  .more { min-height: 38px; } .more:hover { filter: brightness(.97); }
  .act:hover, .rec-btn:hover, .rec-listen:hover { filter: brightness(.96); }
  .composer .attach:hover { background: var(--rule); }
  .big-btn:hover { filter: brightness(1.08); }
  .jump:hover { filter: brightness(.98); }
  .ph:hover img { opacity: .92; }
  .file-chip { min-height: 40px; } a.file-chip:hover { background: rgba(127,127,127,.24); }

  /* dashboards and every module view: centred, max 1280 px wide */
  .view > .dash-inner { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 32px 40px; gap: 16px; }
  .card { padding: 18px 20px 16px; }
  .card h3 { font-size: 23px; }
  .card.inner { padding: 4px 0 0; }
  .card.inner h3 { font-size: 13px; }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
  .kpi { padding: 12px 14px; }
  .kpi .kv { font-size: 34px; }
  .grid2 { gap: 16px; }
  .d-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; align-items: start; }
  .d-grid > .kpis, .d-grid > .stamp, .d-grid > .banner, .d-grid > .seg, .d-grid > .engine-host, .d-grid > .grid2, .d-grid > .full, .d-grid > .empty { grid-column: 1 / -1; }
  .d-grid > .dayfeed { order: 1; } .d-grid > .stamp { order: 2; }     /* a day's full log goes under the agent cards */
  .dash > .dash-inner > .seg { align-self: flex-start; } .dash > .dash-inner > .seg button { flex: none; padding: 8px 20px; }
  .seg button:not(.on):hover { background: var(--notice); color: var(--ink); }
  .chart { height: 120px; }
  .rank li:hover { background: var(--notice); }
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
  .tbl tr:hover td { background: var(--notice); }
  .stamp button:hover { text-decoration: underline; }
  .engine-host { padding: 18px 22px; }
  .pod { padding: 16px; }
  .agents-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .procs { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .pod-open { width: auto; padding: 10px 18px; }
  .pod-open:hover, .pod-form button:hover, .guide-card button.primary:hover { filter: brightness(1.08); }
  .pod-x:hover { color: var(--ink); background: var(--notice); border-radius: 8px; }
  .days button:hover { border-color: var(--accent); }

  /* the file viewer (transcripts, recordings, photos): a right-hand drawer over the dimmed app instead of a full screen.
     The dim layer is the drawer's own ::before, so a click on it lands on the drawer element itself (app.js closes it). */
  .viewer.fv { left: auto; width: min(760px, 62vw); background: transparent; }
  .viewer.fv::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(8, 10, 16, .45); }
  .viewer.fv > .viewer-top, .viewer.fv > .viewer-body { border-left: 1px solid var(--rule); animation: drawer-in .18s ease-out; }
  .viewer.fv .viewer-body { background: var(--bg); padding: 20px 24px; }
  .viewer-top { padding: 10px 10px 10px 8px; }
  .viewer-top .back, .viewer-top .share { min-height: 36px; border-radius: 8px; padding: 0 12px; font-size: 15px; }
  .viewer-top .back:hover, .viewer-top .share:hover { background: var(--accent-soft); }
  .viewer-top .title { font-size: 15px; font-weight: 600; color: var(--ink); }

  /* small things: centred dialogs, toasts over the main area, hover, keyboard focus */
  .guide { align-items: center; padding: 24px; }
  .guide-arrow { display: none; }
  .toast { bottom: 32px; left: calc(50% + var(--side-w) / 2); }

  .icon-btn:hover { background: var(--notice); }
  .menu button:focus-visible { outline-offset: -2px; }
  :where(button, a, input, select, textarea, summary, [tabindex], [role="button"]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}
@keyframes drawer-in { from { transform: translateX(32px); opacity: .7; } to { transform: none; opacity: 1; } }

/* 1440 px and wider: "Keep chat open" docks the chat as a 400 px panel on the right while another screen is open */
@media (min-width: 1440px) {
  .dock-btn { display: flex !important; grid-column: 1; grid-row: 3; align-items: center; gap: 12px; margin: 0 10px 2px; min-height: 40px; padding: 0 12px;
    border-radius: 10px; color: var(--muted); font-size: 14px; font-weight: 500; text-align: left; }
  .dock-btn svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .dock-btn:hover { background: var(--notice); color: var(--ink); }
  .dock-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
  body.chat-docked:not([data-view="chat"]) .app { grid-template-columns: var(--side-w) minmax(0, 1fr) 400px; }
  body.chat-docked:not([data-view="chat"]) .app > #view-chat[hidden] { display: flex !important; grid-column: 3; grid-row: 1 / -1; border-left: 1px solid var(--rule); background: var(--bg); }
  body.chat-docked:not([data-view="chat"]) #view-chat .thread-inner { padding: 14px 14px 12px; }
  body.chat-docked:not([data-view="chat"]) #view-chat .composer, body.chat-docked:not([data-view="chat"]) #view-chat .attachments,
  body.chat-docked:not([data-view="chat"]) #view-chat .recording { padding-left: 12px; padding-right: 12px; }
  body.chat-docked:not([data-view="chat"]) .toast { left: calc(var(--side-w) + (100% - var(--side-w) - 400px) / 2); }
}

/* Sign-in links (28 Oct 2026): paste box on the signed-out screen (the Home Screen app has no address bar), and the
   "Sign in on another device" card. Phone-first; nothing here changes the desktop layout. */
.so-form { display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); margin: 10px auto 4px; text-align: left; }
.so-form label { font-size: 14px; font-weight: 600; }
.so-form input, .guide-card .link-box { width: 100%; box-sizing: border-box; font: 14px ui-monospace, Menlo, monospace; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.so-form button { padding: 12px; border-radius: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 600; cursor: pointer; }
.guide-card .link-box { margin: 4px 0 10px; }
.guide-card .ghost-btn { width: 100%; padding: 10px; margin-top: 8px; border-radius: 14px; border: 1px solid var(--rule); background: transparent; color: var(--ink); font-size: 15px; }

/* Matt's own open homes: the "Start sign-in" card at the top of Chat on a day he has an open (3 Nov 2026) */
.opens-today{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:8px 12px 0;padding:10px 12px;border-radius:12px;border:2px solid var(--accent);background:var(--surface)}
.opens-today[hidden]{display:none}.opens-today>div{flex:1 1 160px;min-width:0;display:flex;flex-direction:column}.opens-today span{color:var(--muted);font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.opens-today button{min-height:40px;padding:0 14px;border-radius:10px;border:0;background:var(--accent);color:var(--accent-ink,#fff);font:inherit;font-weight:600}
.opens-today button.ghost{background:transparent;color:var(--accent);border:1px solid var(--rule)}
/* show-password eye inside every password box (password.js, 9 Nov 2026) */
.pw-eyewrap { position: relative; display: block; width: 100%; }
.pw-card .pw-eyewrap { margin-top: 6px; }
.pw-eyewrap > input { width: 100%; box-sizing: border-box; padding-right: 50px !important; margin-top: 0 !important; }
.pw-eyewrap > input::-ms-reveal, .pw-eyewrap > input::-ms-clear { display: none; }
.pw-eye { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; min-width: 44px; padding: 0 !important; margin: 0 !important;
  display: grid; place-items: center; border: 0 !important; border-radius: 10px !important; background: transparent !important; color: var(--muted) !important; cursor: pointer; box-shadow: none !important; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--ink) !important; }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 14 Nov 2026: files dragged onto the main chat (app.js addFiles), same look as the Chief of staff's drop area */
.chat-drop { position: absolute; inset: 6px; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 2px dashed var(--accent, #2563eb); border-radius: 14px; background: color-mix(in srgb, var(--bg, #fff) 88%, transparent); pointer-events: none; }
.chat-drop[hidden] { display: none; }
.chat-drop b { font-size: 17px; }
.chat-drop span { font-size: 13px; opacity: .75; max-width: 360px; }

/* 14 Nov 2026: what the Keystone chat has, in the main chat (mainchat.js): Waiting for you, Approve / Changes under a review
   link, where dropped files were filed, Ask Stirling on a Keystone record, suggestions, record links in replies */
.chat-waiting { margin: 8px 12px 0; border: 2px solid var(--accent); border-radius: 12px; background: var(--surface); }
.chat-waiting[hidden] { display: none; }
.cw-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.cw-head .cw-n { color: var(--muted); font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-dot { width: 8px; height: 8px; border-radius: 50%; background: #e8590c; flex: none; }
.cw-chev { color: var(--muted); }
.cw-list { max-height: 42vh; overflow: auto; border-top: 1px solid var(--rule); }
.cw-item { padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.cw-item:last-child { border-bottom: 0; }
.cw-t { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.cw-t span { color: var(--muted); font-size: 12px; }
.cw-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cw-ok, .cw-ghost { min-height: 40px; padding: 0 14px; border-radius: 10px; font: inherit; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; text-decoration: none; cursor: pointer; }
.cw-ok { border: 0; background: var(--accent); color: var(--accent-ink, #fff); }
.cw-ghost { border: 1px solid var(--rule); background: transparent; color: var(--accent); }
.cw-sent { color: var(--muted); font-size: 13px; }
.cw-wait { color: var(--muted); font-size: 13px; font-weight: 600; }
.cw-replacing .cw-t b { opacity: .6; }
.cw-inline { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; }
.cw-inline .cw-item { padding: 0; border: 0; }
.cw-il-t { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.pv-video { display: block; width: 100%; max-height: 60vh; margin-top: 8px; border-radius: 10px; background: #000; }
.cos .cw-item, .cw-pv .cw-item { padding: 10px 0; }
.filed { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.filed-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filed-chip { font-size: 12.5px; padding: 6px 10px; border-radius: 9px; background: color-mix(in srgb, currentColor 12%, transparent); color: inherit; text-decoration: none; }
.filed-chip.off { opacity: .8; }
.filed-go { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 9px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); background: transparent; color: inherit; cursor: pointer; }
.chat-suggest { padding: 16px 4px; color: var(--muted); }
.chat-suggest div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chat-suggest button, .sa-sugg button { min-height: 38px; padding: 6px 12px; border-radius: 18px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.krec { font: inherit; color: var(--accent); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.knote { font-weight: 600; }
.sa-input { display: flex; gap: 8px; align-items: flex-end; }
.sa-input textarea { flex: 1; min-width: 0; resize: none; min-height: 42px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.sa-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.sa-ans { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.sa-b { padding: 10px 12px; border-radius: 12px; max-width: 100%; overflow-wrap: anywhere; }
.sa-b.me { align-self: flex-end; background: var(--mine); color: var(--mine-ink); }
.sa-b.them { align-self: flex-start; background: var(--notice); color: var(--ink); }
.sa-wait { color: var(--muted); }
.sa-chat { align-self: flex-start; font: inherit; font-size: 13px; color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; }

/* 14 Nov 2026 (Lisa B): Edit / Delete under your own sent message */
.mine-acts { display: none; gap: 10px; margin-left: 8px; }
/* tap (or hover on a computer) one of your messages to show them; a message in a run shows its own line while picked */
.msg.me.sel .mine-acts, .msg.me:not(.nometa):hover .mine-acts { display: inline-flex; }
.msg.me.nometa.sel > .meta { display: flex; }
.mine-act { background: none; border: 0; padding: 4px 2px; font-size: 12px; color: var(--accent); font-weight: 600; cursor: pointer; }
.mine-act:hover { text-decoration: underline; }
.deleted-msg { font-style: italic; opacity: .7; }
