:root {
  --bg: #f6f6f4; --surface: #fff; --ink: #0a0a0a; --muted: #5c5c58; --line: #dcdcd6; --accent: #0a0a0a; --on-accent: #fff;
  --ai: #eef0f2; --agent: #e6f2ea; --agent-line: #2f7a4a; --warn: #8a5a00; --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111; --surface: #1a1a1a; --ink: #f2f2ee; --muted: #a8a8a2; --line: #333; --accent: #f2f2ee; --on-accent: #111; --ai: #23262a; --agent: #1d2e23; --agent-line: #6cc28c; --warn: #e0b04a; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom); }
[hidden] { display: none !important; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: calc(.7rem + env(safe-area-inset-top)) 16px .7rem; background: var(--ink); color: var(--bg); }
.brand { color: inherit; font-weight: 700; text-decoration: none; letter-spacing: .01em; }
.who { font-size: .85rem; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.35rem; margin: 0 0 .5rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .55rem 1.05rem; border-radius: 999px; border: 2px solid var(--accent); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn--quiet { background: transparent; color: var(--ink); }
/* The header is inverted (ink background): its quiet button uses the page colour so it stays visible in both themes. */
.top .btn--quiet { color: var(--bg); border-color: var(--bg); flex: none; min-height: 40px; padding: .4rem .9rem; }
.top .btn:focus-visible { outline-color: #60a5fa; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .tabs button:focus-visible, .list a:focus-visible, textarea:focus-visible { outline: 3px solid #3b82f6; outline-offset: 2px; }
.alerts, .install { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: .8rem; }
.alerts p, .install p { margin: 0; flex: 1 1 16rem; }
.alerts--off { border-color: var(--warn); }
.tabs { display: flex; gap: .4rem; margin: .4rem 0 .8rem; }
.tabs button { flex: 1; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list a { display: block; padding: .8rem 1rem; color: inherit; text-decoration: none; }
.list .row { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; }
.list .title { font-weight: 600; }
.list .snip { margin: .25rem 0 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead { padding: .8rem 1rem; }
.lead dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .8rem; margin: .4rem 0 0; }
.lead dt { color: var(--muted); }
.lead dd { margin: 0; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.badge--human { background: var(--agent); border-color: var(--agent-line); }
.badge--alert { border-color: var(--warn); color: var(--warn); }
.conv { display: flex; flex-direction: column; gap: .6rem; }
.conv__bar { display: flex; justify-content: space-between; align-items: center; }
.back { color: inherit; font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.log { list-style: none; margin: 0; padding: .8rem; display: grid; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 40dvh; max-height: 60dvh; overflow-y: auto; }
.m { max-width: 85%; padding: .5rem .75rem; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.m small { display: block; font-size: .72rem; font-weight: 700; opacity: .7; margin-bottom: .1rem; }
.m--visitor { justify-self: end; background: var(--ink); color: var(--bg); }
.m--ai { justify-self: start; background: var(--ai); }
.m--agent { justify-self: start; background: var(--agent); border: 2px solid var(--agent-line); }
.m--system { justify-self: center; max-width: 100%; background: none; color: var(--muted); font-size: .85rem; text-align: center; }
.typing { min-height: 1.2em; margin: 0; font-size: .85rem; }
.conv__actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.compose { display: flex; gap: .5rem; align-items: flex-end; }
.compose textarea { flex: 1; min-height: 48px; padding: .6rem .75rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.empty { text-align: center; padding: 1.5rem 0; }
