/* The Reset & The Build. Layered off-black surfaces; one accent per section so the eye knows where it is.
   Reset = green, Training = orange, Creator = violet, Journal = blue, money = gold. Body 15px, labels 11px+. */
:root {
  --bg: #0B0D10;
  --s1: #13161B;
  --s2: #1A1E25;
  --s3: #232831;
  --line: #2A303A;
  --text: #F2F4F7;
  --muted: #98A2B3;
  --dim: #667085;
  --green: #34D399;
  --gold: #F5B544;
  --orange: #FF7A45;
  --violet: #A78BFA;
  --blue: #60A5FA;
  --pink: #F472B6;
  --red: #F87171;
  --accent: var(--gold);
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { max-width: 720px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 0; line-height: 1.1; }
.sub { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--s2); font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--s1); display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn svg { width: 20px; height: 20px; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(11, 13, 16, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar nav { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.tab { height: 60px; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--dim); cursor: pointer; }
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--tc); }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--s1); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; height: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: none; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--s3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- cards ---------- */
.card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.card.raised { background: linear-gradient(180deg, var(--s2), var(--s1)); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-h h2 { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin: 0; color: var(--muted); }
.card-h h2 b { color: var(--text); }
.link { border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 700; cursor: pointer; padding: 6px 0; }
.big { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.mid { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats.two { grid-template-columns: repeat(2, 1fr); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--s2); border-radius: 14px; padding: 12px; min-width: 0; }
.stat .k { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; line-height: 1.2; }
.stat .v { font-size: 20px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 700; }
.empty { color: var(--dim); font-size: 14px; padding: 6px 0; }

.bar { height: 8px; background: var(--s3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .m { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tap { cursor: pointer; }

/* ---------- buttons ---------- */
.btn { height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); font-weight: 800; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0B0D10; }
.btn.ghost { background: none; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn.danger { color: var(--red); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btns > .btn { flex: 1; }

.pill-toggle { display: inline-flex; background: var(--s2); border-radius: 12px; padding: 3px; gap: 3px; }
.pill-toggle button { height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.pill-toggle button.yes { background: var(--green); color: #052E1C; }
.pill-toggle button.no { background: #3A1E22; color: var(--red); }

/* ---------- today ---------- */
.hero { display: flex; gap: 16px; align-items: center; }
.ring { position: relative; width: 104px; height: 104px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .lbl b { font-size: 26px; font-weight: 800; display: block; line-height: 1; }
.ring .lbl small { font-size: 11px; color: var(--muted); font-weight: 700; }
.groups { flex: 1; display: grid; gap: 8px; min-width: 0; }
.group-line { display: grid; grid-template-columns: 84px 1fr 36px; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.group-line span:last-child { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }

.habits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.habit { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--s2); padding: 8px 12px; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; }
.habit .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--dim); flex: none; display: grid; place-items: center; }
.habit .nm { font-weight: 700; font-size: 14px; line-height: 1.2; }
.habit .vl { font-size: 12px; color: var(--muted); }
.habit.done { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }
.habit.done .dot { background: var(--green); border-color: var(--green); }
.habit.missed { border-color: rgba(248, 113, 113, .35); }
.habit.missed .dot { border-color: var(--red); background: rgba(248, 113, 113, .15); }
.habit.partial .dot { border-color: var(--green); border-style: dashed; }
.dot svg { width: 14px; height: 14px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--s2); font-weight: 700; font-size: 13px; cursor: pointer; color: var(--muted); }
.check.on { background: rgba(96, 165, 250, .14); border-color: rgba(96, 165, 250, .5); color: var(--text); }

.prio { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.prio:first-child { border-top: 0; padding-top: 0; }
.prio .box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--dim); background: none; flex: none; cursor: pointer; display: grid; place-items: center; }
.prio.done .box { background: var(--gold); border-color: var(--gold); }
.prio.done .txt { color: var(--dim); text-decoration: line-through; }
.prio .txt { flex: 1; min-width: 0; border: 0; background: none; font-weight: 600; padding: 6px 0; outline: none; }
.pdot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.save-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.save-hero .big { color: var(--green); }
.save-line { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }

/* ---------- reset calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dh { font-size: 11px; font-weight: 800; color: var(--dim); text-align: center; }
.cal .d { aspect-ratio: 1; border-radius: 10px; background: var(--s2); display: grid; place-items: center; font-size: 13px; font-weight: 800; cursor: pointer; border: 1px solid transparent; position: relative; }
.cal .d.future { opacity: .35; cursor: default; }
.cal .d.today { border-color: var(--text); }
.cal .d small { position: absolute; bottom: 3px; font-size: 9px; font-weight: 700; opacity: .8; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

.mile { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.mile .m-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--s3); color: var(--dim); flex: none; }
.mile.hit .m-dot { background: var(--gold); color: #0B0D10; }

/* ---------- lists / pipeline ---------- */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11px; font-weight: 800; background: var(--s3); color: var(--muted); white-space: nowrap; }
.badge.ig { background: rgba(244, 114, 182, .15); color: var(--pink); }
.badge.ugc { background: rgba(245, 181, 68, .15); color: var(--gold); }
.badge.tiktok { background: rgba(96, 165, 250, .15); color: var(--blue); }
.badge.good { background: rgba(52, 211, 153, .15); color: var(--green); }
.badge.warn { background: rgba(248, 113, 113, .15); color: var(--red); }
.stepper { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 14px; }
.stepper button { border: 0; border-radius: 10px; background: var(--s2); padding: 8px 2px; cursor: pointer; text-align: center; color: var(--muted); }
.stepper button b { display: block; font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.stepper button span { display: block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; line-height: 1.15; }
.stepper button.on { background: var(--s3); box-shadow: inset 0 -2px 0 var(--accent); }
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 12px; }
.filters::-webkit-scrollbar { display: none; }
.filters button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: none; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; cursor: pointer; }
.filters button.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.chart { width: 100%; height: 120px; display: block; }
.chart text { fill: var(--dim); font-size: 10px; font-weight: 700; }

/* ---------- sheet (sub-page) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); animation: fade .2s; }
.sheet { position: relative; width: 100%; max-width: 720px; max-height: 92vh; background: var(--s1); border-radius: 22px 22px 0 0; border: 1px solid var(--line); border-bottom: 0; display: flex; flex-direction: column; animation: up .25s cubic-bezier(.2, .8, .2, 1); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.sheet-head h3 { flex: 1; margin: 0; font-size: 17px; font-weight: 800; }
.sheet-body { padding: 16px 16px calc(24px + var(--safe-b)); overflow-y: auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea, .in { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--s2); outline: none; font-size: 16px; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .in:focus { border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opts button { min-width: 40px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--s2); font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.opts button.on { background: var(--accent); border-color: var(--accent); color: #0B0D10; }
.setrow { display: grid; grid-template-columns: 1.4fr .9fr .9fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.setrow input, .setrow select { min-height: 40px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--s2); font-size: 16px; width: 100%; min-width: 0; }
.x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: var(--s3); color: var(--muted); cursor: pointer; }
.note { font-size: 12px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 800; font-size: 14px; padding: 10px 16px; border-radius: 999px; z-index: 80; animation: up .25s; white-space: nowrap; }
.toast.gold { background: var(--gold); }

/* ---------- login / lock ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate .box { width: 100%; max-width: 360px; text-align: center; }
.gate h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 16px 0 6px; }
.gate img { width: 72px; height: 72px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }

.entry { padding: 12px 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry p { margin: 4px 0 0; white-space: pre-wrap; }
.qa { margin-bottom: 8px; }
.qa b { display: block; font-size: 12px; color: var(--muted); }

@media (min-width: 700px) {
  .habits { grid-template-columns: repeat(3, 1fr); }
  .stats.four-wide { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 360px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ring { width: 88px; height: 88px; }
}
