/* =========================================================
   Mi Planner · Sistema visual
   Paleta v1.1: https://coolors.co/palette/001219-005f73-0a9396-94d2bd-e9d8a6-ee9b00-ca6702-bb3e03-ae2012-9b2226
   Contraste AA verificado para texto en claro y oscuro.
   ========================================================= */
@font-face { font-family: 'Marcellus'; src: url('../fonts/marcellus-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url('../fonts/nunito-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url('../fonts/nunito-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url('../fonts/nunito-sans-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url('../fonts/nunito-sans-latin-800-normal.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  /* Superficies (papel vainilla) */
  --bg: #FBF6EA;
  --surface: #FFFDF7;
  --surface-2: #F3EBD6;
  --surface-3: #E7DDC4;
  /* Texto */
  --ink: #001219;
  --ink-2: #4A5D63;
  --ink-3: #6E7F83;
  --line: #E7DDC4;
  /* Acento */
  --accent: #005F73;
  --accent-ink: #FFFFFF;
  --accent-soft: #D7EEE6;
  /* Colores de apoyo (nombres históricos: se usan en la base de datos) */
  --sage: #0A9396;
  --rose: #BB3E03;
  --gold: #EE9B00;
  --gold-ink: #9B6400;
  --sky: #94D2BD;
  --danger: #AE2012;
  --danger-ink: #FFFFFF;
  --ok: #005F73;
  /* Tarjeta destacada y anillo de progreso */
  --hero-1: #005F73;
  --hero-2: #00798F;
  --ring-inner: #004E5E;
  --toast-action: #EE9B00;
  --shadow: 0 1px 2px rgba(0,18,25,.05), 0 6px 18px rgba(0,18,25,.06);
  --shadow-lg: 0 -8px 40px rgba(0,18,25,.18);
  --radius: 20px;
  --radius-sm: 12px;
  --serif: 'Marcellus', 'Georgia', serif;
  --sans: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 68px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #001219; --surface: #0A1F27; --surface-2: #12303A; --surface-3: #183843;
  --ink: #E9D8A6; --ink-2: #A9B9B4; --ink-3: #7D9696; --line: #183843;
  --accent: #94D2BD; --accent-ink: #001219; --accent-soft: #12303A;
  --gold-ink: #EE9B00; --danger: #CA6702; --danger-ink: #001219; --ok: #94D2BD;
  --toast-action: #005F73;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #001219; --surface: #0A1F27; --surface-2: #12303A; --surface-3: #183843;
    --ink: #E9D8A6; --ink-2: #A9B9B4; --ink-3: #7D9696; --line: #183843;
    --accent: #94D2BD; --accent-ink: #001219; --accent-soft: #12303A;
    --gold-ink: #EE9B00; --danger: #CA6702; --danger-ink: #001219; --ok: #94D2BD;
    --toast-action: #005F73;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--sans);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg.i { width: 20px; height: 20px; flex: none; stroke-width: 1.8; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; }
.screen { padding: calc(var(--safe-top) + 8px) 16px calc(var(--tabbar-h) + var(--safe-bottom) + 96px); animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; gap: 8px; min-height: 52px; margin-bottom: 4px; }
.topbar h1 { font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: .02em; margin: 0; flex: 1; line-height: 1.15; }
.topbar .sub { display: block; font-family: var(--sans); font-size: 13px; color: var(--ink-2); letter-spacing: 0; margin-top: 2px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: transparent; transition: background .15s; flex: none; }
.icon-btn:active, .icon-btn:hover { background: var(--surface-2); }
.icon-btn.filled { background: var(--surface); box-shadow: var(--shadow); }

.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.serif { font-family: var(--serif); font-weight: 400; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-h h2 { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); margin: 0; flex: 1; }
.card-h .link { font-size: 13px; font-weight: 700; color: var(--accent); padding: 6px 4px; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.hero { background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: #fff; }
.card.hero .muted, .card.hero .eyebrow { color: rgba(255,255,255,.85); }

/* ---------- Inputs ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .02em; }
.input, .textarea, .select {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
  padding: 12px 14px; outline: none; transition: border-color .15s, box-shadow .15s; min-height: 46px;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { resize: none; min-height: 84px; line-height: 1.5; }
.ghost-area { width: 100%; border: 0; background: transparent; outline: none; resize: none; padding: 0; min-height: 44px; line-height: 1.5; font-size: 15px; }
.ghost-area::placeholder, .input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.paper { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; }
.add-line { display: flex; align-items: center; gap: 10px; padding: 8px 2px 2px; color: var(--ink-3); }
.add-line input { flex: 1; border: 0; background: transparent; outline: none; padding: 8px 0; min-height: 40px; }
.add-line svg { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 22px; border-radius: 999px; font-weight: 800; letter-spacing: .02em; background: var(--accent); color: var(--accent-ink); transition: transform .1s, opacity .15s; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { height: 38px; padding: 0 16px; font-size: 13px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; height: 38px; border-radius: 999px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Lists / checks ---------- */
.list { margin: 0; padding: 0; list-style: none; }
.li { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.li .t small { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 1px; }
.li.done .t b { text-decoration: line-through; color: var(--ink-3); }
.li .del { color: var(--ink-3); width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.li .del svg { width: 17px; height: 17px; }
.li.tap { cursor: pointer; }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink-3); display: grid; place-items: center; flex: none; transition: all .15s; color: transparent; }
.check svg { width: 15px; height: 15px; stroke-width: 3; }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.18); } }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 13px; display: grid; place-items: center; flex: none; }
.empty { text-align: center; padding: 22px 12px; color: var(--ink-2); }
.empty .big { font-size: 40px; display: block; margin-bottom: 6px; }

/* ---------- Week strip / today ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 4px 0 16px; }
.week-strip button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; border-radius: 16px; color: var(--ink-2); position: relative; }
.week-strip button b { font-size: 17px; color: var(--ink); font-weight: 700; }
.week-strip button small { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.week-strip button.sel { background: var(--accent); color: var(--accent-ink); }
.week-strip button.sel b { color: var(--accent-ink); }
.week-strip button.today:not(.sel) { background: var(--surface); box-shadow: var(--shadow); }
.week-strip .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--sage); position: absolute; bottom: 4px; }
.week-strip .sel .dot { background: var(--accent-ink); }

.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.25) 0); }
.ring span { width: 52px; height: 52px; border-radius: 50%; background: var(--ring-inner); display: grid; place-items: center; font-weight: 800; font-size: 15px; }

.moods { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.moods button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; border-radius: 14px; font-size: 25px; filter: grayscale(.6); opacity: .65; transition: all .15s; }
.moods button small { font-size: 9.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; text-align: center; line-height: 1.1; }
.moods button.on { filter: none; opacity: 1; background: var(--surface-2); transform: translateY(-2px); }
.drops { display: flex; flex-wrap: wrap; gap: 6px; }
.drops button { width: 34px; height: 40px; display: grid; place-items: center; color: var(--sage); }
.drops button svg { width: 28px; height: 28px; stroke-width: 1.6; }
.drops button.on svg { fill: var(--sage); }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-stats .paper b { display: block; font-size: 20px; font-weight: 800; }
.meals { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meals label { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; display: block; }
.meals label span { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: var(--ink-2); text-transform: uppercase; }
.meals input { width: 100%; border: 0; background: transparent; outline: none; padding: 4px 0; min-height: 30px; }
.habit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.habit-chip { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 10px; border-radius: 999px; background: var(--surface-2); font-weight: 700; font-size: 13.5px; transition: all .15s; }
.habit-chip .e { font-size: 18px; }
.habit-chip.on { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--accent); }

/* ---------- Calendar ---------- */
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 11px; font-weight: 800; color: var(--ink-3); letter-spacing: .08em; margin-bottom: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal button { aspect-ratio: 1 / 1.08; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 7px; font-weight: 700; font-size: 14px; background: var(--surface); position: relative; gap: 3px; }
.cal button.out { background: transparent; color: var(--ink-3); font-weight: 400; }
.cal button.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal .dots { display: flex; gap: 2px; }
.cal .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cal .mood-bar { position: absolute; bottom: 5px; left: 22%; right: 22%; height: 3px; border-radius: 3px; }

/* ---------- Habits ---------- */
.habit { display: flex; align-items: center; gap: 12px; }
.habit .ico { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; font-size: 22px; flex: none; }
.habit-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.habit-days button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 800; color: var(--ink-3); }
.habit-days button i { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; transition: all .15s; }
.habit-days button.on i { background: var(--sage); border-color: var(--sage); color: #fff; }
.habit-days button.on i::after { content: '✓'; font-style: normal; font-weight: 800; font-size: 15px; }
.habit-days button.today { color: var(--accent); }
.habit-days button.future { opacity: .35; pointer-events: none; }
.streak { font-size: 12px; font-weight: 800; color: var(--gold-ink); display: inline-flex; align-items: center; gap: 2px; }

/* ---------- Progress ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s ease; }
.bar.sage > i { background: var(--sage); }
.bar.over > i { background: var(--danger); }
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 11.5px; font-weight: 800; background: var(--accent-soft); color: var(--accent); letter-spacing: .02em; }
.goal-card { cursor: pointer; }
.goal-card h3 { margin: 8px 0 10px; font-size: 17px; font-weight: 700; }
.c30 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.c30 button { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--line); font-weight: 800; font-size: 13px; color: var(--ink-2); }
.c30 button.on { background: var(--gold); border-color: var(--gold); color: #001219; }

/* ---------- Explore ---------- */
.search { position: relative; margin-bottom: 16px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { padding-left: 44px; border-radius: 999px; background: var(--surface); }
.section-title { font-family: var(--serif); font-size: 19px; margin: 22px 2px 10px; font-weight: 400; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 10px; min-height: 104px; position: relative; }
.tile .e { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-size: 21px; }
.tile b { font-weight: 700; font-size: 14px; line-height: 1.25; }
.tile .cnt { position: absolute; top: 12px; right: 12px; font-size: 12px; font-weight: 800; color: var(--ink-3); }

/* ---------- Finance ---------- */
.money-big { font-size: 32px; font-weight: 800; letter-spacing: -.01em; }
.fin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.fin-grid .card { margin: 0; padding: 14px; }
.fin-grid b { display: block; font-size: 18px; font-weight: 800; margin-top: 4px; }
.pos { color: var(--ok); } .neg { color: var(--danger); }
.amount-input { font-size: 34px; font-weight: 800; text-align: center; border: 0; background: transparent; outline: none; width: 100%; padding: 8px 0; }
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cat-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 2px; border-radius: 14px; background: var(--surface-2); font-size: 11px; font-weight: 700; color: var(--ink-2); border: 2px solid transparent; }
.cat-grid button span { font-size: 22px; }
.cat-grid button.on { border-color: var(--accent); background: var(--surface); color: var(--ink); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .col .bars { display: flex; gap: 2px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.chart .col .bars i { width: 42%; border-radius: 4px 4px 0 0; background: var(--accent); min-height: 2px; }
.chart .col .bars i.b { background: var(--rose); }
.chart .col .bars i.sky { background: var(--sky); width: 70%; }
.chart .col small { font-size: 9.5px; font-weight: 700; color: var(--ink-3); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.s52 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.s52 button { border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-2); font-weight: 700; }
.s52 button b { font-size: 13px; color: var(--ink); }
.s52 button.on { background: var(--accent); color: var(--accent-ink); }
.s52 button.on b { color: var(--accent-ink); }

/* ---------- Wellness ---------- */
.pixels { display: grid; grid-template-columns: 18px repeat(12, 1fr); gap: 3px; font-size: 9px; color: var(--ink-3); font-weight: 700; }
.pixels .px { aspect-ratio: 1.4; border-radius: 3px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.pixels .px.na { background: transparent; }
.pixels .h { text-align: center; }
.mood-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 12px; font-size: 12.5px; }
.mood-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -1px; }

/* ---------- Reflection ---------- */
.prompt { margin-bottom: 14px; }
.prompt label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scale button { height: 36px; border-radius: 10px; background: var(--surface-2); font-weight: 800; font-size: 13px; color: var(--ink-2); }
.scale button.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- Notes ---------- */
.notes-grid { columns: 2; column-gap: 10px; }
.note { break-inside: avoid; margin-bottom: 10px; border-radius: 16px; padding: 14px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; }
.note h4 { margin: 0 0 6px; font-size: 15px; }
.note p { margin: 0; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.note.c-rose { background: #F7E1D6; } .note.c-sage { background: #DDF0E9; } .note.c-sky { background: #D3ECEC; } .note.c-gold { background: #FBEBCB; }
.note[class*="c-"], .note[class*="c-"] .muted { color: #001219; }
.note[class*="c-"] p { color: #3D5157; }
.note.c-paper { background: var(--surface); }
.note.c-paper, .note.c-paper p { color: inherit; }
.note.c-paper p { color: var(--ink-2); }
.swatches { display: flex; gap: 10px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); }
.swatches button.on { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Tab bar & FAB ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); }
.tabbar nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--ink-3); text-decoration: none; }
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--accent); }
.tabbar a.on svg { stroke-width: 2.2; }
.fab { position: fixed; z-index: 21; right: max(16px, calc(50vw - 244px)); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); width: 60px; height: 60px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 10px 24px rgba(0,95,115,.35); transition: transform .15s; }
.fab:active { transform: scale(.94); }
.fab svg { width: 28px; height: 28px; stroke-width: 2.2; }

/* ---------- Sheets / dialogs ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,18,25,.45); opacity: 0; transition: opacity .22s; }
.overlay.show { opacity: 1; }
.sheet { position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: var(--bg); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg); max-height: 92vh; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.sheet.show { transform: none; }
.sheet .grab { width: 40px; height: 5px; border-radius: 9px; background: var(--surface-3); margin: 10px auto 4px; flex: none; }
.sheet .sh-h { display: flex; align-items: center; gap: 8px; padding: 4px 12px 8px 20px; flex: none; }
.sheet .sh-h h3 { flex: 1; margin: 0; font-family: var(--serif); font-weight: 400; font-size: 22px; }
.sheet .sh-b { overflow-y: auto; padding: 6px 20px 20px; flex: 1; }
.sheet .sh-f { padding: 12px 20px calc(16px + var(--safe-bottom)); display: flex; gap: 10px; border-top: 1px solid var(--line); flex: none; background: var(--bg); }
.sheet .sh-f .btn { flex: 1; }
.sheet.full { height: 92vh; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-grid button { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.quick-grid button span { font-size: 26px; }
.stars { display: flex; gap: 4px; }
.stars button { color: var(--line); }
.stars button svg { width: 30px; height: 30px; }
.stars button.on { color: var(--gold); }
.stars button.on svg { fill: var(--gold); }
.stars-sm { color: var(--gold-ink); font-size: 12px; letter-spacing: 1px; }
.emoji-pick { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-pick button { font-size: 22px; height: 42px; border-radius: 12px; }
.emoji-pick button.on { background: var(--accent-soft); }
.switch { display: flex; align-items: center; justify-content: space-between; min-height: 46px; }
.switch input { width: 46px; height: 28px; appearance: none; -webkit-appearance: none; background: var(--surface-3); border-radius: 99px; position: relative; transition: background .15s; }
.switch input::after { content: ''; position: absolute; width: 22px; height: 22px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.toast { position: fixed; z-index: 60; left: 16px; right: 16px; max-width: 480px; margin: 0 auto; top: calc(var(--safe-top) + 12px); background: var(--ink); color: var(--bg); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; }
.toast button { color: var(--toast-action); font-weight: 800; margin-left: auto; padding: 4px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- Onboarding ---------- */
.onb { min-height: 100vh; padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 24px); display: flex; flex-direction: column; }
.onb .logo { width: 76px; height: 76px; border-radius: 24px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--serif); font-size: 34px; box-shadow: 0 12px 28px rgba(0,95,115,.3); }
.onb h1 { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.1; margin: 28px 0 10px; }
.onb p.lead { color: var(--ink-2); font-size: 16px; margin: 0 0 28px; }
.onb .feat { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.onb .feat span { font-size: 22px; width: 44px; height: 44px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; flex: none; box-shadow: var(--shadow); }
.onb .feat b { display: block; }
.onb .feat small { color: var(--ink-2); font-size: 13.5px; }
.onb .dots { display: flex; gap: 6px; justify-content: center; margin: 20px 0; }
.onb .dots i { width: 7px; height: 7px; border-radius: 9px; background: var(--surface-3); transition: width .2s; }
.onb .dots i.on { width: 22px; background: var(--accent); }
.spacer { flex: 1; }

.loading { min-height: 100vh; display: grid; place-items: center; font-family: var(--serif); font-size: 22px; color: var(--ink-2); }
@media (min-width: 560px) { .screen { padding-top: 24px; } }
