/* BULGAR Jarvis console. Design contract: black #0A0A0A, text #F2EFE9, border #1F1F1F,
   card #121212, one accent red #E04558 (live / active / private), 16px radius. Dark only. */

@font-face { font-family: "Montserrat"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-style: normal; font-display: swap; src: url("/fonts/montserrat-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #0A0A0A;
  --card: #121212;
  --card-2: #171717;
  --border: #1F1F1F;
  --border-2: #2A2A2A;
  --text: #F2EFE9;
  --muted: #9A968F;     /* 6.9:1 on #0A0A0A */
  --faint: #6E6B66;     /* decorative / dividers only */
  --red: #E04558;
  --red-soft: rgba(224, 69, 88, 0.16);
  --red-line: rgba(224, 69, 88, 0.55);
  --radius: 16px;
  --radius-sm: 10px;
  --gutter: 14px;
  --tabbar-h: 68px;
  --font: "Montserrat", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.45; font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.01em; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 1em; height: 1em; flex: none; }
::selection { background: var(--red); color: #fff; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 8px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.skip:focus { top: calc(12px + var(--safe-top)); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell (phone first) ---------- */
.shell { min-height: 100dvh; }
.sidebar, .rightpanel { display: none; }
.center {
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: calc(20px + var(--safe-top)) var(--gutter) calc(var(--tabbar-h) + var(--safe-bottom) + 20px);
  outline: none;
}
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: #0A0A0A; border-top: 1px solid var(--border);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #C9C5BE; font-size: 11.5px; font-weight: 500; transition: color 0.2s var(--ease);
}
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a:hover { color: var(--text); }
.tabbar a[aria-current="page"] { color: var(--red); }
.tabbar a:focus-visible { outline-offset: -4px; }
.shell.fullscreen .tabbar { display: none; }
.shell.fullscreen .center { padding-bottom: calc(24px + var(--safe-bottom)); }

/* ---------- common ---------- */
.card { background: var(--card); border: 1px solid var(--border-2); border-radius: var(--radius); }
.card-pad { padding: 16px 16px; }
.card h2 { font-size: 18px; font-weight: 700; }
.muted { color: var(--muted); }
.red { color: var(--red); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); flex: none; }
.dot.off { background: var(--faint); }
.demo-tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}
.brand-line { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.brand-line b { font-weight: 700; }
.mini-orb {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: #5c0a16 url("/img/icon-192.png") center / 128% no-repeat;
  box-shadow: 0 0 12px rgba(224, 69, 88, 0.5);
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.h1 { font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.sub { color: var(--muted); font-size: 15.5px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border-2);
  background: var(--card); font-weight: 600; font-size: 16px; white-space: nowrap;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.12s var(--ease), color 0.2s var(--ease);
}
.btn:hover { border-color: #3a3a3a; background: #181818; }
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: #e9566a; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 15px; border-radius: 10px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text); transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { background: #1a1a1a; }
.icon-btn svg { width: 24px; height: 24px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px;
  background: #1E1E1E; color: #D8D4CD; font-size: 14px; font-weight: 500; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}

/* ---------- home ---------- */
.home { flex: 1; display: flex; flex-direction: column; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-head .h1 { font-size: 27px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; min-height: 44px; border: 0; background: none; padding: 0; text-align: right; }
.status-pill .dot { width: 10px; height: 10px; }
@media (hover: hover) { button.status-pill:hover span { text-decoration: underline; text-underline-offset: 3px; } }
.orb-stage { flex: 1 1 auto; display: grid; place-items: center; min-height: 250px; position: relative; }
.orb { position: relative; width: min(290px, 74vw); aspect-ratio: 1; }
.orb canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.orb-state { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; color: var(--muted); font-size: 14px; font-weight: 500; }
.talk {
  align-self: center; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 204px; height: 52px; border-radius: 999px; border: 1px solid var(--border-2); background: #141414;
  font-size: 17px; font-weight: 600; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.talk svg { width: 24px; height: 24px; color: var(--red); }
.talk:hover { border-color: #3a3a3a; }
.talk[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); transform: scale(1.03); }
.talk-hint { text-align: center; color: var(--muted); font-size: 14px; min-height: 20px; margin-top: 10px; }
.home-cards { display: grid; gap: 14px; margin-top: 18px; }
.list { list-style: none; margin: 0; padding: 0; }
.list-link {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 10px 0;
  font-size: 15px; font-weight: 500; border-top: 1px solid var(--border-2);
}
.list li:first-child .list-link { border-top: 0; }
.list-link svg { width: 18px; height: 18px; color: var(--muted); }
@media (hover: hover) { .list-link:hover span { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--faint); } }
.list-link .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today h2 { margin-bottom: 4px; }
.spend-line { font-size: 15.5px; font-weight: 500; padding: 15px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, #151515, #1c1c1c, #151515); background-size: 200% 100%; border-radius: 8px; height: 18px; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- chat ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat .h1 { margin-top: 14px; }
.modes {
  display: grid; grid-template-columns: 1fr 1.15fr 1fr; margin-top: 14px;
  border: 1px solid var(--border-2); border-radius: 14px; background: var(--card); overflow: hidden;
}
.mode {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 44px; padding: 6px 6px; border: 0; background: transparent; font-weight: 600; font-size: 14px;
  border-left: 1px solid var(--border-2); transition: background-color 0.2s var(--ease);
}
.mode:first-child { border-left: 0; }
.mode:hover { background: #171717; }
.mode .mode-main { display: inline-flex; align-items: center; gap: 6px; }
.mode .mode-sub { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.mode svg { width: 18px; height: 18px; }
.mode.private svg { color: var(--red); }
.mode[aria-checked="true"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 3px; border-radius: 3px; background: var(--red); }
.mode[aria-checked="true"].private { background: var(--red-soft); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; }
.chat-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13.5px; color: var(--muted); min-height: 22px; }
.chat-meta .private-note { color: var(--red); display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }
.chat-meta svg { width: 15px; height: 15px; }
.agent-pill { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.agent-pill button { border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 6px; display: inline-grid; place-items: center; min-width: 28px; min-height: 28px; }
.agent-pill button:hover { color: var(--text); }
.thread { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 18px 0 16px; min-height: 120px; }
.msg-user {
  align-self: flex-end; max-width: 86%; padding: 12px 16px; border-radius: 16px;
  background: #161616; border: 1px solid var(--border-2); font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap;
}
.msg-user .att { display: block; color: var(--muted); font-size: 13px; margin-top: 6px; }
.msg-bot {
  align-self: flex-start; width: min(100%, 520px); max-width: 88%; padding: 14px 16px 10px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--border-2);
}
.msg-bot.private { border-color: var(--red-line); }
.msg-bot header { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; margin-bottom: 8px; }
.msg-bot header .mini-orb { width: 30px; height: 30px; }
.msg-body { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-body p + p, .msg-body p + ol, .msg-body ol + p { margin-top: 8px; }
.msg-body ol, .msg-body ul { margin: 6px 0 0; padding-left: 22px; }
.msg-body li + li { margin-top: 4px; }
.msg-body code { font-family: var(--mono); font-size: 0.9em; background: #0d0d0d; border: 1px solid var(--border); padding: 1px 5px; border-radius: 6px; }
.msg-body pre { font-family: var(--mono); font-size: 13.5px; background: #0d0d0d; border: 1px solid var(--border); padding: 10px 12px; border-radius: 10px; overflow-x: auto; }
.msg-body.error { color: var(--red); }
.msg-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.msg-foot .readaloud { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--text); font-size: 14px; font-weight: 500; min-height: 36px; padding: 0 4px; border-radius: 8px; white-space: nowrap; flex: none; }
.msg-foot .readaloud svg { width: 20px; height: 20px; }
@media (hover: hover) { .msg-foot .readaloud:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; } }
.msg-foot .readaloud[aria-pressed="true"] { color: var(--red); }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.empty-thread { margin: auto 0; text-align: center; color: var(--muted); padding: 30px 10px; }
.empty-thread b { display: block; color: var(--text); font-size: 18px; margin-bottom: 6px; }
.suggests { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.suggests button { border: 1px solid var(--border-2); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px; min-height: 40px; }
.suggests button:hover { border-color: #3a3a3a; }

.composer-wrap { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px); z-index: 5; padding-top: 6px; background: linear-gradient(transparent, var(--bg) 30%); }
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.attachments .chip button { border: 0; background: none; color: var(--muted); display: inline-grid; place-items: center; padding: 0; width: 22px; height: 22px; }
.composer {
  display: flex; align-items: center; gap: 4px; min-height: 58px; padding: 6px 7px 6px 6px;
  background: #121212; border: 1px solid var(--border-2); border-radius: 18px;
  transition: border-color 0.2s var(--ease);
}
.composer:focus-within { border-color: var(--red-line); }
.composer.private { border-color: var(--red-line); }
.composer .sep { width: 1px; height: 28px; background: var(--border-2); flex: none; }
.composer textarea {
  flex: 1; min-width: 0; resize: none; border: 0; background: transparent; outline: none;
  font-size: 16.5px; line-height: 1.4; padding: 10px 8px; max-height: 140px;
}
.composer textarea::placeholder { color: #8C8882; }
.composer .icon-btn { width: 42px; height: 42px; }
.composer .icon-btn[aria-pressed="true"] { color: var(--red); background: var(--red-soft); }
.send { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 0; background: var(--red); color: #fff; flex: none; transition: background-color 0.2s var(--ease), transform 0.12s var(--ease); }
.send:hover { background: #ea5769; }
.send:active { transform: scale(0.96); }
.send svg { width: 22px; height: 22px; }
.send[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ---------- call mode ---------- */
.call { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; }
.call-head { width: 100%; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.call-head h1 { font-size: 20px; font-weight: 700; }
.call-head .live { color: var(--red); font-size: 13.5px; font-weight: 500; }
.call .orb { width: min(340px, 86vw); margin-top: 0; }
.call-state { font-size: 25px; font-weight: 600; margin-top: 0; }
.call-note { color: var(--muted); font-size: 13.5px; min-height: 19px; margin-top: 4px; }
.wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 38px; margin-top: 10px; color: var(--red); }
.wave i { display: block; width: 3px; height: 100%; border-radius: 2px; background: currentColor; transform-origin: center; transform: scaleY(var(--s, 0.2)); transition: transform 0.12s linear; }
.captions { width: 100%; margin-top: 18px; text-align: left; padding: 4px 16px; }
.captions p { padding: 11px 0; font-size: 14.5px; }
.captions p + p { border-top: 1px solid var(--border-2); }
.captions .you { color: var(--muted); }
.captions .jarvis { font-weight: 500; font-size: 15.5px; }
.call-typed { width: 100%; margin-top: 12px; display: flex; gap: 8px; }
.call-typed input { flex: 1; min-width: 0; height: 46px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--card); padding: 0 14px; font-size: 16px; }
.call-typed input::placeholder { color: #8C8882; }
.call-actions { display: flex; align-items: flex-start; justify-content: center; gap: 36px; margin-top: auto; padding-top: 22px; }
.call-actions label { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); }
.round { display: grid; place-items: center; border-radius: 50%; border: 1px solid #4a4a4a; background: transparent; transition: background-color 0.2s var(--ease), transform 0.12s var(--ease); }
.round:active { transform: scale(0.96); }
.round.mute { width: 60px; height: 60px; margin-top: 6px; }
.round.mute svg { width: 28px; height: 28px; }
.round.mute[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.round.end { width: 72px; height: 72px; background: var(--red); border-color: var(--red); color: #fff; }
.round.end:hover { background: #ea5769; }
.round.end svg { width: 34px; height: 34px; }
.call-actions .end-label { color: var(--text); }

/* ---------- tasks ---------- */
.tasks-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.new-task { display: flex; gap: 8px; margin-top: 16px; }
.new-task input { flex: 1; min-width: 0; height: 48px; border-radius: 12px; border: 1px solid var(--border-2); background: var(--card); padding: 0 14px; font-size: 16px; }
.new-task input::placeholder { color: #8C8882; }
.task-group { margin-top: 22px; }
.task-group h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.task-list { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.task-list > li, .agents-grid > li { min-width: 0; }
.task-card { display: flex; align-items: center; gap: 12px; padding: 14px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border-2); transition: border-color 0.2s var(--ease); }
.task-card:hover { border-color: #3a3a3a; }
.task-card.attn { border-color: var(--red-line); }
.task-card .t-title { font-weight: 600; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card .t-sub { color: var(--muted); font-size: 13px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-card > svg { width: 18px; height: 18px; color: var(--muted); }
.t-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #1b1b1b; flex: none; }
.t-icon svg { width: 20px; height: 20px; }
.t-icon.attn { color: var(--red); background: var(--red-soft); }

.task-top { display: flex; align-items: center; justify-content: space-between; }
.task-top .icon-btn { margin-left: -10px; }
.task-title { font-size: 22.5px; font-weight: 700; line-height: 1.2; margin-top: 14px; }
.task-status { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; margin-top: 8px; }
.task-status .dot.done { background: var(--text); }
.steps { list-style: none; margin: 18px 0 0; padding: 0 0 0 4px; }
.step { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 6px 22px; padding-bottom: 16px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 10.5px; top: 26px; bottom: -2px; width: 1px; background: #4a4a4a; }
.step:last-child::before { display: none; }
.step .mark { width: 22px; height: 22px; border-radius: 50%; margin-top: 3px; display: grid; place-items: center; border: 1.5px solid #6c6c6c; background: var(--bg); position: relative; z-index: 1; }
.step.done .mark { background: var(--text); border-color: var(--text); color: var(--bg); }
.step.done .mark svg { width: 13px; height: 13px; }
.step.running .mark { background: var(--red); border-color: var(--red); }
.step.blocked .mark { border-color: var(--red); color: var(--red); }
.step.blocked .mark svg { width: 12px; height: 12px; }
.step .s-title { font-size: 15.5px; font-weight: 600; }
.step .s-state { color: var(--muted); font-size: 13.5px; }
.approval { margin-top: 22px; padding: 18px 16px 16px; border-color: #2e2e2e; }
.approval-head { display: flex; align-items: center; gap: 14px; }
.approval-head .term { color: var(--red); display: grid; place-items: center; flex: none; }
.approval-head .term svg { width: 40px; height: 40px; }
.approval-head h2 { font-size: 18px; font-weight: 600; }
.cmd { margin-top: 14px; padding: 12px 14px; font-family: var(--mono); font-size: 14.5px; background: #0E0E0E; border: 1px solid var(--border-2); border-radius: 10px; overflow-x: auto; white-space: pre; }
.approval-note { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.approval-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.approval-actions .btn { min-height: 46px; font-size: 16px; }
.approval-actions .btn.ghost { background: #0E0E0E; }
.files-head { font-size: 16px; font-weight: 700; margin-top: 22px; }
.files { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; list-style: none; padding: 0; }
.file { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px 0 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--border-2); font-size: 14px; font-weight: 500; max-width: 100%; }
.file svg { width: 20px; height: 20px; }
.result { margin-top: 18px; padding: 14px 16px; }
.result h2 { font-size: 16px; margin-bottom: 4px; }

/* ---------- agents ---------- */
.agents-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; padding: 0; list-style: none; }
.agent { display: flex; flex-direction: column; padding: 15px 12px 13px 13px; min-height: 140px; }
.agent.private { border-color: var(--red); }
.agent > svg { width: 36px; height: 36px; }
.agent h2 { font-size: 15.5px; font-weight: 700; margin-top: 10px; line-height: 1.25; letter-spacing: -0.015em; }
.agent p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.agent .agent-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 14px; }
.agent .chip { height: 28px; padding: 0 9px; font-size: 12px; min-width: 0; flex: 0 1 auto; display: block; line-height: 28px; }
.ask { min-height: 34px; min-width: 50px; padding: 0 12px; border-radius: 11px; border: 1.5px solid var(--text); background: transparent; font-weight: 600; font-size: 14px; flex: none; display: inline-grid; place-items: center; transition: background-color 0.2s var(--ease), color 0.2s var(--ease); }
.ask:hover { background: var(--text); color: var(--bg); }
.agent-tools { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

/* ---------- settings ---------- */
.settings-head .h1 { font-size: 28px; }
.settings-stack { display: grid; gap: 14px; margin-top: 18px; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 46px; border-top: 1px solid var(--border-2); }
.set-row:first-of-type { border-top: 0; }
.card h2 + .set-row { border-top: 0; }
.set-row .name { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.set-row .val { color: var(--muted); font-size: 13.5px; text-align: right; }
.set-row button.link { display: flex; align-items: center; gap: 12px; flex: 1; min-height: 46px; border: 0; background: none; padding: 0; text-align: left; min-width: 0; }
@media (hover: hover) { .set-row button.link:hover .name { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--faint); } }
.voice-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.voice-row select {
  flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid transparent; background: var(--card); color: var(--text);
  font-size: 16.5px; font-weight: 500; padding: 0 4px; margin-left: -4px; appearance: none; -webkit-appearance: none;
}
.voice-row select:hover { border-color: var(--border-2); }
.play { width: 44px; height: 44px; border-radius: 50%; border: 1px solid #3a3a3a; background: #0E0E0E; display: grid; place-items: center; flex: none; }
.play svg { width: 20px; height: 20px; }
.play:hover { border-color: #555; }
.toggle { position: relative; width: 54px; height: 32px; border-radius: 999px; border: 0; background: #3A3A3A; flex: none; transition: background-color 0.25s var(--ease); }
.toggle::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #E9E6E0; transition: transform 0.25s var(--ease); }
.toggle[aria-checked="true"] { background: var(--red); }
.toggle[aria-checked="true"]::after { transform: translateX(22px); }
.spend-big { font-size: 24px; font-weight: 700; margin-top: 10px; letter-spacing: -0.01em; }
.bars { display: flex; align-items: flex-end; justify-content: space-around; gap: 8px; height: 100px; padding: 14px 8px 0; }
.bar { width: 13px; border-radius: 3px; background: #6A6A6A; min-height: 6px; position: relative; }
.bar.today { background: var(--red); }
.bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-wrap span { font-size: 11.5px; color: var(--muted); }
.by-mode { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13.5px; color: var(--muted); }
.device { display: flex; align-items: center; gap: 14px; min-height: 50px; margin-top: 4px; }
.device svg { width: 26px; height: 26px; }
.device .name { flex: 1; font-size: 15px; font-weight: 500; }
.account { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* sheet (dialog) */
dialog.sheet {
  width: min(560px, 100vw); max-width: 100vw; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 1px solid var(--border-2); border-radius: 20px 20px 0 0; background: #101010; color: var(--text); overscroll-behavior: contain;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.66); }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 20px; } }
.sheet form { padding: 20px 18px calc(18px + var(--safe-bottom)); display: grid; gap: 14px; }
.sheet h2 { font-size: 21px; font-weight: 700; }
.sheet .help { color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: #D8D4CD; }
.field input, .field select {
  height: 46px; border-radius: 11px; border: 1px solid var(--border-2); background: #0A0A0A; color: var(--text);
  padding: 0 13px; font-size: 16px; width: 100%;
}
.field input::placeholder { color: #8C8882; }
.field input:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field .err { color: var(--red); font-size: 13.5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.key-state { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.key-state button { border: 0; background: none; color: var(--red); font-weight: 600; font-size: 14px; padding: 6px; border-radius: 6px; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); }
.auth-box { width: min(400px, 100%); display: grid; gap: 16px; }
.auth-box .orb { width: 170px; justify-self: center; }
.auth-box h1 { font-size: 28px; font-weight: 700; text-align: center; }
.auth-box p { text-align: center; color: var(--muted); }
.auth-box form { display: grid; gap: 14px; margin-top: 6px; }
.auth-box .btn { width: 100%; min-height: 50px; }

/* ---------- asleep / toast ---------- */
.asleep {
  position: fixed; left: 50%; top: calc(14px + var(--safe-top)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 12px; width: min(440px, calc(100vw - 24px)); padding: 12px 16px;
  border-radius: var(--radius); border: 1px solid var(--red-line); background: #160A0C; text-align: left;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}
.asleep svg { width: 26px; height: 26px; color: var(--red); }
.asleep b { display: block; font-size: 16px; }
.asleep small { display: block; color: var(--muted); font-size: 13.5px; }
.asleep:hover { background: #1d0c10; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 84px); transform: translate(-50%, 12px); z-index: 45;
  max-width: calc(100vw - 32px); padding: 11px 16px; border-radius: 12px; background: #1d1d1d; border: 1px solid var(--border-2);
  font-size: 15px; opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { padding: 40px; text-align: center; }

/* ---------- laptop: sidebar / centre / right panel ---------- */
@media (min-width: 1024px) {
  :root { --gutter: 28px; }
  .shell {
    display: grid; grid-template-columns: 248px minmax(0, 1fr) 340px; gap: 12px;
    height: 100dvh; padding: 8px;
  }
  .panel, .center, .rightpanel { border-radius: 18px; }
  .sidebar {
    display: flex; flex-direction: column; background: #0D0D0D; border: 1px solid var(--border); padding: 30px 14px 0;
  }
  .brand { display: flex; align-items: center; gap: 12px; padding: 0 12px; font-size: 19px; }
  .brand b { font-weight: 700; }
  .brand .mini-orb { width: 38px; height: 38px; }
  .side-nav { display: grid; gap: 4px; margin-top: 46px; }
  .side-nav a {
    display: flex; align-items: center; gap: 18px; height: 54px; padding: 0 18px; border-radius: 12px;
    font-size: 18px; font-weight: 500; color: var(--text); transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
  }
  .side-nav a svg { width: 26px; height: 26px; }
  .side-nav a:hover { background: #161616; }
  .side-nav a[aria-current="page"] { background: rgba(224, 69, 88, 0.2); color: var(--red); }
  .side-foot { margin-top: auto; display: flex; align-items: center; gap: 14px; border-top: 1px solid var(--border-2); padding: 24px 12px 26px; font-size: 16.5px; font-weight: 500; }
  .side-foot svg { width: 26px; height: 26px; }
  .center {
    min-height: 0; height: 100%; overflow-y: auto; background: #0B0B0B; border: 1px solid var(--border);
    padding: 28px 28px 20px; scrollbar-width: thin; scrollbar-color: #2a2a2a transparent;
  }
  .rightpanel { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 10px 2px; }
  .tabbar { display: none; }
  .composer-wrap { bottom: 0; }
  .toast { bottom: 40px; }
  .shell.fullscreen { grid-template-columns: 248px minmax(0, 1fr) 340px; }

  .home-head { align-items: flex-start; }
  .home-head .h1 { font-size: 46px; }
  .home-head .sub { color: var(--text); font-size: 21px; margin-top: 2px; }
  .home-lap .orb-stage { min-height: 0; flex: none; }
  .home-lap .orb { width: 300px; }
  .home-lap .talk { width: 272px; height: 54px; border: 2px solid var(--red); background: transparent; font-size: 20px; font-weight: 500; }
  .home-lap .talk svg { color: var(--text); }
  .home-lap .thread { padding-top: 26px; }
  .msg-bot { max-width: 70%; }
  .msg-user { max-width: 70%; }
  .agents-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
  .settings-stack { grid-template-columns: 1fr 1fr; align-items: start; }

  .rp-card { background: #0D0D0D; border: 1px solid var(--border); border-radius: 18px; padding: 22px 20px; }
  .rp-card h2 { font-size: 26px; font-weight: 700; }
  .rp-today .list-link { min-height: 60px; font-size: 16.5px; font-weight: 500; gap: 16px; }
  .rp-today .list-link .grow { white-space: normal; }
  .check { width: 24px; height: 24px; border: 1.5px solid #CFCBC4; border-radius: 6px; flex: none; display: grid; place-items: center; }
  .check.done { background: var(--text); color: var(--bg); }
  .check svg { width: 15px; height: 15px; }
  .rp-big { font-size: 46px; font-weight: 700; letter-spacing: -0.02em; margin-top: 14px; line-height: 1.1; }
  .rp-spend .bars { height: 150px; justify-content: space-between; padding: 18px 2px 0; gap: 0; }
  .rp-spend .bar { width: 32px; border-radius: 3px; }
  .rp-row { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-2); margin-top: 18px; padding-top: 18px; font-size: 19px; }
  .rp-row b { font-size: 22px; }
  .rp-devices { display: flex; align-items: center; gap: 16px; font-size: 18px; font-weight: 500; padding: 20px; }
  .rp-devices svg { width: 30px; height: 30px; }
}
@media (min-width: 1024px) {
  .status-pill { font-size: 17px; }
  .home-lap .orb { width: 390px; }
  .home-lap .orb-stage { margin: -40px 0 -46px; }
  .side-nav a { font-size: 19px; }
  .msg-user { font-size: 17.5px; padding: 12px 20px; }
  .msg-body { font-size: 17px; }
  .composer textarea { font-size: 18px; padding-left: 14px; }
  .composer { min-height: 64px; border-radius: 20px; }
  .home-lap .msg-bot { position: relative; margin-left: 66px; width: auto; max-width: 64%; padding: 12px 22px 10px; border-radius: 18px; }
  .home-lap .msg-bot header { position: absolute; left: -66px; top: 8px; margin: 0; }
  .home-lap .msg-bot header .mini-orb { width: 46px; height: 46px; }
  .home-lap .msg-bot header > span[translate] { display: none; }
  .home-lap .msg-foot { margin-top: 4px; font-size: 14.5px; }
  .rp-today .list-link { font-size: 17.5px; }
}
@media (min-width: 1024px) and (max-width: 1240px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr) 300px; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Leave room for the asleep banner instead of covering the page header. */
body:has(#asleep:not([hidden])) .center { padding-top: calc(100px + var(--safe-top)); }
