/* AI Dev Assistant dashboard. One column, what needs the owner first; light and dark themes. */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f7f9fb; --raised: #eef2f6; --text: #14181d; --muted: #5d6773; --faint: #66707c;
  --line: #e3e8ee; --line-2: #d3dae3;
  --accent: #2f62e6; --accent-soft: #e8efff; --on-accent: #ffffff;
  --ok: #0e6f37; --ok-soft: #e4f6eb; --warn: #9a5b00; --warn-soft: #fff2db; --bad: #c62832; --bad-soft: #fde8ea;
  --claude: #9c4c14; --claude-soft: #fbeee4; --codex: #0d7a6f; --codex-soft: #e1f4f1; --on-bad: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --top: rgba(244, 246, 249, .9); --scrim: rgba(15, 20, 28, .35);
  --radius: 14px; --radius-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1014; --surface: #151a20; --surface-2: #1a2027; --raised: #212832; --text: #e8ebef; --muted: #a6b0bc; --faint: #8a94a0;
    --line: #262d36; --line-2: #333c48;
    --accent: #7aa2ff; --accent-soft: rgba(122, 162, 255, .14); --on-accent: #0b1220;
    --ok: #4fd17f; --ok-soft: rgba(79, 209, 127, .13); --warn: #f2b84b; --warn-soft: rgba(242, 184, 75, .13); --bad: #ff7a7f; --bad-soft: rgba(255, 122, 127, .12);
    --claude: #f0a46a; --claude-soft: rgba(240, 164, 106, .14); --codex: #4fd1c1; --codex-soft: rgba(79, 209, 193, .13); --on-bad: #2a0b0d;
    --shadow: 0 1px 0 rgba(255, 255, 255, .02), 0 10px 28px rgba(0, 0, 0, .35);
    --top: rgba(13, 16, 20, .88); --scrim: rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
/* The page never shifts sideways when a panel locks its scrolling. */
html { scrollbar-gutter: stable; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
code { font: 12px/1.4 Consolas, ui-monospace, monospace; background: var(--raised); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: 13px/1.5 "Segoe UI", system-ui, sans-serif; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.bad { color: var(--bad); }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }

/* ---- top bar ---- */
.top { position: sticky; top: 0; z-index: 20; background: var(--top); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 960px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; }
.brand { font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.offline { background: var(--bad-soft); color: var(--bad); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; background: var(--raised); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; border-radius: 999px; background: var(--bad); color: var(--on-bad); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }

/* ---- layout ---- */
main { max-width: 960px; margin: 0 auto; padding: 16px 16px 110px; display: grid; gap: 14px; }
main > *, .list > *, .task .head > * { min-width: 0; }
.fact { max-width: 100%; overflow-wrap: anywhere; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }

/* ---- buttons, switches, segmented control ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); border-radius: 9px; padding: 6px 13px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn.small { padding: 3px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.big { padding: 10px 20px; font-size: 14.5px; border-radius: 11px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
.btn:disabled, .icon-btn:disabled { opacity: .5; cursor: default; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; border: 0; background: var(--line-2); cursor: pointer; flex: none; transition: background .15s; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--ok); }
.switch[aria-checked="true"]::after { left: 21px; }
.switch.big { width: 58px; height: 32px; }
.switch.big::after { width: 26px; height: 26px; }
.switch.big[aria-checked="true"]::after { left: 29px; }
.switch.sm { width: 36px; height: 21px; }
.switch.sm::after { width: 15px; height: 15px; }
.switch.sm[aria-checked="true"]::after { left: 18px; }
.switch:disabled { opacity: .5; cursor: default; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; background: var(--raised); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 6px 16px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); }
.seg button:disabled { cursor: default; }

/* ---- the status card ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: center; }
.hero-title { display: flex; align-items: center; gap: 14px; }
.hero h1 { font-size: 22px; letter-spacing: -.01em; }
.hero h1 .state { color: var(--ok); }
.hero.off h1 .state { color: var(--bad); }
.hero.off { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); background: linear-gradient(0deg, var(--bad-soft), var(--bad-soft)), var(--surface); }
.hero-sub { margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.hero-usage { display: grid; gap: 14px; }
.engine .row { display: flex; align-items: center; gap: 8px; }
.engine b { font-size: 13.5px; }
.engine .state { font-size: 12px; color: var(--muted); }
.engine .switch { margin-left: auto; }
.bar { height: 7px; border-radius: 999px; background: var(--raised); overflow: hidden; margin: 7px 0 4px; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.bar.warn i { background: var(--warn); }
.bar.bad i { background: var(--bad); }
.engine .meta { font-size: 12px; color: var(--muted); }

/* ---- projects row ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 1px; }
.chips::-webkit-scrollbar { display: none; }
.pchip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.pchip:hover { color: var(--text); }
.pchip.sel { background: var(--text); border-color: var(--text); color: var(--bg); }
.pchip .n { background: var(--bad); color: var(--on-bad); border-radius: 999px; font-size: 11px; padding: 0 6px; }
.pchip .sub { font-weight: 500; opacity: .75; }
.pchip.add { border-style: dashed; color: var(--accent); background: transparent; }

/* ---- a project's facts (the selected project) ---- */
.facts-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.facts-head h2 { font-size: 18px; }
.facts-head .repo { font-size: 12.5px; color: var(--muted); }
.facts-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fact-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fact { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; color: var(--muted); }
.fact b { color: var(--text); font-weight: 600; }
.fact .d { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.fact .d.ok { background: var(--ok); } .fact .d.bad { background: var(--bad); } .fact .d.warn { background: var(--warn); }
.facts details { margin-top: 10px; }
.facts summary, .panel summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.facts .about { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.warnline { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 600; }

/* ---- all projects ---- */
.overview { display: grid; gap: 8px; }
.prow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.prow:hover { border-color: var(--line-2); }
.prow > b { font-size: 14.5px; }
.prow .nums { margin-left: auto; display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; }
.prow .nums b { color: var(--text); font-size: 13.5px; margin-right: 3px; }
.prow .nums .hot b { color: var(--bad); }
.prow .go { color: var(--faint); font-size: 18px; line-height: 1; }

/* ---- the next step, while a project is getting started ---- */
.guide { display: flex; align-items: center; gap: 14px; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.guide .ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.guide .txt { flex: 1; min-width: 0; }
.guide b { display: block; font-size: 14.5px; }
.guide p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ---- where the work is ---- */
.stages { display: grid; grid-template-columns: repeat(var(--tiles, 5), minmax(0, 1fr)); gap: 10px; }
.stage { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; cursor: pointer; }
.stage:hover { border-color: var(--line-2); }
.stage b { display: block; font-size: 22px; line-height: 1.2; }
.stage span { font-size: 12.5px; color: var(--muted); }
.stage.hot { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: linear-gradient(0deg, var(--bad-soft), var(--bad-soft)), var(--surface); }
.stage.hot b { color: var(--bad); }
.stage.good b { color: var(--ok); }

/* ---- sections and task cards ---- */
.sec { scroll-margin-top: 64px; }
.sec > h2 { display: flex; align-items: center; gap: 8px; margin: 4px 2px 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sec-actions { margin-left: auto; text-transform: none; letter-spacing: 0; }
.count { background: var(--raised); color: var(--text); border-radius: 999px; padding: 0 8px; font-size: 12px; letter-spacing: 0; }
.count.bad { background: var(--bad-soft); color: var(--bad); }
.count:empty { display: none; }
.list { display: grid; gap: 10px; }
.task { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.task.attn { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.task.paused { background: var(--surface-2); }
.task .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task .title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.task .title:hover { color: var(--accent); }
.task .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.task .meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.task .text { margin-top: 8px; max-height: 300px; overflow: auto; }
.task .err { color: var(--bad); font-size: 12.5px; margin-top: 6px; overflow-wrap: anywhere; }
.task .foot { display: flex; align-items: flex-start; gap: 10px; margin-top: 8px; }
.task .foot details { flex: 1; min-width: 0; }
.task details summary { font-size: 12.5px; color: var(--faint); cursor: pointer; }
.task details pre { margin-top: 6px; font-size: 12px; color: var(--muted); }
.answer { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.answer textarea { flex: 1; min-width: 0; min-height: 40px; }
.compact .task { padding: 10px 15px; }
.compact .task .meta { margin-top: 2px; }
.more { justify-self: start; }
.group-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 2px 0; font-size: 13px; color: var(--muted); }
.group-row b { color: var(--text); }
.group-row .btn { margin-left: auto; }
.empty { color: var(--muted); font-style: italic; margin: 2px 2px 0; }
.chip { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; border-radius: 6px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; background: var(--raised); color: var(--muted); white-space: nowrap; }
.chip.claude { background: var(--claude-soft); color: var(--claude); }
.chip.codex { background: var(--codex-soft); color: var(--codex); }
.chip.phase { background: var(--accent-soft); color: var(--accent); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.proj { background: transparent; border: 1px solid var(--line); }
/* Where a task is: work, check, review, merge. */
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.steps span { text-align: center; font-size: 11.5px; font-weight: 600; padding: 4px 2px; border-radius: 6px; background: var(--raised); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps span.done { background: var(--ok-soft); color: var(--ok); }
.steps span.now { background: var(--accent); color: var(--on-accent); }
.steps small { font-size: inherit; }
.task.paused .steps span.now { background: var(--warn-soft); color: var(--warn); }

/* ---- onboarding and welcome ---- */
.onboarding { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.onboarding.failed { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); flex-wrap: wrap; }
.onboarding.failed b { color: var(--bad); }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.welcome { text-align: center; padding: 30px 20px; }
.welcome-title { font-size: 19px; margin-bottom: 18px; letter-spacing: -.01em; }
.how { list-style: none; counter-reset: how; padding: 0; margin: 0 auto 22px; max-width: 760px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; text-align: left; }
.how li { counter-increment: how; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.how li::before { content: counter(how); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 12.5px; margin-bottom: 8px; }
.how b { display: block; font-size: 14px; }
.how span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ---- the assistant bar, toasts ---- */
.askbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 22px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 45%); pointer-events: none; }
.askbar-in { pointer-events: auto; max-width: 928px; margin: 0 auto; display: flex; gap: 4px; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 5px; box-shadow: var(--shadow); }
.askbar-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.askbar-in input[type="text"] { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 4px; font-size: 14px; }
.askbar-in input[type="text"]:focus { box-shadow: none; }
.askbar-in .btn { padding: 8px 18px; border-radius: 10px; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 70; max-width: min(640px, calc(100% - 32px)); background: var(--text); color: var(--bg); border-radius: 12px; padding: 10px 16px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: var(--on-bad); }

/* ---- forms ---- */
input[type="text"], input[type="password"], textarea { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px; font: 13.5px/1.4 "Segoe UI", system-ui, sans-serif; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.form .lbl { color: var(--text); font-size: 13px; }
.form .lbl em { font-style: normal; font-weight: 500; color: var(--faint); margin-left: 4px; }
.form label small { font-weight: 400; color: var(--faint); font-size: 12px; }
.modal-title + .hint { margin-top: 4px; }
.form .check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; color: var(--text); line-height: 1.45; }
.form .check input { flex: none; margin: 3px 0 0; }
.form details summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.form-error { margin: 0; color: var(--bad); font-size: 13px; font-weight: 600; }

/* ---- panels (right side; full screen on a phone) and the dialog ---- */
.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); }
.panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(440px, 100%); background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(0, 0, 0, .25); }
.panel > header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel > header b { font-size: 15px; }
.panel-body { flex: 1; overflow: auto; padding: 14px; display: grid; gap: 14px; align-content: start; }
.panel h3 { font-size: 12.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }
.ptabs { display: flex; border-bottom: 1px solid var(--line); }
.ptabs button { flex: 1; border: 0; background: none; padding: 10px 0; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.ptabs button.sel { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.alert { border-bottom: 1px solid var(--line); padding: 10px 2px; }
.alert:last-child { border-bottom: 0; }
.alert .when { font-size: 12px; color: var(--faint); }
.log { display: grid; gap: 1px; font-size: 12.5px; }
.logline { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; padding: 4px 2px; color: var(--muted); overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.logline .t { color: var(--faint); font-variant-numeric: tabular-nums; }
.logline.alert-line { color: var(--text); }
.logline.alert-line .x::before { content: "⚠ "; color: var(--warn); }
.chat-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.owner { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 4px; }
.bubble.assistant { align-self: flex-start; background: var(--raised); border-bottom-left-radius: 4px; }
.bubble.failed { background: var(--bad-soft); color: var(--bad); }
.bubble code { background: rgba(127, 127, 127, .18); }
.bubble-meta { font-size: 11px; opacity: .7; margin-top: 4px; }
.typing { color: var(--muted); font-style: italic; }
.chat-note { margin: 0 0 4px; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 600; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.quick-btn { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text); }
.quick-btn:hover { border-color: var(--accent); color: var(--accent); }
.chat-in { display: flex; gap: 8px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); align-items: flex-end; }
.chat-in textarea { flex: 1; min-height: 44px; max-height: 160px; }
.setting { display: flex; align-items: flex-start; gap: 12px; }
.setting > div { flex: 1; }
.setting b { display: block; font-size: 13.5px; }
.setting p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 14px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); border-radius: 12px; padding: 14px; }
.danger-zone p { margin: 4px 0 12px; color: var(--muted); font-size: 12.5px; }
.modal { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; padding: 16px; overflow: auto; }
.modal > .card { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal-title { font-size: 18px; }

/* ---- the mark, and signing in ---- */
.mark { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 12px; letter-spacing: -.02em; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 9px; }
.login-main { max-width: 400px; padding-top: 14vh; }
.login-card { display: grid; gap: 16px; padding: 24px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .mark { width: 44px; height: 44px; border-radius: 12px; font-size: 16px; }
.login-brand h1 { font-size: 19px; letter-spacing: -.01em; }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.login-card .bad { margin: 0; font-size: 13px; font-weight: 600; }
.login-card .bad:empty { display: none; }
/* Hidden from sight, there for the browser (it outranks the input styles above). */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }

/* ---- phones ---- */
@media (max-width: 720px) {
  .top-in { padding: 9px 12px; }
  main { padding: 12px 12px 104px; gap: 12px; }
  .hero { grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .hero h1 { font-size: 20px; }
  .hero-sub { margin-bottom: 10px; }
  /* Both AIs side by side: the status card stays short. */
  .hero-usage { grid-template-columns: 1fr 1fr; gap: 12px; }
  .engine .meta { font-size: 11.5px; }
  .engine .row { flex-wrap: wrap; row-gap: 2px; }
  .engine .state { order: 3; width: 100%; font-size: 11px; }
  .seg { display: flex; }
  .seg button { flex: 1; padding: 7px 0; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .stages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .stages[data-tiles="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage { padding: 8px 10px; }
  .stage b { font-size: 18px; }
  .btn.small { min-height: 36px; padding: 6px 12px; }
  .switch.sm { width: 44px; height: 26px; }
  .switch.sm::after { width: 20px; height: 20px; }
  .switch.sm[aria-checked="true"]::after { left: 21px; }
  .task details summary, .facts summary { padding: 8px 0; }
  .meta a, .fact a, .facts-head .repo { display: inline-block; padding: 6px 0; }
  .facts-actions { margin-left: 0; width: 100%; }
  .fact.minor { display: none; }
  .prow .go { display: none; }
  .prow .nums { margin-left: 0; width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; text-align: center; font-size: 11px; line-height: 1.25; }
  .prow .nums b { display: block; margin: 0 0 2px; font-size: 16px; }
  .steps small { display: none; }
  .how { grid-template-columns: 1fr; }
  .guide { flex-wrap: wrap; }
  .guide .btn { width: 100%; }
  .task .end { margin-left: 0; }
  .panel { width: 100%; border-left: 0; }
  .askbar { padding-left: 12px; padding-right: 12px; }
  .toast { bottom: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
