/* IMPEX chat website (ADR-0026). One stylesheet, no framework: warm paper, one accent, and motion that
   explains what is happening (something arrived, something is working) rather than decorating it. */
:root {
  /* Warm paper and a clay accent. Surfaces are translucent so the desktop behind shows through (ADR-0027). */
  --bg: #faf9f5; --tint: rgba(250, 249, 245, .60); --side: rgba(240, 238, 230, .58); --panel: rgba(255, 255, 255, .62); --raised: rgba(255, 255, 255, .82);
  --line: rgba(20, 20, 19, .10); --line-2: rgba(20, 20, 19, .18);
  --text: #141413; --dim: #5e5d59; --faint: #87867f;
  --accent: #f5d300; --accent-ink: #141413; --accent-soft: rgba(245, 211, 0, .16); --accent-2: #b5a600;
  --ok: #4d7c4a; --bad: #b53333; --bad-soft: rgba(181, 51, 51, .12); --warn: #a86b14; --warn-soft: rgba(196, 136, 34, .16);
  --user: rgba(232, 230, 220, .78);
  --shadow: 0 1px 2px rgba(20, 20, 19, .05), 0 10px 34px rgba(20, 20, 19, .10);
  --glass: blur(22px) saturate(1.35);
  --radius: 14px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
}
:root[data-theme="dark"] {
  --bg: #1f1e1d; --tint: rgba(31, 30, 29, .62); --side: rgba(20, 20, 19, .46); --panel: rgba(48, 48, 46, .58); --raised: rgba(58, 57, 54, .86);
  --line: rgba(250, 249, 245, .10); --line-2: rgba(250, 249, 245, .20);
  --text: #faf9f5; --dim: #b0aea5; --faint: #87867f;
  --accent: #f5d300; --accent-ink: #141413; --accent-soft: rgba(245, 211, 0, .20); --accent-2: #d5c300;
  --ok: #86b87f; --bad: #e8857c; --bad-soft: rgba(232, 133, 124, .16); --warn: #e0b055; --warn-soft: rgba(224, 176, 85, .16);
  --user: rgba(20, 20, 19, .46);
  --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 12px 36px rgba(0, 0, 0, .36);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1e1d; --tint: rgba(31, 30, 29, .62); --side: rgba(20, 20, 19, .46); --panel: rgba(48, 48, 46, .58); --raised: rgba(58, 57, 54, .86);
    --line: rgba(250, 249, 245, .10); --line-2: rgba(250, 249, 245, .20);
    --text: #faf9f5; --dim: #b0aea5; --faint: #87867f;
    --accent: #f5d300; --accent-ink: #141413; --accent-soft: rgba(245, 211, 0, .20); --accent-2: #d5c300;
    --ok: #86b87f; --bad: #e8857c; --bad-soft: rgba(232, 133, 124, .16); --warn: #e0b055; --warn-soft: rgba(224, 176, 85, .16);
    --user: rgba(20, 20, 19, .46);
    --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 12px 36px rgba(0, 0, 0, .36);
  }
}
/* Without glass (Settings > Look), or where the browser cannot blur, the surfaces are solid. */
:root.no-glass { --tint: var(--bg); --side: color-mix(in srgb, var(--text) 5%, var(--bg)); --panel: color-mix(in srgb, #fff 55%, var(--bg)); --raised: color-mix(in srgb, #fff 80%, var(--bg)); --user: color-mix(in srgb, var(--text) 9%, var(--bg)); --glass: none; }
:root.no-glass[data-theme="dark"] { --panel: color-mix(in srgb, #fff 7%, var(--bg)); --raised: color-mix(in srgb, #fff 12%, var(--bg)); --user: color-mix(in srgb, #000 30%, var(--bg)); }

/* The desktop behind the window: the wallpaper, placed where the real one is, blurred, under a tint. */
body::before { content: ""; position: fixed; z-index: -2; left: calc(var(--sx, 0) * -1px); top: calc(var(--sy, 0) * -1px); width: calc(var(--sw, 1920) * 1px); height: calc(var(--sh, 1080) * 1px);
  background: var(--wall, radial-gradient(60% 50% at 18% 12%, rgba(245, 211, 0, .55), transparent 70%), radial-gradient(50% 45% at 86% 22%, rgba(106, 155, 204, .45), transparent 70%), radial-gradient(60% 60% at 60% 96%, rgba(120, 140, 93, .45), transparent 70%), var(--bg)) center / cover no-repeat;
  filter: blur(26px) saturate(1.25); transform: scale(1.05); transition: opacity .6s var(--ease); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--tint); transition: background-color .4s var(--ease); }
:root.no-glass body::before { display: none; }
.side, .composer, .card, .plan, .item, .tile, .set, .report, .new-chat, .chip, .md pre, .tabs, .jump .icon-btn, .toast { -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.card, .item, .tile, .set, .composer { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .22); }
.item, .tile, .chip, .new-chat { position: relative; overflow: hidden; }
/* A soft sheen that crosses a card when the pointer arrives. */
.item::after, .tile::after, .chip::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .28) 50%, transparent 65%); transform: translateX(-120%); }
.item:hover::after, .tile:hover::after, .chip:hover::after { transform: translateX(120%); transition: transform .9s var(--ease); }
.voice { background: color-mix(in srgb, var(--bg) 55%, transparent) !important; -webkit-backdrop-filter: blur(30px) saturate(1.3); backdrop-filter: blur(30px) saturate(1.3); }
.toast { background: color-mix(in srgb, var(--text) 86%, transparent); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* Scrollbars: always there when a page is longer than the window, in the theme's colours, clay when touched. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 24%, transparent); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; min-height: 44px; }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background: var(--accent); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
html { background: var(--bg); }
body { background: transparent; color: var(--text); font: 15.5px/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; transition: background-color .3s var(--ease), color .3s var(--ease); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 272px 1fr; grid-template-rows: minmax(0, 1fr); height: 100%; transition: grid-template-columns .32s var(--ease); }
.app.is-collapsed { grid-template-columns: 0 1fr; }
.side { background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding: 12px 10px; gap: 6px; transition: opacity .2s var(--ease), background-color .3s var(--ease); }
.app.is-collapsed .side { opacity: 0; pointer-events: none; padding-left: 0; padding-right: 0; border: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-name { font: 600 17px/1 var(--serif); letter-spacing: .14em; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; }
.top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; min-height: 52px; }
.top-title { flex: 1; color: var(--dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
#expand { display: none; }
.app.is-collapsed #expand { display: inline-grid; }

/* ---------- small parts ---------- */
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--dim); transition: background-color .15s, color .15s, transform .12s var(--ease); }
.icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.is-on { color: var(--accent); background: var(--accent-soft); }
.pill { border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--dim); transition: border-color .15s, color .15s, background-color .15s; }
.pill:hover { border-color: var(--accent); color: var(--text); }
.pill.is-full { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.new-chat { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); font-weight: 600; transition: border-color .15s, transform .12s var(--ease), box-shadow .2s; }
.new-chat:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.new-chat:active { transform: scale(.98); }
.new-chat svg { color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--dim); text-align: left; transition: background-color .15s, color .15s; }
.nav-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.nav-item.is-on { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); font-weight: 600; }
.count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; text-align: center; line-height: 20px; }
.side-label { padding: 14px 12px 4px; font-size: 12px; color: var(--faint); letter-spacing: .04em; text-transform: uppercase; }
.chats { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.chat-link { padding: 7px 12px; border-radius: 10px; color: var(--dim); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; flex: none; transition: background-color .15s, color .15s; }
.chat-link:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.chat-link.is-on { background: color-mix(in srgb, var(--text) 9%, transparent); color: var(--text); }
.side-foot { padding-top: 6px; border-top: 1px solid var(--line); }
.status { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 12px; border-radius: 10px; color: var(--dim); font-size: 13px; text-align: left; }
.status:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; transition: background-color .3s; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.dot.bad { background: var(--bad); }

/* ---------- the orb: IMPEX's face ---------- */
.orb { display: inline-block; border-radius: 50%; position: relative; flex: none; background: radial-gradient(circle at 34% 30%, #fff3a3, var(--accent) 46%, var(--accent-2) 100%); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
.orb::after { content: ""; position: absolute; inset: -18%; border-radius: 50%; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); opacity: .7; animation: spin 14s linear infinite; }
/* A slow swirl of gold and amber turns inside the sphere, under a fixed highlight, with a warm glow beneath. */
.orb::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(255, 243, 140, 0) 0deg, rgba(255, 243, 140, .8) 70deg, rgba(255, 243, 140, 0) 150deg, rgba(122, 100, 0, .55) 230deg, rgba(122, 100, 0, 0) 310deg); filter: blur(5px); mix-blend-mode: soft-light; animation: spin 11s linear infinite; }
.orb-lg, .orb-xl { box-shadow: 0 14px 38px -10px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 1px rgba(255, 255, 255, .18), inset 0 -8px 16px rgba(90, 70, 0, .38), inset 0 4px 10px rgba(255, 255, 255, .5); }
.orb-xl::before { filter: blur(14px); }
.orb-xs::before, .orb-sm::before { display: none; }
.orb-xs { width: 22px; height: 22px; }
.orb-xs::after { display: none; }
.orb-sm { width: 26px; height: 26px; }
.orb-sm::after { display: none; }
/* Small busy orbs still read as "working": a fast ring and a bright, pulsing glow (no internal swirl, there is too little room for it). */
.orb-sm.is-busy { animation: think-small 1.2s ease-in-out infinite; }
.orb-sm.is-busy::after { display: block; animation: spin 2.4s linear infinite; border-width: 2px; border-style: solid; border-color: color-mix(in srgb, var(--accent) 80%, transparent); }
@keyframes think-small {
  0%, 100% { transform: scale(1); box-shadow: 0 0 4px 1px color-mix(in srgb, var(--accent) 55%, transparent); }
  50% { transform: scale(1.14); box-shadow: 0 0 14px 4px color-mix(in srgb, var(--accent) 90%, transparent); }
}
.orb-lg { width: 64px; height: 64px; }
.orb-xl { width: 168px; height: 168px; }
/* Thinking: the orb works hard — a rapid internal swirl, a fast breathing glow, a counter-spinning ring, and light that pulses off it. */
.orb.is-busy { animation: think 1.3s ease-in-out infinite; }
.orb.is-busy::before { animation-duration: 1.2s; }
.orb.is-busy::after { animation: spin-rev 3.2s linear infinite; border-color: color-mix(in srgb, var(--accent) 75%, transparent); }
.orb.is-listening { animation: pulse 1.6s ease-out infinite; }
.orb.is-speaking { animation: speak .9s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-rev { to { transform: rotate(-360deg); } }
@keyframes think {
  0%, 100% { transform: scale(1); box-shadow: 0 14px 38px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
  50% { transform: scale(1.07); box-shadow: 0 0 0 20px color-mix(in srgb, var(--accent) 14%, transparent), 0 18px 48px -8px color-mix(in srgb, var(--accent) 90%, transparent); }
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 46px transparent; } }
@keyframes speak { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.09); } 60% { transform: scale(.97); } }

/* ---------- views ---------- */
.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.is-on { display: flex; animation: view-in .34s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.thread { flex: 1; overflow-y: auto; padding: 8px 20px 24px; scrollbar-gutter: stable; }
.msgs, .hello, .page { width: min(760px, 100%); margin: 0 auto; }
.hello { text-align: center; padding: 11vh 0 0; transition: opacity .3s var(--ease), transform .3s var(--ease); }
.hello.is-gone { display: none; }
.hello h1 { font: 500 clamp(28px, 4.4vw, 40px)/1.2 var(--serif); margin: 22px 0 6px; letter-spacing: -.01em; }
.sub { color: var(--dim); margin: 0 0 26px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip { border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 14px; font-size: 14px; color: var(--dim); background: var(--panel); transition: border-color .15s, color .15s, transform .15s var(--ease), box-shadow .2s; animation: rise .5s var(--ease) backwards; }
.chip:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow); }
.chip:nth-child(2) { animation-delay: .05s; } .chip:nth-child(3) { animation-delay: .1s; } .chip:nth-child(4) { animation-delay: .15s; } .chip:nth-child(5) { animation-delay: .2s; } .chip:nth-child(6) { animation-delay: .25s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- messages ---------- */
.msg { display: flex; gap: 12px; margin: 22px 0; animation: rise .36s var(--ease); }
.msg.me { justify-content: flex-end; }
.bubble { background: var(--user); padding: 10px 16px; border-radius: 18px 18px 6px 18px; max-width: 82%; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble img { display: block; max-width: 220px; max-height: 160px; border-radius: 10px; margin: 2px 0 8px; }
.it .body { flex: 1; min-width: 0; }
.it .orb { margin-top: 3px; }
.tag { display: inline-block; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 9px; margin-bottom: 6px; font-weight: 600; }
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3 { font-family: var(--serif); font-weight: 600; line-height: 1.3; margin: 20px 0 8px; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3 { font-size: 17px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 24px; } .md li { margin: 3px 0; }
.md blockquote { margin: 0 0 12px; padding: 2px 14px; border-left: 3px solid var(--line-2); color: var(--dim); }
.md code { font: 13.5px/1.5 var(--mono); background: color-mix(in srgb, var(--text) 8%, transparent); padding: 1px 5px; border-radius: 5px; }
.md pre { position: relative; margin: 0 0 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; white-space: pre; }
.md table { border-collapse: collapse; margin: 0 0 12px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.md th { background: color-mix(in srgb, var(--text) 5%, transparent); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.copy { position: absolute; top: 6px; right: 6px; font-size: 12px; color: var(--dim); background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; opacity: 0; transition: opacity .15s; }
pre:hover .copy, .copy:focus-visible { opacity: 1; }
.caret::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -3px; background: var(--accent); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.meta { display: flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--faint); font-size: 12.5px; flex-wrap: wrap; }
.meta .icon-btn { width: 28px; height: 28px; } .meta svg { width: 16px; height: 16px; }
.meta .sep { flex: 1; }
.notice { color: var(--warn); font-size: 13px; margin-top: 6px; }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 12px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- working: plan, steps, waiting ---------- */
.work { color: var(--dim); font-size: 14px; }
.shimmer { background: linear-gradient(90deg, var(--faint) 0%, var(--text) 45%, var(--faint) 90%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.8s linear infinite; font-weight: 600; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.steps { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0; }
.step { display: flex; align-items: baseline; gap: 8px; font: 13px/1.5 var(--mono); color: var(--dim); animation: rise .28s var(--ease); overflow: hidden; white-space: nowrap; }
.step .mark { width: 14px; flex: none; text-align: center; } .step.ok .mark { color: var(--ok); } .step.bad .mark { color: var(--bad); }
.step .what { color: var(--text); flex: none; } .step .arg { overflow: hidden; text-overflow: ellipsis; color: var(--faint); }
details.trace { margin-top: 8px; } details.trace summary { cursor: pointer; color: var(--faint); font-size: 12.5px; list-style: none; }
details.trace summary::-webkit-details-marker { display: none; }
details.trace summary:hover { color: var(--text); }
.plan { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 0; font-size: 14px; animation: rise .3s var(--ease); }
.plan .goal { font-weight: 600; margin-bottom: 4px; } .plan .how { color: var(--dim); margin-bottom: 6px; font-size: 13px; }
.plan-step { display: flex; gap: 9px; align-items: flex-start; padding: 2px 0; transition: color .3s, opacity .3s; }
.plan-step .box { width: 16px; height: 16px; margin-top: 4px; border-radius: 5px; border: 1.5px solid var(--line-2); flex: none; display: grid; place-items: center; font-size: 11px; line-height: 1; transition: background-color .3s var(--ease), border-color .3s, transform .3s var(--ease); }
.plan-step.done .box { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.08); }
.plan-step.done { color: var(--dim); }
.plan-step.in_progress .box { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-step.failed .box { background: var(--bad); border-color: var(--bad); color: #fff; }
.plan-step.skipped { opacity: .55; }
.plan-step .note { color: var(--faint); font-size: 12.5px; }

/* ---------- cards: approvals, proposals ---------- */
.card { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; box-shadow: var(--shadow); animation: pop .32s var(--ease); }
.card.ask { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.card h4 { margin: 0 0 4px; font-size: 15px; } .card .why { color: var(--dim); font-size: 13.5px; margin: 0 0 8px; }
.card pre { margin: 0 0 10px; padding: 10px 12px; background: var(--bg); border-radius: 10px; font: 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 1px solid var(--line-2); border-radius: 10px; padding: 6px 14px; background: var(--raised); font-size: 14px; transition: border-color .15s, background-color .15s, transform .12s var(--ease), opacity .15s; }
.btn:hover { border-color: var(--accent); } .btn:active { transform: scale(.97); } .btn:disabled { opacity: .5; cursor: default; }
.btn.go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.go:hover { filter: brightness(1.06); }
.btn.no { color: var(--bad); } .btn.no:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.sm { padding: 3px 10px; font-size: 13px; border-radius: 8px; }

/* ---------- composer ---------- */
.dock { padding: 0 20px 14px; position: relative; }
.composer { width: min(760px, 100%); margin: 0 auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 22px; padding: 10px 10px 8px 16px; box-shadow: var(--shadow); transition: border-color .2s, box-shadow .2s; }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); }
.composer.is-drop { border-style: dashed; border-color: var(--accent); }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; background: none; resize: none; max-height: 220px; padding: 6px 4px; line-height: 1.5; }
.composer textarea::placeholder { color: var(--faint); }
.composer-row { display: flex; align-items: center; gap: 4px; margin-left: -8px; }
.hint { flex: 1; color: var(--faint); font-size: 12.5px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; transition: transform .15s var(--ease), opacity .2s, background-color .2s; }
.send:hover { transform: scale(1.06); } .send:active { transform: scale(.94); }
.send .i-stop { display: none; } .is-busy .send .i-send { display: none; } .is-busy .send .i-stop { display: block; }
.send:disabled { opacity: .35; transform: none; cursor: default; }
.mic.is-rec { color: #fff; background: var(--bad); animation: pulse-rec 1.4s ease-out infinite; }
@keyframes pulse-rec { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 50%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
.shots { display: flex; gap: 8px; padding: 2px 0 8px; flex-wrap: wrap; }
.shot { position: relative; animation: pop .25s var(--ease); } .shot img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.shot button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 12px; line-height: 20px; }
.fine { width: min(760px, 100%); margin: 6px auto 0; text-align: center; color: var(--faint); font-size: 12px; min-height: 18px; }
.jump { position: absolute; left: 50%; top: -46px; transform: translateX(-50%); animation: rise .25s var(--ease); }
.jump .icon-btn { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 50%; }

/* ---------- pages ---------- */
.view:not(.view-chat) { overflow-y: auto; padding: 8px 20px 40px; scrollbar-gutter: stable; scroll-behavior: smooth; }
.view:not(.view-chat) > .page { flex: none; }
.page h2 { font: 500 28px/1.2 var(--serif); margin: 14px 0 4px; }
.page .lead { color: var(--dim); margin: 0 0 20px; }
.page h3 { font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin: 26px 0 10px; font-weight: 600; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 14px; align-items: flex-start; animation: rise .32s var(--ease) backwards; transition: border-color .15s, box-shadow .2s, opacity .25s, transform .25s var(--ease); }
.item:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.item.is-leaving { opacity: 0; transform: translateX(12px); }
.item .grow { flex: 1; min-width: 0; } .item .name { font-weight: 600; overflow-wrap: anywhere; } .item .desc { color: var(--dim); font-size: 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.item .small { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--dim); vertical-align: 1px; margin-left: 6px; }
.badge.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.acc { background: var(--accent-soft); color: var(--accent); }
.empty { color: var(--faint); padding: 18px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tile { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; animation: rise .32s var(--ease) backwards; transition: border-color .15s, box-shadow .2s, transform .2s var(--ease); }
.tile:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.tile .name { font-weight: 600; } .tile .desc { color: var(--dim); font-size: 13.5px; flex: 1; }
.tabs { display: inline-flex; background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 12px; padding: 3px; gap: 2px; }
.tab { padding: 5px 14px; border-radius: 9px; color: var(--dim); font-size: 14px; transition: background-color .2s, color .2s; }
.tab.is-on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); font-weight: 600; }
.field { display: flex; gap: 8px; margin-top: 10px; }
.tile a.small { color: var(--accent); font-size: 13px; text-decoration: none; } .tile a.small:hover { text-decoration: underline; }
.page > .btn { margin-top: 12px; }
.field input, .field select, .set select, .set input[type="text"] { flex: 1; border: 1px solid var(--line-2); background: var(--panel); border-radius: 10px; padding: 7px 12px; outline: 0; transition: border-color .15s, box-shadow .15s; min-width: 0; }
.field input:focus, .set select:focus, .set input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.set { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }
.set .grow { flex: 1; min-width: 0; } .set .name { font-weight: 600; } .set .desc { color: var(--dim); font-size: 13.5px; }
.switch { width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; transition: background-color .25s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); } .switch[aria-checked="true"]::after { transform: translateX(18px); }
.report { font: 13px/1.6 var(--mono); white-space: pre-wrap; color: var(--dim); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; overflow-wrap: anywhere; }

/* ---------- voice ---------- */
.voice { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.voice-close { position: absolute; top: 18px; right: 18px; width: 42px; height: 42px; }
.voice-stage { text-align: center; width: min(640px, 90vw); }
.voice-state { margin-top: 44px; font: 500 22px/1.3 var(--serif); }
.voice-text { margin-top: 12px; color: var(--dim); min-height: 3.2em; overflow-wrap: anywhere; }
.voice-tip { margin-top: 18px; color: var(--faint); font-size: 13px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 40; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); border-radius: 12px; padding: 9px 14px; font-size: 14px; box-shadow: var(--shadow); animation: rise .3s var(--ease); max-width: min(420px, 86vw); transition: opacity .3s, transform .3s var(--ease); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 20; box-shadow: var(--shadow); transition: transform .32s var(--ease); }
  .app.is-collapsed .side { transform: translateX(-102%); opacity: 1; padding: 12px 10px; }
  #expand { display: inline-grid; }
  .bubble { max-width: 92%; }
  .hello { padding-top: 7vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Graphics pass: a warm glow behind the greeting, a finer light edge on glass panels, livelier buttons. */
.hello { position: relative; isolation: isolate; }
.hello::before { content: ""; position: absolute; left: 50%; top: 34px; width: 420px; height: 300px; transform: translateX(-50%); z-index: -1; pointer-events: none; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 30%, transparent), transparent 72%); filter: blur(26px); opacity: .7; animation: glow 9s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .5; transform: translateX(-50%) scale(1); } 50% { opacity: .85; transform: translateX(-50%) scale(1.08); } }
.composer { transition: box-shadow .25s var(--ease), border-color .2s, transform .25s var(--ease); }
.composer:focus-within { box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 10px 40px -14px color-mix(in srgb, var(--accent) 60%, transparent); }
.send { box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 80%, transparent); transition: transform .15s var(--ease), box-shadow .2s, filter .2s; }
.send:hover { transform: translateY(-1px) scale(1.05); filter: saturate(1.1) brightness(1.05); }
.send:active { transform: scale(.96); }
.btn.go { background-image: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0)); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.nav-item, .chat-link { transition: background-color .15s, color .15s, transform .15s var(--ease); }
.nav-item:hover, .chat-link:hover { transform: translateX(2px); }
.item, .tile, .set, .card { border-image: none; background-image: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 42%); }
.badge.ok, .badge.warn, .badge.bad, .badge.acc { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
@media (prefers-reduced-motion: reduce) { .orb::before, .hello::before { animation: none; } .nav-item:hover, .chat-link:hover, .send:hover { transform: none; } }

/* Usage per model (ADR-0031): a thin bar for the minute and one for the day. */
.meter { position: relative; height: 16px; margin-top: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; max-width: 340px; }
.meter > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: color-mix(in srgb, var(--accent) 55%, transparent); transition: width .5s var(--ease); }
.meter.hot > i { background: color-mix(in srgb, var(--warn) 70%, transparent); }
.meter > span { position: relative; display: block; font-size: 11px; line-height: 16px; padding: 0 9px; color: var(--dim); }
