:root {
  --bg: #f6f7f9; --card: #ffffff; --ink: #14171f; --muted: #6b7280;
  --line: #e5e7eb; --accent: #4f46e5; --accent-ink: #ffffff;
  --green: #16a34a; --amber: #d97706; --red: #dc2626;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116; --card: #171b22; --ink: #e8eaed; --muted: #9aa3b2;
    --line: #262b34; --accent: #7c74ff; --accent-ink: #0e1116;
    --green: #35c46a; --amber: #f0a84b; --red: #f16b6b;
    --shadow: 0 1px 3px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  padding-bottom: 76px;
}
a { color: var(--accent); }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 17px; margin: 18px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.tap { cursor: pointer; transition: transform .08s; }
.card.tap:active { transform: scale(.99); }

button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; cursor: pointer; min-height: 44px;
}
button:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

input, textarea, select {
  font: inherit; width: 100%; padding: 12px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--ink); min-height: 44px;
}
textarea { min-height: 72px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pill.green { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.pill.amber { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.pill.red { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }

.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }

.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line);
  display: inline-grid; place-items: center; flex: none; cursor: pointer; }
.check.done { background: var(--green); border-color: var(--green); color: #fff; }

/* нижняя навигация */
.nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
  border-top: 1px solid var(--line); display: flex; justify-content: space-around;
  padding: 6px 4px env(safe-area-inset-bottom); z-index: 50; }
.nav a { flex: 1; text-align: center; color: var(--muted); text-decoration: none;
  font-size: 11px; padding: 6px 2px; }
.nav a .ic { font-size: 20px; display: block; }
.nav a.active { color: var(--accent); }

.streak-big { font-size: 40px; font-weight: 800; }
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat { text-align: center; }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }

.focus-timer { font-size: 64px; font-weight: 800; text-align: center; letter-spacing: 2px;
  font-variant-numeric: tabular-nums; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid;
  place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--card); border-radius: var(--radius); padding: 20px;
  max-width: 460px; width: 100%; max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.spark > i { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px;
  opacity: .85; }

.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  z-index: 200; font-size: 14px; box-shadow: var(--shadow); }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.step-line { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.step-line .grow { word-break: break-word; }
.done-text { text-decoration: line-through; color: var(--muted); }
