/* ── PlateMates design system v2 — "wow" pass ───────────────────────────────
   Warm cream canvas · deep pine → emerald gradients · Fraunces display
   Plus Jakarta Sans UI · custom SVG icons · motion & celebration            */

:root {
  --cream: #FAF5EC;
  --cream-2: #F1EADB;
  --cream-3: #E9E0CC;
  --card: #FFFFFF;
  --ink: #1F2D27;
  --ink-2: #56655E;
  --ink-3: #8C978F;
  --line: #E6DDCB;
  --pine: #1E4436;
  --pine-2: #2E6B50;
  --emerald: #3E8E5A;
  --coral: #E2604C;
  --coral-2: #F07A5A;
  --amber: #C77E1F;
  --gold: #F6C453;
  --good: #3E8E5A;
  --warn: #C77E1F;
  --bad: #C0452F;
  --gleb: #2F7FC1;
  --gleb-soft: #E4EEF8;
  --ilana: #D4547A;
  --ilana-soft: #FAE7EE;
  --grad-pine: linear-gradient(140deg, #1E4436 0%, #2E6B50 55%, #3E8E5A 115%);
  --grad-coral: linear-gradient(135deg, #E2604C, #F07A5A);
  --grad-gold: linear-gradient(135deg, #F6C453, #F0A24A);
  --r: 20px;
  --shadow: 0 1px 2px rgba(30, 58, 45, .05), 0 6px 20px rgba(30, 58, 45, .09);
  --shadow-lg: 0 2px 4px rgba(30, 58, 45, .06), 0 14px 40px rgba(30, 58, 45, .14);
  --font-ui: "Plus Jakarta Sans", "Nunito Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  /* slot accents */
  --slot-breakfast: #F0A24A; --slot-breakfast-soft: #FCF0DC;
  --slot-shake: #5B8DD6;     --slot-shake-soft: #E7EFFA;
  --slot-lunch: #D97742;     --slot-lunch-soft: #FAEADF;
  --slot-snack: #C864A0;     --slot-snack-soft: #F8E9F3;
  --slot-dinner: #7A6BC4;    --slot-dinner-soft: #EEEBF9;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
button, .tab, .plan-chip, .act-btn, .opt-tile { touch-action: manipulation; }
html { font-size: 16px; }
body {
  font-family: var(--font-ui);
  background:
    radial-gradient(1100px 480px at 50% -220px, rgba(62, 142, 90, .10), transparent 70%),
    var(--cream);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100dvh;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 13px;
  padding: 12px 14px; width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--pine-2);
  box-shadow: 0 0 0 3px rgba(46, 107, 80, .16);
}
label { font-size: .78rem; font-weight: 700; color: var(--ink-2); display: block; margin: 12px 0 4px; letter-spacing: .01em; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; }

/* ── Motion ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { transform: scale(.85); opacity: 0; } 70% { transform: scale(1.03); } 100% { transform: scale(1); opacity: 1; } }
main > * { animation: fadeUp .45s cubic-bezier(.2, .7, .3, 1) both; }
main > *:nth-child(2) { animation-delay: .04s; } main > *:nth-child(3) { animation-delay: .08s; }
main > *:nth-child(4) { animation-delay: .12s; } main > *:nth-child(5) { animation-delay: .16s; }
main > *:nth-child(6) { animation-delay: .20s; } main > *:nth-child(n+7) { animation-delay: .24s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ── Login ── */
.login {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px; gap: 6px; text-align: center;
  background:
    radial-gradient(700px 420px at 85% -10%, rgba(246, 196, 83, .18), transparent 60%),
    var(--grad-pine);
  color: #FAF5EC;
}
.login-logo { width: 92px; border-radius: 24px; box-shadow: 0 14px 44px rgba(0, 0, 0, .35); margin-bottom: 16px; animation: popIn .5s both; }
.login-title { font-size: 2.4rem; }
.login-sub { opacity: .85; margin-bottom: 28px; font-weight: 600; }
.login form { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login input { text-align: center; border: 0; }
.login-err { color: #FFC9BB; font-size: .85rem; min-height: 1.2em; }

/* ── Layout ── */
.app { max-width: 640px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  position: sticky; top: 0; z-index: 30;
  background: rgba(250, 245, 236, .82); backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid rgba(230, 221, 203, .8);
}
.topbar-brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--pine); }
.topbar-brand img { width: 32px; border-radius: 9px; box-shadow: 0 2px 8px rgba(30, 68, 54, .25); }

.user-switch { display: flex; background: var(--cream-2); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: inset 0 1px 3px rgba(30, 58, 45, .07); }
.user-switch button {
  padding: 7px 16px; border-radius: 999px; font-weight: 800; font-size: .85rem; color: var(--ink-2);
  transition: all .2s cubic-bezier(.2, .7, .3, 1);
}
.user-switch button.active-1 { background: var(--gleb); color: #fff; box-shadow: 0 3px 10px rgba(47, 127, 193, .4); }
.user-switch button.active-2 { background: var(--ilana); color: #fff; box-shadow: 0 3px 10px rgba(212, 84, 122, .4); }

main { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* ── Tabs ── */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; max-width: 640px; margin: 0 auto;
  background: rgba(255, 255, 255, .88); backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-top: 1px solid rgba(230, 221, 203, .9);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  gap: 2px;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; font-size: .66rem; font-weight: 800; color: var(--ink-3);
  border-radius: 14px; transition: all .2s cubic-bezier(.2, .7, .3, 1);
}
.tab svg { width: 22px; height: 22px; stroke-width: 2; transition: transform .2s; }
.tab.active { color: var(--pine); background: rgba(46, 107, 80, .10); }
.tab.active svg { transform: translateY(-1px) scale(1.08); }
.tab:active { transform: scale(.94); }

/* ── Cards ── */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; border: 1px solid rgba(230, 221, 203, .5); }
.card-title { font-size: 1.08rem; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title small { font-family: var(--font-ui); font-weight: 700; color: var(--ink-3); font-size: .74rem; text-align: right; }
.section-label { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin: 6px 2px -6px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; border-radius: 14px; font-weight: 800; font-size: .9rem;
  transition: transform .12s, box-shadow .2s, filter .2s;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--grad-pine); color: #fff; box-shadow: 0 4px 14px rgba(30, 68, 54, .32); }
.btn-primary:hover { filter: brightness(1.07); }
.btn-soft { background: var(--cream-2); color: var(--ink); }
.btn-soft:hover { background: var(--cream-3); }
.btn-coral { background: var(--grad-coral); color: #fff; box-shadow: 0 4px 14px rgba(226, 96, 76, .35); }
.btn-ghost { color: var(--pine-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 13px; font-size: .8rem; border-radius: 11px; }
.btn-danger { background: #F7E2DC; color: var(--bad); }

/* ── Hero / rings ── */
.day-hero {
  position: relative; overflow: hidden; border: 0;
  background:
    radial-gradient(420px 220px at 108% -30%, rgba(246, 196, 83, .22), transparent 65%),
    radial-gradient(300px 300px at -14% 118%, rgba(62, 142, 90, .5), transparent 60%),
    var(--grad-pine);
  color: #F6F1E5; box-shadow: var(--shadow-lg);
}
.day-hero::after {
  content: ''; position: absolute; width: 190px; height: 190px; border-radius: 50%;
  border: 1.5px solid rgba(250, 245, 236, .12); right: -60px; top: -60px; pointer-events: none;
}
.day-hero .card-title { color: #fff; }
.rings { display: flex; gap: 18px; align-items: center; position: relative; }
.ring-wrap { position: relative; width: 96px; height: 96px; flex: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)); }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-wrap circle { transition: stroke-dashoffset 1s cubic-bezier(.3, .7, .3, 1); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center b { font-size: 1.3rem; line-height: 1.05; font-family: var(--font-display); }
.ring-center span { font-size: .6rem; opacity: .8; font-weight: 700; }
.macro-rows { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.macro-row { font-size: .78rem; font-weight: 700; }
.macro-row .bar { height: 8px; background: rgba(255, 255, 255, .18); border-radius: 99px; margin-top: 3px; overflow: hidden; }
.macro-row .bar i { display: block; height: 100%; border-radius: 99px; background: var(--grad-gold); transition: width .8s cubic-bezier(.3, .7, .3, 1); }
.macro-row .bar i.p { background: linear-gradient(90deg, #7ED8A4, #A6E8C0); }
.macro-row .bar i.f { background: linear-gradient(90deg, #F09A7E, #F7BCA5); }
.macro-row .num { float: right; opacity: .85; font-weight: 600; }

/* ── Meal cards ── */
.meal-card { display: flex; flex-direction: column; gap: 10px; position: relative; }
.meal-card[data-slot] { border-left: 4px solid var(--line); }
.meal-card[data-slot="breakfast"] { border-left-color: var(--slot-breakfast); }
.meal-card[data-slot="shake"]     { border-left-color: var(--slot-shake); }
.meal-card[data-slot="lunch"]     { border-left-color: var(--slot-lunch); }
.meal-card[data-slot="snack"]     { border-left-color: var(--slot-snack); }
.meal-card[data-slot="dinner"]    { border-left-color: var(--slot-dinner); }
.meal-head { display: flex; gap: 12px; align-items: center; }
.meal-emoji {
  width: 54px; height: 54px; flex: none; border-radius: 16px; background: var(--cream-2);
  display: flex; align-items: center; justify-content: center; font-size: 1.75rem; overflow: hidden;
  box-shadow: inset 0 -2px 6px rgba(30, 58, 45, .07);
}
.meal-card[data-slot="breakfast"] .meal-emoji { background: var(--slot-breakfast-soft); }
.meal-card[data-slot="shake"] .meal-emoji     { background: var(--slot-shake-soft); }
.meal-card[data-slot="lunch"] .meal-emoji     { background: var(--slot-lunch-soft); }
.meal-card[data-slot="snack"] .meal-emoji     { background: var(--slot-snack-soft); }
.meal-card[data-slot="dinner"] .meal-emoji    { background: var(--slot-dinner-soft); }
.meal-emoji img { width: 100%; height: 100%; object-fit: cover; }
.meal-head-info { flex: 1; min-width: 0; }
.meal-slot { font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.meal-slot .chip { font-size: .6rem; padding: 2px 7px; }
.meal-name { font-weight: 800; font-size: 1.02rem; line-height: 1.22; }
.meal-kcal { text-align: right; flex: none; }
.meal-kcal b { font-size: 1.25rem; font-family: var(--font-display); }
.meal-kcal span { display: block; font-size: .62rem; color: var(--ink-3); font-weight: 700; }
.macro-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: .72rem; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  background: var(--cream-2); color: var(--ink-2); white-space: nowrap; display: inline-block;
}
.chip.p { background: #E1F3E8; color: #256A41; }
.chip.c { background: #F8EDD5; color: #8A6215; }
.chip.f { background: #FBE7DE; color: #A54A32; }
.chip.gleb { background: var(--gleb-soft); color: var(--gleb); }
.chip.ilana { background: var(--ilana-soft); color: var(--ilana); }
.chip.good { background: #E1F3E8; color: var(--good); }
.chip.warn { background: #F8EDD5; color: var(--warn); }
.chip.bad { background: #F7E2DC; color: var(--bad); }
.meal-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meal-actions .btn { flex: 1; min-width: 0; }
.meal-note { font-size: .8rem; color: var(--ink-2); background: var(--cream-2); border-radius: 12px; padding: 9px 11px; }
.meal-eaten { border-color: rgba(62, 142, 90, .45); background: linear-gradient(180deg, #FDFFFB, #F4FAF4); }
.meal-eaten-badge { color: var(--good); font-weight: 800; font-size: .8rem; }
details summary::-webkit-details-marker { display: none; }
details summary { list-style: none; }
details summary::after { content: ' ▾'; font-size: .7em; }
details[open] summary::after { content: ' ▴'; }

.ing-list { font-size: .85rem; color: var(--ink-2); }
.ing-list li { list-style: none; display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); gap: 10px; }
.ing-list li:last-child { border-bottom: 0; }
.ing-list b { color: var(--ink); font-weight: 700; text-align: right; }

/* ── Cook mode ── */
.cook-box { background: linear-gradient(150deg, #FFF8EA, #FBEEd6 70%, #F9E8C8); border: 1.5px dashed var(--amber); }
.plate-split { display: flex; gap: 10px; margin-top: 10px; }
.plate-split .plate { flex: 1; border-radius: 14px; padding: 11px; text-align: center; font-weight: 800; font-size: 1.05rem; }
.plate-split .plate small { display: block; font-weight: 700; font-size: .66rem; opacity: .75; }
.plate.gleb { background: var(--gleb-soft); color: var(--gleb); }
.plate.ilana { background: var(--ilana-soft); color: var(--ilana); }

/* ── Week board ── */
.week-board { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 16px 14px; margin: 0 -16px; }
.day-col { flex: 0 0 78%; max-width: 320px; scroll-snap-align: start; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid rgba(230, 221, 203, .5); padding: 12px; }
.day-col.today-col { border: 2px solid var(--pine-2); box-shadow: 0 6px 24px rgba(46, 107, 80, .18); }
.day-col h3 { font-size: .95rem; display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.day-col h3 small { font-family: var(--font-ui); color: var(--pine-2); font-weight: 800; font-size: .68rem; }
.slot-lane { min-height: 40px; border-radius: 12px; margin-bottom: 8px; transition: background .15s; }
.slot-lane.drag-over { background: rgba(46, 107, 80, .08); outline: 2px dashed var(--pine-2); }
.slot-tag { font-size: .6rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 3px; }
.plan-chip {
  background: var(--cream); border-radius: 12px; padding: 8px 10px; margin-bottom: 5px;
  display: flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 700;
  border: 1px solid var(--line); touch-action: none; cursor: grab;
  transition: box-shadow .15s, transform .15s;
}
.plan-chip:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.plan-chip:active { cursor: grabbing; border-color: var(--pine-2); }
.plan-chip .pc-name { flex: 1; min-width: 0; }
.plan-chip .pc-name b { display: block; font-size: .8rem; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-chip .pc-name small { font-size: .66rem; font-weight: 700; color: var(--ink-3); }
.plan-chip.sortable-ghost { opacity: .4; border: 1.5px dashed var(--pine-2); }
.day-kcal { font-size: .72rem; color: var(--ink-2); font-weight: 700; text-align: right; }
.add-slot-btn { width: 100%; border: 1.5px dashed var(--cream-3); border-radius: 12px; padding: 7px; color: var(--ink-3); font-weight: 800; font-size: .75rem; transition: all .15s; }
.add-slot-btn:hover { border-color: var(--pine-2); color: var(--pine-2); }

/* ── Glucose ── */
.glu-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 800; padding: 5px 10px; border-radius: 999px; }
.glu-badge.pre { background: var(--cream-2); color: var(--ink-2); }
.glu-badge.due { background: #F8EDD5; color: var(--warn); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
table.glu-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.glu-table th { text-align: left; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 6px 4px; border-bottom: 1.5px solid var(--line); }
table.glu-table td { padding: 9px 4px; border-bottom: 1px solid var(--line); }

/* ── Progress ── */
.chart-box { position: relative; width: 100%; }
.legend { display: flex; gap: 14px; font-size: .75rem; font-weight: 800; color: var(--ink-2); margin: 4px 0 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-tile { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid rgba(230, 221, 203, .5); padding: 13px 15px; }
.stat-tile b { font-size: 1.5rem; font-family: var(--font-display); }
.stat-tile span { display: block; font-size: .68rem; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.stat-tile .delta { font-size: .75rem; font-weight: 800; }
.delta.down { color: var(--good); } .delta.up { color: var(--bad); }

/* ── Coach / gamification ── */
.xp-bar { height: 10px; border-radius: 99px; background: var(--cream-2); overflow: hidden; margin-top: 6px; }
.xp-bar i { display: block; height: 100%; background: var(--grad-pine); border-radius: 99px; transition: width .8s cubic-bezier(.3, .7, .3, 1); }
.level-flex { display: flex; align-items: center; gap: 14px; }
.level-badge {
  width: 58px; height: 58px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; color: #fff;
  background: radial-gradient(circle at 30% 28%, #4E9A6C, var(--pine) 75%);
  box-shadow: 0 5px 16px rgba(30, 68, 54, .45), inset 0 1px 2px rgba(255, 255, 255, .35);
  border: 2.5px solid rgba(246, 196, 83, .8);
}
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ach { background: var(--cream-2); border-radius: 14px; padding: 11px 8px; text-align: center; opacity: .35; filter: grayscale(1); transition: all .3s; }
.ach.earned {
  opacity: 1; filter: none; box-shadow: var(--shadow);
  background: linear-gradient(160deg, #FFFDF6, #FBF3DE);
  border: 1px solid rgba(246, 196, 83, .6);
}
.ach .e { font-size: 1.55rem; }
.ach .t { font-size: .66rem; font-weight: 800; margin-top: 3px; line-height: 1.2; }
.goal-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.goal-item:last-child { border-bottom: 0; }
.goal-check { width: 25px; height: 25px; flex: none; border-radius: 9px; border: 2px solid var(--cream-3); display: flex; align-items: center; justify-content: center; font-size: .85rem; transition: all .2s; }
.goal-item.done .goal-check { background: var(--grad-pine); border-color: var(--pine-2); color: #fff; }
.goal-item.done .goal-text { text-decoration: line-through; color: var(--ink-3); }
.goal-text b { font-size: .88rem; } .goal-text p { font-size: .78rem; color: var(--ink-2); }
.team-bar { height: 18px; background: var(--cream-2); border-radius: 99px; overflow: hidden; display: flex; box-shadow: inset 0 1px 3px rgba(30, 58, 45, .08); }
.team-bar i { height: 100%; transition: width .8s cubic-bezier(.3, .7, .3, 1); }
.streak-flames { display: flex; gap: 12px; }
.streak-pill { flex: 1; background: var(--cream-2); border-radius: 14px; text-align: center; padding: 11px 6px; }
.streak-pill b { font-size: 1.3rem; font-family: var(--font-display); }
.streak-pill span { display: block; font-size: .64rem; font-weight: 800; color: var(--ink-3); }

/* ── Activity ── */
.act-row { display: flex; gap: 8px; }
.act-btn { flex: 1; background: var(--cream-2); border-radius: 14px; padding: 11px 4px; text-align: center; font-size: .72rem; font-weight: 800; color: var(--ink-2); transition: all .2s; }
.act-btn .e { display: block; font-size: 1.35rem; margin-bottom: 2px; filter: grayscale(.8); transition: filter .2s; }
.act-btn.on { background: #E1F3E8; color: #256A41; box-shadow: inset 0 0 0 2px var(--good); }
.act-btn.on .e { filter: none; }
.steps-input { display: flex; gap: 8px; margin-top: 8px; }
.steps-input input { flex: 1; }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(20, 32, 26, .55);
  display: flex; align-items: flex-end; justify-content: center; backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--cream); width: 100%; max-width: 640px; max-height: 88dvh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: sheet .28s cubic-bezier(.2, .7, .3, 1);
  box-shadow: 0 -10px 50px rgba(0, 0, 0, .25);
}
@keyframes sheet { from { transform: translateY(48px); opacity: .4; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font-size: 1.25rem; }
.modal-x { font-size: 1.4rem; color: var(--ink-3); padding: 6px 12px; border-radius: 12px; }
.modal-x:hover { background: var(--cream-2); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-tile { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 13px; text-align: left; font-weight: 700; font-size: .85rem; transition: all .15s; }
.opt-tile:hover { border-color: var(--pine-2); }
.opt-tile .e { font-size: 1.35rem; display: block; margin-bottom: 4px; }
.opt-tile.sel { border-color: var(--pine-2); box-shadow: 0 0 0 2px rgba(46, 107, 80, .25); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.row-flex { display: flex; gap: 8px; align-items: center; }

/* ── Lists / editor ── */
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px 2px; border-bottom: 1px solid var(--line); transition: background .15s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: rgba(46, 107, 80, .03); }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-main b { font-size: .9rem; display: block; }
.list-row .lr-main small { color: var(--ink-3); font-size: .74rem; font-weight: 700; }
.item-edit-row { display: grid; grid-template-columns: 1fr 64px 64px 34px; gap: 6px; align-items: center; margin-bottom: 6px; }
.item-edit-row input, .item-edit-row select { padding: 8px; font-size: .85rem; }

/* ── Banner & toast ── */
.banner {
  margin: 12px 16px 0; padding: 12px 14px; border-radius: 16px; font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow);
  animation: fadeUp .4s both;
}
.banner.amber { background: linear-gradient(140deg, #FCF3DF, #FAEBC8); color: #7A5410; }
.banner.green { background: linear-gradient(140deg, #E1F3E8, #D2ECD9); color: #1F5236; }
.banner .btn { margin-left: auto; flex: none; }
.toast {
  position: fixed; bottom: calc(94px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  background: linear-gradient(140deg, #26332C, #1B2622); color: #FAF5EC; font-weight: 700; font-size: .87rem;
  padding: 12px 22px; border-radius: 99px; z-index: 200; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
  max-width: 90vw; text-align: center; animation: popIn .3s cubic-bezier(.2, .7, .3, 1) both;
}

.coach-msg {
  background: linear-gradient(140deg, #F4F0E4, #EFE9d8);
  border-left: 3.5px solid var(--pine-2); padding: 11px 13px; border-radius: 4px 14px 14px 4px;
  font-size: .86rem; color: var(--ink-2);
}
.coach-msg b { color: var(--pine); }

.ai-spin { display: inline-block; width: 16px; height: 16px; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-soft .ai-spin, .card .ai-spin { border-color: rgba(46, 107, 80, .25); border-top-color: var(--pine-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* confetti canvas */
.confetti-canvas { position: fixed; inset: 0; z-index: 300; pointer-events: none; }

@media (min-width: 480px) {
  .day-col { flex-basis: 46%; }
  main { padding: 20px; }
}

/* ── Desktop: full width ── */
@media (min-width: 900px) {
  .app { max-width: 1280px; padding-left: 24px; padding-right: 24px; }
  .topbar { max-width: 1280px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }
  .tabs { max-width: 1280px; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 26px rgba(30, 58, 45, .1); }
  .tab { font-size: .78rem; flex-direction: row; gap: 8px; padding: 13px 0; }
  main { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
  main > .day-hero, main > .section-label, main > .row-flex, main > .banner,
  main > .week-board, main > .stat-tiles, main > button, main > .coach-msg { grid-column: 1 / -1; }
  .week-board { flex-wrap: nowrap; }
  .day-col { flex: 1 1 0; max-width: none; min-width: 0; }
  .rings { gap: 30px; }
  .stat-tiles { grid-template-columns: repeat(4, 1fr); }
  .modal { align-items: center; }
  .modal-card { border-radius: 24px; max-width: 720px; }
  .card { transition: box-shadow .25s, transform .25s; }
  .card:hover { box-shadow: var(--shadow-lg); }
}
@media (min-width: 1400px) {
  .app, .topbar, .tabs { max-width: 1440px; }
}
