:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #22262b;
  --muted: #6b7078;
  --line: #e6e1d8;
  --accent: #3f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e3eee9;
  --warm: #f2b84b;
  --warm-soft: #fbefd6;
  --danger: #b4544a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .05);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --card: #20232a;
    --ink: #eceae6;
    --muted: #9ba0a8;
    --line: #2f333b;
    --accent: #7fbfa6;
    --accent-ink: #10231c;
    --accent-soft: #23352e;
    --warm: #f2b84b;
    --warm-soft: #3a3121;
    --danger: #e08b80;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px 24px;
}
h1 { font-size: 30px; line-height: 1.15; margin: 6px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 26px 0 10px; }
p { margin: 6px 0; }
.sub { color: var(--muted); margin: 0 0 18px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
a { color: var(--accent); }

/* Buttons */
button, .btn {
  font: inherit;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  min-height: 48px;
  background: var(--accent-soft);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .5; }
.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.big { width: 100%; font-size: 19px; min-height: 60px; }
.ghost { background: transparent; color: var(--muted); padding: 10px 12px; min-height: 40px; }
.danger { color: var(--danger); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.stack > * + * { margin-top: 10px; }

/* Forms */
label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.error { color: var(--danger); min-height: 1.4em; margin-top: 10px; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 12px;
}
.task-head { display: flex; gap: 14px; align-items: flex-start; }
.check {
  flex: 0 0 34px;
  width: 34px; height: 34px; min-height: 34px;
  border-radius: 50%;
  border: 2.5px solid var(--accent);
  background: transparent;
  padding: 0;
  margin-top: 1px;
}
.check.on { background: var(--accent); }
.check.on::after { content: "✓"; color: var(--accent-ink); font-weight: 700; }
.task-title { font-weight: 600; font-size: 18px; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.chip {
  font-size: 13px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--ink);
}
.chip.warm { background: var(--warm-soft); }
.firststep {
  margin: 14px 0 4px;
  padding: 12px 14px;
  background: var(--warm-soft);
  border-radius: 12px;
}
.firststep b { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 12px 0 0; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.steps li .check { flex-basis: 26px; width: 26px; height: 26px; min-height: 26px; border-width: 2px; font-size: 13px; }
.steps li.done span { text-decoration: line-through; color: var(--muted); }
.task-actions { margin-top: 12px; }
.task-actions button { flex: 1 1 40%; }
.more-hint { text-align: center; color: var(--muted); padding: 8px; }
.done-list .card { opacity: .7; }
.done-list .task-title { text-decoration: line-through; }
.progress { display: flex; gap: 6px; margin: 4px 0 18px; }
.progress i { height: 8px; flex: 1; border-radius: 4px; background: var(--line); }
.progress i.on { background: var(--accent); }

/* Week */
.day h2 { display: flex; justify-content: space-between; align-items: baseline; }
.day h2 small { font-weight: 400; color: var(--muted); font-size: 14px; }
.due-pin { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
.compact { padding: 12px 14px; }
.compact .task-title { font-size: 16px; }

/* Capture */
.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
}
.drop .ti { font-size: 42px; display: block; }
input[type=file] { display: none; }
.spinner {
  width: 54px; height: 54px; border-radius: 50%;
  border: 5px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin 1s linear infinite; margin: 30px auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.review-item.off { opacity: .45; }
.review-item .task-head input[type=text] { font-weight: 600; }
.flag { font-size: 14px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--warm-soft); }

/* Focus */
.timer {
  font-size: 76px; font-weight: 700; text-align: center; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin: 10px 0 4px;
}
.focus-step {
  font-size: 23px; line-height: 1.3; font-weight: 600; text-align: center;
  padding: 22px 16px; border-radius: var(--radius); background: var(--warm-soft); margin: 16px 0;
}
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choices button { flex: 1 1 0; min-width: 64px; }
.choices button.sel { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
.sheet {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 24px 24px 0 0; padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
}
.sheet h2 { margin-top: 0; font-size: 24px; }
.banner { background: var(--accent-soft); border-radius: 14px; padding: 14px; margin-bottom: 16px; }

/* Tabs */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
#tabs[hidden] { display: none; }
#tabs a {
  flex: 1; text-align: center; font-size: 12px; color: var(--muted); text-decoration: none;
  padding: 4px 0; border-radius: 12px;
}
#tabs a .ti { display: block; font-size: 22px; line-height: 1.2; }
#tabs a.on { color: var(--ink); font-weight: 600; background: var(--accent-soft); }
#tabs a.add .ti { color: var(--accent); font-weight: 700; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(14px + env(safe-area-inset-top));
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  max-width: calc(100% - 32px); z-index: 30; box-shadow: var(--shadow);
}
.celebrate { animation: pop .5s ease; }
@keyframes pop { 50% { transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
