/* v13 calm redesign. Loaded last so it overrides the earlier "vivid" layer.
   One accent (--do, orange) means "do this now"; everything else is quiet:
   soft neutral surfaces, muted category colors, no competing borders. */
:root {
  --bg: #F7F5F1; --bg-2: #EFECE6; --elev: #FFFFFF; --ink: #1C1D22; --muted: #565A64; --line: #E6E2DA;
  --brand: #3E4A89; --brand-ink: #FFFFFF; --focus: #3E4A89; --accent: #B45309;
  --do: #C2410C; --do-ink: #FFFFFF; --do-soft: #FFF1E8;
  --grad: var(--brand); --grad-soft: var(--bg-2);
  --radius: 16px;
  --shadow: 0 1px 2px rgba(20,20,30,.05), 0 4px 14px rgba(20,20,30,.05);
}
html[data-theme="dark"] {
  --bg: #121317; --bg-2: #1A1C22; --elev: #1D2026; --ink: #ECEDEF; --muted: #A9AEB8; --line: #2C3038;
  --brand: #A9B4F0; --brand-ink: #121317; --focus: #A9B4F0; --accent: #F2B36B;
  --do: #FB923C; --do-ink: #1A0E05; --do-soft: #2A1C12;
  --grad: var(--brand); --grad-soft: var(--bg-2);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
}
body, html[data-theme="dark"] body { background: var(--bg); }
.app-header { background: color-mix(in srgb, var(--elev) 94%, transparent); color: var(--ink); box-shadow: none; border-bottom: 1px solid var(--line); }
.app-header .brand-block p { color: var(--muted); }
.app-header .who-btn { background: var(--elev); border-color: var(--line); color: var(--ink); }
.app-header .sync-pill { background: var(--elev); color: var(--ink); border-color: var(--line); }
.app-header :focus-visible { outline-color: var(--focus); }
.tab-btn[aria-selected="true"], .bottom-nav .tab-btn[aria-selected="true"] { background: color-mix(in srgb, var(--brand) 14%, var(--elev)); color: var(--brand); }
.bottom-nav { box-shadow: 0 -1px 0 var(--line); }
.bottom-nav button[aria-selected="true"] { color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: none; }
.fab { background: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 14px rgba(20,20,40,.18); }
.btn { border-radius: 12px; }
.page-head h2, html[data-theme="dark"] .page-head h2 { background: none; color: var(--ink); -webkit-text-fill-color: currentColor; }
.card, .card.tone { border: 0; border-top: 0; background: var(--elev); box-shadow: var(--shadow); border-radius: var(--radius); }
.card.slim { padding-top: 10px; padding-bottom: 10px; }
.card + .card, .cards > * + * { margin-top: 12px; }
.h-emoji { width: 1.8rem; height: 1.8rem; font-size: 1.05rem; border-radius: 10px; background: var(--bg-2); }
details.card > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 8px; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.card[open] > summary::after { transform: rotate(180deg); }
/* The one accent: things to do now */
.do-now { box-shadow: inset 4px 0 0 var(--do), var(--shadow) !important; }
.do-now h3 { color: var(--do); }
.count-pill { display: inline-grid; place-items: center; min-width: 1.6em; padding: 0 .45em; margin-left: 6px; border-radius: 999px; background: var(--do); color: var(--do-ink); font-size: .8rem; }
.btn.do { background: var(--do); color: var(--do-ink); border-color: transparent; }
.pill-count { background: var(--do); color: var(--do-ink); }
.next-when { margin: 0 0 4px; color: var(--do); }
.next-then { margin: 6px 0 0; }
/* Muted category colors */
.cat-chip { background: color-mix(in srgb, var(--chip) 8%, var(--elev)); border: 0; border-left: 0; min-height: 40px; font-weight: 600; }
.cat-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--chip) 70%, var(--muted)); }
.cat-tiles { margin: 8px 0 0; }
.member-dots span { opacity: .8; }
/* Hero: quiet */
.hero { background: var(--elev); color: var(--ink); box-shadow: var(--shadow); padding: 14px 16px; border-radius: var(--radius); }
.hero h2 { font-size: 1.3rem; }
.hero p { color: var(--muted); }
.hero .hero-date { color: var(--muted); }
.hero-art { width: 64px; filter: none; }
@media (max-width: 380px) { .hero-art { width: 52px; } }
/* Smart add buttons: neutral, compact */
.smart-btn.speak, .smart-btn.snap { background: var(--bg-2); color: var(--ink); box-shadow: none; }
.smart-btn svg { color: var(--brand); }
.smart-row.compact .smart-btn { min-height: 48px; }
.add-row .btn { flex: 1 1 120px; }
.add-sheet { display: grid; gap: 12px; }
/* Zone tabs (Food / Kids / Calendar) */
.zone-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding: 4px; border-radius: 14px; background: var(--bg-2); }
.zone-tab { flex: 1 0 auto; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 600; white-space: nowrap; }
.zone-tab[aria-selected="true"] { background: var(--elev); color: var(--ink); box-shadow: var(--shadow); }
/* Shopping list + stock at home */
.stock-badge { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--bg-2); color: var(--muted); vertical-align: middle; }
.stock-badge.out { background: var(--do-soft); color: var(--do); }
.stock-badge.low { background: color-mix(in srgb, #B45309 12%, var(--elev)); color: #92400E; }
html[data-theme="dark"] .stock-badge.low { color: #FCD34D; }
.stock-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.stock-row:first-of-type { border-top: 0; }
.stock-name { flex: 1; min-width: 0; }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: .9rem; }
.stock-more > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; color: var(--brand); font-weight: 600; }
/* Meals: dinner first, others on demand */
.meal-adds { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.meal-add { font-size: .85rem; min-height: 36px; }
.meal-slot.empty-slot { background: var(--bg-2); border-style: dashed; }
/* Pickup board: usual week + changes */
.ho-cell.changed { background: var(--do-soft); border-radius: 10px; }
.ho-badge { font-size: .75rem; font-weight: 700; color: var(--do); }
.ho-pat-grid { display: grid; gap: 10px; margin-top: 8px; }
.ho-pat-day { padding: 8px 0; border-top: 1px solid var(--line); }
.ho-pat-day:first-child { border-top: 0; }
.ho-pat-kid { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.ho-pat-kid select { min-height: 40px; }
.ho-pat-who { font-size: .9rem; color: var(--muted); }
.ho-change-days { display: grid; gap: 10px; margin-top: 8px; }
.ho-day-mini h4 { margin: 8px 0 4px; }
@media (prefers-contrast: more) {
  .app-header, .btn.primary, .fab, .tab-btn[aria-selected="true"], .pill-count, .hero { background: var(--elev) !important; color: var(--ink) !important; }
  .btn.primary, .fab { background: #1E2A66 !important; color: #fff !important; }
}

/* ── Kitchen display v13: readable from about 10 ft ────────────────────── */
.kd.kd13 { --kd-bg: #F4F1EC; --kd-card: #FFFFFF; --kd-ink: #16171C; --kd-muted: #4D515B; --kd-line: #E4E0D8;
  display: flex; flex-direction: column; gap: 10px; overflow-x: hidden; min-width: 0;
  padding-top: calc(var(--safe-t, 0px) + 12px); padding-bottom: calc(var(--safe-b, 0px) + 12px); padding-left: 16px; padding-right: 16px; }
.kd.kd13[data-night="true"] { --kd-bg: #15161B; --kd-card: #22242C; --kd-ink: #F1F1F3; --kd-muted: #B9BDC7; --kd-line: #343844; }
.kd13 .kd-top { flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 4px; min-width: 0; max-width: 100%; }
.kd13 .kd-clock { font-size: clamp(56px, 10vw, 120px); line-height: 1; margin: 0; }
.kd13 .kd-clock small { font-size: .32em; }
.kd13 .kd-meta { margin: 0; max-width: 100%; font-size: clamp(15px, 2.8vw, 26px); font-weight: 700; color: var(--kd-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd13 .kd-body { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 900px) {
  .kd13[data-dinner="full"] .kd-body { grid-template-columns: minmax(0, 1fr) minmax(220px, 28%); }
}
.kd13 .kd-people { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.kd13 .kd-person { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 12px;
  width: 100%; min-width: 0; overflow: hidden; min-height: 52px; padding: 8px 12px; border-radius: 18px; border: 0;
  background: var(--kd-card); box-shadow: inset 6px 0 0 color-mix(in srgb, var(--m) 75%, var(--kd-muted)); }
.kd13 .kd-name { flex: none; margin: 0; font-size: clamp(18px, 2.6vw, 32px); gap: .4em; display: flex; align-items: center;
  font-weight: 800; white-space: nowrap; max-width: 8.5em; min-width: 0; overflow: hidden; }
.kd13 .kd-name .avatar { width: 1.35em; height: 1.35em; font-size: .48em; flex: none; }
.kd13 .kd-name span:last-child { overflow: hidden; text-overflow: ellipsis; }
.kd13 .kd-next { margin: 0; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: clamp(16px, 2.2vw, 28px); font-weight: 700; line-height: 1.25; }
.kd13 .kd-next-text { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd13 .kd-next .kd-dir { flex: none; }
.kd13 .kd-next.empty { color: var(--kd-muted); font-weight: 600; }
.kd13 .kd-left { flex: none; white-space: nowrap; font-size: clamp(14px, 1.9vw, 22px); font-weight: 800; color: var(--kd-muted); }
.kd13 .kd-left-empty { min-width: 0; padding: 0; }
.kd13 .kd-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
.kd13 .kd-card { border-top: 0; box-shadow: none; padding: 12px 14px; border-radius: 22px; min-width: 0; }
.kd13 .kd-card h2 { font-size: clamp(16px, 2.4vw, 28px); color: var(--kd-muted); margin: 0 0 6px; }
.kd13 .kd-dinner { box-shadow: inset 0 6px 0 #C2410C; }
.kd13 .kd-big { font-size: clamp(28px, 5.5vw, 72px); line-height: 1.05; margin: 0; overflow-wrap: anywhere; }
.kd13 .kd-small { font-size: clamp(14px, 2vw, 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.kd13 .kd-chips { gap: 8px; }
.kd13 .kd-chips li { font-size: clamp(16px, 2.2vw, 26px); padding: 6px 12px; }
.kd13 .kd-dinner-line { margin: 0; min-width: 0; max-width: 100%; font-size: clamp(16px, 2.2vw, 24px); font-weight: 800;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kd13 .kd-foot { display: flex; flex-direction: column; gap: 8px; font-size: 15px; min-width: 0; }
.kd13 .kd-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.kd.kd13, .kd.kd13[data-night="true"] { background: var(--kd-bg); height: 100%; min-height: 100%; box-sizing: border-box; }
.zone-tab { flex: 1 1 auto; padding: 0 8px; font-size: .92rem; }
.ho-day.today { outline: 0; }
.ho-nav { flex-wrap: nowrap; gap: 6px; }
.ho-nav strong { flex: 1; text-align: center; font-size: .9rem; }
.ho-nav .btn { padding: 0 10px; }
.ho-cell { padding: 4px; }
.ho-cell select { width: 100%; }
.meal-day { border: 0; box-shadow: var(--shadow); }
.meal-slot, .meal-slot.breakfast, .meal-slot.lunch, .meal-slot.dinner { border: 0; border-left: 0; background: var(--bg-2); }
.meal-slot.dinner { background: color-mix(in srgb, var(--brand) 7%, var(--elev)); }
.meal-slot.dinner.empty-slot { background: var(--bg-2); outline: 1px dashed var(--line); }
.meal-day.is-today { box-shadow: inset 4px 0 0 var(--do), var(--shadow); }
/* Saving pulse on the dot only, so the label always keeps full contrast */
.sync-pill.saving .sync-text { animation: none; }
.sync-pill.saving::before { animation: syncPulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .sync-pill.saving::before { animation: none; } }

/* Conflict cards: calm, not alarming */
.conflict-card { box-shadow: inset 4px 0 0 color-mix(in srgb, var(--accent) 55%, var(--line)), var(--shadow); }
.conflict-card h3 { margin: 0 0 6px; color: var(--ink); font-size: 1.05rem; }
.conflict-card p { color: var(--muted); margin: 0 0 12px; }
.slot-pick { display: grid; gap: 8px; margin-top: 8px; }
.slot-pick .btn { width: 100%; justify-content: center; }
.not-going-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; letter-spacing: .01em; background: var(--bg-2); color: var(--muted); vertical-align: middle; }
.pending-move-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--do-soft); color: var(--do); vertical-align: middle; }
.ev-flag { display: flex; align-items: center; gap: 8px; padding: 0 0 8px; color: var(--muted); font-size: .9rem; }
.ev-flag .not-going-tag { margin-left: 0; }
.event-row.is-not-going { opacity: .55; }
.attend-actions { margin: 8px 0 4px; }
.attend-actions .btn-row { margin-top: 6px; }


/* Grocery item photos */
.quick-add { display: flex; align-items: center; gap: 8px; }
.quick-add input[name="name"] { flex: 1; min-width: 0; }
.item-photo-add { cursor: pointer; flex: 0 0 auto; }
.item-photo-thumb { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--bg-2); flex: 0 0 auto; }
.item-photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-photo-busy { font-size: .78rem; color: var(--muted); font-weight: 600; padding: 0 4px; }
.item-photo-pending { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.item-photo-pending img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.item-photo-full { margin: 0 0 12px; text-align: center; }
.item-photo-full img { max-width: 100%; max-height: 70vh; border-radius: 12px; }
.shop-row { display: flex; align-items: center; gap: 8px; }

.member-dots .unknown-dot { background: #94a3b8; }

/* v33 invites, search, comments */
.cal-search{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.cal-search input[type=search]{flex:1 1 160px;min-width:0;padding:10px 12px;border:1px solid var(--line);border-radius:12px;font:inherit;background:var(--card,#fff)}
.cal-search select{padding:10px 8px;border:1px solid var(--line);border-radius:12px;font:inherit;background:var(--card,#fff)}
.ask-badge{display:inline-block;margin-left:4px;padding:1px 8px;border-radius:999px;background:#FEF3C7;color:#92400E;font-size:.75rem;font-weight:600}
.ask-badge.on{background:#DCFCE7;color:#166534}
.ask-card{border-top:1px solid var(--line);padding:10px 0}
.ask-replies{margin:6px 0 0;padding-left:1.1em}
.ask-covered{font-weight:600;margin:6px 0}
.ev-comments{margin-top:12px}
.ev-cmt{border-top:1px solid var(--line);padding:8px 0}
.ev-cmt-photo{max-width:100%;border-radius:12px;margin:6px 0}
.rsvp-card{background:#fff;border-radius:16px;padding:8px 4px}
.rsvp-card h1{font-size:1.2rem;margin:0 0 8px}
#cal-share-settings input[readonly], #modal-root input[readonly], [data-testid=ask-url], [data-testid=cal-share-url]{width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid var(--line);border-radius:10px;font:inherit;margin:6px 0}

.invite-chips{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 8px}
.invite-chip{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:999px;background:#EDE9FE;color:#5B21B6;font-size:.85rem;font-weight:600}
.invite-chip button{border:0;background:transparent;color:inherit;font-size:1.05rem;line-height:1;padding:0 2px;cursor:pointer}
.ask-remembered{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
.ask-headcount{font-weight:600}

#modal-root textarea[data-testid=ask-note]{min-height:56px}
.ask-who-row{display:flex;gap:8px;align-items:center}
.ask-who-row input{flex:1;margin:0}
.ask-save-row{position:sticky;bottom:0;background:var(--elev,#fff);padding:10px 0 calc(8px + env(safe-area-inset-bottom,0px));margin-bottom:0;z-index:2}
/* Keep Add people / Create links in a real footer, not a sticky bar inside the
   scrolling sheet. iOS Safari often swallows submit events from a position:sticky
   button in an overflow:auto bottom sheet, so nothing ran and no toast appeared. */
.sheet.sheet-with-foot{display:flex;flex-direction:column;overflow:hidden;padding-bottom:0;max-height:92vh}
.sheet.sheet-with-foot .sheet-head{flex:0 0 auto}
.sheet.sheet-with-foot form[data-inv-form=ask-save]{display:flex;flex-direction:column;min-height:0;flex:1 1 auto;overflow:hidden}
.sheet.sheet-with-foot .ask-form-body{flex:1 1 auto;min-height:0;overflow:auto;-webkit-overflow-scrolling:touch}
.sheet.sheet-with-foot .ask-save-row{position:static;flex:0 0 auto;padding:10px 16px calc(12px + env(safe-area-inset-bottom,0px));margin:0 -16px 0;border-top:1px solid var(--line)}



/* v49 leave-the-table + pre-yes card */
.leave-line { margin: 8px 0; }
.leave-line [data-testid=leave-breakdown] { display: block; margin-top: 4px; }
.preyes { display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.preyes-sec { background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; padding: 10px 12px; }
.preyes-sec h3 { margin: 0 0 6px; font-size: 0.95rem; }
.preyes-sec p, .preyes-sec .event-meta { margin: 0; }
#overlap-warn .preyes { gap: 8px; margin: 8px 0 4px; }
#overlap-warn .preyes-sec { padding: 8px 10px; }
#overlap-warn { margin: 8px 0 4px; }


/* v50 school papers, graduation, meals-for-one */
.school-papers { margin-top: 12px; }
.paper-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line, #e5e7eb); }
.paper-thumb, .paper-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.paper-preview { margin: 8px 0; text-align: center; }
.paper-preview img { width: 100%; max-height: 240px; height: auto; }
.grad-mark { font-weight: 600; color: #0E7490; }
.grad-offer-row { margin: 8px 0 12px; }
[data-testid=meal-for] { display: inline-block; margin-left: 4px; }
