:root {
  --bg: #0b0f14;
  --panel: #151b23;
  --line: #263040;
  --text: #e8edf3;
  --muted: #8b98a9;
  --accent: #3b82f6;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ask: #a78bfa;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
[hidden] { display: none !important; }
.screen { max-width: 640px; margin: 0 auto; padding: 12px 16px 40px; }
.login { display: flex; flex-direction: column; gap: 16px; padding-top: 18vh; text-align: center; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 18px; margin: 24px 0 8px; color: var(--muted); font-weight: 600; }
h3 { font-size: 16px; margin: 20px 0 8px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.msg { min-height: 1.4em; color: var(--warn); }
button { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
button:disabled { opacity: .5; }
.big { padding: 16px 18px; font-size: 18px; font-weight: 600; width: 100%; }
.link { display: block; padding: 16px; color: var(--text); background: var(--accent); border-radius: 14px; text-decoration: none; font-weight: 600; }
.primary { background: var(--accent); border-color: var(--accent); }
.ok { background: #14532d; border-color: var(--ok); }
.danger { background: #450a0a; border-color: var(--danger); }
.chip { padding: 8px 12px; font-size: 15px; border-radius: 999px; }
.chip[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.row { display: flex; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.top { display: flex; align-items: center; gap: 8px; padding: 6px 0 12px; }
.top .title { flex: 1; font-weight: 700; font-size: 18px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); }
.dot.off { background: var(--danger); }
.talk { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.bubble { padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { color: var(--muted); font-style: italic; }
.bubble.bot { font-size: 19px; }
.card { padding: 14px; border-radius: 16px; background: #1f1a0d; border: 1px solid var(--warn); }
.card p { margin: 0 0 10px; overflow-wrap: anywhere; }
.mic { align-self: center; width: 46vw; max-width: 220px; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #1d4ed8, #1e3a8a); border: 4px solid #60a5fa; font-size: 24px; font-weight: 700; margin: 10px 0 0; touch-action: manipulation; }
.mic.listening { background: radial-gradient(circle at 50% 40%, #dc2626, #7f1d1d); border-color: #fca5a5; animation: pulse 1.2s infinite; }
.mic.busy { opacity: .6; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.type { display: flex; gap: 8px; }
.type input, .type textarea { flex: 1; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.quick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 18px; }
.quick .big { padding: 14px 6px; font-size: 16px; }
.sessions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sessions li { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; }
.sessions .name { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.sessions .sub { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.state { font-size: 13px; padding: 3px 8px; border-radius: 999px; background: #222b37; color: var(--muted); white-space: nowrap; }
.s-working { background: #172554; color: #93c5fd; }
.s-needs_permission { background: #451a03; color: #fcd34d; }
.s-needs_input { background: #2e1065; color: var(--ask); }
.s-idle { background: #1f2937; color: #d1d5db; }
details summary { color: var(--muted); padding: 12px 0; cursor: pointer; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; z-index: 10; }
.sheet-inner { width: 100%; max-width: 760px; margin: 0 auto; max-height: 92vh; overflow: auto; background: var(--bg); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
pre { margin: 0; padding: 10px; background: #05080b; border: 1px solid var(--line); border-radius: 10px; font: 12px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow: auto; }
.opt { display: flex; gap: 10px; align-items: center; padding: 10px 0; }
.opt input { width: 22px; height: 22px; }
.history { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.history li { padding: 8px 10px; background: var(--panel); border-radius: 10px; overflow-wrap: anywhere; }
