:root {
  --bg: #f4f6f7; --card: #fff; --text: #14201f; --muted: #66767a; --line: #dde3e5;
  --accent: #0f766e; --accent-text: #fff; --done: #15803d; --miss: #b91c1c; --pend: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1415; --card: #172022; --text: #e8eeee; --muted: #8fa1a4; --line: #2a373a;
    --accent: #2dd4bf; --accent-text: #052e2a; --done: #4ade80; --miss: #f87171; --pend: #fbbf24;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  max-width: 560px; margin-inline: auto;
}
header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0 8px; }
h1 { font-size: 1.15rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 8px; }
button, select, input {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 44px;
}
button { cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--miss); }
button.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.chip { border-radius: 999px; min-height: 36px; padding: 6px 14px; font-size: .9rem; }
nav { display: flex; gap: 6px; margin: 8px 0 14px; }
nav button { flex: 1; }
nav button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); font-size: .9rem; }
.status-done { color: var(--done); font-weight: 600; }
.status-pending { color: var(--pend); font-weight: 600; }
.status-missed { color: var(--miss); font-weight: 600; }
.date-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.date-head strong { font-size: 1.05rem; }
.progress { color: var(--muted); }
.hist-row { display: grid; grid-template-columns: 1fr repeat(4, 34px); gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist-row:last-child { border: 0; }
.hist-head { color: var(--muted); font-size: .8rem; }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; justify-self: center; }
.dot.done { background: var(--done); color: var(--bg); }
.dot.missed { background: transparent; border: 2px solid var(--miss); color: var(--miss); }
.dot.pending { background: transparent; border: 2px dashed var(--line); color: var(--muted); }
.hist-who { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
form.add { display: flex; gap: 8px; margin-bottom: 12px; }
form.add input { flex: 1; min-width: 0; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; padding: 16px; z-index: 5; }
.overlay[hidden] { display: none; }
.sheet { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 380px; display: grid; gap: 12px; }
#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0;
  transition: .2s; pointer-events: none; max-width: 90vw; z-index: 10;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
