:root {
  --bg: #fff8f1; --card: #ffffff; --text: #3d2e28; --muted: #7a6359; --line: #f0e2d6;
  --accent: #b4581c; --accent-soft: #fde8d6; --good: #2e7d4f; --warn: #b23a48; --used: #f4a261; --empty: #f6ece3; --treat: #c2457a;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1a17; --card: #2b2420; --text: #f6ede6; --muted: #bfaea4; --line: #3d332d;
    --accent: #f7b27a; --accent-soft: #4a3526; --good: #7fd3a0; --warn: #f28b95; --used: #f7b27a; --empty: #3a302a; --treat: #f29bc0;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Segoe UI", Roboto, sans-serif; }
main { overflow-wrap: anywhere; max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
header .lang { float: right; font-size: 14px; }
h1 { font-size: 28px; line-height: 1.25; margin: 8px 0 8px; }
h2 { font-size: 21px; margin: 36px 0 10px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
p.lead { color: var(--muted); margin-top: 0; }
a { color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin: 16px 0; }
.trip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; align-items: end;
  padding: 12px 0; border-bottom: 1px solid var(--line); }
.trip:last-of-type { border-bottom: 0; }
.trip > div { min-width: 0; }
.trip input[type=date], .check input { min-width: 0; max-width: 100%; }
.trip label { font-size: 13px; color: var(--muted); display: block; }
.trip input[type=date] { width: 100%; font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); }
.trip .opts { grid-column: 1 / -1; display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--muted); }
.trip .opts label { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }
button { font: inherit; border-radius: 999px; border: 0; padding: 10px 18px; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.ghost { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
button.remove { background: none; color: var(--muted); padding: 8px; font-size: 20px; line-height: 1; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.check label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); }
.check { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.check input { font: inherit; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); }
.big { font-size: 44px; font-weight: 800; line-height: 1.1; }
.big small { font-size: 18px; font-weight: 600; color: var(--muted); }
.results p { margin: 6px 0; }
.ok { color: var(--good); font-weight: 600; } .ng { color: var(--warn); font-weight: 600; }
.timeline { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; margin: 12px 0 4px; }
.timeline span { aspect-ratio: 1; border-radius: 3px; background: var(--empty); }
.timeline span.used { background: var(--used); }
.timeline span.over { background: var(--warn); }
.timeline span.today { outline: 2px solid var(--text); outline-offset: 1px; }
.legend { font-size: 13px; color: var(--muted); }
.note { font-size: 14px; color: var(--muted); }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { font-weight: 600; cursor: pointer; }
footer { margin-top: 48px; font-size: 13px; color: var(--muted); }
.trip .opts .remove { margin-left: auto; }

[hidden] { display: none !important; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); min-width: 0; }
.form input, .form select { font: inherit; font-size: 16px; padding: 9px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); min-width: 0; max-width: 100%; }
.form .full { grid-column: 1 / -1; }
.seg { display: flex; gap: 8px; }
.seg label { flex: 1; flex-direction: row; justify-content: center; align-items: center; gap: 6px; padding: 10px;
  border: 1px solid var(--line); border-radius: 999px; font-size: 16px; color: var(--text); cursor: pointer; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.stat { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.stat div { flex: 1 1 140px; background: var(--accent-soft); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 26px; }
.stat span { font-size: 13px; color: var(--muted); }
.treat b { color: var(--treat); }
