/* Snap Plan */
:root {
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-2: #fbfaf7;
  --ink: #1d1d1f;
  --muted: #6e6b66;
  --line: #e6e2da;
  --line-soft: #f0ede7;
  --accent: #3d6df2;
  --card: #ffffff;
  --card-ink: #1d1d1f;
  --card-border: #dcd7ce;
  --shadow: 0 1px 2px rgba(0,0,0,.08), 0 2px 8px rgba(0,0,0,.06);
  --lift: 0 12px 28px rgba(0,0,0,.22), 0 3px 8px rgba(0,0,0,.12);
  --now: #ef4b4b;
  --danger: #e5484d;
  --gutter: 40px;
  --row: 40px;               /* one 30-minute row */
  --rose: #f7b3b3; --peach: #f8c9a2; --butter: #f3e08b; --mint: #aee3bd;
  --sky: #a7d6f2; --periwinkle: #b9bdf6; --lavender: #d7b8f0; --sand: #dccdb5;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a; --panel: #1e2026; --panel-2: #1a1c21; --ink: #f2f1ee; --muted: #a29f99;
    --line: #2e3038; --line-soft: #24262d; --card: #2a2d35; --card-ink: #f2f1ee; --card-border: #3a3d46;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3);
    --lift: 0 14px 30px rgba(0,0,0,.6), 0 3px 8px rgba(0,0,0,.4);
    --accent: #7c9bff;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, .card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding-top: var(--safe-t); overflow: hidden; max-width: 100vw; }

/* v12: iOS 27 draws a soft blur over the top ~40 pt of a home-screen web app (the "scroll edge" glass effect),
   which is what made the header look soft. A small, opaque, position:fixed strip touching the top edge makes iOS
   use a solid status bar instead and drop the blur. Same color as the page, under the status bar + the header's
   own 6px top padding, so nothing looks different. */
.sb-strip { position: fixed; top: 0; left: 0; right: 0; height: max(6px, calc(var(--safe-t) + 6px)); background: var(--bg); z-index: 40; pointer-events: none; }
.app-ver { text-align: center; margin: 14px 0 4px; }

/* header */
.top { flex: none; background: var(--bg); padding: 6px 10px 4px; }
.bar { display: flex; align-items: center; gap: 6px; height: 44px; min-width: 0; }
.brand { font-size: 17px; font-weight: 750; letter-spacing: -.02em; margin: 0; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.brand-mark { flex: none; }
.brand-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, #f7b3b3, #a7d6f2); box-shadow: 3px -3px 0 -1px var(--bg), 3px -3px 0 0 #b9bdf6; }
.seg { flex: none; display: flex; background: var(--line-soft); border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 11px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); min-height: 34px; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow); }
.count { font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; border-radius: 9px; padding: 1px 5px; min-width: 17px; text-align: center; }
.count:empty { display: none; }
.icon-btn { flex: none; border: 0; background: none; width: 44px; height: 44px; border-radius: 12px; font-size: 26px; line-height: 1; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.icon-btn:active { background: var(--line-soft); }
.gear { font-size: 20px; width: 40px; }
.daynav { display: flex; align-items: center; justify-content: center; gap: 6px; height: 40px; }
.day-label { border: 0; background: var(--panel); border-radius: 12px; min-width: 150px; height: 36px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); cursor: pointer; padding: 0 14px; }
.day-label small { font-weight: 500; color: var(--muted); margin-left: 6px; font-size: 13px; }

/* plan layout: schedule left, list right */
.plan { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 56fr) minmax(0, 44fr); gap: 8px; padding: 4px 8px 0; }
.sched, .todo { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border-radius: 16px 16px 0 0; box-shadow: var(--shadow); overflow: hidden; }
.sched-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; position: relative; }
.grid { position: relative; margin: 10px 0 calc(90px + var(--safe-b)); }
.hour-label { position: absolute; left: 0; width: calc(var(--gutter) - 4px); text-align: right; font-size: 10.5px; font-weight: 600; color: var(--muted); transform: translateY(-50%); pointer-events: none; white-space: nowrap; }
.hline { position: absolute; left: var(--gutter); right: 0; border-top: 1px solid var(--line); pointer-events: none; }
.hline.half { border-top: 1px dashed var(--line-soft); }
.now { position: absolute; left: calc(var(--gutter) - 6px); right: 0; height: 0; border-top: 2px solid var(--now); z-index: 5; pointer-events: none; }
.now::before { content: ""; position: absolute; left: 0; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }
.preview { position: absolute; left: var(--gutter); right: 4px; border: 2px dashed var(--accent); border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); z-index: 3; pointer-events: none; font-size: 11px; font-weight: 700; color: var(--accent); padding: 2px 6px; }

.todo { background: var(--panel-2); }
.add { flex: none; padding: 8px; }
.add input { width: 100%; height: 44px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px; font-size: 16px; background: var(--panel); color: var(--ink); outline: none; }
.add input:focus { border-color: var(--accent); }
.list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 2px 8px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.4; padding: 10px 4px; text-align: center; }
.hint b { color: var(--ink); }

/* cards */
.card {
  position: relative; background: var(--card); color: var(--card-ink); border: 1.5px solid var(--card-border);
  border-radius: 10px; box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; cursor: grab;
}
.card[data-color] { background: var(--c); border-color: color-mix(in srgb, var(--c) 70%, #000 12%); color: #1d1d1f; }
.card[data-color="rose"] { --c: var(--rose); } .card[data-color="peach"] { --c: var(--peach); }
.card[data-color="butter"] { --c: var(--butter); } .card[data-color="mint"] { --c: var(--mint); }
.card[data-color="sky"] { --c: var(--sky); } .card[data-color="periwinkle"] { --c: var(--periwinkle); }
.card[data-color="lavender"] { --c: var(--lavender); } .card[data-color="sand"] { --c: var(--sand); }
.card .t { display: block; overflow: hidden; text-overflow: ellipsis; overflow-wrap: anywhere; font-weight: 600; }
.list > .card { flex-shrink: 0; }
.card.in-list { min-height: 48px; padding: 12px 12px; font-size: 14.5px; animation: pop .22s ease-out; }
.card.in-list .t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card.in-grid { position: absolute; padding: 3px 7px; font-size: 12.5px; line-height: 1.2; z-index: 2; overflow: visible; }
.card.in-grid .t { white-space: nowrap; }
.card.in-grid.tall .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card.in-grid .tm { display: block; font-size: 10.5px; font-weight: 600; opacity: .7; white-space: nowrap; overflow: hidden; }
.card.in-grid.short { padding-top: 1px; padding-bottom: 1px; font-size: 11px; }
.card.in-grid.short .tm, .card.in-grid.mid .tm { display: none; }
.card.in-grid.mid { padding-top: 2px; padding-bottom: 2px; line-height: 1.15; }
.card.in-grid.mid .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card.in-grid.narrow { padding-left: 4px; padding-right: 4px; }
.card.selected { z-index: 6; box-shadow: 0 0 0 3px var(--accent), var(--shadow); }
.card .handle { display: none; position: absolute; left: 50%; bottom: -12px; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--panel); box-shadow: var(--shadow); touch-action: none; cursor: ns-resize; z-index: 7; }
.card .handle::before { content: ""; position: absolute; inset: -12px; border-radius: 50%; }
.card.selected .handle { display: block; }
.card.lifted { opacity: .28; }
.card.snapped { animation: snap .32s cubic-bezier(.2, 1.6, .4, 1); }
.card.completing .t { text-decoration: line-through; text-decoration-thickness: 2px; opacity: .6; }
.card.completing { animation: doneDim .45s ease-out both; }
/* completed cards stay in place: faded, desaturated, struck through, with a small badge */
.card.done { opacity: .5; filter: grayscale(.8); box-shadow: none; cursor: pointer; }
.card.done .t { text-decoration: line-through; text-decoration-thickness: 2px; }
.card.done .handle, .card.done.selected .handle { display: none; }
.card.done.selected { box-shadow: 0 0 0 3px var(--accent); }
.done-badge { position: absolute; top: 4px; right: 5px; z-index: 1; pointer-events: none; white-space: nowrap;
  font-size: 9px; font-weight: 800; letter-spacing: .03em; line-height: 1; text-transform: uppercase;
  padding: 3px 6px 3px 5px; border-radius: 999px; background: var(--ink); color: var(--panel); }
.done-badge i { font-style: normal; } .done-badge b { font-weight: 800; }
.card .rf { display: block; margin-top: 4px; font-size: 10.5px; font-weight: 700; color: var(--muted); }
.card[data-color] .rf { color: rgba(0, 0, 0, .55); }
.card.in-list .done-badge { position: static; display: inline-block; margin-top: 6px; font-size: 9px; }
.card.in-grid.done { padding-right: 8px; }
.card.in-grid .done-badge { position: static; display: inline-block; margin-top: 3px; vertical-align: top; }
.card.in-grid.short.done { padding-right: 24px; }
.card.in-grid.short .done-badge { position: absolute; margin-top: 0; }
.card.in-grid.short .done-badge b { display: none; }
.card.in-grid.short .done-badge { top: 2px; font-size: 8.5px; padding: 2px 5px 2px 4px; }
.card.in-grid.narrow.done { padding-right: 22px; }
.card.in-grid.narrow .done-badge b { display: none; }
.card.in-grid.narrow .done-badge { right: 3px; padding: 2px 4px; }
.ghost { position: fixed !important; z-index: 50; margin: 0; pointer-events: none; box-shadow: var(--lift); transform: rotate(-2deg) scale(1.04); transition: width .12s ease, height .12s ease; cursor: grabbing; }
.ghost.landing { transition: left .17s cubic-bezier(.2, 1.3, .4, 1), top .17s cubic-bezier(.2, 1.3, .4, 1), width .17s, height .17s, transform .17s, opacity .17s; transform: none; }
.ghost.trashing { transition: all .2s ease-in; transform: scale(.2) rotate(12deg); opacity: 0; }
body.dragging, body.dragging * { cursor: grabbing !important; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes snap { 0% { transform: scale(1.06); } 55% { transform: scale(.97); } 100% { transform: none; } }
@keyframes doneDim { 0% { opacity: 1; filter: none; transform: scale(1.04); } 100% { opacity: .5; filter: grayscale(.8); transform: none; } }

/* trash */
.trash { position: fixed; right: 14px; bottom: calc(14px + var(--safe-b)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--panel); box-shadow: var(--lift); font-size: 26px; display: grid; place-items: center; z-index: 40; transition: transform .15s ease, background .15s ease; }
body.dragging .trash { transform: scale(1.12); }
.trash.hot { background: var(--danger); transform: scale(1.35) !important; }

/* palette */
.palette { position: fixed; z-index: 45; display: flex; gap: 6px; padding: 7px; background: var(--panel); border-radius: 16px; box-shadow: var(--lift); border: 1px solid var(--line); }
.sw { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); padding: 0; cursor: pointer; position: relative; flex: none; }
.sw::after { content: ""; position: absolute; inset: -3px; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--panel), 0 0 0 4.5px var(--ink); }
.sw.none { background: var(--panel) !important; border: 2px solid var(--muted); overflow: hidden; }
.sw.none::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; margin-left: -1px; background: var(--danger); transform: rotate(45deg); }

/* toast */
.toast { position: fixed; left: 12px; right: 84px; bottom: calc(18px + var(--safe-b)); z-index: 60; background: #1f2026; color: #fff; border-radius: 14px; padding: 8px 8px 8px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; box-shadow: var(--lift); animation: pop .2s ease-out; max-width: 420px; }
.toast span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { border: 0; background: #ffffff22; color: #ffd76a; font-weight: 700; border-radius: 10px; min-height: 36px; padding: 0 12px; cursor: pointer; }
.toast button:empty { display: none; }

/* done view */
.done-view { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 12px calc(30px + var(--safe-b)); }
.done-group h2 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 4px 8px; }
.done-group ul { list-style: none; margin: 0; padding: 0; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.done-item { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 12px; border-top: 1px solid var(--line-soft); min-height: 56px; }
.done-item:first-child { border-top: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1.5px solid var(--card-border); background: transparent; }
.dot[data-color] { background: var(--c); border-color: transparent; }
.dot[data-color="rose"] { --c: var(--rose); } .dot[data-color="peach"] { --c: var(--peach); }
.dot[data-color="butter"] { --c: var(--butter); } .dot[data-color="mint"] { --c: var(--mint); }
.dot[data-color="sky"] { --c: var(--sky); } .dot[data-color="periwinkle"] { --c: var(--periwinkle); }
.dot[data-color="lavender"] { --c: var(--lavender); } .dot[data-color="sand"] { --c: var(--sand); }
.done-main { flex: 1; min-width: 0; }
.done-title { font-weight: 600; text-decoration: line-through; text-decoration-color: var(--muted); overflow-wrap: anywhere; }
.done-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.undo-btn { border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 10px; min-height: 40px; padding: 0 12px; font-size: 13px; font-weight: 600; cursor: pointer; flex: none; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; line-height: 1.5; }
.empty .big { font-size: 42px; display: block; margin-bottom: 8px; }

/* settings sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; background: var(--panel); border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); animation: up .22s ease-out; }
.sheet h2 { margin: 0 0 4px; font-size: 20px; }
.sheet h3 { font-size: 14px; margin: 16px 0 6px; }
.sheet ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.55; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.row-btn { display: block; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 12px; min-height: 50px; padding: 0 14px; margin-bottom: 8px; font-weight: 600; cursor: pointer; }
.close-btn { display: block; width: 100%; margin-top: 16px; border: 0; background: var(--accent); color: #fff; border-radius: 12px; min-height: 50px; font-weight: 700; cursor: pointer; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- roles under the list ---------- */
.card .re { font-size: .9em; margin-right: 3px; font-weight: 400; }
.card.in-grid.narrow .re, .card.in-grid.short .re { margin-right: 1px; }
.roles-area { flex: none; margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 8px; }
.roles-h { margin: 0 2px; font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.roles-h span { font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 3px; }
.roles { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
.role {
  --c: var(--line-soft);
  border: 0; border-radius: 12px; min-height: 52px; padding: 5px 3px 6px; cursor: pointer;
  background: color-mix(in srgb, var(--c) 42%, var(--panel)); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; min-width: 0;
}
.role:active { transform: scale(.95); }
.role.picked { box-shadow: 0 0 0 2.5px var(--accent); }
.role-e { font-size: 19px; line-height: 1; }
.role-n { font-size: 10.5px; font-weight: 650; line-height: 1.12; text-align: center; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
[data-color="rose"] { --c: var(--rose); } [data-color="peach"] { --c: var(--peach); }
[data-color="butter"] { --c: var(--butter); } [data-color="mint"] { --c: var(--mint); }
[data-color="sky"] { --c: var(--sky); } [data-color="periwinkle"] { --c: var(--periwinkle); }
[data-color="lavender"] { --c: var(--lavender); } [data-color="sand"] { --c: var(--sand); }
.metime { position: relative; background: color-mix(in srgb, var(--mint) 30%, var(--panel)); border: 1.5px dashed color-mix(in srgb, var(--mint) 80%, var(--ink) 10%); border-radius: 12px; padding: 7px 8px 8px; }
.metime p { margin: 0 22px 6px 0; font-size: 12px; line-height: 1.3; font-weight: 600; }
.me-actions { display: flex; }
.me-add { flex: 1 1 auto; border: 0; border-radius: 10px; min-height: 34px; padding: 0 6px; font-size: 12.5px; font-weight: 700; background: var(--mint); color: #1d1d1f; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.me-skip { position: absolute; top: 0; right: 0; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 0; }
.metime[data-state="drag"] p { margin-bottom: 0; }
.tagline { display: flex; align-items: center; gap: 4px; margin-top: 6px; padding: 2px 2px 2px 9px; border-radius: 10px; font-size: 12.5px; font-weight: 650; background: color-mix(in srgb, var(--c, var(--line)) 45%, var(--panel)); }
.tagline span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tagline button { border: 0; background: none; width: 32px; height: 30px; font-size: 18px; cursor: pointer; color: var(--muted); }

/* role ideas sheet */
.ideas { display: grid; gap: 8px; margin-bottom: 8px; }
.idea { text-align: left; border: 0; border-radius: 12px; min-height: 50px; padding: 0 14px; font-weight: 650; font-size: 15.5px; cursor: pointer; background: color-mix(in srgb, var(--c, var(--line)) 45%, var(--panel)); color: var(--ink); }
.idea:active { transform: scale(.98); }

/* settings: calendar + roles */
.small { font-size: 12.5px; }
.cal, .role-edit { border-top: 1px solid var(--line); margin-top: 14px; }
.cal h3, .role-edit h3 { font-size: 16px; margin-top: 14px; }
.cal-status { font-weight: 650; font-size: 14px; margin: 4px 0 10px; }
.big-btn { display: flex; align-items: center; justify-content: center; min-height: 56px; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 750; font-size: 17px; text-decoration: none; margin-bottom: 10px; }
.big-btn.wait { opacity: .45; pointer-events: auto; }
.steps { margin: 0 0 8px; padding-left: 22px !important; font-size: 15px !important; line-height: 1.6 !important; }
.row-btn.danger { color: var(--danger); }
.role-row { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.rdot { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); background: var(--c, transparent); cursor: pointer; padding: 0; }
.remoji { flex: none; width: 44px; height: 40px; text-align: center; font-size: 18px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--ink); padding: 0; }
.rname { flex: 1; min-width: 0; height: 40px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--ink); padding: 0 8px; font-size: 16px; }
.rmini { flex: none; width: 32px; height: 40px; border: 0; border-radius: 9px; background: var(--line-soft); cursor: pointer; font-size: 12px; color: var(--ink); padding: 0; }
.rmini:disabled { opacity: .3; cursor: default; }
@media (prefers-color-scheme: dark) {
  .role { background: color-mix(in srgb, var(--c) 26%, var(--panel)); }
  .idea { background: color-mix(in srgb, var(--c, var(--line)) 26%, var(--panel)); }
  .metime { background: color-mix(in srgb, var(--mint) 16%, var(--panel)); }
  .tagline { background: color-mix(in srgb, var(--c, var(--line)) 28%, var(--panel)); }
}

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }

@media (max-width: 360px) {
  .brand { font-size: 15px; }
  .seg button { padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .card.in-list, .card.snapped, .card.completing, .toast, .sheet { animation: none; }
}

/* daily line */
.dline { display: flex; align-items: center; gap: 4px; margin: 2px 0 4px; min-height: 30px; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); }
.dline-main::selection, .dline-main *::selection { background: transparent; }
.dline-main:focus:not(:focus-visible) { outline: none; }
.dline-main { -webkit-tap-highlight-color: transparent; flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 7px; border: 0; background: none; text-align: left; padding: 6px 4px 6px 10px; cursor: pointer; font-size: 13.5px; line-height: 18px; font-weight: 550; color: var(--ink); -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.dline-emoji { flex: none; font-size: 14px; }
.dline-text { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.dline.open .dline-text { white-space: normal; }
.dline.empty .dline-text { color: var(--muted); font-weight: 500; font-style: italic; }
.dline-next { flex: none; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 0 3px; align-self: flex-start; }
.dline.empty .dline-next, .dline.one .dline-next { display: none; }
.line-row { display: flex; align-items: flex-start; gap: 4px; margin-bottom: 6px; }
.lkind { flex: none; width: 44px; height: 40px; font-size: 18px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; padding: 0; }
.ltext { flex: 1; min-width: 0; min-height: 40px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--ink); font: inherit; font-size: 14px; padding: 8px 9px; resize: none; field-sizing: content; max-height: 120px; }
.lbtn { flex: none; width: 34px; height: 40px; border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--muted); padding: 0; }
.lbtn:disabled { opacity: .25; }

.dline { cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
.pick-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.pick { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px; font-size: 15px; line-height: 1.35; cursor: pointer; color: var(--ink); }
.pick .pe { flex: none; font-size: 18px; }
.pick .pt { flex: 1; min-width: 0; }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.pick .pon { flex: none; font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; padding-top: 2px; }

.sw.edit { background: var(--panel-2); border: 2px solid var(--line); font-size: 15px; line-height: 26px; text-align: center; }

/* ================= kitchen: shopping, trends, meals, recipes (v10) ================= */
.seg button.ico { padding: 7px 6px; font-size: 17px; }
/* v11: the top bar must never be wider than the screen. When it was (v10: three new icon tabs + the Done count),
   iPhone Safari zoomed the whole page out a few percent to fit, and every pixel got resampled = soft text, logo and emoji. */
@media (max-width: 413px) { .seg button { padding-left: 9px; padding-right: 9px; } .seg button.ico { padding-left: 5px; padding-right: 5px; } .gear { width: 36px; } }
.bar.tight .brand-text { display: none; }   /* no room for the name: show just the logo square (script.js fitBar) */
.kview { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 12px calc(28px + var(--safe-b)); }
.kview.recipes { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.seg.ksub { margin: 2px 0 10px; }
.seg.ksub button { flex: 1; justify-content: center; padding: 7px 6px; font-size: 13.5px; }
.seg.ksub.small { margin: 0; }
.seg.ksub.small button { flex: none; padding: 6px 14px; }
.kadd { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; margin-bottom: 10px; }
.krow { display: flex; gap: 6px; align-items: center; }
.krow + .krow { margin-top: 6px; }
.krow input, .krow select, .kf input, .kf select, .kf textarea, .kselect { font: inherit; font-size: 16px; color: var(--ink); background: var(--panel-2, var(--bg)); border: 1.5px solid var(--line); border-radius: 10px; min-height: 42px; padding: 0 10px; min-width: 0; }
.krow input[type="text"], .krow input[type="search"] { flex: 1; }
.krow.small input.q { width: 64px; flex: none; }
.krow.small select { flex: 1; }
.krow.small input.p { width: 84px; flex: none; }
.kbtn { border: 0; border-radius: 10px; min-height: 42px; padding: 0 14px; font-weight: 700; font-size: 14px; background: var(--line-soft); color: var(--ink); cursor: pointer; white-space: nowrap; }
.kbtn.primary { background: var(--accent); color: #fff; }
.kbar { display: flex; gap: 6px; align-items: center; margin: 0 0 8px; flex-wrap: wrap; }
.kbar .kbtn { margin-left: auto; min-height: 36px; }
.kchip { border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; min-height: 34px; padding: 0 12px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.kchip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.kchip.rec { border-color: var(--accent); }
.kchips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.kgroup { margin-bottom: 12px; }
.kgh { display: flex; align-items: center; gap: 8px; margin: 4px 2px 6px; font-size: 15px; font-weight: 750; }
.kgh small { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.sdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; margin-right: 6px; vertical-align: middle; }
.kgh .sdot { margin-right: 0; }
.kitem { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 4px 10px 4px 6px; margin-bottom: 6px; min-height: 48px; }
.kcheck { flex: none; width: 40px; height: 40px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.kcheck::before { content: ''; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); }
.kcheck:active::before { background: var(--mint); border-color: #2f9e5b; }
.kmain { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 6px 0; color: var(--ink); cursor: pointer; display: flex; flex-direction: column; }
.kmain.plain { flex-direction: row; align-items: center; cursor: default; padding-left: 8px; font-weight: 600; }
.kn { font-weight: 650; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.km { color: var(--muted); font-size: 12.5px; }
.kp { color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kmini { border: 0; background: var(--line-soft); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 15px; color: var(--ink); }
.empty.small { padding: 30px 16px; }
.kcard { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 10px; }
.kchart { width: 100%; height: auto; display: block; }
.kchart .gl { stroke: var(--line); stroke-width: 1; }
.kchart .ax { fill: var(--muted); font-size: 11px; }
.kchart .pt { stroke: var(--panel); stroke-width: 1.5; }
.klegend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; font-weight: 600; margin-top: 4px; }
.klegend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.ktable { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--panel); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 8px; }
.ktable th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); }
.ktable td { padding: 8px; border-bottom: 1px solid var(--line-soft); }
.ktable tr:last-child td { border-bottom: 0; }
.ktable td.num { font-variant-numeric: tabular-nums; text-align: right; }
.ktable th:nth-child(n+2) { text-align: right; }
#kSheetBody .ktable th:nth-child(2), #kSheetBody .ktable th:nth-child(4) { text-align: left; }
.ktable tr.best td { background: color-mix(in srgb, var(--mint) 35%, transparent); font-weight: 650; }
.kf { display: block; margin-bottom: 10px; }
.kf > span { display: block; font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 0 0 4px 2px; }
.kf input, .kf select, .kf textarea, .kselect { width: 100%; box-sizing: border-box; }
.kf textarea { padding: 10px; line-height: 1.4; resize: vertical; }
.krow2 { display: flex; gap: 8px; } .krow2 > .kf { flex: 1; min-width: 0; }
.kest { margin-top: 0; }
.kstore { cursor: pointer; border: 2px solid transparent; }
.kstore.best { border-color: #2f9e5b; }
.kst { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.kst .tot { margin-left: auto; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.badge { background: #2f9e5b; color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 3px 8px; text-transform: uppercase; letter-spacing: .03em; }
.kmiss { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kh3 { font-size: 15px; margin: 18px 2px 8px; }
.row-btn.ghost { text-align: center; border: 0; background: none; color: var(--muted); }
.ksheet h3 { font-size: 14px; margin: 14px 0 6px; }
.ksheet .muted.small, .kview .muted.small { font-size: 12.5px; }
.close-btn:disabled { opacity: .45; }
/* meals */
.knav { margin: 0 0 6px; }
.kmeals .mday { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 4px 10px 6px; margin-bottom: 8px; }
.kmeals .mday.today { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.mdh { display: block; width: 100%; text-align: left; border: 0; background: none; font-weight: 750; font-size: 14px; padding: 6px 0 2px; color: var(--ink); cursor: pointer; }
.mslot { display: flex; align-items: center; gap: 6px; min-height: 38px; border-top: 1px solid var(--line-soft); border-radius: 8px; transition: background .3s; }
.mdh + .mslot { border-top: 0; }
.mslot.flash { animation: kflash 1.6s ease-out; }
@keyframes kflash { 0%, 40% { background: color-mix(in srgb, var(--butter) 80%, transparent); } 100% { background: transparent; } }
.msl { flex: none; width: 94px; white-space: nowrap; font-size: 12.5px; font-weight: 650; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.msl i { font-style: normal; font-size: 15px; }
.mes { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; }
.mchip { border: 0; background: var(--line-soft); color: var(--ink); border-radius: 9px; padding: 5px 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: left; max-width: 100%; }
.mchip.rec { background: color-mix(in srgb, var(--sky) 45%, transparent); }
.madd { flex: none; width: 34px; height: 34px; border-radius: 10px; border: 1.5px dashed var(--line); background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.kmeals.day .mslot { min-height: 56px; }
.kmeals.day .msl { width: 96px; font-size: 14px; }
.kmeals.day .mchip { font-size: 15px; padding: 8px 11px; }
.kfoot { text-align: center; }
.kpicks h3 { margin-top: 12px; }
.kchk { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.kchk input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.kct { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.kct small { color: var(--muted); font-size: 12.5px; }
.kchk .tag, .kchk.onlist .tag { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--line-soft); border-radius: 999px; padding: 3px 8px; white-space: nowrap; }
.king { margin: 0 0 8px; padding-left: 20px; line-height: 1.55; }
.ksteps { white-space: pre-wrap; line-height: 1.5; font-size: 15px; margin-bottom: 10px; }
.kplan { background: var(--panel-2, var(--bg)); border-radius: 12px; padding: 10px; margin: -2px 0 10px; }
/* recipes A-Z */
.ktop { margin-bottom: 8px; flex: none; }
.kaz { position: relative; flex: 1; min-height: 0; }
.kazlist { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 30px calc(28px + var(--safe-b)) 0; }
.azh { position: sticky; top: 0; z-index: 1; margin: 0; padding: 6px 4px 4px; font-size: 13px; font-weight: 800; color: var(--accent); background: var(--bg); }
.krec { display: flex; flex-direction: column; width: 100%; text-align: left; border: 0; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 6px; color: var(--ink); cursor: pointer; }
.krec b { font-size: 15.5px; }
.krec small { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.azidx { position: absolute; top: 0; right: -6px; bottom: calc(6px + var(--safe-b)); width: 30px; display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; touch-action: none; user-select: none; -webkit-user-select: none; padding: 2px 0; z-index: 2; }
.azl { flex: 1; border: 0; background: none; padding: 0; font-size: 11px; font-weight: 800; color: var(--accent); cursor: pointer; line-height: 1; min-height: 0; -webkit-tap-highlight-color: transparent; }
.azl.off { color: var(--line); color: color-mix(in srgb, var(--muted) 35%, transparent); }
.azbubble { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); width: 72px; height: 72px; border-radius: 18px; background: rgba(0,0,0,.6); color: #fff; font-size: 40px; font-weight: 800; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.kpad { padding: 12px 4px; }
/* @ links on planner cards + the autocomplete */
.at { display: inline; font-weight: 750; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; padding: 0 3px; cursor: pointer; }
.card.done .at { color: inherit; background: none; }
.add { position: relative; }
.at-pop { position: absolute; left: auto; right: 0; width: max(100%, 236px); top: calc(100% + 4px); z-index: 70; background: var(--panel); border-radius: 12px; box-shadow: var(--lift); padding: 4px; display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; }
.ac-opt { border: 0; background: none; text-align: left; font-size: 15px; font-weight: 600; color: var(--ink); min-height: 40px; padding: 0 10px; border-radius: 8px; cursor: pointer; }
.ac-opt:active, .ac-opt:hover { background: var(--line-soft); }
@media (max-width: 400px) {
  .seg button.ico { padding: 7px 6px; font-size: 16px; }
  .seg button { padding: 7px 8px; }
  .msl { width: 88px; font-size: 12px; }
}
@media (max-width: 360px) { .brand { font-size: 0; gap: 0; } }
