/* Life app styles.
   The look: rounded tiles floating over big, flat background shapes. Bold, friendly type.
   Each theme sets a handful of colours (below); everything else is built from those.
     --bg      page colour            --surface  tiles and inputs
     --ink     main text, ticks       --muted    quieter text
     --accent  the strong colour (Money tile, + button)   --accent-ink  text on it
     --wash    a pale version of the accent
     --good    the Glimmers tile      --cool / --cool-soft  habits
     --s1..s4  the background shapes */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/jakarta.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --r: 14px;
  --tile-r: 26px;
  --tabbar: 66px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --danger: #A8301B;
  --accent-ink: #FFFFFF;
  color-scheme: light;
}

/* Sunrise (the default): coral, navy, sky and yellow on a warm page. */
[data-theme="sunrise"] {
  --bg: #FFF3EA; --surface: #FFFFFF; --ink: #1E2A5A; --muted: #4B4A63; --line: #EADFD6;
  --accent: #D6452B; --wash: #FFE0D6; --good: #FFDF8A; --cool: #1F6FB8; --cool-soft: #E3F1FF;
  --s1: #FFB8A1; --s2: #BFE0FF; --s3: #FFDF8A; --s4: #D9CBFF;
}
[data-theme="sunrise"][data-dark] {
  --bg: #1B1830; --surface: #2A2644; --ink: #F4EFFA; --muted: #BDB7D3; --line: #3D3862;
  --accent: #FF8A6E; --wash: #47304A; --good: #4D4118; --cool: #7DBBF2; --cool-soft: #243A57;
  --s1: #5A2F3A; --s2: #23406A; --s3: #4D4118; --s4: #3A2F6A;
}
[data-theme="ocean"] {
  --bg: #EAF6FB; --surface: #FFFFFF; --ink: #12324A; --muted: #41596E; --line: #D3E4EC;
  --accent: #0B7480; --wash: #D3EEF0; --good: #FFE08A; --cool: #2B5FD9; --cool-soft: #E1EAFF;
  --s1: #A6DDE6; --s2: #C9D8FF; --s3: #FFE08A; --s4: #BDEBD0;
}
[data-theme="ocean"][data-dark] {
  --bg: #0F1E2B; --surface: #1A2E40; --ink: #EAF4FA; --muted: #A9BFD0; --line: #2A4258;
  --accent: #4FC3CC; --wash: #1E3F47; --good: #4A3F16; --cool: #86A8FF; --cool-soft: #22335C;
  --s1: #17424B; --s2: #26386B; --s3: #4A3F16; --s4: #1D4634;
}
[data-theme="meadow"] {
  --bg: #F3F8EC; --surface: #FFFFFF; --ink: #1F3324; --muted: #485A4C; --line: #DCE7D3;
  --accent: #2A7549; --wash: #DDEFD9; --good: #FFE38F; --cool: #1F6FB8; --cool-soft: #E3F1FF;
  --s1: #BFE5B0; --s2: #FFD9A8; --s3: #FFE38F; --s4: #CDE3FF;
}
[data-theme="meadow"][data-dark] {
  --bg: #141D16; --surface: #1F2C22; --ink: #EAF3EA; --muted: #A9BBAB; --line: #2F4033;
  --accent: #7ED3A0; --wash: #234031; --good: #4A3F16; --cool: #7DBBF2; --cool-soft: #243A57;
  --s1: #29452B; --s2: #4D3A1E; --s3: #4A3F16; --s4: #243A57;
}
[data-theme="berry"] {
  --bg: #FBF0F6; --surface: #FFFFFF; --ink: #3A1F4D; --muted: #5A4669; --line: #EBDCE6;
  --accent: #B8336A; --wash: #F9DCE8; --good: #FFE08A; --cool: #6A4BD6; --cool-soft: #ECE6FF;
  --s1: #F7B6D2; --s2: #D6C8FF; --s3: #FFE08A; --s4: #BFE0FF;
}
[data-theme="berry"][data-dark] {
  --bg: #1E1426; --surface: #2D2038; --ink: #F6ECF7; --muted: #C2B0CC; --line: #43324F;
  --accent: #FF8FB8; --wash: #4A2640; --good: #4A3F16; --cool: #B6A1F7; --cool-soft: #33295A;
  --s1: #5A2743; --s2: #33295A; --s3: #4A3F16; --s4: #23406A;
}
/* Lotus: the optional calmer look. Saffron and maroon on warm stone. */
[data-theme="lotus"] {
  --bg: #F8F1E4; --surface: #FFFDF8; --ink: #46201F; --muted: #6B564C; --line: #E9DDC8;
  --accent: #A85A08; --wash: #F6E3C0; --good: #F3D58A; --cool: #7A3B2E; --cool-soft: #F3E0D8;
  --s1: #F0C27A; --s2: #E7B4A4; --s3: #F3D58A; --s4: #D9C7A8;
}
[data-theme="lotus"][data-dark] {
  --bg: #1F1615; --surface: #2D201D; --ink: #F6EADB; --muted: #BFAA99; --line: #45322C;
  --accent: #F2A93F; --wash: #44301A; --good: #4A3A14; --cool: #E7A894; --cool-soft: #4A2B24;
  --s1: #4F3716; --s2: #52302A; --s3: #4A3A14; --s4: #3D3324;
}
[data-dark] { color-scheme: dark; --danger: #FF9C8A; --accent-ink: var(--bg); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 500 16.5px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
body.no-scroll { overflow: hidden; }

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--cool); outline-offset: 2px; border-radius: 8px; }
.app:focus { outline: none; }

/* ---------- background shapes ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; display: block; }
.bg .b1 { right: -70px; top: -50px; width: 240px; height: 240px; border-radius: 50%; background: var(--s1); }
.bg .b2 { left: -90px; top: 38%; width: 260px; height: 260px; border-radius: 50%; background: var(--s2); }
.bg .b3 { right: -60px; top: 66%; width: 200px; height: 200px; border-radius: 50%; border: 34px solid var(--s3); }
.bg .b4 { left: 12%; bottom: -40px; width: 300px; height: 150px; border-radius: 150px 150px 0 0; background: var(--s4); }

.app {
  position: relative; z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 30px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 100px);
}

/* ---------- type ---------- */
h1 { font-weight: 800; font-size: 2.2rem; line-height: 1.1; letter-spacing: -0.02em; padding: 0 6px; }
.sub { color: var(--muted); font-size: 0.95rem; font-weight: 600; margin-top: 4px; padding: 0 6px; }
.today-head .sub { margin: 0 0 2px; }
h2 { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.empty { color: var(--muted); padding: 14px 6px 6px; max-width: 36ch; }
.error { color: var(--danger); font-weight: 700; margin-top: 10px; }
.back { display: inline-block; color: var(--muted); font-weight: 700; text-decoration: none; padding: 6px 10px 6px 6px; margin-bottom: 4px; }

/* ---------- tiles: each section of a screen gets its own ---------- */
.panel {
  display: block; position: relative; overflow: hidden;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-radius: var(--tile-r);
  padding: 16px 18px 10px; margin-top: 12px;
  text-decoration: none;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 6px; min-height: 34px; }
.panel-count, .tile-chip {
  flex: none; font-size: 0.78rem; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  background: var(--ink); color: var(--surface);
}
.panel > ul > li:last-child, .panel > .switch-row:last-child, .panel > .link-row:last-child, .panel .habit:last-child, .panel.bare > li:last-child { border-bottom: 0; }
.panel .empty { padding: 2px 0 10px; }
.panel-lede { color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.panel-foot { padding: 12px 0 8px; }
.chips.in-panel { margin-top: 4px; }
.panel .btn-row { margin: 8px 0 10px; }
.panel form .btn-row { margin-top: 20px; }
.panel form label.field:first-child { margin-top: 4px; }
.panel.bare { padding-top: 4px; padding-bottom: 4px; }
.panel.late .panel-count { background: var(--accent); color: var(--accent-ink); }
.panel.soft { background: transparent; border: 2px dashed color-mix(in srgb, var(--ink) 30%, transparent); }
.panel.soft .panel-count { background: transparent; color: var(--muted); padding-right: 0; }

/* Glimmers: its own sunny tile, with each line on a white strip. */
.panel.glow { background: var(--good); padding-bottom: 14px; }
.panel.glow .panel-lede, .panel.glow .saved { color: var(--ink); }
.panel.glow::after { content: ""; position: absolute; right: 86px; top: 12px; width: 26px; height: 26px; background: var(--surface); opacity: 0.85;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c1 6 4 9 10 10-6 1-9 4-10 10-1-6-4-9-10-10 6-1 9-4 10-10z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2c1 6 4 9 10 10-6 1-9 4-10 10-1-6-4-9-10-10 6-1 9-4 10-10z'/%3E%3C/svg%3E") center / contain no-repeat; }
.good { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 14px; padding: 4px 14px; margin-top: 8px; }
.good span { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 0.78rem; font-weight: 800; display: grid; place-items: center; }
.good input[type="text"].plain { border: 0; min-height: 44px; font-weight: 700; padding: 0; }
.saved { color: var(--muted); font-size: 0.86rem; font-weight: 600; min-height: 1.3em; margin-top: 10px; }
.panel.glow .link-row { border-bottom: 0; }
.day-entry { padding: 16px 18px 14px; }
.day-entry h3 { font-weight: 800; font-size: 1rem; margin-bottom: 8px; }
.day-entry li { display: flex; gap: 10px; padding: 4px 0; align-items: flex-start; font-weight: 600; }
.day-entry li svg { flex: none; width: 20px; height: 20px; fill: var(--accent); stroke: none; margin-top: 2px; }

/* The daily reflection (Lotus look). */
.panel.reflect { background: var(--wash); padding-bottom: 16px; }
.panel.reflect .panel-head h2 { font-size: 0.9rem; color: var(--muted); }
.panel.reflect p { font-size: 1.25rem; font-weight: 600; line-height: 1.35; max-width: 28ch; }

/* ---------- Today: the two tiles at the top ---------- */
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.duo .panel { margin-top: 0; padding-bottom: 16px; }
.tile-progress { display: flex; flex-direction: column; }
.ring { position: relative; width: 96px; height: 96px; margin: 2px auto 0; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring circle { fill: none; stroke-width: 10; }
.ring .track { stroke: var(--wash); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; }
.ring span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 800; line-height: 1; }
.ring small { font-size: 0.7rem; color: var(--muted); margin-top: 3px; font-weight: 600; }
.tile-note { text-align: center; color: var(--muted); font-size: 0.82rem; font-weight: 600; margin-top: 8px; }
.tile-money { background: var(--accent); color: var(--accent-ink); display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 164px; }
.tile-money::before { content: ""; position: absolute; right: -34px; top: -34px; width: 110px; height: 110px; border-radius: 50%; border: 18px solid color-mix(in srgb, var(--accent-ink) 18%, transparent); }
.tile-money h2, .tile-figure, .tile-money .tile-chip { position: relative; }
.tile-figure { display: flex; flex-direction: column; gap: 2px; }
.tile-figure b { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.tile-figure span { font-size: 0.85rem; font-weight: 600; }
.tile-money .tile-chip { align-self: flex-start; background: var(--accent-ink); color: var(--accent); }

/* Habits on Today: one round button each. */
.hbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 8px; padding: 8px 0 6px; }
.hb { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.hb-btn { width: 62px; height: 62px; border-radius: 50%; border: 3px solid var(--cool); background: var(--cool-soft); display: grid; place-items: center; transition: background-color 0.15s, transform 0.15s; }
.hb-btn.on { background: var(--cool); }
.hb-btn.on::after { content: ""; width: 28px; height: 28px; background: var(--surface);
  -webkit-mask: var(--check) center / contain no-repeat; mask: var(--check) center / contain no-repeat; }
.hb-btn:active { transform: scale(0.94); }
.hb-name { font-size: 0.84rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.hb-sub { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
:root { --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.500 4.500L19 7.500'/%3E%3C/svg%3E"); }

/* ---------- money ---------- */
.money-hero { margin-top: 16px; padding: 0 6px; }
.money-big { font-weight: 800; font-size: 3.2rem; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.money-big small { font-size: 1.4rem; color: var(--muted); font-weight: 700; }
.money-hero.over .money-big { color: var(--danger); }
.money-cap { color: var(--muted); font-weight: 600; margin-top: 8px; }
.alloc { display: block; width: 100%; height: 14px; border-radius: 14px; overflow: hidden; margin-top: 18px; }
.alloc .track { fill: var(--surface); }
.s-bill { fill: var(--ink); } .k-bill { background: var(--ink); }
.s-debt { fill: var(--accent); } .k-debt { background: var(--accent); }
.s-pot { fill: var(--cool); } .k-pot { background: var(--cool); }
.s-oneoff { fill: var(--s4); } .k-oneoff { background: var(--s4); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 0.84rem; font-weight: 600; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.money-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px -6px 0; }
.money-stats div { background: color-mix(in srgb, var(--surface) 90%, transparent); border-radius: 20px; padding: 12px 16px; }
.money-stats span { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.money-stats b { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.mrow-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.amount { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount.unset { color: var(--muted); font-weight: 600; }
.row.is-done .amount { color: var(--muted); }
.meter { display: block; width: 100%; height: 6px; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.meter .track { fill: var(--wash); } .meter .fill { fill: var(--accent); }
.add-row, .panel-link { display: block; width: 100%; padding: 13px 0 11px; font-weight: 700; text-decoration: none; }
.add-row::before { content: "+"; color: var(--accent); font-weight: 800; margin-right: 10px; }
.panel > ul + .add-row, .panel > ul + .panel-link, .panel > .hbs + .panel-link { border-top: 1px solid var(--line); }
.panel-extra { border-top: 1px solid var(--line); padding: 12px 0 8px; }
.chart { display: block; max-width: 100%; margin-top: 10px; }
.chart .bar { fill: var(--s2); }
.chart .bar.cur { fill: var(--ink); }
.chart .extra { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; font-weight: 600; font-family: var(--font); }
.month-pick { margin-top: 14px; }
.btn-row.wrap { flex-wrap: wrap; }
.choices .link-row { font-size: 1.05rem; }
.choices .link-row:last-child { border-bottom: 0; }

/* ---------- rows ---------- */
.row { display: flex; align-items: flex-start; gap: 12px; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; padding: 13px 0; display: flex; flex-direction: column; gap: 1px; text-decoration: none; }
.row-title { font-weight: 700; overflow-wrap: anywhere; }
.row-meta { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.row-meta b { font-weight: 500; }
.row.late .row-meta b { color: var(--danger); font-weight: 700; }
.row.is-done .row-title, .row.ticked .row-title { color: var(--muted); text-decoration: line-through; }
.row-end { align-self: center; color: var(--muted); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }

/* The tick: a rounded box that fills when done. */
.tick { flex: none; width: 44px; height: 52px; margin: 0 -8px; display: grid; place-items: center; }
.tick::before, .tick::after { content: ""; grid-area: 1 / 1; }
.tick::before { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--muted); transition: background-color 0.15s, border-color 0.15s, transform 0.15s; }
.tick::after { width: 17px; height: 17px; background: var(--surface); opacity: 0;
  -webkit-mask: var(--check) center / contain no-repeat; mask: var(--check) center / contain no-repeat; }
.tick.on::before, .row.ticked .tick::before { background: var(--ink); border-color: var(--ink); }
.tick.on::after, .row.ticked .tick::after { opacity: 1; }
.row.ticked .tick::before { transform: scale(1.1); }

.link-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.link-row span:last-child { color: var(--muted); font-size: 0.86rem; font-weight: 600; white-space: nowrap; }
.choices .link-row span:last-child { color: var(--ink); font-size: 1.05rem; font-weight: 700; }

/* ---------- controls ---------- */
.seg { display: inline-flex; border-radius: 999px; padding: 4px; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.panel .seg { background: var(--bg); }
.seg button, .seg a { padding: 8px 16px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0.92rem; font-weight: 700; }
.seg .on { background: var(--ink); color: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { border-radius: 999px; padding: 7px 14px; font-size: 0.88rem; font-weight: 700; color: var(--muted); background: color-mix(in srgb, var(--surface) 90%, transparent); }
.panel .chip { background: var(--bg); }
.sheet .chip { background: var(--surface); }
.chip.on { background: var(--ink); color: var(--surface); }
.chip.add { background: var(--wash); color: var(--ink); }
.chip.add::before { content: "+ "; color: var(--accent); font-weight: 800; }

.btn {
  display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 2px solid var(--ink); font-weight: 700; text-align: center; text-decoration: none;
}
.btn.primary { background: var(--ink); color: var(--surface); }
.btn.quiet { border-color: transparent; background: color-mix(in srgb, var(--surface) 90%, transparent); }
.panel .btn.quiet, .sheet .btn.quiet { background: var(--wash); }
.btn.danger { border-color: transparent; color: var(--danger); padding: 0 8px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; }
.btn-row { display: flex; gap: 10px; align-items: center; margin-top: 22px; }
.btn-row .grow { flex: 1; }

label.field, div.field, p.field { display: block; margin-top: 16px; }
label.field > span, .field-label { display: block; color: var(--muted); font-size: 0.84rem; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="search"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r);
  font-weight: 600; appearance: none; -webkit-appearance: none;
}
textarea { resize: none; line-height: 1.5; display: block; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; font-weight: 500; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two > * { min-width: 0; }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type="text"].plain { border: 0; border-radius: 0; background: transparent; padding-left: 0; padding-right: 0; }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); font-weight: 700; }
.switch-row .grow { flex: 1; min-width: 0; }
.switch-row input[type="time"] { width: auto; min-height: 40px; padding: 6px 10px; }
.switch { position: relative; width: 48px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background-color 0.15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 0 0 1px var(--muted); transition: transform 0.15s; }
.switch input:checked + span { background: var(--cool); }
.switch input:checked + span::after { transform: translateX(18px); box-shadow: none; }
.switch input:focus-visible + span { outline: 3px solid var(--cool); outline-offset: 2px; }

/* ---------- habits (the full week view) ---------- */
.habit { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.habit-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; }
.habit-top .row-title { flex: 1; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); margin-top: 10px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 4px 0; color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.day i { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--cool); background: var(--cool-soft); display: block; transition: background-color 0.15s; }
.day.off i { border-style: dotted; background: transparent; opacity: 0.6; }
.day.on i { background: var(--cool); opacity: 1; border-style: solid; }
.day.today { color: var(--ink); }
.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick button { min-height: 44px; border-radius: 12px; text-align: center; color: var(--muted); font-weight: 700; background: var(--surface); border: 2px solid var(--line); }
.daypick button.on { border-color: var(--cool); color: var(--surface); background: var(--cool); }

/* ---------- notes ---------- */
input[type="text"].note-title { font-weight: 800; font-size: 1.7rem; min-height: 56px; letter-spacing: -0.02em; padding: 0 6px; }
.note-body { border: 0; background: color-mix(in srgb, var(--surface) 90%, transparent); padding: 16px 18px; min-height: 50vh; border-radius: var(--tile-r); margin-top: 6px; font-weight: 500; }
.note-bar { display: flex; justify-content: space-between; align-items: center; }
.pin { color: var(--accent); font-weight: 800; }
.saved#note-saved { padding: 0 6px; }

/* ---------- themes picker ---------- */
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 12px; }
.swatch { border: 2px solid var(--line); border-radius: var(--r); padding: 12px 4px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.swatch.on { border-color: var(--ink); color: var(--ink); }
.swatch i { width: 34px; height: 34px; border-radius: 50%; border: 6px solid; }
.swatch[data-value="sunrise"] i { background: #FFDF8A; border-color: #D6452B; }
.swatch[data-value="ocean"] i { background: #C9D8FF; border-color: #0B7480; }
.swatch[data-value="meadow"] i { background: #FFD9A8; border-color: #2A7549; }
.swatch[data-value="berry"] i { background: #D6C8FF; border-color: #B8336A; }
.swatch[data-value="lotus"] i { background: #F3D58A; border-color: #A85A08; flex: none; }
.swatch.wide { grid-column: 1 / -1; flex-direction: row; gap: 14px; padding: 12px 14px; text-align: left; align-items: center; }
.swatch.wide b { font-weight: 800; color: var(--ink); font-size: 1rem; }
.swatch.wide small { font-size: 0.84rem; color: var(--muted); font-weight: 500; }

/* ---------- tab bar and add button ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  padding: 6px 8px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--surface);
  border-radius: 24px 24px 0 0;
}
.tabs div { display: flex; gap: 4px; width: 100%; max-width: 560px; }
.tabs a {
  flex: 1; height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 0.7rem; font-weight: 700; border-radius: 16px;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ink); background: var(--wash); }

.fab {
  position: fixed; z-index: 11; right: max(18px, calc(50% - 262px));
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 18px);
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--ink); color: var(--surface);
  display: grid; place-items: center;
  box-shadow: 0 0 0 4px var(--bg);
}
.fab svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ---------- sheet (the panel that slides up to add or edit) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgb(15 16 35 / 0.45); }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto;
  background: var(--bg); border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 24px);
  animation: rise 0.2s ease-out;
}
.sheet::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 16px; }
.sheet h2 { font-weight: 800; font-size: 1.6rem; letter-spacing: -0.02em; }
.sheet .title-input { font-size: 1.1rem; font-weight: 700; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.toast {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
  background: var(--ink); color: var(--surface); border-radius: 999px;
  padding: 11px 20px; display: flex; gap: 16px; align-items: center; font-weight: 700; font-size: 0.92rem;
  max-width: calc(100vw - 110px); white-space: nowrap;
}
.toast button { color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 800; }

/* ---------- login ---------- */
.login { min-height: 76dvh; display: flex; flex-direction: column; justify-content: center; padding: 0 6px; }
.login h1 { font-size: 4rem; padding: 0; }
.login .sub { padding: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
