@font-face {
  font-family: "Pacifico";
  src: url("fonts/pacifico.woff2") format("woff2");
  font-display: swap;
}
:root {
  --bg: #fdf7f9;
  --card: #ffffff;
  --ink: #2a1f24;
  --muted: #7a6b72;
  --line: #f0dfe6;
  --accent: #c2336d;
  --accent-ink: #ffffff;
  --accent-soft: #fce4ee;
  --danger: #b4412f;
  --warn: #9a6b12;
  --radius: 6px;
  --r-sm: 4px;
  --tabbar: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1417;
    --card: #241c20;
    --ink: #f5ecf0;
    --muted: #b09ba5;
    --line: #3a2d33;
    --accent: #f27fae;
    --accent-ink: #2a0f1b;
    --accent-soft: #3d2330;
    --danger: #e0715f;
    --warn: #d9a441;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 16px);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 8px;
  border-bottom: 1px solid var(--line);
}
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.top h1 { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; white-space: nowrap; }
main { max-width: 760px; margin: 0 auto; padding: 12px 16px; }

/* bottom tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; height: var(--tabbar); border: 0; background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button.active { color: var(--accent); font-weight: 600; }

/* buttons and inputs */
button { cursor: pointer; }
.btn, .sheet button:not(.close):not(.link):not(.chip), .toolbar button, .row-btns button {
  border: 1px solid var(--line); background: var(--card);
  padding: 10px 14px; border-radius: var(--r-sm);
}
.primary { background: var(--accent) !important; color: var(--accent-ink) !important; border-color: var(--accent) !important; font-weight: 600; }
.danger { color: var(--danger) !important; }
.wide { width: 100%; margin-top: 14px; }
.link { background: none; border: 0; color: var(--accent); padding: 6px 0; text-decoration: underline; }
input[type=text], input[type=search], input[type=url], input[type=password], input[type=email], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--card);
}
textarea { min-height: 120px; resize: vertical; }
label { display: block; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--ink); font-size: 16px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* recipes */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; }
.toolbar input { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card {
  display: flex; flex-direction: column; text-align: left; padding: 0;
  border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); overflow: hidden;
}
.card img, .card .noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.card .noimg {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 34px; font-weight: 700;
}
.card span { padding: 8px 10px 10px; font-weight: 600; font-size: 15px; line-height: 1.25; }
.empty { color: var(--muted); text-align: center; padding: 32px 8px; grid-column: 1 / -1; }
.footer-actions { margin-top: 24px; text-align: center; color: var(--muted); font-size: 14px; }

/* modal sheet */
.modal {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }
.sheet {
  position: relative; background: var(--bg); width: 100%; max-width: 640px;
  max-height: 92vh; overflow-y: auto; border-radius: var(--radius) var(--radius) 0 0;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) { .modal { align-items: center; } .sheet { border-radius: var(--radius); } }
.sheet h2 { margin: 0 36px 6px 0; font-size: 21px; }
.sheet h3 { margin: 18px 0 6px; font-size: 16px; }
.close {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px;
  border-radius: var(--r-sm); border: 0; background: var(--line); font-size: 20px; line-height: 1;
}
.hero { width: calc(100% + 32px); margin: -18px -16px 12px; max-height: 260px; object-fit: cover; display: block; border-radius: var(--radius) var(--radius) 0 0; }
.meta { color: var(--muted); margin: 0 0 10px; font-size: 14px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ing, .steps { padding-left: 22px; margin: 0; }
.ing li, .steps li { margin: 4px 0; }
.steps li { margin: 8px 0; }
.seg { display: flex; background: var(--line); border-radius: var(--r-sm); padding: 3px; margin: 10px 0; }
.seg button { flex: 1; border: 0 !important; background: none !important; padding: 8px 4px !important; border-radius: var(--r-sm) !important; font-size: 14px; }
.seg button.on { background: var(--card) !important; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.photo-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: var(--r-sm); margin-top: 6px; display: block; }
.results { list-style: none; padding: 0; margin: 12px 0 0; }
.results li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ok { color: var(--accent); font-weight: 600; }
.bad { color: var(--danger); font-weight: 600; }
.picklist { list-style: none; padding: 0; margin: 10px 0 0; }
.picklist button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important;
  background: none !important; padding: 8px 2px !important;
}
.picklist img, .picklist .dot { width: 44px; height: 44px; border-radius: var(--r-sm); object-fit: cover; flex: none; }
.picklist .dot { background: var(--accent-soft); display: flex; align-items: center; justify-content: center; color: var(--accent); font-weight: 700; }

/* week */
.weeknav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.weeknav > div { flex: 1; text-align: center; }
.weeknav small { display: block; color: var(--muted); font-size: 13px; }
.weeknav button { width: 44px; height: 44px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); font-size: 22px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
.day.today { border-color: var(--accent); }
.day h3 { margin: 0 0 6px; font-size: 15px; }
.day.today h3::after { content: " · Today"; color: var(--accent); }
.slot {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  border: 0; border-top: 1px solid var(--line); background: none; padding: 9px 0;
}
.slot:first-of-type { border-top: 0; }
.slabel { width: 78px; flex: none; font-size: 13px; color: var(--muted); }
.stitle { flex: 1; color: var(--muted); }
.slot.filled .stitle { color: var(--ink); font-weight: 600; }

/* groceries */
.summary {
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
}
.summary .big { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.summary small { display: block; opacity: 0.85; }
.summary a {
  display: inline-block; margin-top: 10px; background: var(--accent-ink); color: var(--accent);
  padding: 9px 14px; border-radius: var(--r-sm); text-decoration: none; font-weight: 600;
}
.gsec h3 { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.gitem {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; margin-bottom: 6px;
}
.gitem input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.gname { flex: 1; min-width: 0; }
.gname b { display: block; font-weight: 600; }
.gname small { display: block; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.gitem.got .gname b { text-decoration: line-through; color: var(--muted); }
.gprice { display: flex; align-items: center; gap: 2px; flex: none; }
.gprice input { width: 64px; padding: 6px 6px; text-align: right; }
.gprice .est { font-size: 11px; color: var(--warn); width: 22px; }
.chip {
  border: 1px solid var(--line); background: none; border-radius: var(--r-sm);
  padding: 5px 9px; font-size: 12px; color: var(--muted); flex: none;
}
.gitem.have { opacity: 0.6; }
.addrow { display: flex; gap: 6px; margin-top: 8px; }
.addrow input:first-child { flex: 1; }
.addrow input.p { width: 80px; flex: none; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 14px); z-index: 30;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.hidden { display: none; }
.loading { color: var(--muted); padding: 24px 0; text-align: center; }

/* tags, filters, sort */
.fbar { margin: 0 0 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.tagchip {
  flex: none; border: 1px solid var(--line) !important; background: var(--card) !important;
  border-radius: var(--r-sm) !important; padding: 6px 11px !important; font-size: 14px; color: var(--ink);
}
.tagchip span { color: var(--muted); font-size: 12px; margin-left: 2px; }
.tagchip.on { background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-ink); font-weight: 600; }
.tagchip.on span { color: var(--accent-ink); opacity: .8; }
.sortby { display: flex; align-items: center; gap: 8px; margin: 4px 0 0; font-size: 14px; }
.sortby select { width: auto; flex: none; margin: 0; padding: 6px 10px; font-size: 14px; }
.card small, .stitle small, .pinfo small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pinfo { display: block; min-width: 0; }
.pinfo b { display: block; font-weight: 600; }

/* fun header */
.brand { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand span {
  font-family: "Pacifico", "Snell Roundhand", "Brush Script MT", cursive;
  font-size: 27px; line-height: 1.25; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 2px 2px 0 var(--accent-soft);
  padding-right: 2px;
}
.brand .whisk { width: 24px; height: 24px; flex: none; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; transform: rotate(-18deg); }
.brand .heart { width: 15px; height: 15px; flex: none; fill: var(--accent); align-self: flex-start; margin-top: 4px; animation: beat 2.4s ease-in-out infinite; }
@keyframes beat { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.25); } 90% { transform: scale(.95); } }
@media (prefers-reduced-motion: reduce) { .brand .heart { animation: none; } }

/* protein chips and tags */
.tagchip.meat:not(.on) { background: var(--accent-soft) !important; border-color: transparent !important; }
.tagline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { font-size: 13px; padding: 3px 8px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.tag.meat { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

/* recipe page: favorite, stars, made-it, servings */
.title-row { display: flex; align-items: flex-start; gap: 10px; margin-right: 40px; }
.title-row h2 { flex: 1; margin-right: 0; }
.heart-btn {
  flex: none; width: 40px; height: 40px; border-radius: var(--r-sm) !important; padding: 0 !important;
  font-size: 22px; line-height: 1; color: var(--line); background: var(--card) !important;
  border: 1px solid var(--line) !important;
}
.heart-btn.on { color: var(--accent); background: var(--accent-soft) !important; border-color: transparent !important; }
.stars { display: flex; gap: 2px; margin: 2px 0 6px; }
.stars button { border: 0 !important; background: none !important; padding: 2px 3px !important; font-size: 24px; line-height: 1; color: var(--line); }
.stars button.on { color: #e7a521; }
.made { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.made-dot { color: #2e9d5b; font-weight: 700; }
.ing-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.ing-head h3 { margin: 0; }
.scaler { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.scaler button {
  width: 34px; height: 34px; padding: 0 !important; border-radius: var(--r-sm) !important;
  font-size: 20px; line-height: 1; border: 1px solid var(--line) !important; background: var(--card) !important;
}
.scaler button:disabled { opacity: .35; }
.scaler #sVal { min-width: 84px; text-align: center; font-weight: 600; }
.scaler.big { margin: 14px 0 4px; font-size: 16px; }
.scaler.big > span:first-child { flex: 1; color: var(--muted); }
.scaler.big #sVal { min-width: 40px; font-size: 20px; }
.stack-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.stack-btns button { width: 100%; text-align: left; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; margin-top: 12px; }
label.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }

/* recipe cards */
.card { position: relative; }
.card-heart {
  position: absolute; top: 8px; right: 8px; font-style: normal; font-size: 16px; line-height: 1;
  color: var(--accent); background: var(--card); border-radius: var(--r-sm); padding: 5px 6px;
}
.card-stars { color: #e7a521 !important; letter-spacing: 1px; }
.pinfo .fav { color: var(--accent); }

/* week: meals with sides and leftovers */
.week-actions { display: flex; gap: 8px; margin: -2px 0 12px; }
.week-actions button { flex: 1; border: 1px solid var(--line); background: var(--card); padding: 10px 8px; border-radius: var(--r-sm); font-weight: 600; }
.week-actions button:disabled { opacity: .45; }
.slot { display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--line); padding: 8px 0; }
.slot:first-of-type { border-top: 0; }
.slot .slabel { padding-top: 3px; }
.sitems { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.sitem { border: 0; background: none; padding: 2px 0; text-align: left; width: 100%; font-weight: 600; color: var(--ink); }
.sitem small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.sitem.empty { font-weight: 400; color: var(--muted); }
.sitem.side { font-weight: 500; font-size: 14.5px; color: var(--ink); padding-left: 10px; }
.sitem .lo { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); padding: 2px 5px; border-radius: var(--r-sm); vertical-align: 1px; }
.addside { border: 0; background: none; padding: 2px 0 0 10px; font-size: 13px; color: var(--accent); }

/* texting */
a.btn, a.wide.btn { display: block; text-decoration: none; }
.center { text-align: center; }
.sheet a.primary { display: block; padding: 11px 14px; border-radius: var(--r-sm); text-decoration: none; text-align: center; margin-top: 12px; }
.sheet button.wide { margin-top: 8px; }
#msgText { min-height: 200px; font-size: 15px; }
.sum-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sum-actions a { margin-top: 10px; }

/* reviews */
.rating-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 2px 0 6px; font-size: 14px; color: var(--muted); }
.rating-sum .avg { color: #c98a0e; font-weight: 700; font-size: 16px; }
.rating-sum .who { color: #c98a0e; }
.reviews { display: grid; gap: 10px; }
.review { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.review-head b { font-size: 16px; }
.review .stars { margin: 0; }
.review textarea { min-height: 0; margin-top: 8px; font-size: 15px; resize: vertical; }
.review .saved { display: block; min-height: 1em; font-size: 12px; color: #2e9d5b; margin-top: 2px; }

/* style tags */
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.tag.style { border-color: transparent; background: #f3eefc; color: #6a4bb0; }
@media (prefers-color-scheme: dark) { .tag.style { background: #2e2640; color: #c6b4f0; } }
.sortrow { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 4px; }
.sortrow .sortby { margin: 0; }
.sortby select.styleSel { max-width: 170px; }

/* ---------- drag & drop planner ---------- */
.modeseg { margin: 0 0 12px; }
.planner { display: block; }
.bhead, .brow { display: grid; grid-template-columns: 44px repeat(3, minmax(0, 1fr)); gap: 6px; }
.bhead { position: sticky; top: 58px; z-index: 4; background: var(--bg); padding: 4px 0; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.brow { margin-bottom: 6px; }
.bday { display: flex; flex-direction: column; justify-content: center; font-size: 13px; line-height: 1.15; }
.bday small { color: var(--muted); font-size: 11.5px; }
.brow.today .bday b { color: var(--accent); }
.cell {
  min-height: 60px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.brow.today .cell { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cell .clabel { display: none; }
.cell .cempty { margin: auto; color: var(--muted); font-size: 18px; opacity: .55; }
.cell.over { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent) inset; }
.bitem {
  font-size: 12.5px; line-height: 1.25; font-weight: 600; padding: 4px 5px; border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--ink); overflow-wrap: anywhere;
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.bitem.side { background: transparent; border: 1px dashed var(--line); font-weight: 500; }
.bitem.leftover { background: color-mix(in srgb, var(--accent-soft) 50%, var(--card)); }
.bitem .lo { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.bitem.dragging, .dchip.dragging { opacity: .35; }

.library { display: flex; flex-direction: column; background: var(--bg); }
.lib-head { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.lib-head .chips { padding-bottom: 2px; }
.lib-head .tagchip { padding: 4px 9px !important; font-size: 13px; }
.lib-list { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; }
.dchip {
  display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; background: var(--bg);
}
.dchip img, .dchip .dot { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; flex: none; pointer-events: none; }
.dchip .dot { display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.dinfo { flex: 1; min-width: 0; }
.dinfo b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dinfo small { display: block; font-size: 12px; color: var(--muted); }
.dinfo .fav { color: var(--accent); }
.grip { color: var(--muted); font-size: 18px; padding: 0 4px; }
.lib-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

.ghost {
  position: fixed; top: 0; left: 0; z-index: 60; pointer-events: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 14px;
  padding: 7px 11px; border-radius: var(--r-sm); box-shadow: 0 8px 22px rgba(0,0,0,.25);
  max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.trash {
  display: none; position: fixed; z-index: 55; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 10px); padding: 14px 26px; border-radius: var(--radius);
  background: var(--danger); color: #fff; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.2);
}
.trash.show { display: block; }
.trash.over { transform: translateX(-50%) scale(1.08); }

/* Phone: week on top, recipes in a drawer at the bottom */
@media (max-width: 859px) {
  body.board-mode .board { padding-bottom: calc(40vh + 12px); }
  body.board-mode .library {
    position: fixed; left: 0; right: 0; z-index: 9;
    bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
    height: 40vh; padding: 8px 12px 6px;
    border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(0,0,0,.08);
  }
}
/* Mac / wide screens: side by side */
@media (min-width: 860px) {
  body.board-mode main { max-width: 1200px; }
  body.board-mode .planner { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
  body.board-mode .library {
    position: sticky; top: 74px;
    max-height: calc(100vh - 74px - var(--tabbar) - 24px);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; background: var(--card);
  }
  body.board-mode .dchip { background: var(--card); }
  .bhead, .brow { grid-template-columns: 54px repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cell { min-height: 70px; padding: 6px; }
  .bitem { font-size: 13.5px; }
}

/* ---------- more than one thing per meal, extras, eat out / leftovers ---------- */
.lo.dess { color: #9a5b12; background: #fbecd6; }
@media (prefers-color-scheme: dark) { .lo.dess { color: #f0c27a; background: #3a2c18; } }
.sitem.free, .bitem.free { color: var(--muted); }
.sitem.kind-eatout, .sitem.kind-leftovers, .sitem.kind-note { font-weight: 600; }
.sitem.dessert, .sitem.side { font-weight: 500; font-size: 14.5px; padding-left: 10px; }

.quick-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-btns button {
  border: 1px solid var(--line) !important; background: var(--card) !important; border-radius: var(--r-sm) !important;
  padding: 8px 11px !important; font-size: 14px; font-weight: 600;
}
.quick-btns #randomOne { border-style: dashed !important; }

.extras-box { border-style: dashed; }
.extras-box .hint { margin: -2px 0 6px; }
.extras-box .sitems { gap: 6px; }
.extras-box .sitem.main { padding: 4px 0; }

/* drag & drop board */
.cell .cmore { display: none; margin-top: auto; align-self: flex-end; font-size: 15px; line-height: 1; color: var(--muted); opacity: .6; padding: 0 2px; }
.cell.filled:hover .cmore, .cell.filled.over .cmore { display: block; }
@media (pointer: coarse) { .cell.filled .cmore { display: block; opacity: .4; } }
.bitem.dessert { background: #fbecd6; font-weight: 500; }
@media (prefers-color-scheme: dark) { .bitem.dessert { background: #3a2c18; } }
.bitem.kind-eatout, .bitem.kind-leftovers { background: var(--card); border: 1px dashed var(--line); font-weight: 600; }
.bitem.kind-note { background: var(--card); border: 1px solid var(--line); }
.cell.extras {
  flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 58px;
  margin: 10px 0 0 50px; padding: 8px; border-style: dashed;
}
.cell.extras .xlabel { width: 100%; font-size: 13px; font-weight: 700; color: var(--ink); }
.cell.extras .xlabel small { font-weight: 400; color: var(--muted); }
.cell.extras .bitem { flex: 0 1 auto; }
.cell.extras .cmore { display: block; margin: 0 0 0 auto; align-self: center; }
@media (min-width: 860px) { .cell.extras { margin-left: 62px; } }

.quick-row { display: flex; gap: 6px; }
.qchip {
  flex: 1; text-align: center; font-size: 13px; font-weight: 600; padding: 7px 4px;
  border: 1px dashed var(--accent); color: var(--accent); background: var(--card); border-radius: var(--r-sm);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; white-space: nowrap;
}
.qchip.dragging { opacity: .35; }

/* ---------- accounts ---------- */
.top { align-items: center; }
.top-right { display: flex; align-items: center; gap: 10px; flex: none; }
.acct-btn {
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: 999px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
body.guest .acct-btn { background: var(--card); color: var(--accent); border: 1.5px solid var(--accent); }
@media (max-width: 480px) {
  .top h1 { display: none; }
  .brand span { font-size: 23px; }
}
body.auth-mode .tabs, body.auth-mode .top-right { display: none; }
body.auth-mode { padding-bottom: 24px; }

.auth-card {
  max-width: 420px; margin: 18px auto 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 18px 16px;
}
.auth-card h2 { margin: 0 0 6px; font-size: 22px; }
.auth-card .primary.wide { margin-top: 18px; padding: 12px; }
.auth-reason { margin: 0 0 12px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.auth-err { color: var(--danger); font-weight: 600; min-height: 1.2em; margin: 10px 0 0; }
.auth-alt { margin: 10px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.auth-note { text-align: center; margin-top: 14px; }

.guest-banner {
  background: var(--accent-soft); color: var(--ink); border-radius: var(--radius);
  padding: 9px 12px; margin: 0 0 12px; font-size: 14px;
}
.guest-banner .link { padding: 0; font-weight: 700; }

.acct-head { display: flex; align-items: center; gap: 12px; margin-right: 40px; }
.acct-head h2 { margin: 0; }
.acct-head .meta { margin: 2px 0 0; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; vertical-align: middle;
}
.avatar.big { width: 52px; height: 52px; font-size: 19px; background: var(--accent); color: var(--accent-ink); flex: none; }
.acct-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.acct-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 14px;
}
.acct-row small { color: var(--muted); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }
.code.big { font-size: 26px; font-weight: 700; color: var(--accent); text-align: center; margin: 4px 0; }
.invite-box { background: var(--card); border: 1.5px dashed var(--accent); border-radius: var(--radius); padding: 12px; margin-top: 10px; }
.invite-box textarea { min-height: 0; font-size: 14px; margin: 6px 0 8px; }
.invite-box .row-btns a.btn { display: inline-block; padding: 10px 14px; border-radius: var(--r-sm); text-decoration: none; }

/* reviews by account */
.review.mine { border-color: var(--accent); }
.review-head b small { font-weight: 400; color: var(--muted); }
.stars-ro { color: #e7a521; letter-spacing: 1px; font-size: 17px; }
.stars-ro i { font-style: normal; color: var(--line); }
.review-text { margin: 6px 0 2px; white-space: pre-wrap; font-size: 15px; }

/* PIN sign-in */
.cred-q { margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
#credSeg { margin: 0; }
.cred-row { display: flex; gap: 8px; margin-top: 8px; }
.cred-row input { flex: 1; }
.cred-row button { flex: none; min-width: 84px; }
#mCur { margin-top: 4px; }
.signin-now { margin: 0 0 6px; }
.acct-row .row-btns { gap: 6px; flex-wrap: nowrap; }

/* admin panel */
.admin-btn {
  height: 36px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--accent);
  background: var(--card); color: var(--accent); font-weight: 700; font-size: 13.5px; white-space: nowrap;
}
.admin-btn[hidden] { display: none; }
body.auth-mode .admin-btn { display: none; }
@media (max-width: 400px) { .admin-btn { padding: 0 9px; font-size: 0; } .admin-btn::before { content: "🛠"; font-size: 16px; } }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.stat b { display: block; font-size: 22px; color: var(--accent); }
.stat span { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.25; }
table.people { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.people th, table.people td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--line); }
table.people th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.people td:not(:first-child), table.people th:not(:first-child) { text-align: center; }
table.people tr:last-child td { border-bottom: 0; }
.acct-row .row-btns { flex-wrap: wrap; justify-content: flex-end; }
.dinfo small.by { color: var(--accent); font-weight: 600; }
#libPeople:empty { display: none; }
.tagchip.person { display: inline-flex; align-items: center; gap: 5px; }
.tagchip.person .avatar { width: 20px; height: 20px; font-size: 10px; }
.tagchip.person.on .avatar { background: var(--accent-ink); color: var(--accent); }

/* households */
.acct-btn { position: relative; }
.acct-btn.has-dot::after {
  content: ""; position: absolute; top: -1px; right: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #e7a521; border: 2px solid var(--bg);
}
.hh-invite b { display: block; margin-bottom: 2px; }
.hh-card .acct-list { margin-top: 8px; }
.acct-row.pending { border-style: dashed; color: var(--muted); }
#hhLeave { display: block; margin: 10px 0 0; color: var(--danger); }
.weeknav small { line-height: 1.35; }
.today-link { display: block; margin: 2px auto 0; padding: 0; font-size: 13px; }

/* admin: warnings, backups, activity */
.stat.warn { border-color: #e7a521; background: color-mix(in srgb, #e7a521 10%, var(--card)); }
.stat.warn b { color: #b07800; }
.stat a { color: inherit; }
.warn-box { background: color-mix(in srgb, #e7a521 14%, var(--card)); border: 1px solid #e7a521; border-radius: var(--radius);
  padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }
.hint code { font-size: 12px; overflow-wrap: anywhere; }
a.chip { text-decoration: none; display: inline-block; }
#actSeg { margin: 4px 0 8px; }
.act-list { display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.act-row { display: flex; justify-content: space-between; gap: 10px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 7px 10px; font-size: 14px; }
.act-row .who { color: var(--muted); }
.act-row small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.act-row .when { text-align: right; flex: none; font-size: 12.5px; color: var(--muted); }
.act-row.problem { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--card)); }
.act-row.problem b { color: var(--danger); }

/* profile pictures */
.avatar.has-img { overflow: hidden; background: var(--line); padding: 0; }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; margin-right: 4px; }
/* Photo in the header: a fixed 36px circle that never stretches (the dot for invites stays visible). */
.acct-btn.has-img { width: 36px; min-width: 36px; height: 36px; flex: none; padding: 0; background: var(--line); }
.acct-btn.has-img img { width: 36px; height: 36px; object-fit: cover; display: block; border-radius: 50%; }
.avatar-edit { position: relative; padding: 0; border: 0; background: none; border-radius: 999px; flex: none; }
.avatar-edit .cam { position: absolute; right: -4px; bottom: -4px; font-size: 13px; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; }
.pic-links { margin: 4px 0 0; font-size: 13.5px; }
.pic-links .link { padding: 0; font-size: 13.5px; }
.rv-who { display: inline-flex; align-items: center; gap: 2px; }
.by-who { display: inline-flex; align-items: center; gap: 2px; }

/* Pi health + notifications */
.stat.bad { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--card)); }
.stat.bad b { color: var(--danger); }
h3 .link { font-size: 13px; font-weight: 600; padding: 0 0 0 8px; }
.nt-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.nt-card > b { display: block; margin-bottom: 2px; }
.nt-card .hint { margin: 2px 0 8px; }
.nt-card details { margin-top: 6px; }
.nt-card .check { margin: 4px 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nt-card .check select { width: auto; padding: 4px 6px; }
.nt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nt-grid label { font-size: 12.5px; color: var(--muted); }
@media (max-width: 420px) { .nt-grid { grid-template-columns: 1fr; } }
.nt-preview { white-space: pre-wrap; font-size: 12.5px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; max-height: 320px; overflow: auto; }
.nt-preview.hidden { display: none; }

/* offline at the store */
.offline-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40;
  background: #3a2a33; color: #fff; border-radius: var(--radius); padding: 9px 12px; font-size: 13.5px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18); text-align: center;
}
.sheet .avatar-edit, .avatar-edit { border: 0 !important; background: none !important; box-shadow: none !important;
  padding: 0 !important; min-width: 0; height: auto; }
