:root {
  --bg: #0b0d10;
  --card: #151922;
  --card2: #1c212c;
  --line: #262c39;
  --text: #e9ecf2;
  --muted: #8b93a7;
  --gold: #f5c451;
  --green: #3ecf8e;
  --red: #ff5c6c;
  --blue: #5ca8ff;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  padding-bottom: calc(84px + var(--safe-b));
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: rgba(11, 13, 16, .88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: .2px; font-size: 17px; }
.logo { color: var(--gold); }
.top-date { margin-left: auto; color: var(--muted); font-size: 13px; text-transform: capitalize; }
.icon-btn { background: none; border: 0; font-size: 20px; color: var(--muted); padding: 4px 6px; }

main { max-width: 760px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
main * { min-width: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 10px 2px 0; font-weight: 700; }
h3 { margin: 0 0 8px; font-size: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
@media (min-width: 640px) { .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (max-width: 639px) {
  .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
  .grid3 .card { padding: 12px; }
  .grid3 .stat .value { font-size: 17px; }
  .grid3 .stat .label { font-size: 10px; }
}

.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 13px; }
.big { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.good { color: var(--green); }
.bad { color: var(--red); }
.gold { color: var(--gold); }

.bar { height: 10px; background: var(--card2); border-radius: 99px; overflow: hidden; margin: 10px 0 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--green)); border-radius: 99px; transition: width .4s; }
.bar.red > i { background: var(--red); }
.bar.blue > i { background: var(--blue); }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.btn {
  border: 1px solid var(--line); background: var(--card2); border-radius: 12px;
  padding: 10px 14px; font-weight: 600;
}
.btn.primary { background: var(--gold); color: #1a1405; border-color: var(--gold); }
.btn.ghost { background: none; }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn:active { transform: scale(.97); }

/* today checklist */
.checks { display: grid; gap: 10px; }
.check {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px;
}
.check .box {
  width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line);
  display: grid; place-items: center; flex: none; font-size: 16px;
}
.check.done { border-color: rgba(62, 207, 142, .4); }
.check.done .box { background: var(--green); border-color: var(--green); color: #05130c; }
.check .t { font-weight: 600; }
.check .d { color: var(--muted); font-size: 13px; }
.score { font-size: 13px; font-weight: 700; color: var(--gold); }

/* lists */
.list { display: grid; }
.item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .meta { color: var(--muted); font-size: 12px; }
.item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.x { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 4px 6px; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 10px 0; }
.cat-row .bar { grid-column: 1 / -1; margin: 2px 0 0; height: 8px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card2); border-radius: 99px; padding: 6px 12px; font-size: 13px; }
.chip.on { background: var(--gold); color: #1a1405; border-color: var(--gold); font-weight: 700; }

.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin-top: 10px; }
.heat i { aspect-ratio: 1; border-radius: 4px; background: var(--card2); display: block; }
.heat i.on { background: var(--green); }
.heat i.today { outline: 2px solid var(--gold); outline-offset: 1px; }

.banner { border-radius: var(--radius); padding: 14px 16px; font-weight: 600; }
.banner.red { background: rgba(255, 92, 108, .12); border: 1px solid rgba(255, 92, 108, .4); color: #ffb3bb; }
.banner.gold { background: rgba(245, 196, 81, .1); border: 1px solid rgba(245, 196, 81, .35); color: #ffe1a1; }

svg.chart { width: 100%; height: 160px; display: block; margin-top: 8px; }

.fab {
  position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); z-index: 6;
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--gold); color: #1a1405; font-size: 28px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(245, 196, 81, .3);
}

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(15, 18, 23, .95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 6px calc(6px + var(--safe-b));
}
.tabs button {
  background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600;
  display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 12px;
}
.tabs button span { font-size: 20px; filter: grayscale(1); opacity: .7; }
.tabs button.on { color: var(--text); background: var(--card); }
.tabs button.on span { filter: none; opacity: 1; }

dialog {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 20px; padding: 0; width: min(460px, calc(100vw - 24px));
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
#modalForm { padding: 18px; display: grid; gap: 12px; }
#modalForm h3 { font-size: 18px; }
label.f { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; font-size: 16px; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: -1px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 20;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.rules li { margin: 6px 0; }
textarea { min-height: 110px; resize: vertical; }

.check.fail { border-color: rgba(255, 92, 108, .4); }
.check.fail .box { background: var(--red); border-color: var(--red); color: #200; }
.tick { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--line); background: none; color: #05130c; font-weight: 800; }
.tick.on { background: var(--green); border-color: var(--green); }
.item[data-action], .item [data-action] { cursor: pointer; }
.item .ic { font-size: 18px; width: 24px; text-align: center; flex: none; }
#modalForm .chips .chip { padding: 8px 12px; }
#modalForm .list .item { padding: 6px 0; }
label.f.row { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
dialog { max-height: calc(100dvh - 24px); overflow: auto; }
