/* static/css/app.css — canteen ordering UI */

/* Warm "cookie" palette: cream paper, caramel accents, cocoa text. */
:root {
  --bg: #faf3e6;
  --card: #fffbf3;
  --text: #2d2117;
  --muted: #8a7560;
  --border: #ecdcc3;
  --primary: #b9651a;
  --primary-600: #9c5314;
  --primary-soft: #f9e7cf;
  --on-primary: #ffffff;
  --danger: #c2473a;
  --danger-600: #a53a2f;
  --danger-soft: #fbe3de;
  --success: #3f8a4a;
  --success-soft: #e3f1e1;
  --warning: #d9951c;
  --warning-soft: #fff0cc;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(80, 50, 20, 0.08);
  --tap: 44px;
}
:root.dark, :root.auto[data-system-dark="true"] {
  --bg: #1f1711;
  --card: #2b2118;
  --text: #f4e9d8;
  --muted: #b9a58b;
  --border: #3f3226;
  --primary: #e9a650;
  --primary-600: #d8933a;
  --primary-soft: #3e2e1b;
  --on-primary: #241708;
  --danger: #ef6b5c;
  --danger-600: #d85a4b;
  --danger-soft: #45231f;
  --success: #6cc26f;
  --success-soft: #1f3a22;
  --warning: #f0b445;
  --warning-soft: #4a3510;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

/* ---- alternative palettes (chosen in Settings, stored per device) ---- */
/* Honey: sunny yellow */
:root[data-palette="honey"] {
  --bg: #fffae8; --card: #fffdf5; --text: #2f2a1a; --muted: #857a5a; --border: #f0e4b8;
  --primary: #d99a00; --primary-600: #b98300; --primary-soft: #fff1c2; --on-primary: #2a1f00;
  --warning: #e07b00; --warning-soft: #ffe9cc;
}
:root[data-palette="honey"].dark, :root[data-palette="honey"].auto[data-system-dark="true"] {
  --bg: #1d1a10; --card: #2a2616; --text: #f7f0d8; --muted: #bdb38c; --border: #433d22;
  --primary: #f5c43c; --primary-600: #e6b428; --primary-soft: #3d3514; --on-primary: #221b00;
  --warning: #f7a541; --warning-soft: #4a3210;
}
/* Olive: sage green, Greek kitchen */
:root[data-palette="olive"] {
  --bg: #f4f5ec; --card: #fdfdf8; --text: #22281a; --muted: #6f7a60; --border: #dde2cb;
  --primary: #5f7f2e; --primary-600: #4e6a24; --primary-soft: #e6eed4; --on-primary: #ffffff;
  --warning: #c98a1a; --warning-soft: #fbefd2;
}
:root[data-palette="olive"].dark, :root[data-palette="olive"].auto[data-system-dark="true"] {
  --bg: #171b12; --card: #22281a; --text: #eaf0dd; --muted: #a9b395; --border: #343d29;
  --primary: #a3c95a; --primary-600: #92b84c; --primary-soft: #2e3b1c; --on-primary: #14200a;
  --warning: #e3ad3e; --warning-soft: #43330f;
}
/* Terracotta: clay and tomato */
:root[data-palette="terracotta"] {
  --bg: #faf1ec; --card: #fffaf7; --text: #2f1f19; --muted: #8c7268; --border: #ecd8cf;
  --primary: #c4553a; --primary-600: #a84630; --primary-soft: #f8e1d9; --on-primary: #ffffff;
  --warning: #d98a2b; --warning-soft: #fdeed7;
}
:root[data-palette="terracotta"].dark, :root[data-palette="terracotta"].auto[data-system-dark="true"] {
  --bg: #1f1512; --card: #2b1e1a; --text: #f6e9e3; --muted: #bfa297; --border: #432f29;
  --primary: #ef8a6e; --primary-600: #e27a5e; --primary-soft: #44271f; --on-primary: #2a110a;
  --warning: #f0a94a; --warning-soft: #4a3312;
}
/* Coffee: deep espresso brown */
:root[data-palette="coffee"] {
  --bg: #f4ede6; --card: #fdf9f5; --text: #2a1f18; --muted: #86746a; --border: #e3d5c8;
  --primary: #6f4e37; --primary-600: #5b3f2c; --primary-soft: #ebdfd4; --on-primary: #ffffff;
  --warning: #c98a1a; --warning-soft: #f8ead0;
}
:root[data-palette="coffee"].dark, :root[data-palette="coffee"].auto[data-system-dark="true"] {
  --bg: #19120e; --card: #261b15; --text: #f1e6dc; --muted: #b49e8f; --border: #3c2c24;
  --primary: #c89b7a; --primary-600: #b88a69; --primary-soft: #3b2a20; --on-primary: #1d110a;
  --warning: #e9ae4a; --warning-soft: #46320f;
}
/* Blue: the original neutral look */
:root[data-palette="blue"] {
  --bg: #f7f9fc; --card: #ffffff; --text: #0f172a; --muted: #6b7280; --border: #e5e7eb;
  --primary: #0d6efd; --primary-600: #0b5ed7; --primary-soft: #e7f0ff; --on-primary: #ffffff;
  --warning: #f59e0b; --warning-soft: #fff4dc; --shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
:root[data-palette="blue"].dark, :root[data-palette="blue"].auto[data-system-dark="true"] {
  --bg: #0b1220; --card: #0f172a; --text: #e5e7eb; --muted: #9aa3af; --border: #1f2937;
  --primary: #3b82f6; --primary-600: #2563eb; --primary-soft: #16233d; --on-primary: #ffffff;
  --warning: #f59e0b; --warning-soft: #3a2a0c;
}

.palette-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.palette-swatch {
  display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .8rem .45rem .5rem; border-radius: 999px;
  border: 2px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font: inherit; min-height: 44px;
}
.palette-swatch.sel { border-color: var(--primary); }
.palette-swatch i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(0,0,0,.08); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.4;
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.4rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
.inline { display: inline; }
.grow { flex: 1; min-width: 0; }
.link { font-size: .9rem; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: .5rem 1rem;
  display: flex; align-items: center; gap: 1rem;
}
.brand { font-size: 1.35rem; line-height: 1; color: var(--text); white-space: nowrap; text-decoration: none; }
.topnav { display: none; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topnav a { padding: .4rem .7rem; border-radius: 8px; color: var(--text); font-size: .95rem; }
.topnav a.active, .topnav a:hover { background: var(--primary-soft); color: var(--primary); }
.navmenu { position: relative; }
.navmenu summary {
  list-style: none; cursor: pointer; padding: .4rem .7rem; border-radius: 8px; font-size: .95rem; color: var(--text);
  display: flex; align-items: center; gap: .25rem; user-select: none;
}
.navmenu summary::-webkit-details-marker { display: none; }
.navmenu summary .caret { font-size: .75rem; color: var(--muted); }
.navmenu summary:hover, .navmenu[open] summary, .navmenu:has(a.active) summary { background: var(--primary-soft); color: var(--primary); }
.navmenu-list {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 220px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: .3rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); display: flex; flex-direction: column;
}
.navmenu-list a { display: block; padding: .5rem .7rem; }
.badge-type { background: var(--border); color: var(--muted); font-weight: 500; font-size: .7rem; vertical-align: middle; }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.topbar .who { font-size: .9rem; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: .3rem .5rem; cursor: pointer; font-size: .9rem; min-height: 34px;
}
.page { max-width: 1200px; margin: 0 auto; padding: 1rem 1rem calc(80px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .45rem 0 .4rem; font-size: .7rem; color: var(--muted); position: relative; min-height: 54px;
}
.tabbar a .ico { font-size: 1.25rem; line-height: 1; }
.tabbar a.active { color: var(--primary); }
.tabbar .badge-count { position: absolute; top: 4px; right: calc(50% - 22px); }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .page { padding-bottom: 2rem; }
  h1 { font-size: 1.6rem; }
}

/* ---------- components ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: var(--shadow); margin-bottom: .75rem;
}
.section { margin-bottom: 1.1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 10px; padding: .5rem .9rem; font-size: .95rem; cursor: pointer; min-height: 40px;
  text-decoration: none; white-space: nowrap; transition: background .12s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-600); }
.btn-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
:root.dark .btn-success, :root.auto[data-system-dark="true"] .btn-success { color: #0f2412; }
.btn-ghost { background: transparent; }
.btn-sm { padding: .3rem .6rem; min-height: 32px; font-size: .85rem; }
.btn-lg { min-height: var(--tap); font-size: 1.05rem; padding: .6rem 1.1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.badge {
  display: inline-block; font-size: .75rem; padding: .15rem .5rem; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.badge-soft { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.badge-warn { background: var(--warning-soft); color: #8a5a07; }
:root.dark .badge-warn, :root.auto[data-system-dark="true"] .badge-warn { color: #f6c86a; }
.badge-off { background: var(--danger-soft); color: var(--danger); }
.badge-count { background: var(--danger); color: #fff; font-weight: 700; min-width: 20px; text-align: center; padding: .05rem .4rem; }
.chips, .date-chips { display: flex; gap: .5rem; margin: .25rem 0 1rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding: 2px; }
.chips::-webkit-scrollbar, .date-chips::-webkit-scrollbar { display: none; }
.page { overflow-x: clip; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); white-space: nowrap; min-height: 40px; font-size: .95rem;
}
.chip-active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.date-weeks { display: flex; flex-direction: column; gap: .35rem; margin: .25rem 0 1rem; }
.date-week-head { font-size: .85rem; color: var(--muted); margin: .25rem 0 0; }
.date-week.is-selected .date-week-head { color: var(--primary); }
.date-week .date-chips.week-chips { margin: .3rem 0 .25rem; overflow: visible; flex-wrap: nowrap; gap: .35rem; padding: 0; }
.date-chip { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: .4rem .3rem; line-height: 1.15; border-radius: 12px; text-align: center; }
.date-chip .dow { font-weight: 600; font-size: .9rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.date-chip .dow .long { display: none; }
.date-chip .dom { font-size: .8rem; opacity: .8; display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.date-chip .cnt { font-size: .72rem; padding: 0 .4rem; }
@media (min-width: 600px) { .date-chip { flex: 0 1 auto; padding: .4rem .85rem; } .date-chip .dow .long { display: inline; } .date-chip .dow .short { display: none; } }
@media (min-width: 900px) { .date-weeks { flex-direction: row; gap: 1.25rem; flex-wrap: wrap; } .date-week { flex: 1 1 320px; } }
.chip .cnt { background: rgba(0,0,0,.08); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; }
.chip-active .cnt { background: rgba(255,255,255,.25); }
.hscroll { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.hscroll::-webkit-scrollbar { display: none; }
.banner { padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: .75rem; }
.banner-warn { background: var(--warning-soft); border: 1px solid var(--warning); }
.messages { margin-bottom: .75rem; }
.msg { padding: .6rem .9rem; border-radius: 10px; margin-bottom: .4rem; font-size: .95rem; }
.msg-success { background: var(--success-soft); color: var(--success); }
.msg-error { background: var(--danger-soft); color: var(--danger); }
.msg-info, .msg-warning { background: var(--primary-soft); color: var(--primary); }
.empty { color: var(--muted); padding: 1.2rem; text-align: center; }
.list { display: flex; flex-direction: column; gap: .4rem; }
.list-row {
  display: flex; align-items: center; gap: .6rem; padding: .65rem .85rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
}
.list-row.is-off { opacity: .55; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.kv:last-of-type { border-bottom: 0; }
.amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.amt.owes { color: var(--danger); }
.amt.credit, .balance.credit { color: var(--success); }
.balance-card { text-align: center; }
.balance { font-size: 2rem; font-weight: 700; margin: .2rem 0; }
.balance.owes { color: var(--danger); }
.status-pill { font-size: .75rem; padding: .2rem .55rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); white-space: nowrap; }
.status-pending .status-pill { background: var(--warning-soft); color: #8a5a07; border-color: transparent; }
:root.dark .status-pending .status-pill, :root.auto[data-system-dark="true"] .status-pending .status-pill { color: #f6c86a; }
.status-ready .status-pill { background: var(--success-soft); color: var(--success); border-color: transparent; }
.status-done .status-pill { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.status-rejected .status-pill, .status-cancelled .status-pill { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.details summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .5rem; }
.details summary h2 { margin: 0; }
.details summary::before { content: "▸"; color: var(--muted); }
.details[open] summary::before { content: "▾"; }
.details.advanced { margin-top: 1.25rem; padding-top: .75rem; border-top: 1px dashed var(--border); }
.details.advanced h3 { margin: 1rem 0 .4rem; font-size: .95rem; color: var(--muted); }
.details.advanced summary .small { margin-left: .25rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: .7rem 1.1rem; border-radius: 999px; z-index: 50;
  box-shadow: var(--shadow); max-width: 92vw; text-align: center;
}
.toast.error { background: var(--danger); color: #fff; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; font-size: .9rem; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--bg); font-weight: 600; }
.table .num { text-align: right; }
.table tr.status-rejected td, .table tr.status-cancelled td { opacity: .6; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }

/* ---------- forms ---------- */
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search],
input[type=date], input[type=time], input:not([type]), select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--card); color: var(--text); font: inherit; min-height: 42px;
}
textarea { min-height: 70px; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .7rem; }
.field > span { font-size: .85rem; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; min-height: 32px; }
.check input { width: 20px; height: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
.form-grid .span2 { grid-column: 1 / -1; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.form-row input, .form-row select { width: auto; flex: 1; min-width: 100px; }
.form-row .w-num { flex: 0 0 70px; min-width: 70px; }
.form-row .w-icon { flex: 0 0 56px; min-width: 56px; text-align: center; }
.form-row .w-amt { flex: 0 0 110px; min-width: 110px; }
.form-row label.small { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .9rem .3rem; margin: .5rem 0 1rem; }
.fieldset legend { padding: 0 .4rem; color: var(--muted); font-size: .85rem; }
.radio-cards { display: grid; gap: .5rem; margin-bottom: .75rem; }
@media (min-width: 700px) { .radio-cards { grid-template-columns: repeat(3, 1fr); } }
.radio-card { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { margin-top: .2rem; }
.radio-card span { display: flex; flex-direction: column; }
.radio-card small { color: var(--muted); }
.auth-card { max-width: 420px; margin: 2rem auto; }
.auth-links { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; font-size: .9rem; }
.filter-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filter-form input, .filter-form select { width: auto; flex: 1; min-width: 120px; }
.filter-form label.small { display: inline-flex; align-items: center; gap: .3rem; }
.search-form { display: flex; gap: .4rem; }
.search-form input { width: auto; }
.weekday-checks { display: flex; gap: .8rem; flex-wrap: wrap; }
.two-col { display: grid; gap: 1rem; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* ---------- home / ordering ---------- */
.home-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.home-main { min-width: 0; }
.cart-aside { display: none; }
@media (min-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .cart-aside { display: block; position: sticky; top: 70px; }
  .cart-bar { display: none !important; }
}
.order-chip {
  display: flex; flex-direction: column; gap: 2px; min-width: 170px; max-width: 240px;
  padding: .55rem .75rem; border-radius: 10px; background: var(--card); border: 1px solid var(--border); color: var(--text);
}
.order-chip .when { font-weight: 700; }
.order-chip .what { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-chip .st { font-size: .75rem; }
.order-chip.status-ready { border-color: var(--success); }
.order-chip.status-ready .st { color: var(--success); }
.fav-row { padding: 2px; }
.fav-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 150px; max-width: 220px;
  padding: .6rem .8rem; border-radius: 12px; background: var(--card); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; text-align: left; font: inherit; position: relative; min-height: var(--tap);
}
.fav-card:active { transform: scale(.98); }
.fav-card.is-off { opacity: .5; }
.fav-name { font-weight: 600; padding-right: 28px; }
.fav-meta { font-size: .78rem; color: var(--muted); }
.fav-add { position: absolute; right: .5rem; top: .5rem; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.cat-title { margin: .6rem 0 .4rem; }
.items { display: flex; flex-direction: column; gap: .4rem; }
.item-row {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .5rem .55rem .85rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
}
.item-row.is-off { opacity: .6; }
.item-row-quick { align-items: stretch; }
.item-main-quick { cursor: default; }
.item-head { display: flex; justify-content: space-between; gap: .6rem; align-items: baseline; }
.quick-q { font-size: .85rem; color: var(--muted); margin: .35rem 0 .3rem; }
.quick-choices { display: flex; flex-wrap: wrap; gap: .45rem; }
.quick-choice { font: inherit; color: var(--text); min-height: 44px; padding: .5rem 1rem; font-weight: 600; }
.quick-choice:active, .quick-choice.sel { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.quick-none { font-weight: 400; color: var(--muted); }
.quick-group + .quick-group .quick-q { margin-top: .55rem; }
.quick-add { margin-top: .6rem; width: 100%; }
.quick-add:disabled { opacity: .55; }
.choice-card { border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; margin: .5rem 0; background: var(--card); }
.choice-card-new { border-style: dashed; }
.choice-card-head { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: flex-end; }
.choice-card-head .grow { flex: 1; min-width: 200px; }
.choice-card textarea { width: 100%; }
.item-main { flex: 1; min-width: 0; cursor: pointer; }
.item-row.is-off .item-main { cursor: default; }
.item-name { font-weight: 600; }
.item-desc { font-size: .85rem; color: var(--muted); }
.item-allergens { font-size: .85rem; color: var(--danger); margin-top: .15rem; }
.opt-info { display: grid; gap: .2rem; margin: -.25rem 0 .6rem; }
.item-meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .25rem; }
.item-side { display: flex; align-items: center; gap: .6rem; }
.item-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn-add { width: var(--tap); height: var(--tap); border-radius: 50%; background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-size: 1.4rem; padding: 0; }
.upcoming-day { display: flex; gap: .8rem; padding: .35rem 0; border-bottom: 1px dashed var(--border); }
.upcoming-date { min-width: 110px; font-weight: 600; }
.upcoming-items { display: flex; flex-wrap: wrap; gap: .3rem .8rem; }
.cart-bar {
  position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 19; padding: .5rem 1rem;
}
.cart-bar .btn { box-shadow: 0 6px 20px rgba(185,101,26,.35); }

/* bottom sheets (dialog) */
dialog.sheet {
  border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; height: 100dvh; margin: 0;
  position: fixed; inset: 0;
}
dialog.sheet:not([open]) { display: none; }
dialog.sheet::backdrop { background: rgba(0,0,0,.45); }
dialog.sheet .sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-radius: 18px 18px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 30px rgba(0,0,0,.25);
}
@media (min-width: 700px) {
  dialog.sheet .sheet-body { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 520px; border-radius: 18px; max-height: 88vh; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.sheet-head strong { font-size: 1.1rem; }
.opt-group { margin-bottom: .9rem; }
.opt-group-title { font-weight: 600; margin-bottom: .35rem; display: flex; gap: .5rem; align-items: baseline; }
.opt-choices { display: flex; flex-wrap: wrap; gap: .4rem; }
.opt-choice {
  display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .8rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--card); cursor: pointer; min-height: 40px; user-select: none;
}
.opt-choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.opt-choice.sel { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.qty-stepper button { width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); font-size: 1.2rem; cursor: pointer; }
.qty-stepper span { min-width: 32px; text-align: center; font-weight: 600; }
.sheet-foot { display: flex; gap: .6rem; align-items: center; margin-top: .8rem; }
.sheet-foot .btn-primary { flex: 1; }
.cart-lines { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .8rem; }
.cart-line { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 10px; }
.cart-line .nm { flex: 1; min-width: 0; }
.cart-line .nm small { display: block; color: var(--muted); }
.cart-line .rm { background: transparent; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: .3rem; }
.cart-line.is-off { border-color: var(--danger); }
.cart-section { margin-bottom: .8rem; }
.cart-section-title { font-weight: 600; margin-bottom: .35rem; font-size: .95rem; }
.cart-summary { display: flex; justify-content: space-between; font-size: 1.05rem; margin: .6rem 0; }
.cart-groups { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.cart-aside .sheet-body-static { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.cart-empty { color: var(--muted); text-align: center; padding: 1rem; }
.fav-save { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; }
.fav-save input { flex: 1; }

/* ---------- order cards (user + cook) ---------- */
.order-card { padding: .8rem .9rem; }
.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.order-lines { list-style: none; margin: .5rem 0; padding: 0; }
.order-lines li { display: flex; gap: .5rem; align-items: baseline; padding: .25rem 0; border-bottom: 1px dashed var(--border); }
.order-lines li:last-child { border-bottom: 0; }
.order-lines .qty { font-weight: 700; min-width: 2em; }
.order-lines .nm { flex: 1; min-width: 0; }
.order-lines .nm small { color: var(--muted); }
.order-lines.big li { font-size: 1.05rem; padding: .4rem 0; }
.order-lines.big .nm small { display: block; font-size: .85rem; }
.order-lines.big .note { color: var(--warning); }
.line-rejected { text-decoration: line-through; opacity: .55; }
.line-rejected small { text-decoration: none; }
.order-foot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .3rem; }
.order-foot .actions { margin-left: auto; display: flex; gap: .4rem; align-items: center; }
.order-note { background: var(--warning-soft); border-radius: 8px; padding: .4rem .6rem; margin: .3rem 0; }

/* ---------- cook board ---------- */
.board-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.day-nav { display: flex; align-items: center; gap: .4rem; }
.day-title { font-size: 1.1rem; }
.board-tools { display: flex; gap: .4rem; }
.board-grid { display: grid; gap: .7rem; }
@media (min-width: 700px) { .board-grid { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }
.board-card { margin: 0; border-left: 5px solid var(--warning); }
.board-card.status-ready { border-left-color: var(--success); }
.board-card.status-done { border-left-color: var(--primary); opacity: .75; }
.board-card.status-rejected, .board-card.status-cancelled { border-left-color: var(--danger); opacity: .6; }
.board-card .when .time { font-size: 1.3rem; font-weight: 800; }
.board-card .when .asap { color: var(--warning); font-size: 1rem; }
.board-card .who { flex: 1; min-width: 0; }
.board-card .who strong { font-size: 1.05rem; }
.board-actions { display: flex; gap: .4rem; margin-top: .5rem; flex-wrap: wrap; }
.board-actions .btn { flex: 1; }
.board-actions .spacer { flex: 1 1 100%; height: 0; }
.board-actions .btn-sm { flex: 0 0 auto; opacity: .75; }
.board-card.is-new { animation: pop .6s ease; }
@keyframes pop { 0% { box-shadow: 0 0 0 0 rgba(245,158,11,.7); } 100% { box-shadow: 0 0 0 14px rgba(245,158,11,0); } }
.reasons { display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0; }
.reject-lines { display: flex; flex-direction: column; gap: .3rem; margin: .5rem 0; }
.reject-lines label { display: flex; gap: .5rem; align-items: center; padding: .3rem .4rem; border: 1px solid var(--border); border-radius: 8px; }
.field-row { display: flex; gap: .4rem; }
.field-row input { flex: 1; }
.prep-card { padding: .7rem .9rem; }
.prep-head { display: flex; align-items: center; gap: .6rem; }
.prep-qty { font-size: 1.5rem; font-weight: 800; min-width: 2.2em; }
.prep-variants, .prep-notes { margin: .4rem 0 0; padding-left: 1.2rem; }
.prep-variants .qty { font-weight: 700; }
.week-grid { display: grid; gap: .6rem; }
@media (min-width: 900px) { .week-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }
.day-card { margin: 0; }
.day-card.is-off { opacity: .55; }
.day-card.is-today { border-color: var(--primary); }
.entry-row { flex-wrap: wrap; width: 100%; gap: .3rem; }
.entry-row .grow { flex: 1 1 100%; min-width: 0; }
.entry-row .w-num { width: 4.2rem; flex: 0 0 auto; }
.entry-row .w-note { flex: 1 1 5rem; min-width: 4rem; }
.section-title { margin: 1.2rem 0 .5rem; font-size: 1.05rem; }
/* schedule matrix (dishes × days) */
.matrix-tools { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 .25rem; }
.search-input { flex: 1; max-width: 420px; font-size: 1rem; }
.matrix-wrap { margin-bottom: 1rem; }
.matrix { width: 100%; border-collapse: separate; border-spacing: 0; }
.matrix th, .matrix td { padding: .35rem .4rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.matrix th { font-size: .85rem; text-align: center; white-space: nowrap; }
.matrix th.is-today div { color: var(--primary); }
.matrix .dish-col { text-align: left; min-width: 180px; max-width: 320px; position: sticky; left: 0; background: var(--card); z-index: 1; }
.matrix .dish-name { font-weight: 600; color: var(--text); text-decoration: none; }
.matrix .dish-name:hover { text-decoration: underline; }
.matrix .cell { text-align: center; }
.matrix .is-off { opacity: .45; }
.matrix .week-start { border-left: 2px solid var(--border); }
.matrix .week-head { font-size: .78rem; color: var(--muted); border-left: 2px solid var(--border); border-bottom: none; padding-bottom: 0; }
.matrix .week-head.is-current { color: var(--primary); }
.week-title { font-size: .95rem; color: var(--muted); margin: 1rem 0 .4rem; }
.weekday-checks + .weekday-checks { margin-top: .4rem; }
.weekday-checks .week-tag { min-width: 120px; }
.allergen-inline { color: var(--danger); }
.cell-btn {
  width: 2.6rem; height: 2.6rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-size: 1.1rem; cursor: pointer; transition: transform .1s, background .15s;
}
.cell-btn:hover { border-color: var(--primary); color: var(--primary); }
.cell-btn.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.cell-btn.weekly, .dish-chip.chip-weekly { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--primary); }
.entry-row .is-weekly { color: var(--primary); font-weight: 700; }
.cutoff-modes { display: flex; flex-direction: column; gap: .35rem; margin: .25rem 0 .75rem; }
.chk-inline { display: inline-flex; align-items: center; gap: .2rem; font-size: .9rem; cursor: pointer; }
.cell-btn.flash { transform: scale(1.15); }
.cell-btn:disabled { opacity: .6; cursor: wait; }
.quick-dish { margin-bottom: 1rem; border: 1px solid var(--primary); }
.view-switch { display: flex; align-items: center; gap: .4rem; margin: .5rem 0 .75rem; flex-wrap: wrap; }
.view-switch .chip { cursor: pointer; }
.chip-days { display: grid; gap: .6rem; }
@media (min-width: 900px) { .chip-days { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.chip-day { margin: 0; }
.chip-day.is-today { border-color: var(--primary); }
.dish-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.dish-chip { cursor: pointer; font-size: .95rem; padding: .45rem .8rem; }
.dish-chip .mark { font-weight: 700; }
.dish-chip small { opacity: .75; }
.dish-chip.flash { transform: scale(1.08); }
.dish-chip:disabled { opacity: .6; }
@media (max-width: 700px) { .matrix .dish-col { min-width: 140px; } .cell-btn { width: 2.3rem; height: 2.3rem; } }
.day-card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .3rem; }
.day-items { list-style: none; padding: 0; margin: 0 0 .5rem; }
.day-items li { display: flex; justify-content: space-between; align-items: center; gap: .4rem; padding: .25rem 0; border-bottom: 1px dashed var(--border); }
.add-row select { flex: 1; }
.option-group { padding: .7rem .8rem; }
.options-list { margin-top: .5rem; padding-left: .5rem; border-left: 3px solid var(--border); }
.pause-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pause-card.is-paused { border-color: var(--warning); background: var(--warning-soft); }
.ledger-row { align-items: center; }
.ledger-row > div:first-child { flex: 1; min-width: 0; }

/* choice sets: checkbox rows in the dish form / quick-dish form, chips on schedule rows */
.choice-set-checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin: .3rem 0; }
.choice-sets-field { border: 0; padding: 0; margin: 0 0 .9rem; }
.set-usage { margin: .25rem 0 .1rem; }
.entry-sets { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: .2rem .7rem; font-size: .85rem; }
.entry-sets.is-override { color: var(--primary); }
