:root {
  --bg: #f6f5f1; --card: #ffffff; --ink: #1d1f22; --muted: #6b6f76; --line: #e3e1da;
  --accent: #2f6f5e; --accent-ink: #ffffff; --warn: #b26a00; --bad: #b3261e; --ok: #2e7d32;
  --chip: #eceae3; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --radius: 14px; --gap: 12px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416; --card: #1b1e21; --ink: #eceff1; --muted: #9aa1a8; --line: #2b2f33;
    --accent: #6fc2a7; --accent-ink: #0d1a15; --warn: #f0b04a; --bad: #ff8a80; --ok: #81c784; --chip: #262a2e;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #121416; --card: #1b1e21; --ink: #eceff1; --muted: #9aa1a8; --line: #2b2f33;
  --accent: #6fc2a7; --accent-ink: #0d1a15; --warn: #f0b04a; --bad: #ff8a80; --ok: #81c784; --chip: #262a2e; --shadow: none;
}
:root[data-text="large"] { font-size: 118%; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent); }
h1 { font-size: 1.45rem; margin: 4px 0 2px; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
h3 { font-size: .95rem; margin: 10px 0 6px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .82rem; }
.hidden { display: none !important; }

main { max-width: 680px; margin: 0 auto; padding: 14px 16px 96px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 var(--gap); box-shadow: var(--shadow); min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.row > .grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; min-height: 42px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; min-height: 34px; font-size: .88rem; }
.btn.icon { padding: 4px 8px; min-width: 38px; min-height: 38px; }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--accent); padding: 6px 0; cursor: pointer; text-align: left; }

input[type=text], input[type=search], input[type=date], input[type=number], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; min-height: 42px;
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.big3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.big3 button { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 6px; cursor: pointer; min-height: 76px; }
.big3 b { display: block; font-size: 1.3rem; }
.big3 span { font-size: .85rem; color: var(--muted); }

.needs li { list-style: none; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; align-items: flex-start; }
.needs li:first-child { border-top: 0; }
.needs ul { margin: 0; padding: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--muted); }
.dot.act { background: var(--bad); } .dot.watch { background: var(--warn); } .dot.ok { background: var(--ok); }

.rings { display: flex; gap: 10px; flex-wrap: wrap; }
.ring { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--chip); font-size: .88rem; cursor: pointer; border: 0; }

.list { margin: 0; padding: 0; }
.list li { list-style: none; display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); min-width: 0; }
.list li:first-child { border-top: 0; }
.list li.done .txt { text-decoration: line-through; color: var(--muted); }
.list .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list input.txt { border: 0; background: transparent; padding: 6px 4px; min-height: 36px; }
.tick { width: 26px; height: 26px; flex: none; accent-color: var(--accent); }

.note { cursor: pointer; overflow-wrap: anywhere; }
.note .body { white-space: pre-wrap; max-height: 9.5em; overflow: hidden; }
.badge { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }
.badge.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
nav.tabs a { text-align: center; padding: 8px 0 10px; color: var(--muted); text-decoration: none; font-size: .78rem; }
nav.tabs a span { display: block; font-size: 1.25rem; line-height: 1.3; }
nav.tabs a.on { color: var(--accent); font-weight: 600; }

.fab { position: fixed; right: 16px; bottom: 76px; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 1.8rem; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; z-index: 11; }

.banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: var(--gap); font-size: .92rem; }
.banner.bad { background: color-mix(in srgb, var(--bad) 15%, var(--card)); border: 1px solid var(--bad); }
.banner.warn { background: color-mix(in srgb, var(--warn) 15%, var(--card)); border: 1px solid var(--warn); }

.toast { position: fixed; left: 16px; right: 16px; bottom: 84px; max-width: 520px; margin: 0 auto; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; z-index: 30; }
.toast .grow { flex: 1; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 700; cursor: pointer; }

.sheet { position: fixed; inset: 0; background: var(--bg); z-index: 20; overflow-y: auto; }
.sheet main { padding-bottom: 40px; }

.chat { display: flex; flex-direction: column; gap: 8px; }
.bubble { padding: 10px 12px; border-radius: 14px; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.bubble.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: .8rem; background: var(--chip); border-radius: 999px; padding: 3px 10px; border: 0; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.seg { display: flex; gap: 6px; overflow-x: auto; margin-bottom: var(--gap); }
.seg button { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat b { display: block; font-size: 1.1rem; overflow-wrap: anywhere; }
.bar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; table-layout: fixed; }
td, th { padding: 6px 4px; border-top: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; vertical-align: top; }
td.num, th.num { text-align: right; width: 28%; }
.neg { color: var(--bad); } .pos { color: var(--ok); }

.login { max-width: 420px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.login .card { text-align: left; }
.logo { width: 64px; height: 64px; }

.steps { padding-left: 1.3em; margin: 6px 0 12px; }
.steps li { margin: 4px 0; }
.btn.wide { width: 100%; min-height: 50px; font-size: 1.05rem; }
.msg { font-weight: 600; min-height: 1.5em; }
.paircode { font-size: 2.4rem; letter-spacing: .25em; font-weight: 700; text-align: center; margin: 8px 0; font-variant-numeric: tabular-nums; }

.col-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.radius { width: auto; min-height: 36px; padding: 4px 8px; }
details summary { cursor: pointer; color: var(--accent); padding: 6px 0; }
.chips .chip { white-space: normal; text-align: left; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
details.acc { border-top: 1px solid var(--line); padding: 6px 0; }
details.acc summary { color: var(--ink); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
details.acc label { padding: 4px 0 4px 18px; }

.drivebtn { display: block; text-align: center; text-decoration: none; margin-bottom: var(--gap); line-height: 32px; }
.drive { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: var(--gap); }
.drive.over { border: 3px solid var(--bad); }
.drive-row { display: flex; justify-content: space-around; align-items: center; gap: 12px; }
.speed { text-align: center; } .speed b { font-size: 4.5rem; line-height: 1; display: block; font-variant-numeric: tabular-nums; } .drive.over .speed b { color: var(--bad); }
.sign { width: 104px; height: 104px; border-radius: 50%; border: 10px solid #d32f2f; background: #fff; color: #111; display: flex; align-items: center; justify-content: center; flex: none; } .sign b { font-size: 2.6rem; }
.drive-road { text-align: center; font-weight: 600; margin: 8px 0; }

.talk { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 24px 0; }
.orb { width: 150px; height: 150px; border-radius: 50%; border: 0; font-size: 3rem; cursor: pointer; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 24px rgba(0,0,0,.25); transition: transform .2s; }
.orb.listening { animation: pulse 1.4s infinite; } .orb.thinking { opacity: .7; } .orb.speaking { transform: scale(1.06); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 70% { box-shadow: 0 0 0 26px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.talk-status { font-weight: 600; font-size: 1.1rem; }

.qr { display: block; margin: 10px auto; width: 210px; height: 210px; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: 8px; }
