:root {
  --bg: #f6f7f8;
  --card: #ffffff;
  --text: #15191d;
  --muted: #6b737b;
  --line: #e3e6e9;
  --accent: #1f7a5c;
  --accent-text: #ffffff;
  --warn: #b4441f;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101418;
    --card: #181d22;
    --text: #e8ebee;
    --muted: #8b949c;
    --line: #262d34;
    --accent: #3fb98d;
    --accent-text: #08130e;
    --warn: #f08a63;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
main { max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; }
h1 { font-size: 22px; margin: 4px 0 16px; font-weight: 650; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; font-weight: 600; }
button, input, textarea, select { font: inherit; color: inherit; }
input, textarea, select {
  width: 100%; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--card); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 120px; resize: vertical; }
button {
  border: 0; border-radius: var(--radius); padding: 11px 16px; background: var(--accent); color: var(--accent-text);
  font-weight: 600; cursor: pointer;
}
button.plain { background: transparent; color: var(--accent); padding: 8px 4px; }
button.danger { background: transparent; color: var(--warn); padding: 8px 4px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); min-height: 48px; }
.row:first-child { border-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .sub { color: var(--muted); font-size: 13px; }
.row .amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.done .grow > span:first-child { text-decoration: line-through; color: var(--muted); }
.row.click { cursor: pointer; }
.check {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); flex: none; padding: 0;
  background: transparent; display: grid; place-items: center;
}
.done .check { background: var(--accent); border-color: var(--accent); }
.done .check::after { content: ""; width: 9px; height: 5px; border: solid var(--accent-text); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.empty { color: var(--muted); padding: 12px 14px; }
.ask { display: flex; gap: 8px; position: sticky; top: 0; padding: 8px 0; background: var(--bg); z-index: 2; }
.ask input { flex: 1; }
.toast { color: var(--muted); font-size: 14px; min-height: 20px; margin: 4px 2px 0; }
.chat { display: grid; gap: 8px; margin-top: 8px; }
.bubble { padding: 10px 14px; border-radius: var(--radius); max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { background: var(--accent); color: var(--accent-text); justify-self: end; }
.bubble.assistant { background: var(--card); border: 1px solid var(--line); }
.big { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0 0 4px; }
.bar { height: 6px; border-radius: 3px; background: var(--accent); opacity: .8; margin-top: 6px; }
.field { display: grid; gap: 6px; margin: 10px 0; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle input { width: 44px; height: 26px; accent-color: var(--accent); }
.stack { display: grid; gap: 10px; }
.code { font: 600 28px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-align: center; padding: 16px; }
.center { max-width: 360px; margin: 18vh auto 0; }
nav#tabs {
  position: fixed; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav#tabs button { background: transparent; color: var(--muted); border-radius: 0; padding: 14px 4px; font-weight: 600; font-size: 14px; }
nav#tabs button[aria-current="page"] { color: var(--accent); }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.inline-select { width: auto; padding: 2px 6px; border: 0; background: transparent; color: inherit; font-size: 13px; }
[hidden] { display: none !important; }
