/* Donna UI. Tokens first: every colour, size and duration below comes from here (see design-system/donna/MASTER.md).
   Contrast was measured, not guessed: text >= 4.5:1, control borders and focus rings >= 3:1, in both themes. */
:root {
  /* surfaces + text */
  --bg: #f6f6fb; --card: #ffffff; --ink: #1b1b2f; --muted: #5b5b75;
  --line: #e4e4ef;            /* decorative dividers only */
  --control-line: #8a8aa3;    /* borders of inputs / ghost buttons (3:1 against bg and card) */
  /* brand */
  --accent: #5b4bf0; --accent-ink: #ffffff; --accent-text: #5b4bf0; --accent-soft: #e8e5ff;
  --me: #5b4bf0; --me-ink: #fff; --bot: #ececf6;
  /* status */
  --ok: #15764a; --ok-btn: #17804f; --warn: #8a5600; --bad: #b42335; --bad-btn: #c42b3d; --info: #2f6fdb; --on-accent: #fff;
  --st-run-bg: #dfe9ff; --st-run-ink: #1e45a8; --st-ok-bg: #d9f4e6; --st-ok-ink: #15764a;
  --st-bad-bg: #fde1e4; --st-bad-ink: #b42335; --st-warn-bg: #fff0d1; --st-warn-ink: #8a5600;
  --accent-glow: rgba(91,75,240,.25); --accent-glow2: rgba(91,75,240,.12);
  /* spacing (4/8 rhythm), radius, motion */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px;
  --t-press: 100ms; --t-fast: 150ms; --t-base: 200ms; --ease: cubic-bezier(.2, 0, 0, 1);
  --tap: 48px;                /* minimum touch target */
  --shadow: 0 1px 2px rgba(20,20,60,.06), 0 4px 16px rgba(20,20,60,.06);
  --sk-bone: #e9e9f3; --sk-hi: rgba(255,255,255,.65);   /* skeleton placeholder + shimmer highlight */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1020; --card: #181a30; --ink: #ececf8; --muted: #a3a3c0; --line: #2a2c48; --control-line: #6b6f99;
    --accent-text: #a99fff; --accent-soft: #2b2760; --bot: #20233d; --ok: #4cc58a; --warn: #ffcb6b; --bad: #ff8b98;
    --shadow: none; color-scheme: dark;
    --sk-bone: #262948; --sk-hi: rgba(255,255,255,.07);
    --info: #8fb0ff;
    --st-run-bg: #1d2b57;
    --st-run-ink: #8fb0ff;
    --st-ok-bg: #12382a;
    --st-ok-ink: #6fe0a8;
    --st-bad-bg: #4a1a22;
    --st-bad-ink: #ff8b98;
    --st-warn-bg: #4a3510;
    --st-warn-ink: #ffcb6b;
    --accent-glow: rgba(169,159,255,.3);
    --accent-glow2: rgba(169,159,255,.14);
  }
}
:root[data-theme="dark"] {
  --info: #8fb0ff; --st-run-bg: #1d2b57; --st-run-ink: #8fb0ff; --st-ok-bg: #12382a; --st-ok-ink: #6fe0a8; --st-bad-bg: #4a1a22; --st-bad-ink: #ff8b98; --st-warn-bg: #4a3510; --st-warn-ink: #ffcb6b; --accent-glow: rgba(169,159,255,.3); --accent-glow2: rgba(169,159,255,.14);
  --bg: #0f1020; --card: #181a30; --ink: #ececf8; --muted: #a3a3c0; --line: #2a2c48; --control-line: #6b6f99;
  --accent-text: #a99fff; --accent-soft: #2b2760; --bot: #20233d; --ok: #4cc58a; --warn: #ffcb6b; --bad: #ff8b98;
  --shadow: none; color-scheme: dark;
  --sk-bone: #262948; --sk-hi: rgba(255,255,255,.07);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-top: env(safe-area-inset-top, 0px);
}
#app { height: 100%; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* keyboard focus is always visible; sticky bars never hide it (scroll-padding) */
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: var(--r-sm); }
.main { scroll-padding: 72px 0 96px; }

/* icons: one family (stroke 1.75, round), sized by token, colour from the text */
.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i.sm { width: 18px; height: 18px; }
.i.lg { width: 28px; height: 28px; }
.i.fill { fill: currentColor; stroke: none; }

.hdr {
  display: flex; align-items: center; gap: 10px; padding: var(--s3) var(--s4); background: var(--bg);
  border-bottom: 1px solid var(--line); min-height: 60px;
}
.hdr h1 { font-size: 20px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .sub { font-size: 13px; color: var(--muted); font-weight: 400; display: block; }
.main { flex: 1; overflow-y: auto; padding: var(--s4); -webkit-overflow-scrolling: touch; }
.tabs {
  display: flex; border-top: 1px solid var(--line); background: var(--card);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs a {
  flex: 1; text-align: center; padding: var(--s2) var(--s1) var(--s2); text-decoration: none; color: var(--muted);
  font-size: 12px; font-weight: 500; display: flex; flex-direction: column; gap: var(--s1); align-items: center; min-height: 64px; justify-content: center;
}
.tabs a .ic { display: flex; width: 56px; height: 30px; border-radius: 15px; align-items: center; justify-content: center; transition: background-color var(--t-fast) var(--ease); }
.tabs a:active .ic { background: var(--line); }
.tabs a.on { color: var(--accent-text); font-weight: 700; }
.tabs a.on .ic { background: var(--accent-soft); }
.icon-btn {
  border: 0; background: transparent; width: var(--tap); height: var(--tap); border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink);
  transition: background-color var(--t-press) var(--ease);
}
.icon-btn:active { background: var(--line); }
@media (hover: hover) { .icon-btn:hover { background: var(--line); } }
.btn {
  border: 0; background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: var(--r-md); min-height: var(--tap);
  font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); white-space: nowrap;
  transition: filter var(--t-press) var(--ease), background-color var(--t-press) var(--ease), opacity var(--t-fast);
}
.btn:active { filter: brightness(.88); }
.btn.ghost { background: transparent; color: var(--accent-text); border: 1px solid var(--control-line); }
.btn.ghost:active { background: var(--accent-soft); filter: none; }
.btn.danger { background: var(--bad-btn); color: var(--on-accent); }
.btn.small { padding: 8px 14px; font-size: 14px; border-radius: var(--r-sm); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn[disabled]:active { filter: none; }
.btn.loading { pointer-events: none; opacity: .85; }
.btn.loading::after { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--s3); }
.pcard {
  background: var(--card); border-radius: var(--r-lg); padding: var(--s4) var(--s3) var(--s3); text-align: center; position: relative;
  box-shadow: var(--shadow); border: 1px solid var(--line); cursor: pointer; transition: background-color var(--t-press) var(--ease);
}
.pcard:active { background: var(--accent-soft); }
.pcard .pmain { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; border-radius: inherit; }
.pcard .edit { z-index: 1; }
.pcard .edit {
  position: absolute; top: 0; right: 0; width: var(--tap); height: var(--tap); color: var(--muted);
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.pcard .name { font-weight: 700; margin-top: var(--s2); }
.pcard .title { font-size: 14px; color: var(--muted); min-height: 20px; }
.pcard.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2); color: var(--muted); border-style: dashed; border-color: var(--control-line); min-height: 140px; }
.pcard.add .i { width: 32px; height: 32px; }
.av {
  width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--on-accent);
}
.av.sm { width: 36px; height: 36px; font-size: 18px; }
.av.xl { width: 110px; height: 110px; font-size: 56px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; margin-bottom: var(--s3); box-shadow: var(--shadow); }
a.card:active { background: var(--accent-soft); }
.ico { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.chev { color: var(--muted); }
.ok-badge { color: var(--ok); display: inline-flex; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 14px; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--line); color: var(--muted); font-weight: 600; }
.pill.running { background: var(--st-run-bg); color: var(--st-run-ink); }
.pill.done { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.pill.failed, .pill.cancelled { background: var(--st-bad-bg); color: var(--st-bad-ink); }
.pill.queued { background: var(--st-warn-bg); color: var(--st-warn-ink); }
label { display: block; font-size: 14px; font-weight: 600; margin: var(--s3) 0 var(--s1); color: var(--muted); }
input[type=text], input[type=email], input[type=number], input[type=search], input[type=url], input[type=password], select, textarea {
  width: 100%; padding: 12px; min-height: var(--tap); border: 1px solid var(--control-line); border-radius: var(--r-md); background: var(--card);
  transition: border-color var(--t-fast) var(--ease);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-text); }
input[type=checkbox] { -webkit-appearance: none; appearance: none; width: var(--tap); height: var(--tap); margin: 0; flex: none; position: relative; background: transparent; border: 0; cursor: pointer; }
input[type=checkbox]::before { content: ""; position: absolute; inset: 12px; border: 2px solid var(--control-line); border-radius: 6px; background: var(--card); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
input[type=checkbox]:checked::before { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { content: ""; position: absolute; left: 20px; top: 15px; width: 7px; height: 13px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
textarea { resize: vertical; min-height: 90px; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: var(--s2); }
.msg { max-width: 86%; padding: 9px 13px; border-radius: var(--r-lg); word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--me); color: var(--me-ink); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--bot); border-bottom-left-radius: 6px; }
.msg.assistant.agent { border-left: 3px solid var(--ok); }
.msg .src { font-size: 12px; opacity: .85; display: block; margin-top: 3px; }
.msg .src .i { vertical-align: -3px; }
.msg pre { background: rgba(0,0,0,.12); padding: 8px 10px; border-radius: var(--r-sm); overflow-x: auto; white-space: pre; margin: 6px 0; font-size: 13px; }
.msg code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: rgba(0,0,0,.1); padding: 1px 4px; border-radius: 5px; }
.msg pre code { background: none; padding: 0; }
.msg.user a { color: var(--on-accent); }
.note { align-self: center; font-size: 13px; color: var(--muted); background: var(--card); border: 1px solid var(--line); padding: 6px 12px; border-radius: 99px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.typing::after { content: "▍"; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.composer {
  display: flex; gap: var(--s2); padding: 10px var(--s3) calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line);
  background: var(--bg); align-items: flex-end;
}
.composer textarea { min-height: var(--tap); max-height: 140px; border-radius: 24px; padding: 12px 16px; resize: none; }
.send { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); flex: none; display: inline-flex; align-items: center; justify-content: center; transition: filter var(--t-press) var(--ease); }
.send:active { filter: brightness(.88); }
.send[disabled] { opacity: .45; cursor: not-allowed; }
.login { margin: auto; width: min(380px, 100%); padding: var(--s5) var(--s4); text-align: center; }
.login .logo { width: 88px; height: 88px; border-radius: 24px; margin-bottom: 14px; }
.login input { text-align: center; font-size: 18px; margin: 14px 0 10px; }
.code { letter-spacing: 8px; font-size: 26px !important; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  background: #222; color: var(--on-accent); padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 50; max-width: 90vw;
}
.call {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; align-items: center; background: var(--bg);
  padding: calc(24px + env(safe-area-inset-top, 0px)) var(--s4) calc(24px + env(safe-area-inset-bottom, 0px));
}
.call .who { margin-top: 4vh; text-align: center; }
.call .state { color: var(--muted); margin-top: 6px; min-height: 22px; }
.call .ring { border-radius: 50%; padding: 10px; transition: box-shadow var(--t-base); }
.call .ring.talk { box-shadow: 0 0 0 10px var(--accent-glow), 0 0 0 22px var(--accent-glow2); }
.call .live { flex: 1; width: 100%; max-width: 560px; overflow-y: auto; margin: var(--s4) 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.call .live .l { padding: 6px 10px; border-radius: var(--r-md); max-width: 92%; }
.call .live .l.user { align-self: flex-end; background: var(--me); color: var(--on-accent); }
.call .live .l.assistant { align-self: flex-start; background: var(--bot); }
.call .btns { display: flex; gap: 22px; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--control-line); background: var(--card); color: var(--ink); box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center; transition: filter var(--t-press) var(--ease), background-color var(--t-fast); }
.round:active { filter: brightness(.9); }
.round.end { background: var(--bad-btn); color: var(--on-accent); border: 0; }
.round.end .i { transform: rotate(135deg); }
.round.ok { background: var(--ok-btn); color: var(--on-accent); border: 0; }
.round.off { background: var(--line); }
.log { font: 12.5px/1.5 ui-monospace, Consolas, monospace; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; max-height: 50vh; overflow: auto; }
.log .t { color: var(--ink); white-space: pre-wrap; margin-bottom: 6px; }
.log .tool { color: var(--accent-text); margin-bottom: 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px var(--s4); }
.sw { position: relative; width: 56px; height: var(--tap); flex: none; }
.sw input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; z-index: 1; }
.sw i { position: absolute; left: 2px; right: 2px; top: 8px; bottom: 8px; background: var(--control-line); border-radius: 99px; transition: background-color var(--t-base) var(--ease); }
.sw i::after { content: ""; position: absolute; width: 24px; height: 24px; left: 4px; top: 4px; background: var(--on-accent); border-radius: 50%; transition: transform var(--t-base) var(--ease); }
.sw input::before, .sw input::after { content: none; }
.sw input:checked + i { background: var(--accent); }
.sw input:checked + i::after { transform: translateX(20px); }
.sw input:focus-visible + i { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.mem { display: flex; gap: var(--s2); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }

.msg.assistant { white-space: normal; }
.msg p { margin: 0 0 .55em; } .msg p:last-child { margin-bottom: 0; }
.msg h4 { margin: .7em 0 .3em; font-size: 1em; } .msg h4:first-child { margin-top: 0; }
.msg ul, .msg ol { margin: .3em 0 .55em; padding-left: 1.3em; }
.msg hr { border: 0; border-top: 1px solid var(--line); margin: .6em 0; }
.tbl { overflow-x: auto; margin: .4em 0 .6em; max-width: 100%; }
.msg table { border-collapse: collapse; font-size: 12.5px; white-space: normal; }
.msg th, .msg td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.msg th { background: rgba(0,0,0,.06); }
.call .live details.agentres { max-width: 100%; width: 100%; background: transparent; padding: 0; }
.call .live details.agentres summary { cursor: pointer; padding: 10px 12px; border-radius: var(--r-md); background: var(--bot); display: inline-flex; gap: 6px; align-items: center; font-size: 14px; min-height: 44px; }
.call .live .mdbox { max-width: 100%; margin-top: 6px; max-height: 40vh; overflow: auto; font-size: 14px; }
.msg table { width: max-content; min-width: 100%; white-space: nowrap; }
.msg td { white-space: normal; min-width: 5.5em; max-width: 16em; }
.msg td:first-child, .msg th { white-space: nowrap; }
.msg.assistant.agent { max-width: 98%; }

/* motion: respect the system setting (no blinking cursor, no springy transitions) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .typing::after { animation: none; }
}

/* short screens (landscape phones): compact bars so the content keeps most of the height */
@media (max-height: 520px) {
  .hdr { min-height: 52px; padding-block: var(--s2); }
  .tabs a { flex-direction: row; gap: var(--s2); min-height: 52px; padding-block: 0; }
  .tabs a .ic { width: 44px; height: 28px; }
}

.caps { margin: 4px 0 10px; padding-left: 20px; font-size: 14px; color: var(--ink); }
.caps li { margin: 3px 0; }
.caps.no li { color: var(--muted); }

/* ---------- Ask cards and shared console styles (ask.js, agents page). Colours come from the tokens, so it follows the app's light/dark theme. ---------- */
#app.wide { max-width: 1240px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.dv { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dv-tabs { display: flex; gap: var(--s1); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); overflow-x: auto; }
.dv-tabs button { flex: none; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--s3); border: 1px solid transparent; border-radius: 99px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.dv-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.dv-n:not(:empty) { background: var(--accent); color: var(--on-accent); font-size: 12px; min-width: 20px; padding: 0 6px; border-radius: 99px; text-align: center; }
.dv-cols { flex: 1; min-height: 0; display: flex; }
.dv-stream { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.dv-feed { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: var(--s2); }
.dv-feed > * { flex: none; }
.dv-side { display: none; flex: 1; min-width: 0; overflow-y: auto; padding: var(--s3); }
.dv-panel { display: none; }
.dv[data-tab="stream"] .dv-stream { display: flex; }
.dv:not([data-tab="stream"]) .dv-stream { display: none; }
.dv:not([data-tab="stream"]) .dv-side { display: block; }
.dv[data-side="plan"] #p-plan, .dv[data-side="agents"] #p-agents, .dv[data-side="changes"] #p-changes, .dv[data-side="threads"] #p-threads { display: block; }
@media (min-width: 900px) {
  .dv-tabs button[data-t="stream"] { display: none; }
  .dv .dv-stream, .dv:not([data-tab="stream"]) .dv-stream { display: flex; }
  .dv .dv-side, .dv:not([data-tab="stream"]) .dv-side { display: block; flex: 0 0 380px; border-left: 1px solid var(--line); }
}
.dv-job { align-self: stretch; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.dv-job[data-status="running"] { border-color: var(--info); }
.dv-jh { width: 100%; min-height: var(--tap); display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3); background: transparent; border: 0; text-align: left; }
.dv-jt { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-jm { font-size: 12px; padding: 0 var(--s3) var(--s2); }
.dv-job.shut .dv-jm { display: none; }
.dv-jh .i { transition: transform var(--t-fast) var(--ease); }
.dv-job.shut .dv-jh .i { transform: rotate(-90deg); }
.dv-job.shut .dv-jb, .dv-job.shut .dv-jr { display: none; }
.dv-jb { padding: 0 var(--s3) var(--s2); display: flex; flex-direction: column; gap: 6px; }
.dv-t { font-size: 14px; } .dv-t p { margin: 0 0 .4em; }
.dv-err { max-height: 240px; overflow: auto; overflow-wrap: anywhere; margin: 0 var(--s3) var(--s3); padding: 8px 10px; border-radius: var(--r-sm); background: var(--st-bad-bg); color: var(--st-bad-ink); font-size: 13px; white-space: pre-wrap; }
.dv-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--control-line); flex: none; }
.dv-job[data-status="running"] .dv-dot, .dv-dot.running { background: var(--info); animation: dvpulse 1.4s ease-in-out infinite; }
.dv-job[data-status="done"] .dv-dot, .dv-dot.done { background: var(--ok); }
.dv-job[data-status="failed"] .dv-dot, .dv-dot.failed, .dv-dot.cancelled { background: var(--bad); }
.dv-dot.queued { background: var(--warn); }
@keyframes dvpulse { 50% { opacity: .35; } }
.dv-tool { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: 13px; }
.dv-tool > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer; list-style: none; }
.dv-tool > summary::-webkit-details-marker { display: none; }
.dv-tool .dv-hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.dv-st { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--control-line); }
.dv-tool.run .dv-st { background: var(--info); animation: dvpulse 1.2s ease-in-out infinite; }
.dv-tool.ok .dv-st { background: var(--ok); }
.dv-tool.bad .dv-st { background: var(--bad); }
.dv-tool.bad { border-color: var(--bad); }
.dv-cnt { display: inline-flex; gap: 6px; font: 12px ui-monospace, Consolas, monospace; flex: none; }
.dv-cnt .a { color: var(--ok); font-style: normal; } .dv-cnt .d { color: var(--bad); font-style: normal; }
.dv-tb { padding: 0 10px 10px; }
.dv-pre, .dv-cmd { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--card); border: 1px solid var(--line); font: 12px/1.45 ui-monospace, Consolas, monospace; overflow-x: auto; white-space: pre; max-height: 260px; overflow-y: auto; }
.dv-cmd { color: var(--accent-text); }
.dv-diff { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-sm); overflow-x: auto; font: 12px/1.45 ui-monospace, Consolas, monospace; }
.dv-ln { display: flex; gap: 8px; padding: 0 8px; white-space: pre; min-width: max-content; }
.dv-ln.add { background: var(--st-ok-bg); color: var(--st-ok-ink); } .dv-ln.del { background: var(--st-bad-bg); color: var(--st-bad-ink); }
.dv-ag { display: flex; align-items: center; gap: 4px; }
.dv-agb { flex: 1; min-width: 0; min-height: var(--tap); display: flex; align-items: center; gap: var(--s2); background: transparent; border: 0; text-align: left; padding: 4px 0; }
.dv-agb .grow { min-width: 0; } .dv-agb b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-sub { display: block; font-size: 12px; }
.dv-x { width: var(--tap); height: var(--tap); flex: none; }
.dv-plan { margin: 6px 0 0; padding-left: 1.3em; font-size: 14px; }
.dv-plan li.completed { color: var(--muted); text-decoration: line-through; } .dv-plan li.in_progress { font-weight: 700; }
.dv-file { display: flex; gap: var(--s2); align-items: center; min-height: 36px; font-size: 13px; } .dv-fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; }
.dv-th { width: 100%; text-align: left; cursor: pointer; } .dv-th .grow { min-width: 0; } .dv-th .dv-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-thread { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); max-height: 60vh; overflow-y: auto; }
.dv-tm { padding: 8px 10px; border-radius: var(--r-sm); background: var(--bot); font-size: 14px; } .dv-tm.user { background: var(--accent-soft); }
.dv-tm p { margin: .3em 0 0; }
.send.stop { background: var(--bad-btn); }
@media (prefers-reduced-motion: reduce) { .dv-dot, .dv-tool.run .dv-st { animation: none; } }

.dv-appr { align-self: stretch; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.dv-appr.pending { border: 2px solid var(--warn); }
.dv-appr.approved { border-color: var(--ok); } .dv-appr.rejected, .dv-appr.expired { border-color: var(--control-line); }
.dv-ah { display: flex; align-items: center; gap: var(--s2); }
.dv-aico { display: inline-flex; width: 36px; height: 36px; border-radius: 50%; align-items: center; justify-content: center; background: var(--st-warn-bg); color: var(--st-warn-ink); flex: none; }
.dv-appr.approved .dv-aico { background: var(--st-ok-bg); color: var(--st-ok-ink); }
.dv-appr.rejected .dv-aico, .dv-appr.expired .dv-aico { background: var(--bot); color: var(--muted); }
.dv-abtns { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; }
.dv-abtns .btn { min-height: var(--tap); }
.dv-files { display: flex; flex-direction: column; }
.dv-patch .dv-ln.meta { color: var(--muted); } .dv-patch .dv-ln.ctx { color: var(--ink); }
.dv-apbar { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: 6px var(--s3); border: 0; border-top: 2px solid var(--warn); background: var(--st-warn-bg); color: var(--st-warn-ink); font-weight: 600; text-align: left; }
.dv-apbar b { margin-left: auto; text-decoration: underline; }
.dv-n.dv-warn:not(:empty) { background: var(--st-warn-bg); color: var(--st-warn-ink); border: 1px solid var(--warn); }
.dv-redir { padding: 0 0 var(--s2); } .dv-redir textarea { min-height: 64px; margin-bottom: var(--s2); }
.dv-x { color: var(--bad); }
.dv-ag .btn.small, .dv-agm .btn.small { min-height: 44px; padding: 6px 12px; }
.dv-tg { width: var(--tap); height: var(--tap); flex: none; }
.dv-tg[aria-expanded="true"] .i { transform: rotate(180deg); }
.dv-agm { font-size: 13px; padding: 0 0 var(--s2); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); overflow-wrap: anywhere; }
.dv-agb .dv-sub { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 440px) { .dv-tabs button .i { display: none; } .dv-tabs button { padding: 0 10px; } }

.dv-ctl { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); }
.dv-mode { display: flex; width: 100%; }
.dv-mode button { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 4px var(--s2); border: 1px solid var(--control-line); background: transparent; color: var(--muted); font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.2; }
.dv-mode button small { font-size: 12px; font-weight: 500; }
.dv-mode button:first-of-type { border-radius: 99px 0 0 99px; } .dv-mode button:nth-of-type(2) { border-radius: 0 99px 99px 0; margin-left: -1px; }
.dv-mode button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dv[data-mode="plan"] .dv-ctl { background: var(--st-warn-bg); }
.dv-todos { padding: 4px var(--s3); }
.dv-todo { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 4px 0; border-bottom: 1px solid var(--line); } .dv-todo:last-child { border-bottom: 0; }
.dv-tick { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 2px solid var(--control-line); background: transparent; color: var(--on-accent); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.dv-todo.in_progress .dv-tick { border-color: var(--info); color: var(--info); } .dv-todo.done .dv-tick { background: var(--ok); border-color: var(--ok); }
.dv-todo.blocked .dv-tick { border-color: var(--bad); color: var(--bad); }
.dv-todo.done .dv-ttxt { color: var(--muted); text-decoration: line-through; }
.dv-mv.dn .i { transform: none; } .dv-mv:not(.dn) .i { transform: rotate(180deg); } .dv-mv[disabled] { opacity: .3; }
.dv-note { width: 100%; }

.dv-qchip { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: 6px var(--s3); border: 0; border-top: 2px solid var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; text-align: left; }
.dv-qchip b { margin-left: auto; text-decoration: underline; }
.dv-qsheet { position: absolute; left: 0; right: 0; bottom: calc(var(--tap) + 20px); z-index: 5; max-height: 78%; display: flex; flex-direction: column; background: var(--card); border: 2px solid var(--accent); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -8px 24px rgba(20,20,60,.18); }
.dv-qh { display: flex; align-items: center; gap: var(--s2); padding: 4px var(--s3); border-bottom: 1px solid var(--line); min-height: var(--tap); }
.dv-qb { overflow-y: auto; padding: var(--s2) var(--s3); flex: 1; }
.dv-qf { display: flex; gap: var(--s2); justify-content: flex-end; padding: var(--s2) var(--s3); border-top: 1px solid var(--line); }
.dv-q { border: 0; padding: 0; margin: 0 0 var(--s3); min-width: 0; } .dv-q legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.dv-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); margin-right: 4px; }
.dv-opt { display: flex; align-items: flex-start; gap: var(--s2); min-height: var(--tap); padding: 8px var(--s2); border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 6px; cursor: pointer; }
.dv-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dv-opt input[type="radio"], .dv-opt input[type="checkbox"] { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.dv-rec { font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 99px; background: var(--st-ok-bg); color: var(--st-ok-ink); }
.dv-other { width: 100%; margin-top: 4px; min-height: 40px; }
.dv-qcard .dv-sub { display: block; }
.dv-opt input[type="radio"], .dv-opt input[type="checkbox"] { appearance: auto; -webkit-appearance: auto; padding: 0; min-height: 0; border: 0; background: none; }

/* ---------- Talk via Donna: Inbox and Connections (inbox.js) ---------- */
.msg.unread { box-shadow: inset 4px 0 0 var(--accent); }
.btn.ghost.danger-text { color: var(--bad); border-color: var(--bad); }
.hdr .icon-btn { position: relative; }
.hdr .icon-btn .dv-n { position: absolute; top: 2px; right: 0; }

/* ---------- Phone cleanup (phone.js): the inventory browser, the apply sheet and the cleaner's cards ---------- */
.linkbtn { background: none; border: 0; color: var(--accent-text); text-decoration: underline; padding: 8px 4px; min-height: 40px; font: inherit; }
.ph-perms { padding: 6px var(--s3); }
.ph-ph { width: 100%; min-height: var(--tap); display: flex; align-items: center; gap: var(--s2); background: transparent; border: 0; text-align: left; }
.ph-ph[aria-expanded="true"] .i { transform: rotate(180deg); }
.ph-sumc .ph-bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 4px; } .ph-bar i { display: block; height: 100%; background: var(--accent); }
.ph-stats { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: 8px; font-size: 14px; }
.ph-tabs { display: flex; gap: var(--s1); overflow-x: auto; margin: var(--s3) 0 var(--s2); }
.ph-tabs button { flex: none; min-height: 44px; padding: 0 var(--s4); border-radius: 99px; border: 1px solid var(--control-line); background: transparent; color: var(--muted); font-weight: 700; }
.ph-tabs button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ph-cardbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: 8px var(--s3); margin-bottom: var(--s2); border-radius: var(--r-md); background: var(--accent-soft); }
.ph-tools { display: flex; gap: var(--s2); margin-bottom: var(--s2); } .ph-tools { flex-wrap: wrap; } .ph-tools input { flex: 1 1 100%; min-width: 0; border-radius: var(--r-sm); } .ph-tools select { flex: 1 1 40%; width: auto; min-width: 0; }
.ph-acts { margin-top: 10px; flex-wrap: wrap; gap: var(--s2); }
.ph-chips { display: flex; gap: var(--s2); overflow-x: auto; padding: 2px 0 var(--s2); }
.ph-chip { flex: none; min-height: 40px; padding: 0 var(--s3); border-radius: 99px; border: 1px solid var(--control-line); background: transparent; color: var(--ink); font-size: 14px; }
.ph-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.ph-count { padding: 4px 2px 8px; }
.ph-grp { padding: 10px 2px 4px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.ph-row { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); }
.ph-ck { width: var(--tap); height: 56px; display: flex; align-items: center; justify-content: center; flex: none; }
.ph-main { flex: 1; min-width: 0; min-height: 56px; display: flex; align-items: center; gap: var(--s3); background: transparent; border: 0; text-align: left; padding: 6px 0; }
.ph-av { width: 38px; height: 38px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
.ph-main .grow { min-width: 0; } .ph-nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-sub { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-rk { flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.ph-rk.low { background: var(--st-ok-bg); color: var(--st-ok-ink); } .ph-rk.medium { background: var(--st-warn-bg); color: var(--st-warn-ink); }
.ph-rk.protected { background: var(--bot); color: var(--muted); }
@media (max-width: 440px) { .ph-main .ph-rk { display: none; } }
.ph-row.prot .ph-av { opacity: .6; }
.ph-actionbar { position: sticky; bottom: 0; display: flex; align-items: center; gap: var(--s2); padding: 8px var(--s3); margin: 8px calc(-1 * var(--s3)) 0; background: var(--card); border-top: 2px solid var(--accent); box-shadow: 0 -6px 18px rgba(20,20,60,.14); z-index: 3; }
.ph-ov { position: fixed; inset: 0; z-index: 60; background: rgba(10,10,30,.55); display: flex; align-items: flex-end; justify-content: center; }
.ph-sheet { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--card); border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s4) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom, 0px)); }
.ph-sheet h2 { margin-bottom: var(--s2); }
.ph-sum { padding-left: 1.2em; margin: var(--s2) 0; } .ph-sum li { margin-bottom: 6px; }
.ph-det summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; } .ph-names { max-height: 30vh; overflow: auto; padding-left: 1.2em; font-size: 14px; }
.ph-btns { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; margin-top: var(--s3); } .ph-btns .btn { min-height: var(--tap); }
.ph-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s3); margin: var(--s3) 0; font-size: 14px; } .ph-facts dt { color: var(--muted); } .ph-facts dd { margin: 0; overflow-wrap: anywhere; }
.ph-card { max-width: 100%; align-self: stretch; }
.ph-clist { margin-top: var(--s2); } .ph-crow { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); border-top: 1px solid var(--line); }
.ph-crow .grow { min-width: 0; } .ph-crow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) { .ph-ov { align-items: center; } .ph-sheet { border-radius: var(--r-lg); } }

/* ---------- Files and photos shared to Donna (files.js) ---------- */
.fchips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: 6px; }
.fthumb img { display: block; max-width: 220px; max-height: 220px; border-radius: var(--r-md); border: 1px solid var(--line); }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px; background: var(--bot); color: var(--ink); text-decoration: none; font-size: 14px; max-width: 100%; }
.fchip.gone { color: var(--muted); text-decoration: line-through; }
.msg.user .fchip { background: rgba(255,255,255,.2); color: var(--me-ink); }
.fpending { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 6px var(--s3) 0; }
.fwho { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0; }
.fwho-b { min-height: var(--tap); display: inline-flex; align-items: center; gap: var(--s2); padding: 4px 12px 4px 6px; border-radius: 99px; border: 1px solid var(--control-line); background: transparent; }
.fwho-b[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* ---------- Agents running elsewhere (app.js: pageAgents / pageExtAgent) ---------- */
.ext-h { margin: var(--s5) 0 2px; font-size: 18px; }
.ext-sub { font-size: 13px; margin-bottom: var(--s2); }
.ext-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--control-line); flex: none; vertical-align: middle; }
.ext-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--st-ok-bg); }
.ext-card.off { opacity: .72; }
.ext-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ext-head b { flex: 0 0 auto; max-width: 55%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext-chip { flex: 0 1 auto; min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .ext-chip { max-width: 55%; flex: 0 1 auto; }
#et { flex: 0 0 auto; max-width: 60%; }
.ext-read { display: block; font-size: 12px; opacity: .85; margin-top: 2px; }
.ext-read.ok { font-weight: 700; opacity: 1; } .ext-read.wait { font-style: italic; }
.ext-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ext-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ext-top { padding: var(--s3) var(--s3) 0; flex: none; }
.ext-log { max-height: 28vh; margin-top: var(--s2); }
.ext-note { text-align: center; font-size: 13px; padding: 4px var(--s3); flex: none; }
.ext-quick { display: flex; gap: var(--s2); padding: 4px var(--s3); flex: none; flex-wrap: wrap; }
.ext-quick .btn { min-height: 40px; }
.ext-quick[hidden] { display: none; }

/* ---------- Reply-to (app.js: quoteHtml / replyBar / wireReplies; used by the inbox thread and the agent screen) ---------- */
.qt { display: flex; flex-direction: column; gap: 1px; width: 100%; max-width: 100%; text-align: left; border: 0; border-left: 3px solid var(--accent); border-radius: 8px;
  background: rgba(127,127,127,.16); padding: 5px 9px; margin: 0 0 6px; font: inherit; color: inherit; cursor: pointer; white-space: normal; line-height: 1.3; }
.msg.user .qt { background: rgba(255,255,255,.2); border-left-color: var(--on-accent); color: var(--me-ink); }
.qt-who { font-size: 12px; font-weight: 700; opacity: .9; }
.qt-txt { font-size: 13px; opacity: .9; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.msg .src .rp { min-height: 32px; padding: 2px 10px; font-size: 12px; margin-left: 6px; vertical-align: middle; }
.qbar { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3) 0; background: var(--bg); flex: none; }
.qbar .qt { margin: 0; flex: 1; min-width: 0; cursor: default; }
.qbar .qt-txt { -webkit-line-clamp: 1; }
.msg.hl { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Loaders (app.js: withLoader / skeletonHtml / busy). Skeletons copy the real cards' radius, padding and gap. ---------- */
.ld { width: 100%; }
.ld-cover { position: absolute; inset: 0; z-index: 4; background: var(--bg); overflow: hidden; padding: var(--s4); }
.ld .card { box-shadow: none; }
.sk-b { display: block; background-color: var(--sk-bone); background-image: linear-gradient(90deg, transparent 0, var(--sk-hi) 50%, transparent 100%);
  background-size: 55% 100%; background-repeat: no-repeat; background-position: -80% 0; border-radius: 8px; animation: sk-shimmer 1.5s ease-in-out infinite; }
@keyframes sk-shimmer { to { background-position: 180% 0; } }
.sk-l { height: 14px; margin: 6px 0; } .sk-l.s { height: 11px; }
.w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w75 { width: 75%; } .w90 { width: 90%; }
.sk-av { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.sk-pill { width: 54px; height: 22px; border-radius: 99px; flex: none; }
.sk-btn { width: 92px; height: 34px; border-radius: var(--r-sm); }
.sk-bubble { height: 44px; border-radius: var(--r-lg); border-bottom-left-radius: 6px; width: 62%; margin-bottom: var(--s2); }
.sk-bubble.me { align-self: flex-end; margin-left: auto; border-bottom-left-radius: var(--r-lg); border-bottom-right-radius: 6px; width: 48%; }
.sk-bubble.tall { height: 76px; } .sk-bubble.wide { width: 78%; }
.sk-log { height: 150px; border-radius: var(--r-md); margin-top: var(--s2); }
.ld-note { text-align: center; color: var(--muted); font-size: 14px; padding: var(--s3) var(--s4) 0; }
.ld-err { text-align: center; padding: var(--s5) var(--s4); color: var(--muted); }
.ld-err .ld-msg { color: var(--ink); font-weight: 600; margin-bottom: var(--s1); }
.ld-err .ld-why { font-size: 13px; margin-bottom: var(--s3); overflow-wrap: anywhere; }
.ld-err .btn, .ld-note .btn { margin-top: var(--s3); }
/* small inline spinner for buttons and actions: <span class="spinner"></span>, or button.loading (see busy()) */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; flex: none; }
/* route-level page skeleton (header + list) shown when a page fetches before it can draw */
.sk-hdr { display: flex; align-items: center; gap: 10px; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); min-height: 60px; background: var(--bg); }
.sk-hdr .sk-b.t { height: 20px; width: 40%; }
@media (prefers-reduced-motion: reduce) {
  .sk-b { animation: none !important; background-image: none; }
  .spinner, .btn.loading::after, #boot i { animation: none !important; }
}

/* Agent report: the verdict (3 lines) first and bold, the details collapsed after it */
.verdict { margin: 4px 0 8px; padding: 8px 10px; border-left: 3px solid var(--accent); border-radius: var(--r-sm); background: var(--accent-soft); }
.verdict > b { display: block; }
.verdict > div { margin-top: 2px; }
.av-head { margin: 0 0 4px; }
details.av-rest { margin-top: 6px; }
details.av-rest > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); }

/* replay: Play on a message, one audio at a time */
.msg .src .pl { min-height: 32px; padding: 2px 10px; font-size: 12px; margin-left: 6px; vertical-align: middle; }
.msg .src .pl .i { vertical-align: -3px; }
.pl.playing, #playall.playing { color: var(--accent); }
/* research plan card */
.rs-card { display: flex; flex-direction: column; gap: var(--s2); max-width: 100%; }
.rs-q { font-weight: 600; }
.rs-plan { margin: 0; padding-left: 1.3em; font-size: 14px; }
.rs-btns { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; } .rs-btns .btn { min-height: var(--tap, 48px); }

/* All approved (away mode) */
.dv-aa { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 52px; }
.dv-aa-t { display: flex; flex-direction: column; min-width: 0; }
.dv-aa-line { display: flex; align-items: center; gap: var(--s2); min-height: 44px; flex-wrap: nowrap; }
.dv-aa select { min-height: 44px; }
.dv-aa select[hidden] { display: none; }
.dv-aa .dv-aa-state { font-weight: 600; font-size: 13px; color: var(--muted); }
.dv-more { flex-basis: 100%; }
.dv-more > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; }
.dv-more > summary::-webkit-details-marker { display: none; }
.dv-more > summary::after { content: "\00a0\203a"; }
.dv-more[open] > summary::after { content: "\00a0\2304"; }
.dv-more p { margin: 0 0 var(--s2); }
.dv-more p:empty { display: none; }
.dv-hold { margin-top: var(--s2); padding: 6px var(--s3); border-left: 3px solid var(--accent); background: var(--st-warn-bg); font-size: 14px; }

/* UI/UX audit 2026-10-12 */
@media (max-width: 440px) { .hdr { gap: 4px; padding-inline: 8px; } .hdr .av.sm { display: none; } }
.ph-ck, .ph-crow { margin: 0; }
.tbl table { border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.msg .src .pl, .msg .src .rp { position: relative; }
.msg .src .pl::after, .msg .src .rp::after { content: ""; position: absolute; inset: -8px -4px; }
.dv-ag { flex-wrap: nowrap; }
.send.stop { margin-right: var(--s2); }

/* ---- Practice (Phase 2) ---- */
.pr-nav { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.pr-nav a { white-space: nowrap; padding: 11px 14px; min-height: 44px; box-sizing: border-box; display: inline-flex; align-items: center; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-size: 14px; background: var(--card); }
.pr-nav a.on { background: #5a49e8; color: #fff; border-color: #5a49e8; }
.pr-filters select { flex: 1 1 30%; min-width: 0; }
.pr-card { display: block; text-decoration: none; color: inherit; }
.pr-wrap { margin-bottom: 8px; }
.pr-wrap .pr-card { margin-bottom: 4px; }
.pr-dim .pr-card { opacity: .55; }
.pr-hide, .pr-manage { min-height: 44px; min-width: 44px; }
.pr-hide { width: 100%; }
.pr-manage { margin: 4px 0 8px; }
.pr-desc { margin-top: 6px; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pill.pr-easy { background: #d9f4e6; color: var(--ok); } .pill.pr-medium { background: #fff0d1; color: var(--warn); } .pill.pr-hard { background: #fde1e4; color: var(--bad); }
.pr-persona { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; margin: 0; color: var(--ink); font-weight: 400; font-size: 15px; }
.pr-persona input { margin-top: 4px; }
.pr-goal { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; text-decoration: none; color: inherit; }
.pr-bar { height: 6px; border-radius: 99px; background: var(--line); margin: 4px 0; } .pr-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.pr-big { font-size: 24px; font-weight: 700; min-width: 44px; text-align: center; color: var(--accent-text); } .pr-big.xl { font-size: 44px; } .pr-big small { font-size: 14px; color: var(--muted); }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-bottom: 12px; }
.pr-m { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.pr-m b { display: block; font-size: 20px; } .pr-m span { font-size: 12px; color: var(--muted); }
.pr-line { padding: 8px 10px; border-radius: 12px; margin-top: 8px; cursor: pointer; background: var(--bot); font-size: 15px; }
.pr-line.u { background: rgba(109,94,252,.14); } .pr-line:active { outline: 2px solid var(--accent); }
.pr-sub { background: var(--bg); box-shadow: none; }
.pr-timer { font-size: 28px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.pr-strip { display: flex; gap: 8px; width: 100%; max-width: 560px; justify-content: center; padding: 8px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-top: 12px; }
.pr-strip.on { border-color: var(--accent); }
.pr-strip div { flex: 1; text-align: center; } .pr-strip b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; } .pr-strip span { font-size: 11px; color: var(--muted); }

/* Practice a11y: tap targets, pill contrast */
.pr-persona input { width: 22px; height: 22px; flex: none; }
.pr-persona { min-height: 44px; }
#app .btn.small { min-height: 44px; }
.pill.pr-easy { background: #d4f0e2; } .pill.pr-medium { background: #fbe9bd; } .pill.pr-hard { background: #fbd5da; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.pr-easy { background: #12382a; } :root:not([data-theme="light"]) .pill.pr-medium { background: #4a3510; } :root:not([data-theme="light"]) .pill.pr-hard { background: #4a1a22; } }
:root[data-theme="dark"] .pill.pr-easy { background: #12382a; } :root[data-theme="dark"] .pill.pr-medium { background: #4a3510; } :root[data-theme="dark"] .pill.pr-hard { background: #4a1a22; }
.pill.pr-hard { color: #9c1a2a; } .pill.pr-medium { color: #7a4a00; } .pill.pr-easy { color: #11603c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.pr-hard { color: #ff8b98; } :root:not([data-theme="light"]) .pill.pr-medium { color: #ffcb6b; } :root:not([data-theme="light"]) .pill.pr-easy { color: #6fe0a8; } }
:root[data-theme="dark"] .pill.pr-hard { color: #ff8b98; } :root[data-theme="dark"] .pill.pr-medium { color: #ffcb6b; } :root[data-theme="dark"] .pill.pr-easy { color: #6fe0a8; }

/* practice history filters */
.pr-filters { display: grid; gap: 6px; } .pr-filters select, .pr-filters input { min-height: 44px; box-sizing: border-box; width: 100%; }
.pr-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.pr-chip { min-height: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: 14px; display: inline-flex; align-items: center; cursor: pointer; }
span.pr-chip { min-height: 32px; font-size: 13px; cursor: default; } .pr-chip.on { background: #5a49e8; color: #fff; border-color: #5a49e8; }

/* practice: detail page, edit button */
.pr-edit { width: 100%; min-height: 44px; box-sizing: border-box; margin-bottom: 4px; }
.pr-detail { max-width: 70ch; margin: 0 auto; font-size: 16px; line-height: 1.5; }
.pr-sec { margin-bottom: 16px; }
.pr-sec h3 { margin: 0 0 8px; font-size: 18px; }
.pr-md p { margin: 0 0 .7em; } .pr-md p:last-child { margin-bottom: 0; }
.pr-md ul, .pr-md ol { margin: .2em 0 .9em; padding-left: 1.4em; } .pr-md li { margin: .25em 0; }
.pr-md h4 { margin: 1em 0 .4em; font-size: 16px; } .pr-md .tbl { overflow-x: auto; }
.pr-md table { border-collapse: collapse; } .pr-md th, .pr-md td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.pr-rub { list-style: none; margin: 0; padding: 0; } .pr-rub li { padding: 10px 0; border-top: 1px solid var(--line); } .pr-rub li:first-child { border-top: 0; padding-top: 0; }
.pill.pr-w { background: var(--bg); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pr-train { margin-top: 10px; } .pr-train summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.pr-acts .btn { min-height: 44px; }
.pr-sticky { position: sticky; bottom: 0; padding: 10px 0 8px; margin-top: 8px; background: var(--bg); z-index: 3; }
.pr-sticky .btn { width: 100%; min-height: 48px; }

/* Practice: Learn (study courses) */
.lrn-path { list-style: none; margin: 0; padding: 0; }
.lrn-row { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; min-height: 44px; margin-bottom: 8px; }
.lrn-n { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.lrn-row .pill { margin: 4px 4px 0 0; display: inline-block; }
.pill.lrn-ok { background: color-mix(in srgb, var(--ok) 18%, var(--card)); color: var(--ok); }
.lrn-top { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.lrn-prog { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.lrn-prog i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.lrn-card { padding: 16px; max-width: 70ch; }
.lrn-card h2 { margin: 8px 0 10px; font-size: 20px; }
.lrn-card:focus { outline: none; }
.lrn-t { margin-bottom: 4px; }
.lrn-tools { margin-top: 14px; gap: 8px; }
.lrn-tools .btn, .lrn-end .btn { min-height: 44px; }
.lrn-end { margin-top: 14px; }
.lrn-nav { position: sticky; bottom: calc(-1 * var(--s4)); margin: 8px calc(-1 * var(--s4)) calc(-1 * var(--s4)); display: flex; gap: 10px; padding: 10px var(--s4) calc(10px + var(--s4)); background: var(--bg); border-top: 1px solid var(--line); z-index: 3; }
.lrn-nav .btn { flex: 1; min-height: 48px; }
.lrn-bad, .lrn-good, .lrn-turn { border-left: 4px solid var(--line); padding: 4px 0 4px 12px; margin: 10px 0; }
.lrn-bad { border-color: var(--bad); }
.lrn-good { border-color: var(--ok); }
.lrn-turn { border-color: var(--warn); background: var(--accent-soft); padding: 8px 12px; border-radius: 8px; }
.lrn-q { margin: 14px 0; }
.lrn-opt { display: block; width: 100%; text-align: left; min-height: 44px; margin-top: 8px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--control-line); background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.lrn-opt.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, var(--card)); }
.lrn-opt.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--card)); }
.lrn-opt:disabled { color: var(--ink); opacity: 1; cursor: default; }
.lrn-why { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.lrn-score { margin-top: 12px; }
.lrn-chk { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 0; }
.lrn-chk input { width: 24px; height: 24px; flex: none; margin: 0; }

.ask-fixed { position: fixed; left: 0; right: 0; bottom: calc(var(--tap) + 20px); max-width: 760px; margin: 0 auto; }
