/* ---------- tokens ---------- */
:root {
  --paper: #f6f0e4;
  --card: #fffbf4;
  --ink: #23201a;
  --muted: #736b5e;
  --line: #e4d9c6;
  --line-strong: #cdbfa6;
  --accent: #c8502a;
  --accent-soft: #f6dfd2;
  --herb: #4d6b3e;
  --herb-soft: #e3ead6;
  --warn: #a8432a;
  --shadow: 0 1px 0 rgba(60, 40, 10, .04), 0 8px 24px -12px rgba(60, 40, 10, .18);
  --radius: 14px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #191712;
    --card: #221f19;
    --ink: #f1eadc;
    --muted: #a69d8c;
    --line: #37322a;
    --line-strong: #4b443a;
    --accent: #e27a52;
    --accent-soft: #3a2519;
    --herb: #a3c48b;
    --herb-soft: #26301e;
    --warn: #f08a6c;
    --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -14px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; }
a { color: inherit; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.page { max-width: 1120px; margin: 0 auto; padding: 0 20px 80px; }

.eyebrow {
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- buttons ---------- */
.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border-radius: 999px; padding: .62em 1.2em;
  font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn:hover { background: var(--accent); border-color: var(--accent); }
.btn:active, .btn-ghost:active { transform: scale(.97); }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-wide { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: .9rem;
}
.link-btn:hover { color: var(--ink); }
.link-btn.danger:hover { color: var(--warn); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.logo { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 4px; white-space: nowrap; }
.nav a {
  text-decoration: none; padding: 6px 12px; border-radius: 999px; color: var(--muted); font-weight: 500;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.me form { margin: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--herb-soft); color: var(--herb); font-weight: 650; font-size: .8rem;
}
.me-name { font-weight: 500; }

/* ---------- hero ---------- */
.hero { padding: 48px 0 28px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; margin: 8px 0 14px; font-weight: 450; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.status {
  display: inline-flex; align-items: flex-start; gap: 10px;
  padding: 7px 14px 7px 12px; border-radius: 18px; font-size: .92rem; font-weight: 500; line-height: 1.4;
}
.status .dot { flex: none; width: 8px; height: 8px; margin-top: .48em; border-radius: 50%; background: currentColor; }
.status-open { background: var(--herb-soft); color: var(--herb); }
.status-open .dot { animation: pulse 2s ease-in-out infinite; }
.status-open.is-urgent { background: var(--accent-soft); color: var(--accent); }
.status-locked { background: var(--accent-soft); color: var(--accent); }
[data-deadline] { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- day tabs ---------- */
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 24px; scrollbar-width: none; }
.day {
  flex: none; text-decoration: none; display: flex; flex-direction: column;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  transition: border-color .15s ease;
}
.day:hover { border-color: var(--line-strong); }
.day-name { font-weight: 600; font-size: .9rem; }
.day-date { color: var(--muted); font-size: .82rem; }
.day.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.day.is-active .day-date { color: color-mix(in srgb, var(--paper) 70%, transparent); }

/* ---------- menu ---------- */
.menu-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }

.course { border: 0; padding: 0; margin: 0 0 36px; min-width: 0; }
.course legend {
  display: flex; align-items: baseline; gap: 12px; padding: 0; margin-bottom: 14px;
  font-family: var(--serif); font-size: 1.55rem; font-weight: 500;
}
.course-no { font-family: var(--sans); font-size: .8rem; color: var(--accent); font-weight: 650; letter-spacing: .08em; }

.dishes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.dish {
  position: relative; display: flex; flex-direction: column; min-height: 100%;
  border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease, background-color .15s ease;
}
.dish:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.dish-body {
  display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; width: 100%;
  padding: 16px 16px 16px 18px; border: 0; border-radius: inherit; background: none;
  font: inherit; color: inherit; text-align: left; cursor: pointer;
}
.dish-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dish-name { font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.dish-desc { color: var(--muted); font-size: .9rem; }
.tick {
  flex: none; min-width: 22px; height: 22px; border-radius: 999px; margin-top: 1px;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  transition: background-color .15s ease, border-color .15s ease;
}
.tick-n { font-size: .75rem; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.dish.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--card)); }
.dish.is-picked .tick { background: var(--accent); border-color: var(--accent); }
.dish.is-multi .tick { padding: 0 7px; }
.dish.is-picked:not(.is-multi) .tick::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Portions stepper: appears once a dish is picked. */
.stepper { display: none; align-items: center; gap: 8px; padding: 0 14px 12px 18px; }
.dish.is-picked .stepper { display: flex; animation: rise .2s ease both; }
.stepper-label { flex: 1; font-size: .8rem; font-weight: 600; color: var(--muted); }
.stepper button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--accent); background: var(--card);
  color: var(--accent); font-size: 1.15rem; line-height: 1; cursor: pointer; transition: background-color .15s ease;
}
.stepper button:hover:not(:disabled) { background: var(--accent); color: #fff; }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.stepper output { min-width: 1.6em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.tag { font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.tag-veg, .tag-vegan { color: var(--herb); background: var(--herb-soft); border-color: transparent; }
.tag-spicy { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

.is-locked .dish { box-shadow: none; }
.is-locked .dish-body { cursor: default; }
.is-locked .dish:hover { transform: none; border-color: var(--line); }
.is-locked .dish.is-picked:hover { border-color: var(--accent); }
.is-locked .dish:not(.is-picked) { opacity: .55; }

/* ---------- ticket ---------- */
.ticket { position: sticky; top: 84px; scroll-margin-top: 120px; }
html { scroll-behavior: smooth; }
.ticket-paper {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 20px; box-shadow: var(--shadow);
}
.ticket-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1.5px dashed var(--line-strong);
  font-family: var(--serif); font-size: 1.3rem;
}
.ticket-head .muted { font-family: var(--sans); font-size: .8rem; text-align: right; }
.ticket-lines ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ticket-lines li { display: grid; gap: 1px; animation: rise .25s ease both; }
.line-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.line-name { font-weight: 600; }
.saved-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-top: 14px; }
.saved { font-size: .82rem; color: var(--herb); }
.saved-row .link-btn { font-size: .82rem; }
.stamp {
  display: inline-block; margin-top: 16px; padding: 4px 12px; transform: rotate(-3deg);
  border: 2px solid var(--accent); color: var(--accent); border-radius: 6px;
  font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem;
}
.ticket-empty { color: var(--muted); font-size: .95rem; }
.note-label { display: block; margin: 18px 0 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
textarea, input[type="text"], input:not([type]), input[type="date"], input[type="number"] {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); resize: vertical; transition: border-color .15s ease;
}
textarea:focus, input:focus { border-color: var(--line-strong); outline: none; }
textarea:disabled { opacity: .7; }
.ticket-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.autosave { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.spinner { display: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: transparent; }
.htmx-request .spinner { display: inline-block; animation: spin .7s linear infinite; }
.crowd { margin-top: 22px; text-align: center; font-size: .88rem; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* ---------- table talk (comments) ---------- */
.talk { margin-top: 64px; padding-top: 40px; border-top: 1px solid var(--line); }
.talk-compact { margin-top: 40px; }
.talk-compact h2 { margin-bottom: 16px; }
.talk-head { display: grid; gap: 6px; margin-bottom: 18px; max-width: 620px; }
.talk-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; max-width: 720px; }
.talk-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip span {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: .85rem; font-weight: 500;
  border: 1px solid var(--line); background: var(--paper); transition: all .15s ease;
}
.chip:hover span { border-color: var(--line-strong); }
.chip:has(input:checked) span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.form-error { color: var(--warn); font-size: .9rem; font-weight: 500; }
.form-ok { color: var(--herb); font-size: .9rem; font-weight: 500; transition: opacity .6s ease; }
.form-ok.fade { opacity: 0; }

.notes { list-style: none; padding: 0; margin: 24px 0 0; columns: 3 260px; column-gap: 14px; }
.note {
  break-inside: avoid; margin-bottom: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); animation: rise .3s ease both;
}
.note p { white-space: pre-line; overflow-wrap: anywhere; }
.note-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: .78rem; color: var(--muted); }
.note-topic { font-weight: 650; text-transform: uppercase; letter-spacing: .08em; }
.note-food .note-topic { color: var(--accent); }
.note-idea .note-topic { color: var(--herb); }
.note-remove { margin-top: 8px; font-size: .8rem; }
.talk-empty { margin-top: 18px; }

/* ---------- kitchen ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.board-total, .board-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.board-total { display: flex; flex-direction: column; justify-content: center; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.board-total .muted { color: color-mix(in srgb, var(--paper) 65%, transparent); }
.big { font-family: var(--serif); font-size: 4rem; line-height: 1; font-weight: 500; }
.board-card header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.board-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-row { display: flex; justify-content: space-between; gap: 10px; font-size: .95rem; }
.bar-row strong { font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.bar { height: 6px; border-radius: 999px; background: var(--paper); margin-top: 5px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }

.orders { margin-top: 40px; }
.orders h2 { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.note-pill { display: inline-block; background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: 8px; font-size: .88rem; }

/* ---------- manage ---------- */
.manage-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.manage-course { margin-bottom: 28px; }
.manage-course h3 { margin-bottom: 10px; font-size: 1.35rem; }
.manage-course ul { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.manage-dish { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.manage-dish:last-child { border-bottom: 0; }
.manage-dish > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.manage-dish-side { display: flex; align-items: center; gap: 12px; flex: none; }
.count-pill { font-size: .78rem; font-weight: 600; color: var(--herb); background: var(--herb-soft); padding: 2px 9px; border-radius: 999px; }
.manage-form { display: grid; gap: 16px; align-content: start; }
.card-form {
  display: grid; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.card-form h2 { font-size: 1.35rem; }
.card-form label { display: grid; gap: 6px; font-size: .85rem; font-weight: 600; }
.card-form label .muted { font-weight: 400; }
.tag-pick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick legend { font-size: .85rem; font-weight: 600; margin-bottom: 6px; padding: 0; }
.tag-pick .chip { display: inline-block; font-weight: 400; }
.date-jump { display: flex; gap: 6px; margin: 0; }
.date-jump input { width: auto; padding: 8px 10px; border-radius: 999px; }
.banner { padding: 10px 16px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; animation: rise .25s ease both; }
.banner-error { background: var(--accent-soft); color: var(--warn); }
.banner-ok { background: var(--herb-soft); color: var(--herb); }

/* ---------- empty + login ---------- */
.empty-state { text-align: center; padding: 70px 20px; display: grid; gap: 12px; justify-items: center; }
.empty-title { font-size: clamp(1.6rem, 4vw, 2.2rem); max-width: 22ch; line-height: 1.2; margin-bottom: 8px; }
.empty-inline { padding: 50px 20px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-inline form { margin-top: 8px; }

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px 0; }
.page:has(.login) { padding-bottom: 0; }
.login-card {
  width: 100%; max-width: 420px; text-align: center; display: grid; gap: 14px; justify-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 44px 32px; box-shadow: var(--shadow);
}
.login-card .logo { width: 52px; height: 52px; }
.login-card h1 { font-size: 2.6rem; font-weight: 450; line-height: 1.1; }
.login-card h1 em { color: var(--accent); }
.login-card .btn { margin-top: 8px; }
.dev-login { width: 100%; display: grid; gap: 10px; margin-top: 6px; }
.dev-badge { font-size: .78rem; color: var(--warn); background: var(--accent-soft); padding: 6px 10px; border-radius: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .menu-layout, .manage-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .ticket, .card-form { position: static; }
  .manage-form { order: -1; }
  .me-name { display: none; }
}
@media (max-width: 560px) {
  .topbar-inner { gap: 8px 12px; padding: 10px 16px; flex-wrap: wrap; }
  /* Nav moves to its own scrollable row so it never widens the page. */
  .nav { order: 3; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .nav a { padding: 5px 9px; }
  .nav { gap: 0; }
  .page { padding: 0 16px 60px; }
  .hero { padding: 32px 0 20px; }
  .dishes { grid-template-columns: 1fr; }
  .hero-row { align-items: stretch; }
  .hero-tools { width: 100%; }
  .date-jump { flex: 1; min-width: 0; }
  .date-jump input { width: 100%; min-width: 0; }
  .manage-dish { flex-direction: column; gap: 8px; }
  .manage-dish-side { justify-content: space-between; }
  .manage-dish-side .link-btn { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- print (kitchen sheet) ---------- */
@media print {
  :root { --paper: #fff; --card: #fff; --ink: #000; --muted: #444; --line: #bbb; --shadow: none; }
  .topbar, .hero-tools, .talk, .status .dot { display: none; }
  .board-total { background: #fff; color: #000; border-color: #000; }
  .board-total .muted { color: #444; }
  .hero { padding: 0 0 12px; }
  .page { max-width: none; padding: 0; }
}

/* ---------- prices + bill ---------- */
/* margin-top:auto pins tags + price to the bottom so prices line up across a row */
.dish-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; }
.dish-foot .tags { margin-top: 0; }
.dish-price { margin-left: auto; font-size: .95rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dish.is-picked .dish-price { color: var(--accent); }
.line-qty { color: var(--accent); font-weight: 700; }

.mobile-bar { display: none; }
@media (max-width: 900px) {
  .mobile-bar {
    position: fixed; z-index: 20; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px;
    background: var(--ink); color: var(--paper); text-decoration: none; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .45);
    transition: transform .25s ease, opacity .25s ease;
  }
  .mobile-bar strong { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; font-variant-numeric: tabular-nums; }
  .mobile-bar-text { flex: 1; font-size: .9rem; }
  .mobile-bar-go { font-size: .85rem; font-weight: 600; opacity: .75; }
  .mobile-bar.is-hidden { transform: translateY(140%); opacity: 0; pointer-events: none; }
  .page:has(.mobile-bar) { padding-bottom: 96px; }
}
.ticket-lines li { grid-template-columns: 1fr auto; column-gap: 12px; }
.ticket-lines .line-cat { grid-column: 1 / -1; }
.line-price { font-variant-numeric: tabular-nums; color: var(--muted); align-self: end; }
.bill { margin: 16px 0 0; padding-top: 12px; border-top: 1.5px dashed var(--line-strong); display: grid; gap: 4px; font-size: .92rem; }
.bill div { display: flex; justify-content: space-between; gap: 12px; }
.bill dt { color: var(--muted); }
.bill dd { margin: 0; font-variant-numeric: tabular-nums; }
.bill-credit dd { color: var(--herb); font-weight: 600; }
.bill-debt dd { color: var(--warn); font-weight: 600; }
.bill-total { margin-top: 4px; font-family: var(--serif); font-size: 1.2rem; }
.bill-total dt { color: var(--ink); }
.pay-status { margin-top: 10px; font-size: .85rem; padding: 8px 10px; border-radius: 8px; }
.pay-ok { background: var(--herb-soft); color: var(--herb); }
.pay-due { background: var(--accent-soft); color: var(--warn); }
.pay-change { background: var(--accent-soft); color: var(--accent); }

/* ---------- payments page ---------- */
.pay-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.pay-stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.pay-stat strong { font-family: var(--serif); font-size: 2rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.pay-stat-due strong { color: var(--warn); }
.pay-stat-change strong { color: var(--accent); }
.pay-stat.is-zero strong { color: var(--muted); }
.pay-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.pay-table th { white-space: nowrap; }
@media (min-width: 701px) {
  /* Shrink-wrap the action column so its buttons stay on one line. */
  .pay-table .pay-actions-cell { width: 1%; white-space: nowrap; }
  .pay-table .pay-actions { flex-wrap: nowrap; }
  .pay-table .pay-custom input { width: 76px; }
  .pay-table td.pay-name { min-width: 170px; }
}

.kitchen-notes { margin-top: 32px; }
.kitchen-notes h2 { margin-bottom: 12px; }
.kitchen-notes ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.kitchen-notes li {
  display: grid; gap: 4px; justify-items: start; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px;
}
.pay-toolbar input { max-width: 320px; width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); }
.pay-table td { vertical-align: middle; font-variant-numeric: tabular-nums; }
.pay-table tr.is-settled td:not(:last-child) { opacity: .6; }
.pay-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.pay-actions form { margin: 0; display: flex; gap: 6px; align-items: center; }
.pay-custom input { width: 90px; padding: 7px 10px; border-radius: 999px; }
.btn-sm { padding: .42em .9em; font-size: .85rem; white-space: nowrap; }
.btn-change { background: var(--accent); border-color: var(--accent); }
.btn-change:hover { background: var(--ink); border-color: var(--ink); }
.pill { display: inline-block; white-space: nowrap; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.pill-ok { background: var(--herb-soft); color: var(--herb); }
.pill-due { background: var(--accent-soft); color: var(--warn); }
.pill-change { background: color-mix(in srgb, var(--accent) 16%, var(--card)); color: var(--accent); }
.amt-credit { color: var(--herb); font-weight: 600; }
.amt-debt { color: var(--warn); font-weight: 600; }
.pay-history { margin-top: 4px; font-size: .85rem; }
.pay-history summary { cursor: pointer; color: var(--muted); }
.pay-history ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.pay-history li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.pay-history li.is-reversed > span:first-child { text-decoration: line-through; color: var(--muted); }
.dev-roles { display: flex; justify-content: center; gap: 18px; }
@media (max-width: 700px) {
  .pay-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .pay-stat { padding: 12px; }
  .pay-stat .muted { font-size: .75rem; }
  .pay-stat strong { font-size: 1.3rem; }
  /* Rows become cards so the action buttons stay reachable. */
  .pay-table thead { display: none; }
  .pay-table, .pay-table tbody, .pay-table tr, .pay-table td { display: block; }
  .pay-table tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .pay-table tr:last-child { border-bottom: 0; }
  .pay-table td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
  .pay-table td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; }
  .pay-table td.pay-name { display: block; padding-bottom: 6px; }
  .pay-table td.pay-actions-cell { display: block; padding-top: 10px; }
  .pay-actions { justify-content: flex-start; }
  .pay-custom { flex: 1 1 100%; flex-wrap: wrap; }
  .pay-custom input { flex: 1 1 100%; width: auto; min-width: 0; }
  .pay-custom .btn-sm { flex: 1; }
}

/* ---------- planner: tabs, library search, week grid ---------- */
.plan-tabs { display: inline-flex; gap: 2px; margin-top: 14px; padding: 3px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.plan-tabs a { text-decoration: none; padding: 5px 14px; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--muted); }
.plan-tabs a:hover { color: var(--ink); }
.plan-tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); }

.lib-box { position: relative; margin: 0; }
.lib-input { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px dashed var(--line-strong); background: transparent; font-size: .92rem; }
.lib-input:focus { border-style: solid; border-color: var(--accent); background: var(--card); }
.lib-results { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 4px); }
.lib-box:not(:focus-within):not(:hover) .lib-results { display: none; }
.lib-list {
  list-style: none; margin: 0; padding: 4px; max-height: 320px; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow);
}
.lib-item {
  width: 100%; display: grid; gap: 1px; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer;
}
.lib-item:hover, .lib-item:focus-visible { background: var(--accent-soft); outline: none; }
.lib-name { font-weight: 600; font-size: .92rem; }
.lib-meta { font-size: .78rem; color: var(--muted); }
.lib-new .lib-name { color: var(--accent); }
.lib-empty { padding: 10px 12px; font-size: .85rem; color: var(--muted); background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; }

.lib-panel .lib-input { padding: 11px 14px; font-size: 1rem; }
.freq-label { font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: 2px; }
.freq { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chip-btn {
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  font-size: .85rem; cursor: pointer; transition: border-color .15s ease, background-color .15s ease;
}
.chip-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }

.week-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; margin-bottom: 20px; }
.week-hint { max-width: 560px; font-size: .9rem; }
.week-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.week-buttons form { margin: 0; }
.add-course { display: flex; gap: 6px; }
.add-course input { width: 170px; padding: 8px 12px; border-radius: 999px; }

.week-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: start; }
.week-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.week-day.is-today { border-color: var(--accent); }
.week-day.is-locked { opacity: .75; }
.week-day-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.week-day-head a { text-decoration: none; font-size: .98rem; }
.week-day-head a:hover strong { color: var(--accent); }
.week-cell { padding: 10px 12px 12px; border-bottom: 1px dashed var(--line); }
.week-cell:last-child { border-bottom: 0; }
.week-cell h4 { margin: 0 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 650; }
.week-dishes { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 4px; }
.week-dishes li {
  display: flex; align-items: baseline; gap: 6px; padding: 6px 4px 6px 9px;
  border-radius: 8px; background: var(--paper); font-size: .88rem; animation: rise .2s ease both;
}
.week-dish-name { flex: 1; min-width: 0; font-weight: 550; line-height: 1.3; }
.week-dish-price { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.week-x {
  flex: none; width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; align-self: center;
}
.week-x:hover { background: var(--accent-soft); color: var(--warn); }
.week-cell .lib-input { padding: 6px 9px; font-size: .85rem; border-radius: 8px; }
.pill-muted { background: var(--paper); color: var(--muted); }

@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 560px) {
  .week-grid { grid-template-columns: minmax(0, 1fr); }
  .week-buttons { width: 100%; }
  .week-buttons form { flex: 1 1 100%; }
  .week-buttons form:first-child .btn-ghost { width: 100%; }
  .add-course input { flex: 1; width: auto; min-width: 0; }
}

/* ---------- personal history ---------- */
.hero h1 em { font-style: normal; }
.history { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.hist-day {
  display: grid; grid-template-columns: 220px minmax(0, 1fr) auto; gap: 8px 20px; align-items: start;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.hist-day:last-child { border-bottom: 0; }
.hist-day.is-future { background: color-mix(in srgb, var(--paper) 50%, var(--card)); }
.hist-date { display: grid; gap: 4px; justify-items: start; }
.hist-items { font-size: .95rem; }
.hist-entries { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: .82rem; color: var(--muted); }
.hist-money { display: grid; gap: 4px; justify-items: end; font-variant-numeric: tabular-nums; }
.hist-charge { font-weight: 600; }
@media (max-width: 700px) {
  .hist-day { grid-template-columns: minmax(0, 1fr) auto; }
  .hist-items { grid-column: 1 / -1; grid-row: 2; }
}

/* Payments: the custom amount form hides behind "Altă sumă" */
.pay-history summary { white-space: nowrap; }
.pay-more { position: relative; }
.pay-more > summary { list-style: none; cursor: pointer; color: var(--muted); }
.pay-more > summary::-webkit-details-marker { display: none; }
.pay-more[open] > summary { color: var(--ink); border-color: var(--ink); }
.pay-more .pay-custom {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
  display: flex; gap: 6px; padding: 8px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.pay-more .pay-custom input { width: 90px; }
@media (max-width: 700px) {
  .pay-more { flex: 1 1 100%; }
  .pay-more > summary { display: inline-block; }
  .pay-more .pay-custom { position: static; margin-top: 8px; box-shadow: none; flex-wrap: wrap; }
  .pay-more .pay-custom input { flex: 1 1 100%; width: auto; }
  .pay-more .pay-custom .btn-sm { flex: 1; }
}

/* ---------- order deadline ---------- */
.cutoff-edit { margin-top: 10px; }
.cutoff-edit > summary {
  display: inline-block; cursor: pointer; list-style: none; font-size: .88rem;
  color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.cutoff-edit > summary::-webkit-details-marker { display: none; }
.cutoff-edit > summary:hover, .cutoff-edit[open] > summary { color: var(--ink); }
.cutoff-form {
  display: grid; gap: 12px; margin-top: 10px; max-width: 460px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.cutoff-time { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; }
.cutoff-time input { width: auto; padding: 7px 10px; font-size: 1rem; font-variant-numeric: tabular-nums; }
.cutoff-scope { display: grid; gap: 6px; }
.cutoff-scope .check { justify-content: flex-start; }
.cutoff-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.week-cutoff { display: block; font-size: .75rem; color: var(--muted); font-weight: 500; }
.week-cutoff.is-special { color: var(--accent); font-weight: 650; }

/* ---------- locations ---------- */
.loc-pick { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.loc-pick legend { padding: 0; margin-bottom: 8px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.loc-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.loc-option { position: relative; cursor: pointer; }
.loc-option input { position: absolute; opacity: 0; pointer-events: none; }
.loc-option span {
  display: block; text-align: center; padding: 9px 10px; border-radius: 10px; font-size: .9rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--paper); transition: all .15s ease;
}
.loc-option:hover span { border-color: var(--line-strong); }
.loc-option input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.loc-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.loc-pick:disabled .loc-option { cursor: default; }
.loc-pick:disabled .loc-option input:not(:checked) + span { opacity: .45; }

.loc-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 20px; }
.loc-tabs a {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: .92rem;
}
.loc-tabs a span { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.loc-tabs a[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.loc-tabs a[aria-current="page"] span { color: color-mix(in srgb, var(--paper) 70%, transparent); }
.loc-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; background: var(--paper); border: 1px solid var(--line); white-space: nowrap; }
.print-only { display: none; }
@media print {
  .loc-tabs { display: none; }
  .print-only { display: block; }
  .print-loc { font-weight: 700; font-size: 1.1rem; margin-bottom: 10px; }
}

/* ---------- limited portions ---------- */
.stock { align-self: flex-start; margin-top: 2px; font-size: .74rem; font-weight: 650; color: var(--herb); font-variant-numeric: tabular-nums; }
.stock-low { color: var(--accent); }
.stock-out { color: var(--muted); }
.dish.is-out { opacity: .55; box-shadow: none; }
.dish.is-out:hover { transform: none; border-color: var(--line); }
.dish.is-out .dish-body { cursor: not-allowed; }
.stock-error { margin: 0 0 10px; }
.count-pill-out { color: var(--muted); background: var(--paper); }
.stock-edit summary { font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.stock-edit[open] { flex-basis: 100%; }
.stock-form { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 8px; }
.stock-form label { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.stock-form input { width: 110px; }
.manage-dish-side:has(.stock-edit[open]) { flex-wrap: wrap; }
.week-dish-stock { font-size: .74rem; font-weight: 650; color: var(--herb); white-space: nowrap; font-variant-numeric: tabular-nums; }
.week-dish-stock.is-out { color: var(--muted); }
