:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --ink: #2b2420;
  --muted: #7a6e66;
  --line: #ece4da;
  --accent: #c2502e;
  --accent-dark: #a2401f;
  --accent-soft: #fbe9e2;
  --green: #2f7d4f;
  --green-soft: #e3f3e8;
  --amber: #a86a00;
  --amber-soft: #fdf1d8;
  --red: #b42318;
  --red-soft: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 36, 32, .06), 0 4px 16px rgba(43, 36, 32, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
code { background: #f1ebe3; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 18px; }
main.wrap { padding-top: 22px; padding-bottom: 48px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.logo { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #fff 0 34%, var(--accent) 36% 100%); box-shadow: inset 0 0 0 3px var(--accent-soft); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.nav a:not(.btn) { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav a.active, .nav a:not(.btn):hover { color: var(--accent); }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--ink); }
.inline { display: inline; margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .15s;
}
.btn:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f3ede6; }
.btn-danger { background: transparent; color: var(--red); border-color: #f2c4bf; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 12px; font-size: .9rem; border-radius: 8px; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent-dark); font: inherit; cursor: pointer; text-decoration: underline; }
.linkbtn.danger { color: var(--red); }
.nav .linkbtn { color: var(--ink); text-decoration: none; font-weight: 500; }

/* alerts */
.alert { padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; border: 1px solid; }
.alert-success { background: var(--green-soft); border-color: #bfe3cb; color: #1e5636; }
.alert-error { background: var(--red-soft); border-color: #f6c9c4; color: #8a1c13; }
.alert-info { background: var(--amber-soft); border-color: #f3dca8; color: #6d4700; }

/* forms */
.form { display: grid; gap: 14px; }
.form label, .filter-grid label { display: grid; gap: 5px; font-weight: 600; font-size: .92rem; }
.form label .muted { font-weight: 400; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #ddd2c6; border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; margin: 0; display: grid; gap: 14px; background: var(--surface); }
legend { font-weight: 700; padding: 0 6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; padding-bottom: 10px; }
.radios { border: 0; padding: 0; background: none; display: flex; gap: 16px; }
.radios label { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-weight: 700; }
.thumb { width: 120px; height: 90px; object-fit: cover; border-radius: 10px; }

.auth-card { max-width: 440px; margin: 20px auto; background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.form-page { max-width: 820px; margin: 0 auto; }
.form-page.narrow { max-width: 640px; }
.form-page h2 { margin-top: 32px; }

/* browse */
.hero { padding: 10px 0 6px; }
.hero h1 { font-size: 2rem; }
.search { margin: 14px 0 6px; }
.searchbar { display: grid; grid-template-columns: 1fr 200px auto; gap: 10px; }
.filters { margin-top: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.filters summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.filters[open] { padding-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.chip-check input { position: absolute; opacity: 0; }
.chip-check span { display: inline-block; padding: 6px 13px; border-radius: 999px; border: 1px solid #ddd2c6; background: #fff; font-weight: 500; font-size: .9rem; cursor: pointer; }
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); }
.filter-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.result-count { margin: 12px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; color: inherit; text-decoration: none; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(43,36,32,.06), 0 10px 28px rgba(43,36,32,.10); }
.card-img, .detail-img { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #f4d9c6, #e9b99a) center / cover no-repeat; display: grid; place-items: center; }
.placeholder { font-size: 3rem; font-weight: 800; color: rgba(255,255,255,.85); }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.95); border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 700; }
.badge-hot { left: auto; right: 10px; background: var(--accent); color: #fff; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 8px; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-top h3 { margin: 0; }
.price { font-weight: 800; white-space: nowrap; color: var(--accent-dark); }
.price.big { font-size: 1.6rem; color: var(--ink); }
.cook-line { font-size: .92rem; }
.stars { color: #e2a400; font-weight: 700; }
.plates { font-size: .9rem; }
.bar { height: 6px; background: #f0e8df; border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.bar span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.meta { display: grid; gap: 1px; font-size: .85rem; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #f3ede6; border-radius: 999px; padding: 2px 9px; font-size: .78rem; font-weight: 600; color: #5b4f47; }
.empty { text-align: center; background: var(--surface); border-radius: var(--radius); padding: 44px 20px; box-shadow: var(--shadow); }

/* listing detail */
.detail { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.detail-img { border-radius: var(--radius); margin-bottom: 18px; }
.desc { font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; background: var(--surface); padding: 16px 18px; border-radius: var(--radius); margin: 18px 0 28px; }
.facts dt { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.facts dd { margin: 0; }
.detail-side { position: sticky; top: 84px; }
.panel { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.total { font-size: 1.05rem; }
.my-order { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 4px; font-size: .92rem; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: .15em; background: var(--accent-soft); color: var(--accent-dark); padding: 2px 8px; border-radius: 6px; }
.code.big { font-size: 1.4rem; }
.review { border-bottom: 1px solid var(--line); padding: 10px 0; }
.review p { margin: 4px 0 0; }

/* kitchen + orders */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.kitchen-card, .order-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.kitchen-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kitchen-head h2 a { color: inherit; text-decoration: none; }
.kitchen-stats { text-align: right; display: grid; gap: 4px; justify-items: end; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.table-wrap { overflow-x: auto; }
table.orders { width: 100%; border-collapse: collapse; font-size: .92rem; }
.orders th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.orders td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.note { font-style: italic; color: var(--muted); font-size: .85rem; }
.order-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.code-form { display: inline-flex; gap: 4px; }
.code-form input { width: 74px; padding: 5px 8px; text-align: center; letter-spacing: .1em; }
.status-pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .8rem; font-weight: 700; background: #f0ebe5; color: #5b4f47; white-space: nowrap; }
.status-confirmed, .status-taking-orders { background: var(--amber-soft); color: var(--amber); }
.status-ready, .status-completed, .status-sold-out { background: var(--green-soft); color: var(--green); }
.status-cancelled_diner, .status-cancelled_cook, .status-no_show, .status-cancelled { background: var(--red-soft); color: var(--red); }
.order-card { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }
.order-card.is-active { border-left: 4px solid var(--accent); }
.order-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.order-top h2 { margin: 0; }
.order-top h2 a { color: inherit; text-decoration: none; }
.order-main { display: grid; gap: 6px; }
.pickup-box { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; margin-top: 6px; }
.review-form { display: grid; gap: 8px; }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; }
.star-input input { position: absolute; opacity: 0; }
.star-input label { font-size: 1.7rem; color: #ddd2c6; cursor: pointer; padding: 0 2px; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: #e2a400; }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); }

.footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .9rem; }

/* mobile */
@media (max-width: 820px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; background: var(--surface); flex-direction: column; align-items: stretch; padding: 12px 18px 18px; gap: 12px; border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .detail, .order-card { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .searchbar { grid-template-columns: 1fr auto; }
  .searchbar select { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 560px) {
  h1, .hero h1 { font-size: 1.5rem; }
  .row2, .row3, .filter-grid, .facts { grid-template-columns: 1fr; }
  .auth-card { padding: 22px 18px; }
  .kitchen-stats { text-align: left; justify-items: start; }
}
