:root {
  --ink: #1c1410;
  --muted: #6d6258;
  --line: #e6dccf;
  --paper: #fffdf9;
  --cream: #f4efe6;
  --sand: #efe4d4;
  --copper: #c4622d;
  --copper-dark: #8d3f18;
  --moss: #2f6b4f;
  --moss-soft: #e5f2ea;
  --wine: #8d2e2e;
  --wine-soft: #f8e6e2;
  --warn: #8a5a12;
  --warn-soft: #f8efd8;
  --shadow: 0 18px 40px rgba(28, 20, 16, 0.08);
  --serif: Fraunces, "Iowan Old Style", Palatino, serif;
  --sans: Outfit, "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 320px at 10% -10%, rgba(196, 98, 45, 0.16), transparent 60%),
    var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.03em; line-height: 1.1; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0 0 0.6rem; }
h2 { font-size: 1.45rem; margin: 0 0 0.7rem; }
a { color: var(--copper-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 1.2rem;
  background: var(--ink);
  color: #f6f1e8;
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: inherit; text-decoration: none; font-family: var(--serif); font-size: 1.25rem; }
.brand-dark { color: var(--ink); }
.brand-mark {
  width: 1.7rem;
  height: 1.7rem;
  background: url("../favicon.svg") center/contain no-repeat;
}
.userbox { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.userbox small { color: #d9c8b6; }
.userbox a, .linkish { color: #f6f1e8; }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.nav {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.7rem 1rem;
  background: rgba(255, 253, 249, 0.8);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.nav a {
  text-decoration: none;
  color: var(--ink);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.nav a.is-on, .nav a:hover { background: var(--ink); color: #f6f1e8; }
.wrap { width: min(1120px, calc(100% - 2rem)); margin: 1.2rem auto 3rem; }
.page-head, .inline-form { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 0.85rem; }
.card, .auth-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.card + .card, .split + .card, .card + .table-wrap, .table-wrap + .card { margin-top: 1rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--ink); color: #f6f1e8; border-radius: 18px; padding: 1rem 1.1rem; }
.stat span, .stat small { color: #d9c8b6; }
.stat strong { display: block; font-family: var(--serif); font-size: 2rem; margin: 0.2rem 0; }
.help, small { color: var(--muted); }
.help-block p { margin: 0 0 0.7rem; }
.flash { padding: 0.75rem 0.9rem; border-radius: 12px; }
.flash-ok { background: var(--moss-soft); color: var(--moss); }
.flash-error { background: var(--wine-soft); color: var(--wine); }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; }
.field input, .field select, .field textarea, .inline-form input, .product-add input, .table input, .table select {
  width: 100%;
  border: 1px solid #d9cec1;
  background: white;
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  font-weight: 400;
}
textarea { resize: vertical; }
.check { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.35rem 0; }
fieldset { border: 1px solid var(--line); border-radius: 14px; margin: 0; }
legend { padding: 0 0.3rem; font-weight: 650; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: white;
  padding: 0.45rem 0.95rem;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
}
.btn-primary { background: var(--copper); border-color: var(--copper); color: white; }
.btn-ok { background: var(--moss); border-color: var(--moss); color: white; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.badge { display: inline-flex; border-radius: 999px; padding: 0.1rem 0.5rem; background: var(--sand); font-size: 0.82rem; }
.badge-ok { background: var(--moss-soft); color: var(--moss); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: 16px; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.7rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.table small, .plain small { display: block; }
.is-hot { color: var(--wine); font-weight: 700; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.stat-line { font-weight: 650; }

.mesa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.8rem; }
.mesa {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 120px;
  padding: 0.9rem;
  border-radius: 18px;
  text-decoration: none;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}
.mesa strong { font-family: var(--serif); font-size: 1.4rem; }
.mesa em { font-style: normal; font-weight: 700; }
.mesa.is-draft { background: var(--sand); }
.mesa.is-kitchen { background: #f6ddcc; }
.mesa.is-pay { background: var(--moss-soft); }
.order-menu { margin-top: 1.2rem; }
.product-add {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) 72px minmax(120px, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.product-add input[type="number"] { width: 72px; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: min(460px, 100%); }
.menu-body { background: #f7f1e7; }
.menu-hero, .menu-sheet { width: min(760px, calc(100% - 2rem)); margin: 0 auto; }
.menu-hero { padding: 2.4rem 0 1rem; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.75rem; color: var(--copper-dark); }
.menu-sheet section { margin: 1.4rem 0 2rem; }
.menu-sheet h2 { font-size: 1.8rem; }
.dish { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; border-bottom: 1px dotted #c8b8a6; }
.dish h3 { margin: 0; font-size: 1.25rem; }
.dish p { margin: 0.2rem 0 0; color: var(--muted); }
.dish strong { font-variant-numeric: tabular-nums; }
.menu-foot { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); padding-bottom: 3rem; }
.empty, .empty-kitchen { padding: 1rem; }

body.kitchen { background: #120f0c; color: #f6f1e8; }
body.kitchen .topbar { background: #1b1612; }
body.kitchen .nav { background: #1b1612; border-bottom-color: #3a3128; }
body.kitchen .nav a { color: #f6f1e8; }
body.kitchen .nav a.is-on { background: var(--copper); }
body.kitchen .wrap { width: min(1280px, calc(100% - 1.2rem)); }
body.kitchen h1 { font-size: 1.6rem; }
.kitchen-tools { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 0.8rem; }
.ticket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.8rem; }
.ticket { background: #2a231c; border-radius: 18px; padding: 0.9rem; border-left: 6px solid var(--copper); }
.ticket.is-new { animation: pulse 1.4s ease; }
.ticket header { display: flex; gap: 0.7rem; align-items: center; }
.ticket h2 { margin: 0; font-size: 1.7rem; }
.ticket header p, .ticket small { color: #d9cbbd; margin: 0; }
.queue { font-family: var(--serif); font-size: 1.8rem; color: #e7a06a; }
.ticket ul { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.ticket li { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 0; border-top: 1px solid #3d342b; }
.ticket li.is-done { opacity: 0.55; }
.ticket li em { display: block; color: #f2d48a; font-style: normal; }
.ticket-actions { display: flex; flex-direction: column; gap: 0.35rem; }
body.kitchen .btn-ghost { color: #f6f1e8; border-color: #8c7b6c; }
.recipe-note { background: #f8efd8; color: #5c3d08; padding: 0.7rem; border-radius: 12px; }
dialog { border: 0; border-radius: 18px; padding: 1rem; width: min(520px, calc(100% - 2rem)); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.recipe h2 { margin-top: 0.2rem; }
.section-title { margin-top: 1.6rem; }
.move-form { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; align-items: end; }
.move-form .field { flex: 1 1 180px; margin: 0; }
.move-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.move-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-top: 1px solid var(--line); }
.move-list span { color: var(--muted); }
.register { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: 1rem; align-items: start; }
.tape ol { list-style: none; margin: 0; padding: 0; }
.tape-head, .tape li { display: flex; justify-content: space-between; gap: 0.8rem; }
.tape-head { align-items: baseline; border-bottom: 1px dashed #c8b8a6; padding-bottom: 0.7rem; margin-bottom: 0.3rem; }
.tape-head p, .tape-head span { margin: 0; color: var(--muted); }
.tape li { padding: 0.75rem 0; border-bottom: 1px dotted #e4d8c8; }
.tape-qty { font-family: var(--serif); font-size: 1.35rem; width: 1.6rem; }
.tape-name { flex: 1; }
.tape-name small, .ticket-lines small { display: block; color: var(--muted); font-weight: 400; }
.tape-price { font-variant-numeric: tabular-nums; }
.tape li.is-void { opacity: 0.45; text-decoration: line-through; }
.tape li.is-hold { color: var(--warn); }
.register-pay {
  background: var(--ink);
  color: #f6f1e8;
  border-radius: 22px;
  padding: 1.15rem;
  position: sticky;
  top: 4.6rem;
}
.register-kicker { margin: 0.9rem 0 0.25rem; color: #d9c8b6; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; }
.register-due { margin: 0; font-family: var(--serif); font-size: clamp(2.4rem, 5vw, 3.5rem); line-height: 1; }
.register-discount, .register-change, .ticket-row { display: flex; justify-content: space-between; gap: 1rem; }
.register-discount[hidden], .cash-box[hidden] { display: none; }
.register-discount { margin: 0.4rem 0 0; color: #f2d48a; }
.register-change { margin: 0.35rem 0 0.8rem; color: #f2d48a; }
.register-pay .field input { background: #2a231c; color: #f6f1e8; border-color: #5c5148; }
.register-extra { margin-top: 0.8rem; }
.register-extra summary { cursor: pointer; font-weight: 650; }
.register-extra[open] summary { margin-bottom: 0.45rem; }
.pay-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.pay-method input { position: absolute; opacity: 0; }
.pay-method span { display: block; text-align: center; border: 1px solid #8c7b6c; border-radius: 12px; padding: 0.75rem 0.3rem; cursor: pointer; }
.pay-method input:checked + span { background: var(--copper); border-color: var(--copper); color: white; }
.pay-method input:focus-visible + span { outline: 2px solid #f6f1e8; }
.btn-charge { width: 100%; border-radius: 14px; min-height: 52px; font-size: 1.15rem; }
.receipt-body { background: #ece4d8; }
.receipt-actions { display: flex; gap: 0.8rem; justify-content: center; margin: 1rem 0; }
.ticket-sheet {
  width: min(360px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  background: white;
  color: #1c1410;
  padding: 1.35rem 1.15rem 1.5rem;
  box-shadow: var(--shadow);
}
.ticket-sheet h1, .ticket-sheet header p, .ticket-no, .ticket-sheet > p, .ticket-sheet footer { text-align: center; }
.ticket-sheet h1 { font-size: 1.7rem; margin-bottom: 0.25rem; }
.ticket-sheet p { margin: 0.12rem 0; }
.ticket-no { font-weight: 700; letter-spacing: 0.08em; }
.ticket-rule { border: 0; border-top: 1px dashed #c8b8a6; margin: 0.75rem 0; }
.ticket-lines { list-style: none; margin: 0; padding: 0; }
.ticket-lines li, .ticket-row { display: flex; justify-content: space-between; gap: 0.8rem; text-align: left; }
.ticket-lines li { padding: 0.35rem 0; }
.ticket-lines span { flex: 1; }
.ticket-grand { font-family: var(--serif); font-size: 1.35rem; margin-top: 0.35rem; }
.ticket-legal { color: var(--muted); font-size: 0.82rem; }

@keyframes pulse {
  from { box-shadow: 0 0 0 0 rgba(224, 138, 69, 0.7); }
  to { box-shadow: 0 0 0 16px rgba(224, 138, 69, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .ticket.is-new { animation: none; }
  html { scroll-behavior: auto; }
}
@media (max-width: 1040px) {
  .register { grid-template-columns: 1fr; }
  .register-pay { position: static; }
}
@media (max-width: 720px) {
  .product-add { grid-template-columns: 1fr 1fr; }
  .product-add div { grid-column: 1 / -1; }
  .userbox span, .userbox small { display: none; }
  .move-list li { flex-direction: column; gap: 0.15rem; }
}
@media print {
  @page { size: 80mm auto; margin: 4mm; }
  .no-print, .topbar, .nav { display: none !important; }
  body, .receipt-body { background: white; }
  .ticket-sheet { width: 72mm; margin: 0; box-shadow: none; padding: 0; }
}
