:root {
  --bg: #f5f3ef;
  --panel: #fff;
  --border: #e0ddd7;
  --border-soft: #e0ddd7;
  --text: #1a1a1a;
  --muted: #333;
  --dim: #444;
  --accent: #0F6E56;
  --accent-dk: #085041;
  --accent-soft: #eef8f2;
  --high: #d63b3b;
  --med: #e8aa00;
  --low: #9FE1CB;
  --radius-card: 12px;
  --radius-ctrl: 8px;
  --top-bar-h: 44px;
  --tab-bar-h: 52px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }

/* ── TOP BAR ── */
.top-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top-bar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.top-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: var(--dim);
  transition: color 0.15s, background 0.15s;
  position: relative;
}
.top-icon.active, .top-icon:active { color: var(--accent); background: rgba(15,110,86,0.12); }
.top-icon.active svg { stroke-width: 2.4; }

/* Per-icon colors — each stays tinted at rest, gets a solid fill + white
   icon when active, instead of every icon sharing one flat grey/teal. */
.top-icon.ic-notif { color: #C24A6B; }
.top-icon.ic-notif.active, .top-icon.ic-notif:active { color: #fff; background: #C24A6B; }
.top-icon.ic-pomo { color: #B8842E; }
.top-icon.ic-pomo.active, .top-icon.ic-pomo:active { color: #fff; background: #B8842E; }
.top-icon.ic-sched { color: #3C7FB1; }
.top-icon.ic-sched.active, .top-icon.ic-sched:active { color: #fff; background: #3C7FB1; }
.top-icon.ic-report { color: #6B8E4E; }
.top-icon.ic-report.active, .top-icon.ic-report:active { color: #fff; background: #6B8E4E; }
.top-icon.ic-health { color: #B5474A; }
.top-icon.ic-health.active, .top-icon.ic-health:active { color: #fff; background: #B5474A; }
.top-icon.ic-more { color: var(--dim); }

button.top-icon { border: none; background: none; font: inherit; cursor: pointer; padding: 0; }

.nav-more-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 500;
}
.nav-more-row:last-child { border-bottom: none; }
.nav-more-row svg { color: var(--dim); flex-shrink: 0; }
.nav-more-row.active { color: var(--accent); }
.nav-more-row.active svg { color: var(--accent); }
.nav-more-row.nm-report svg { color: #6B8E4E; }
.nav-more-row.nm-health svg { color: #B5474A; }
.nav-more-row.nm-notif svg { color: #C24A6B; }
.nav-more-row.nm-security svg { color: #7B5FC7; }

.gfab {
  position: fixed; right: 18px; bottom: 22px; z-index: 90;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.gfab:active { background: var(--accent-dk, var(--accent)); }

.debit-choice-row{display:flex;align-items:center;gap:12px;padding:12px 4px;border-bottom:1px solid var(--border);cursor:pointer;}
.debit-choice-row:last-of-type{border-bottom:none;}
.debit-choice-icon{width:34px;height:34px;border-radius:9px;display:flex;align-items:center;justify-content:center;flex-shrink:0;}
.debit-choice-icon.oneoff{background:rgba(15,110,86,0.1);color:var(--accent);}
.debit-choice-icon.avoidable{background:rgba(216,90,48,0.1);color:#D85A30;}
.debit-choice-title{font-size:14px;font-weight:500;color:var(--text);}
.debit-choice-sub{font-size:11px;color:var(--dim);margin-top:1px;}
.debit-form-hdr{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:700;letter-spacing:0.04em;color:var(--dim);margin-bottom:12px;}
.debit-form-hdr svg{color:var(--accent);flex-shrink:0;}

.pct-pill{font-size:12px;font-weight:600;padding:3px 9px;border-radius:10px;background:rgba(15,110,86,0.1);color:var(--accent);}
.time-chip{background:#E1F5EE;color:#085041;border-radius:6px;padding:2px 7px;font-size:10.5px;font-weight:600;display:inline-block;}

.lifeos-brand {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--dim);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.lifeos-brand.active, .lifeos-brand:active { color: var(--accent); background: rgba(15,110,86,0.12); }

/* ── TAB BAR ── */
.tab-bar {
  position: fixed;
  top: var(--top-bar-h);
  left: 0; right: 0;
  height: var(--tab-bar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 99;
}

.tab {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  transition: color 0.15s;
  position: relative;
}
.tab.active { color: #fff; }
.tab:active { color: var(--accent); }
.tab.active svg { stroke-width: 2.5; }
.tab.active::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 38px; height: 32px;
  transform: translate(-50%, -50%);
  background: var(--accent);
  border-radius: 10px;
  z-index: -1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 3px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* Per-icon colors — rest state tinted, active state a solid fill pill
   in that same color (was one flat grey/teal for every icon before). */
.tab.ic-home { color: #5B6EE8; }
.tab.ic-home.active { color: #fff; }
.tab.ic-home.active::before, .tab.ic-home.active::after { background: #5B6EE8; }
.tab.ic-todayplan { color: #D98A2B; }
.tab.ic-todayplan.active { color: #fff; }
.tab.ic-todayplan.active::before, .tab.ic-todayplan.active::after { background: #D98A2B; }
.tab.ic-projects { color: #2F9E6B; }
.tab.ic-projects.active { color: #fff; }
.tab.ic-projects.active::before, .tab.ic-projects.active::after { background: #2F9E6B; }
.tab.ic-skills { color: #8B5FBF; }
.tab.ic-skills.active { color: #fff; }
.tab.ic-skills.active::before, .tab.ic-skills.active::after { background: #8B5FBF; }
.tab.ic-habits { color: #D9587B; }
.tab.ic-habits.active { color: #fff; }
.tab.ic-habits.active::before, .tab.ic-habits.active::after { background: #D9587B; }
.tab.ic-notes { color: #3E8FB0; }
.tab.ic-notes.active { color: #fff; }
.tab.ic-notes.active::before, .tab.ic-notes.active::after { background: #3E8FB0; }

/* ── PAGE CONTENT ── */
.page-content {
  margin-top: calc(var(--top-bar-h) + var(--tab-bar-h));
  padding: 12px;
  padding-bottom: 24px;
}

/* ── CARDS ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 12px;
  margin-bottom: 10px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius-ctrl);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.75; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger  { background: var(--high);   color: #fff; }
.btn-ghost   { background: transparent; color: var(--accent); border: 1px solid var(--accent); }

/* Uniform "+ Add [thing]" pill — the single app-wide add-button standard (v40).
   Sized to its label, not full-width. Label always names what it adds. */
.add-pill { background: var(--accent); color: #fff; border: none; font-size: 12.5px; font-weight: 500; padding: 7px 14px; border-radius: 14px; cursor: pointer; }

/* ── SWIPE ROWS ── */
.swipe-row {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--panel);
}
.swipe-row-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  background: var(--panel);
  transition: transform 0.2s ease;
  touch-action: pan-y;
  width: 100%;
  box-sizing: border-box;
}
.swipe-actions {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  display: flex;
  align-items: stretch;
}
.swipe-action {
  display: flex; align-items: center; justify-content: center;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  text-align: center;
  line-height: 1.25;
}
.swipe-action.edit   { background: var(--accent); }
.swipe-action.delete { background: var(--high); }
.swipe-action.paid   { background: var(--accent); }
.swipe-action.remove { background: var(--med); color: var(--text); }
.swipe-action.resched { background: var(--med); color: var(--text); }
.swipe-action.complete { background: var(--accent); }
.swipe-action.undo { background: var(--med); color: var(--text); }

/* Any row content placed inside .swipe-row-inner must not carry its own
   margin-bottom — .swipe-row has overflow:hidden, so a margin on the inner
   element leaves a gap at the bottom of the (shorter) inner box while
   .swipe-actions still fills the full height of the outer box, exposing a
   sliver of the edit/delete colors at rest. Spacing between rows belongs on
   the outer .swipe-row (e.g. via .mb-6), never on the inner content. */
.swipe-row-inner { margin-bottom: 0 !important; }

/* ── TYPOGRAPHY ── */
.label-xs {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.text-accent { color: var(--accent); }
.text-high   { color: var(--high); }
.text-med    { color: var(--med); }
.text-muted  { color: var(--muted); }
.text-dim    { color: var(--dim); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: flex-end;
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 32px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ── CHECK-IN POP-UP (v60) ── */
.checkin-section { margin-bottom: 20px; }
.checkin-section:last-child { margin-bottom: 0; }
.checkin-title {
  font-weight: 600; color: var(--accent);
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.checkin-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  gap: 8px;
}
.checkin-row:last-child { border-bottom: none; }

/* Plan Tomorrow — tap-to-reveal priority slots (v92) */
.pt-slot { border: 1px solid var(--border); border-radius: var(--radius-ctrl); margin-bottom: 8px; overflow: hidden; }
.pt-slot:last-child { margin-bottom: 0; }
.pt-slot-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; cursor: pointer; background: var(--panel); }
.pt-slot-head-txt { font-size: 13.5px; font-weight: 600; color: var(--text); }
.pt-slot-head-txt.empty { color: var(--dim); font-weight: 500; }
.pt-slot-chev { font-size: 12px; color: var(--dim); transition: transform 0.15s; }
.pt-slot.open .pt-slot-chev { transform: rotate(180deg); }
.pt-slot-body { padding: 4px 12px 12px; border-top: 1px solid var(--border); }
.pt-picker-group { margin-top: 10px; }
.pt-save-row { margin-top: 12px; display: flex; justify-content: flex-end; }
.pt-save-btn { padding: 7px 20px; }
.field-lbl { display: block; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }

/* Rating circles — same visual as Schedule's Log Block modal, made shared
   so the check-in pop-up's inline rating step (v63) doesn't duplicate it. */
.rating-circles { display: flex; gap: 5px; flex-wrap: wrap; margin: 8px 0; }
.rcircle { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--dim); cursor: pointer; }
.rcircle.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.rating-circles.disabled { opacity: 0.4; pointer-events: none; }

/* ── FORM ELEMENTS ── */
input[type="text"], input[type="number"], input[type="time"], input[type="date"], input[type="month"], input[type="password"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-ctrl);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}

/* Native date/time/month picker icon — was raw browser grey, now tinted to match the app */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(46%) sepia(6%) saturate(1000%) hue-rotate(120deg) brightness(90%);
  cursor: pointer;
  opacity: 0.75;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ── UTILITY ── */
.row   { display: flex; align-items: center; }
.row-sb{ display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12{ gap: 12px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.w-full{ width: 100%; }

/* ── SHARED COMPONENTS (segments, chips, nav, rating, toggle, duration) ── */
.seg-row { display:flex; gap:6px; flex-wrap:wrap; }
.seg-btn { flex:1; padding:7px 4px; border:1px solid var(--border); border-radius:var(--radius-ctrl); background:none; font-size:12px; font-weight:500; color:var(--dim); cursor:pointer; transition:all 0.15s; }
.seg-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }

.chips-row { display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; padding-bottom:2px; }
.chips-row::-webkit-scrollbar { display:none; }
.chip { padding:5px 12px; border-radius:20px; border:1px solid var(--border); background:none; font-size:12px; color:var(--dim); cursor:pointer; white-space:nowrap; flex-shrink:0; }
.chip.active { background:var(--accent); border-color:var(--accent); color:#fff; }

.nav-btn { background:none; border:1px solid var(--border); border-radius:8px; width:32px; height:32px; font-size:16px; color:var(--dim); cursor:pointer; }

.rating-dots { display:flex; gap:8px; }
.rdot { font-size:22px; color:var(--border); cursor:pointer; transition:color 0.15s; }
.rdot.active { color:var(--accent); }

.toggle-switch { position:relative; display:inline-block; width:40px; height:22px; }
.toggle-switch input { opacity:0; width:0; height:0; }
.toggle-track { position:absolute; inset:0; background:var(--border); border-radius:11px; transition:.2s; }
.toggle-switch input:checked+.toggle-track { background:var(--accent); }
.toggle-track::before { content:''; position:absolute; width:16px; height:16px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.2s; }
.toggle-switch input:checked+.toggle-track::before { transform:translateX(18px); }

.dur-row { display:flex; flex-direction:column; gap:6px; }
.dur-group { display:flex; gap:6px; }
.dur-btn { flex:1; padding:7px 4px; border:1px solid var(--border); border-radius:var(--radius-ctrl); background:none; font-size:12px; color:var(--dim); cursor:pointer; }
.dur-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }

/* Now line (schedule) */
.now-line { display:flex; align-items:center; gap:6px; margin:4px 0; }
.now-dot { width:8px; height:8px; border-radius:50%; background:var(--high); flex-shrink:0; margin-left:48px; }
.now-hr { flex:1; height:1px; background:var(--high); }
.now-label { font-size:10px; color:var(--high); flex-shrink:0; }

/* Shared spacing utils */
.mb-4{margin-bottom:4px}.mb-6{margin-bottom:6px}.mb-8{margin-bottom:8px}.mb-10{margin-bottom:10px}.mb-12{margin-bottom:12px}
.mt-8{margin-top:8px}.mt-12{margin-top:12px}
.gap-12{gap:12px}
.tile-empty{font-size:12px;color:var(--dim);}

/* Shared expand/collapse chevron button — circular accent-tinted, rotates + fills
   solid on open. Used app-wide for any section/row that expands in place.
   Reuses --accent / --accent-soft, no new palette. */
.chev-btn{width:26px;height:26px;border-radius:50%;background:var(--accent-soft);
  display:flex;align-items:center;justify-content:center;flex-shrink:0;
  transition:transform .25s cubic-bezier(.4,0,.2,1),background .2s;}
.chev-btn svg{width:12px;height:12px;color:var(--accent);display:block;transition:color .2s;}
.chev-btn.open{transform:rotate(180deg);background:var(--accent);}
.chev-btn.open svg{color:#fff;}
.chev-btn.small{width:22px;height:22px;}
.chev-btn.small svg{width:10px;height:10px;}
.chev-btn.tiny{width:18px;height:18px;}
.chev-btn.tiny svg{width:8px;height:8px;}

/* Shared stat-tile expand panel — used by any page whose top stat strip
   (.b-item tiles) expands into a list on tap. Moved here from tasks.html's
   page-scoped styles (2 Aug 2026) so Skills' stat tiles could reuse it
   without duplicating the block — same root-cause class as the earlier
   Change PIN / habit time-pill bugs: a shared-looking pattern that was
   actually only ever defined in one page's own <style> block. */
.stat-exp-head{font-size:10.5px;font-weight:700;color:var(--dim);text-transform:uppercase;letter-spacing:.05em;padding:8px 2px 6px;}
.stat-exp-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 2px;border-top:1px solid var(--border);}
.stat-exp-body{min-width:0;}
.stat-exp-name{font-size:12.5px;font-weight:700;color:var(--accent);}
.stat-exp-proj{display:inline-block;font-size:9.5px;font-weight:700;color:var(--accent);background:rgba(15,110,86,0.1);padding:2px 8px;border-radius:8px;margin-top:4px;}
.stat-exp-date{font-size:11px;color:var(--dim);font-weight:600;flex-shrink:0;}
.stat-exp-more{font-size:11px;color:var(--accent);font-weight:600;text-align:center;padding:8px 2px 2px;cursor:pointer;}

/* Check-in overlay's three-state buttons (2 Aug 2026 fix) — used by
   Digestion's and now Sugar's questions in the global check-in sheet,
   which can pop up on ANY page. These were only ever defined in Health
   page's own <style> block despite the overlay being page-agnostic —
   same root-cause class as the .stat-exp-* fix above: a shared-looking
   component that silently only worked correctly on one specific page.
   Moved here so the check-in sheet renders correctly everywhere. */
.dig-btn{font-size:13px;font-weight:700;border:1px solid var(--border);background:var(--panel);color:var(--text);}
.dig-good-btn{background:#e8f4ee;color:#0F6E56;border-color:#bfdfd0;}
.dig-okay-btn{background:#fdf5e3;color:#a67a00;border-color:#eeddb4;}
.dig-off-btn{background:#fbe9ea;color:#c0392b;border-color:#f0c9c6;}

/* Shared due-status text (v134, corrected v136) — the finalized date font
   (11.5px bold, not italic) AS THE PILL LABEL — tinted background box per
   state, matching the app's existing badge pattern (Tasks/Skills/Today's
   Plan badges). v134 shipped this as plain text with no background by
   mistake; this corrects it back to the actually-finalized pill treatment. */
.status-overdue{display:inline-block;font-size:10.5px;font-weight:700;font-style:normal;color:var(--high);background:#fde8e8;padding:3px 9px;border-radius:6px;}
.status-today{display:inline-block;font-size:10.5px;font-weight:700;font-style:normal;color:var(--accent);background:#e6f2ee;padding:3px 9px;border-radius:6px;}
.status-upcoming{display:inline-block;font-size:10.5px;font-weight:700;font-style:normal;color:var(--med);background:#fff8e1;padding:3px 9px;border-radius:6px;}
