:root {
  --bg-deep: #0f131a;
  --bg: #1a2130;
  --card: #212938;
  --raised: #2a3448;
  --line: #313b4e;
  --line-soft: #2b3445;
  --line-strong: #3b4862;
  --text: #e6ebf2;
  --text-strong: #eef2f7;
  --muted: #8592a6;
  --faded: #66748c;
  --accent: #b3cbef;
  --accent-ink: #1a2130;
  --high: #e07a5f;
  --medium: #e2b55c;
  --low: #6fb9a0;
  --meds: #d47fa6;
  --coral-text: #f0a08a;
  --radius: 12px;
  --hand: 'Kalam', cursive;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.hand { font-family: var(--hand); color: var(--accent); font-size: 16px; line-height: 1.3; }
.muted { color: var(--muted); font-size: 12px; }
.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.card h2 {
  font-size: 15px; font-weight: 500; margin: 0;
  color: var(--text-strong);
  display: flex; align-items: center; gap: 6px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.input {
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
}
.input::placeholder { color: var(--faded); }
.btn-primary {
  height: 42px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 500; cursor: pointer;
}
.btn-primary:hover { filter: brightness(1.06); }
.error { color: var(--coral-text); font-size: 12px; min-height: 18px; margin: 0; }

/* ---------- Log in ---------- */
.login {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 32px 16px;
  background: var(--bg-deep);
}
.login-brand { text-align: center; }
.login-brand svg { color: var(--accent); }
.login-brand h1 { font-size: 26px; font-weight: 500; margin: 6px 0 0; }
.login-brand p { margin: 2px 0 0; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login-card h2 { font-size: 18px; }
.pw-wrap { position: relative; }
.pw-wrap .input { width: 100%; padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 4px; top: 4px;
  width: 34px; height: 34px; border: none; background: none;
  color: var(--muted); cursor: pointer; border-radius: 6px; font-size: 18px;
}
.row-end { display: flex; justify-content: flex-end; font-size: 13px; }
.login-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 16px; font-size: 12px; color: var(--muted);
}
.login-footer a { color: var(--muted); }
.lang { display: flex; align-items: center; gap: 4px; }
.lang select { background: transparent; border: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.lang option { background: var(--bg); }

/* ---------- Dashboard layout ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 76px; min-height: 100vh; }
.main { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; font-weight: 500; margin: 0; }
.pill { border: 1px solid var(--line-strong); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.spacer { flex: 1; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #2e3b55; color: var(--accent);
  display: grid; place-items: center; font-size: 12px;
  border: none; cursor: pointer;
}
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; }

/* Lists and tasks */
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); min-height: 36px; }
.item:last-child { border-bottom: none; }
.item .hand { flex: 1; min-width: 0; }
.item.done .hand { text-decoration: line-through; color: var(--faded); }
.check {
  appearance: none; margin: 0; flex-shrink: 0; cursor: pointer;
  width: 16px; height: 16px;
  border: 1.5px solid #56637c; border-radius: 4px;
  display: grid; place-items: center;
}
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after {
  content: ''; width: 4px; height: 8px;
  border: solid var(--accent-ink); border-width: 0 2px 2px 0;
  transform: translate(0, -1px) rotate(45deg);
}
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot.high { background: var(--high); }
.dot.medium { background: var(--medium); }
.dot.low { background: var(--low); }
.chip-btn {
  border: 1px solid var(--line-strong); background: none; border-radius: 6px;
  padding: 2px 8px; font-size: 12px; color: var(--muted); cursor: pointer;
}
.chip-btn:hover { color: var(--text); border-color: var(--accent); }

/* Check-in */
.scale-row { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.scale { display: flex; gap: 4px; }
.scale button {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid #46536b; background: none;
  color: var(--muted); font-size: 12px; cursor: pointer;
}
.scale button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Add task */
.add-form { display: flex; gap: 6px; margin-top: 10px; }
.add-form .input { height: 34px; flex: 1; min-width: 0; font-size: 13px; }
.add-form select {
  height: 34px; background: var(--bg); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 0 6px; font-size: 12px;
}
.add-form button {
  height: 34px; width: 34px; flex-shrink: 0; border-radius: 8px;
  border: 1px solid var(--line-strong); background: none; color: var(--accent); cursor: pointer;
}

/* Water */
.drops { display: flex; gap: 4px; margin-top: 8px; }
.drops button { background: none; border: none; padding: 0; cursor: pointer; color: var(--line-strong); font-size: 20px; }
.drops button.full { color: var(--accent); }

/* Gratitude */
textarea.hand { width: 100%; background: transparent; border: none; resize: none; padding: 0; margin-top: 6px; outline: none; }
textarea.hand::placeholder { color: var(--faded); }

/* Schedule */
.sched-time { width: 46px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.layer { border-left: 2px solid transparent; padding-left: 8px; }
.layer.fitness { border-color: var(--low); }
.layer.meds { border-color: var(--meds); }
.layer.work { border-color: var(--accent); }
.badge { border-radius: 999px; padding: 1px 8px; font-size: 11px; flex-shrink: 0; }
.badge.bill { background: #3d3320; color: var(--medium); }
.badge.deadline { background: #432a26; color: var(--coral-text); }

/* Footer and Inky */
.footer { display: flex; justify-content: space-between; align-items: flex-end; min-height: 84px; margin-top: auto; }
.inky-zone { display: flex; align-items: flex-end; gap: 12px; }
.pile { display: flex; gap: 3px; margin-bottom: 8px; }
.inky-wrap { position: relative; width: 72px; height: 72px; }
.inky-btn {
  width: 72px; height: 72px; padding: 0; border: none; background: none;
  color: var(--accent); cursor: pointer;
  animation: float 3s ease-in-out infinite;
}
.inky-btn svg { display: block; }
.bubble {
  position: absolute; right: 0; bottom: 78px; z-index: 2;
  width: max-content; max-width: 210px;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 6px 11px; font-size: 13px; color: var(--text);
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.bubble.show { opacity: 1; transform: translateY(0); }
.flying-clam { position: absolute; left: 0; top: 0; opacity: 0; pointer-events: none; z-index: 3; }
.heart { position: absolute; left: 44px; top: 0; color: var(--coral-text); font-size: 15px; pointer-events: none; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

/* Navigation rail */
.rail {
  position: sticky; top: 0; height: 100vh;
  border-left: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 2px; padding: 14px 8px;
}
.rail a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0; border-radius: 10px; font-size: 11px; color: var(--muted);
}
.rail a i { font-size: 20px; }
.rail a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.rail a[aria-current="page"] { background: var(--raised); color: var(--text); }
.rail .rail-logo { color: var(--accent); padding: 4px 0 12px; }
.rail .rail-logo:hover { background: none; }
.rail .push { flex: 1; }

/* Responsive */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .main { padding: 16px 14px 96px; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 10;
    flex-direction: row; overflow-x: auto;
    background: var(--bg); border-left: none; border-top: 1px solid var(--line-soft); padding: 6px;
  }
  .rail a { min-width: 64px; }
  .rail .rail-logo, .rail .push { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .inky-btn { animation: none; }
  .bubble { transition: none; }
}
/* =========================================================
   Themes, settings panel, and calendar
   ========================================================= */

/* Extra tokens (dark is the default) */
:root {
  color-scheme: dark;
  --check-border: #56637c;
  --avatar-bg: #2e3b55;
  --bill-bg: #3d3320;
  --deadline-bg: #432a26;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);

  --layer-bills: #e2b55c;
  --layer-renewals: #a99be8;
  --layer-reorders: #7cc4d6;
  --layer-expirations: #e07a5f;
  --layer-meds: #d47fa6;
  --layer-fitness: #6fb9a0;
  --layer-work: #b3cbef;
  --layer-cycle: #e8899a;
  --cycle-bg: rgba(232, 137, 154, 0.12);
}

/* Light theme */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-deep: #e8ecf2;
  --bg: #f4f6fa;
  --card: #ffffff;
  --raised: #eef2f8;
  --line: #dde3ec;
  --line-soft: #e8ecf2;
  --line-strong: #c9d2df;
  --text: #1f2a3a;
  --text-strong: #141c28;
  --muted: #5f6b7e;
  --faded: #9aa4b3;
  --accent: #3b6fb6;
  --accent-ink: #ffffff;
  --high: #d0623f;
  --medium: #c08a1e;
  --low: #3f9a7c;
  --meds: #b5508a;
  --coral-text: #b9482c;
  --check-border: #9aa6b8;
  --avatar-bg: #dbe5f3;
  --bill-bg: #f8ecd2;
  --deadline-bg: #fbe3dc;
  --shadow: 0 12px 32px rgba(31, 42, 58, 0.14);

  --layer-bills: #c08a1e;
  --layer-renewals: #6b58c9;
  --layer-reorders: #2a8aa3;
  --layer-expirations: #c95a3c;
  --layer-meds: #b5508a;
  --layer-fitness: #3f9a7c;
  --layer-work: #3b6fb6;
  --layer-cycle: #c94f64;
  --cycle-bg: rgba(201, 79, 100, 0.08);
}

body { transition: background-color .2s, color .2s; }

/* Swap earlier fixed colors for theme tokens */
.check { border-color: var(--check-border); }
.check:checked { border-color: var(--accent); }
.avatar { background: var(--avatar-bg); }
.scale button { border-color: var(--check-border); }
.scale button[aria-pressed="true"] { border-color: var(--accent); }
.badge.bill { background: var(--bill-bg); }
.badge.deadline { background: var(--deadline-bg); }

/* Shared small buttons */
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: none; color: var(--text);
  display: grid; place-items: center; font-size: 16px; cursor: pointer;
}
.icon-btn:hover, .text-btn:hover { border-color: var(--accent); }
.text-btn {
  height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: none; color: var(--text);
  font-size: 13px; cursor: pointer;
}
select.input { padding: 0 8px; }

/* ---------- Settings panel ---------- */
.settings-panel {
  position: fixed; top: 64px; right: 96px; z-index: 30;
  width: 330px; max-height: calc(100vh - 80px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.settings-panel[hidden] { display: none; }
.sp-head { display: flex; justify-content: space-between; align-items: center; }
.sp-head h2 { font-size: 17px; font-weight: 500; margin: 0; }
.settings-panel section {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 14px; border-top: 1px solid var(--line-soft);
}
.settings-panel h3, .sp-label { font-size: 13px; font-weight: 500; margin: 0; color: var(--text-strong); }
.settings-panel textarea.input { height: auto; padding: 8px 12px; resize: vertical; }
.sp-profile { display: flex; align-items: center; gap: 12px; }
.sp-avatar { width: 44px; height: 44px; font-size: 14px; cursor: default; }
.segmented {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px;
}
.segmented button {
  height: 34px; border: none; border-radius: 7px; background: none;
  color: var(--muted); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.segmented button[aria-checked="true"] { background: var(--raised); color: var(--text); }
.sp-foot { border-top: 1px solid var(--line-soft); padding-top: 12px; }
.sp-foot a { color: var(--coral-text); display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Calendar ---------- */
.cal-nav { display: flex; gap: 6px; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.month { padding: 10px; }
.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.weekdays span { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0 8px; }
.day-cell {
  min-height: 98px; min-width: 0; padding: 6px;
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line-soft); border-radius: 10px; cursor: pointer;
}
.day-cell:hover { border-color: var(--line-strong); }
.day-cell.outside { background: transparent; }
.day-cell.outside .day-num { color: var(--faded); }
.day-cell.cycle { background: var(--cycle-bg); }
.day-cell.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day-head { display: flex; align-items: center; justify-content: space-between; }
.day-num {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; color: var(--muted);
}
.day-cell.today .day-num { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.cycle-mark { color: var(--layer-cycle); font-size: 13px; }
.chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  font-size: 11px; color: var(--text); padding: 1px 5px; border-radius: 4px;
  background: color-mix(in srgb, var(--c) 16%, transparent);
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.more { font-size: 11px; color: var(--muted); padding-left: 4px; }

.side { display: flex; flex-direction: column; gap: 14px; }
.layer-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13px;
}
.layer-row:last-child { border-bottom: none; }
.layer-row .count { margin-left: auto; }
.switch {
  appearance: none; margin: 0; flex-shrink: 0; cursor: pointer; position: relative;
  width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong);
  transition: background .15s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  transition: transform .15s;
}
.switch:checked { background: var(--c); }
.switch:checked::after { transform: translateX(12px); }
.layer-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.cycle-setup { display: grid; gap: 8px; margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--cycle-bg); }
.cycle-setup .input { height: 34px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.event-row .ev-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.event-row .del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px; }
.event-row .del:hover { color: var(--coral-text); }
.event-form { display: grid; gap: 8px; margin-top: 10px; }
.event-form .input { height: 36px; }

@media (max-width: 1000px) {
  .cal-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .settings-panel { left: 12px; right: 12px; width: auto; top: 60px; max-height: calc(100vh - 150px); }
  .day-cell { min-height: 56px; padding: 4px; }
  .chips { flex-direction: row; flex-wrap: wrap; gap: 3px; }
  .chip { padding: 0; background: none; }
  .chip-text, .more { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body, .switch, .switch::after { transition: none; }
}
/* =========================================================
   Calendar connection and Money page
   ========================================================= */

/* Anything marked hidden stays hidden, whatever its other styles */
[hidden] { display: none !important; }

:root { --layer-personal: #9fb0c8; }
:root[data-theme="light"] { --layer-personal: #5f7290; }

/* Generic delete button */
.del {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; padding: 4px; border-radius: 6px; flex-shrink: 0;
}
.del:hover { color: var(--coral-text); }

/* Badges that take their color from a calendar layer */
.layer-badge { background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.badge.paid { background: color-mix(in srgb, var(--low) 18%, transparent); color: var(--low); }
.badge.overdue { background: var(--deadline-bg); color: var(--coral-text); }
.badge.due-today { background: var(--bill-bg); color: var(--medium); }

/* Money page */
.currency select { height: 34px; width: auto; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.metric p { margin: 0; }
.metric-value { font-size: 22px; font-weight: 500; margin: 4px 0 2px !important; color: var(--text-strong); }
.metric-value.negative { color: var(--coral-text); }
.money-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }

.subhead { font-size: 12px; font-weight: 500; color: var(--muted); margin: 14px 0 0; }
.stack-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px; margin-top: 8px;
}
.stack-form .input { height: 34px; font-size: 13px; min-width: 0; }
.mini-form { display: flex; gap: 6px; margin-top: 6px; }
.mini-form .input { height: 30px; font-size: 13px; flex: 1; min-width: 0; }
.mini-form .text-btn { height: 30px; }

.income-field { display: flex; align-items: center; gap: 8px; }
.input.num { width: 110px; height: 32px; font-size: 13px; }

.bill-date { display: flex; flex-direction: column; align-items: center; width: 30px; line-height: 1.1; font-size: 14px; flex-shrink: 0; }
.amount { font-variant-numeric: tabular-nums; flex-shrink: 0; }
.item.done .amount { color: var(--faded); }

.money-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.money-row:last-child { border-bottom: none; }
.row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.row-head > :first-child { flex: 1; min-width: 0; }
.bar { height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: inherit; transition: width .3s; }
.loan-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.goal-done { margin: 6px 0 0; color: var(--low); }

@media (max-width: 1000px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .money-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
}
/* =========================================================
   Meds, Workouts, and To buy
   ========================================================= */

.metrics.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric .bar { margin-top: 8px; }
.full { grid-column: 1 / -1; }
.status { min-height: 18px; margin: 8px 0 0; }
.item-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.item-note { font-size: 12px; color: var(--muted); }

/* Meds */
.med-meta { margin: 2px 0 0; }
.med-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.med-actions .mini-form { margin-top: 0; }
.med-actions .mini-form .input { width: 84px; flex: none; }
.badge.low { background: var(--deadline-bg); color: var(--coral-text); }
.badge.soft { background: var(--raised); color: var(--muted); }

/* Workouts */
#cardio-form, #lift-form { margin-top: 12px; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 12px 0 4px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.wk-circle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; font-size: 13px; color: var(--text);
}
.wk-day.done .wk-circle { background: var(--layer-fitness); border-color: var(--layer-fitness); color: var(--accent-ink); }
.wk-day.today .wk-circle { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.wk-dot { width: 5px; height: 5px; border-radius: 50%; }
.wk-day.planned .wk-dot { background: var(--layer-fitness); }
.log-date { font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 0 2px; list-style: none; }
.log-date:first-child { padding-top: 4px; }
.log-icon { color: var(--layer-fitness); font-size: 18px; flex-shrink: 0; }
.pb { color: var(--medium); font-size: 16px; }

/* To buy */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters .chip-btn {
  height: 32px; padding: 0 12px; font-size: 13px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.filters .chip-btn[aria-pressed="true"] { background: var(--raised); color: var(--text); border-color: var(--accent); }
.group-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-strong); margin: 16px 0 0;
}
.group-head i { color: var(--c); font-size: 16px; }
.qty { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.qty button {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: none; color: var(--text);
  cursor: pointer; font-size: 15px; line-height: 1;
}
.qty button:hover { border-color: var(--accent); }
.qty span { min-width: 24px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.add-form .qty-input { flex: 0 0 64px; }
.cart-head { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.cart-head .subhead { margin: 0; }
.reorder-row select {
  height: 30px; font-size: 12px; padding: 0 4px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 6px;
}
.reorder-row .text-btn { height: 30px; }

@media (max-width: 640px) {
  .metrics.three { grid-template-columns: 1fr; }
  .week-strip { gap: 2px; }
  .wk-circle { width: 30px; height: 30px; }
}
/* =========================================================
   To dos and Notes
   ========================================================= */

/* To dos */
.top-input {
  flex: 1; min-width: 0; padding: 4px 0;
  background: transparent; border: none; outline: none;
}
.top-input::placeholder { color: var(--faded); }
.item.done .top-input { text-decoration: line-through; color: var(--faded); }
.todo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.edit-btn:hover { color: var(--accent); }
.edit-row { display: block; }
.edit-form { display: grid; gap: 6px; width: 100%; }
.edit-form .input { height: 34px; font-size: 13px; }
.edit-fields { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 6px; }
.save-btn { border-color: var(--accent); color: var(--accent); }
.done-box { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.done-box summary { cursor: pointer; font-size: 12px; font-weight: 500; color: var(--muted); padding: 4px 0; }
.done-box .text-btn { margin-top: 6px; height: 30px; font-size: 12px; }

/* Notes */
.search { position: relative; display: flex; align-items: center; }
.search i { position: absolute; left: 10px; color: var(--muted); font-size: 16px; pointer-events: none; }
.search .input { height: 34px; width: 220px; padding-left: 32px; font-size: 13px; }
.notes-tabs { max-width: 560px; }
.segmented button[aria-selected="true"] { background: var(--raised); color: var(--text); }
.notes-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.notes-layout.gratitude { grid-template-columns: minmax(0, 1fr) 340px; }
#new-entry { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }
.entry-list {
  list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 62vh; overflow-y: auto;
}
.entry {
  width: 100%; text-align: left; cursor: pointer; color: var(--text);
  background: none; border: 1px solid transparent; border-radius: 10px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px;
}
.entry:hover { background: var(--raised); }
.entry.active { background: var(--raised); border-color: var(--line-strong); }
.entry-title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-snippet { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--faded); }
.editor { min-height: 440px; display: flex; flex-direction: column; }
.editor-head { display: flex; align-items: center; gap: 6px; }
.title-input { flex: 1; min-width: 0; padding: 0; background: transparent; border: none; outline: none; font-size: 24px; }
.title-input::placeholder, .body-input::placeholder, .prompt-input::placeholder { color: var(--faded); }
.body-input {
  flex: 1; width: 100%; min-height: 300px; margin-top: 10px; padding: 0;
  background: transparent; border: none; outline: none; resize: vertical;
  font-size: 17px; line-height: 1.6;
}
.del[aria-pressed="true"] { color: var(--accent); }
.idea-fields { margin-top: 10px; }
.empty-editor {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--muted); text-align: center;
}
.empty-editor i { font-size: 34px; color: var(--line-strong); }

/* Gratitude */
.prompt-input {
  width: 100%; margin-top: 10px; padding: 6px 0;
  background: transparent; border: none; border-bottom: 1px dashed var(--line-strong); outline: none;
  font-size: 18px; font-weight: 500; color: var(--text-strong);
}
.prompt-input:focus { border-bottom-color: var(--accent); }
.prompt-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.prompt-editor { display: grid; gap: 8px; margin-top: 10px; }
.prompt-editor textarea.input { height: auto; padding: 8px 12px; resize: vertical; }
#g-text { min-height: 200px; }
.streak { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-strong); margin: 8px 0 0; }
.streak i { color: var(--medium); }

@media (max-width: 1000px) {
  .todo-grid { grid-template-columns: 1fr; }
  .notes-layout, .notes-layout.gratitude { grid-template-columns: 1fr; }
  .entry-list { max-height: none; }
}
@media (max-width: 640px) {
  .search .input { width: 150px; }
  .edit-fields { grid-template-columns: 1fr 1fr; }
}
