/* Design tokens — from the design team's handoff. Dark-only by design:
   this app is used in a dark room and commits to one visual world. */
:root {
  --bg: #161311;
  --bg-deep: #12100D;
  --surface: #211C18;
  --surface-2: #1D1915;
  --text: #F4EDE4;
  --text-bright: #F7F1E8;
  --warm: #D8CDBF;
  --body: #C9BEB0;
  --muted: #A79B8E;
  --dim: #8A7F73;
  --faint: #6E655C;
  --line: rgba(255, 255, 255, 0.07);
  --line-soft: rgba(255, 255, 255, 0.12);
  --amber: #DB9159;
  --amber-bright: #F0B368;
  --amber-deep: #C9803E;
  --rose: #D69AA6;
  --rose-bright: #E2AEB8;
  --sage: #8FB98C;
  --accent: var(--amber); /* set per profile at runtime */
  --serif: 'Spectral', Georgia, serif;
  --sans: 'Hanken Grotesk', -apple-system, system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 18px calc(96px + var(--safe-bottom));
  min-height: 100vh;
}

/* ------------------------------------------------------------- typography */
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.serif { font-family: var(--serif); }
h1 { font-size: 24px; font-weight: 600; line-height: 1.2; }
.statement {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.25;
  color: var(--text-bright);
  text-wrap: balance;
}

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.card.glow { border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.card.hero { background: linear-gradient(155deg, #241E18, #1B1713); }

/* ---------------------------------------------------------------- buttons */
button { font-family: var(--sans); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 16px; border-radius: 15px;
  font-size: 16px; font-weight: 600;
  border: 1px solid var(--line-soft); background: transparent; color: var(--warm);
  transition: transform 0.1s ease;
}
.btn:active { transform: scale(0.98); }
.btn.primary {
  border: none; color: #1A140D;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 88%, white), color-mix(in srgb, var(--accent) 82%, black));
  font-weight: 700; font-size: 17px;
}
.btn.quiet { border: none; color: var(--dim); font-weight: 500; }
.btn.small { width: auto; padding: 9px 15px; font-size: 14px; border-radius: 11px; }
.btn.sage { border: none; background: var(--sage); color: #161311; font-weight: 700; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--warm); font-size: 13.5px; border: 1px solid var(--line); cursor: pointer;
}
.chip.on { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------- checklist */
.item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 15px;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.item.done { background: var(--surface-2); border-color: rgba(143, 185, 140, 0.22); }
.item .title { font-size: 16px; font-weight: 600; transition: color 0.25s; }
.item.done .title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(180, 168, 153, 0.4); }
.item .sub { font-size: 12px; color: var(--dim); }

.check {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 999px;
  border: 2px solid var(--line-soft); background: transparent;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.item.done .check { background: var(--sage); border-color: var(--sage); }
.check svg path {
  stroke-dasharray: 24; stroke-dashoffset: 24;
}
.item.done .check svg path {
  animation: draw 0.3s cubic-bezier(0.5, 1.5, 0.6, 1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------------------- ring */
.ring { position: relative; }
.ring svg circle.track { stroke: rgba(255, 255, 255, 0.06); }
.ring svg circle.fill {
  stroke: var(--accent); stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: center;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.ring .center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------------- tabs */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: color-mix(in srgb, var(--bg-deep) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#tabs button {
  flex: 1; max-width: 92px; padding: 8px 4px; border: none; background: none;
  color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 10px;
}
#tabs button.active { color: var(--accent); }
#tabs button .dot { width: 4px; height: 4px; border-radius: 999px; background: transparent; }
#tabs button.active .dot { background: var(--accent); }

/* ------------------------------------------------------------------ forms */
input[type='text'], input[type='number'], input[type='date'], input[type='time'], textarea, select {
  width: 100%; padding: 13px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); font-family: var(--sans); font-size: 16px;
  outline: none;
}
textarea { resize: none; min-height: 76px; }
input:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
label.field { display: block; }
label.field .lab { font-size: 13px; color: var(--dim); margin: 0 0 6px 2px; display: block; }

/* ------------------------------------------------------------------ sheet */
.sheet-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 8, 6, 0.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.18s ease;
}
.sheet {
  width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto;
  background: var(--bg-deep); border-radius: 22px 22px 0 0;
  border: 1px solid var(--line); border-bottom: none;
  padding: 20px 20px calc(28px + var(--safe-bottom));
  animation: rise 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0.6; } }
@keyframes fade { from { opacity: 0; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line-soft); margin: 0 auto 16px; }

/* --------------------------------------------------------------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .d { aspect-ratio: 1; border-radius: 7px; background: rgba(255, 255, 255, 0.04); }
.cal .d.full, .cal .d.mvd { background: var(--sage); }
.cal .d.mvd { opacity: 0.55; }
.cal .d.repaired { background: var(--sage); opacity: 0.55; }
.cal .d.missed { background: #2B2521; }
.cal .d.rest { background: #33302B; }
.cal .d.paused { background: transparent; border: 1px dashed var(--line-soft); }
.cal .d.today { outline: 1.5px solid var(--accent); outline-offset: 1px; }

/* --------------------------------------------------------------- confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 9px; border-radius: 2px;
  animation: drop linear forwards;
}
@keyframes drop {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0.9; }
}

/* ------------------------------------------------------------------- misc */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.stack > * + * { margin-top: 14px; }
.spacer { flex: 1; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px; }
.stat .n { font-size: 24px; font-weight: 600; color: var(--text); }
.stat .l { font-size: 12px; color: var(--dim); margin-top: 2px; }
.hr { height: 1px; background: var(--line); border: none; margin: 18px 0; }
.center { text-align: center; }
.dim { color: var(--dim); } .muted { color: var(--muted); } .faint { color: var(--faint); }
.small { font-size: 13px; } .tiny { font-size: 12px; }
.sage-t { color: var(--sage); } .accent-t { color: var(--accent); }
.flame { color: var(--amber-bright); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
