:root {
  --bg: #0f1115; --card: #181b22; --card-2: #1f232c; --line: #2a2f3a;
  --text: #e7e9ee; --muted: #9aa2b1; --accent: #5b9dff; --done: #37c978;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px calc(12px); background: rgba(15,17,21,.9);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.week-label { flex: 1; text-align: center; font-weight: 600; }
.nav {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; width: 40px; height: 40px; font-size: 20px; cursor: pointer;
}
.nav:active { transform: scale(.96); }
main { max-width: 640px; margin: 0 auto; padding: 14px; }

.goals { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.goal {
  flex: 1 1 160px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.goal .g-top { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.goal .g-count { font-size: 22px; font-weight: 700; margin: 2px 0 8px; }
.bar { height: 7px; background: var(--card-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.met > i { background: var(--done); }

.day { margin: 16px 0 8px; }
.day h3 {
  margin: 0 0 8px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}
.day.today h3 { color: var(--accent); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start;
  transition: opacity .15s;
}
.card.done { opacity: .55; }
.card .body { flex: 1; min-width: 0; }
.card .title { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); text-transform: capitalize;
}
.tag.home { color: #7fd1a8; border-color: #2c5a44; }
.tag.commute { color: #ffcf7f; border-color: #6a5326; }
.meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.exs { margin: 8px 0 0; padding: 0; list-style: none; }
.exs li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-top: 1px dashed var(--line); }
.exs li:first-child { border-top: 0; }
.exs li > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exs .scheme { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.modes { color: var(--muted); font-size: 13px; margin-top: 6px; }

.check {
  appearance: none; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  border: 2px solid var(--line); background: var(--card-2); cursor: pointer; position: relative;
}
.check:checked { background: var(--done); border-color: var(--done); }
.check:checked::after {
  content: "✓"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #06210f; font-weight: 800; font-size: 18px;
}
.check:disabled { opacity: .4; cursor: not-allowed; }

.status { text-align: center; color: var(--muted); font-size: 13px; min-height: 1.2em; }
.status.err { color: #ff8686; }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  color: var(--text); max-width: 420px; width: calc(100% - 28px);
}
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin: 0 0 8px; }
.hint { color: var(--muted); font-size: 13px; }
label { display: block; margin: 12px 0; font-size: 14px; }
input {
  width: 100%; margin-top: 6px; padding: 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 15px;
}
.row { display: flex; gap: 10px; margin-top: 6px; }
button { padding: 10px 16px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #06152e; font-weight: 650; cursor: pointer; }
button.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
