:root {
  --wine: #711f25;
  --wine-dark: #4d1318;
  --terracotta: #c66a35;
  --cream: #fffaf1;
  --paper: #fffefd;
  --ink: #2e2522;
  --muted: #7a6b64;
  --line: #eadfd4;
  --green: #327457;
  --amber: #c67b18;
  --shadow: 0 16px 42px rgba(78, 34, 25, .11);
  font-family: "Kanit", system-ui, sans-serif;
  color: var(--ink);
  background: #f5eee5;
}
* { box-sizing: border-box; }
html { width: 100%; background: #f5eee5; }
body { margin: 0; min-height: 100dvh; background: radial-gradient(circle at top left, #fff7e9 0, transparent 36%), #f5eee5; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.demo-ribbon { height: 26px; display: grid; place-items: center; background: var(--wine-dark); color: #fff4e6; font-size: 12px; letter-spacing: .12em; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 4vw, 48px); background: rgba(255, 250, 241, .92); border-bottom: 1px solid rgba(113,31,37,.08); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: var(--wine); color: white; box-shadow: 0 7px 18px rgba(113,31,37,.24); }
.brand-mark span { line-height: .8; font-size: 23px; }
.brand-mark b { font-size: 11px; font-weight: 500; }
.brand strong { display: block; color: var(--wine); font-size: 25px; line-height: 1.05; font-weight: 600; }
.brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.view-nav { position: sticky; top: 84px; z-index: 19; display: flex; gap: 8px; overflow-x: auto; padding: 10px clamp(16px, 4vw, 48px); background: rgba(255, 250, 241, .92); border-bottom: 1px solid var(--line); scrollbar-width: none; }
.view-nav::-webkit-scrollbar { display: none; }
.view-nav a { min-height: 44px; display: grid; place-items: center; flex: 1 0 max-content; padding: 0 17px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; }
.view-nav a.active { color: white; background: var(--wine); box-shadow: 0 7px 20px rgba(113,31,37,.18); }
main { width: min(1320px, 100%); margin: 0 auto; padding: clamp(20px, 4vw, 42px) clamp(14px, 4vw, 40px) 110px; }
.loading { min-height: 45dvh; display: grid; place-content: center; gap: 14px; text-align: center; color: var(--muted); }
.loading span { width: 34px; height: 34px; margin: auto; border: 3px solid var(--line); border-top-color: var(--wine); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--terracotta); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; color: var(--wine-dark); font-size: clamp(29px, 5vw, 44px); line-height: 1.08; font-weight: 600; }
.page-head p, .muted { color: var(--muted); }
.table-pill { min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-radius: 16px; background: var(--wine); color: white; white-space: nowrap; box-shadow: var(--shadow); }
.table-pill strong { font-size: 19px; }
.category-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 20px; padding: 0 14px 4px; scrollbar-width: none; }
.category-row::-webkit-scrollbar { display: none; }
.chip { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.62); white-space: nowrap; }
.chip.active { color: white; border-color: var(--terracotta); background: var(--terracotta); }
.customer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 24px; align-items: start; }
.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card { min-height: 190px; position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; overflow: hidden; padding: 18px; border: 1px solid rgba(113,31,37,.08); border-radius: 22px; background: var(--paper); color: inherit; box-shadow: 0 8px 26px rgba(78,34,25,.07); transition: transform .18s ease, box-shadow .18s ease; }
.product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.product-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -30px; top: -30px; border-radius: 50%; background: color-mix(in srgb, var(--terracotta) 10%, transparent); }
.product-card .emoji { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 18px; border-radius: 16px; background: #fff2dd; font-size: 27px; }
.product-card h3 { margin-bottom: 5px; font-size: 18px; font-weight: 500; }
.product-card p { margin-bottom: 13px; color: var(--muted); font-size: 12px; font-weight: 300; }
.price { margin-top: auto; color: var(--wine); font-size: 18px; font-weight: 600; }
.cart-panel { position: sticky; top: 154px; padding: 20px; border: 1px solid rgba(113,31,37,.09); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.cart-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.cart-title h2 { margin: 0; font-size: 21px; }
.count-badge { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: #f3ded5; color: var(--wine); font-weight: 600; }
.empty { padding: 28px 10px; color: var(--muted); text-align: center; font-size: 14px; }
.cart-list { display: grid; gap: 12px; max-height: 39dvh; overflow-y: auto; margin-bottom: 14px; }
.cart-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 10px; padding-bottom: 11px; border-bottom: 1px dashed var(--line); }
.cart-item strong { font-size: 14px; font-weight: 500; }
.cart-item small { display: block; color: var(--muted); font-size: 11px; font-weight: 300; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #f4e8dc; color: var(--wine); }
.note { width: 100%; min-height: 70px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: #fffcf8; font-size: 14px; }
.note:focus { border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(198,106,53,.12); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin: 15px 0; }
.cart-total strong { color: var(--wine); font-size: 25px; }
.primary, .secondary, .ghost, .danger { min-height: 46px; border: 0; border-radius: 14px; padding: 0 17px; font-weight: 500; }
.primary { background: var(--wine); color: white; box-shadow: 0 8px 20px rgba(113,31,37,.2); }
.primary:hover { background: var(--wine-dark); }
.secondary { background: #f1dfd2; color: var(--wine); }
.ghost { background: white; color: var(--wine); border: 1px solid var(--line); }
.danger { background: #f8e3e0; color: #a13231; }
.wide { width: 100%; }
.compact { min-width: 46px; padding: 0 12px; }
button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; }
.mobile-cart { display: none; }
.order-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.order-card { display: flex; flex-direction: column; min-height: 290px; padding: 19px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 8px 25px rgba(78,34,25,.07); }
.order-card.new { border-top: 5px solid var(--terracotta); }
.order-card.accepted, .order-card.cooking { border-top: 5px solid var(--amber); }
.order-card.ready { border-top: 5px solid var(--green); }
.order-card.cancelled { opacity: .62; }
.order-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.order-head h3 { margin: 0; color: var(--wine); font-size: 20px; }
.order-head small { color: var(--muted); }
.status { height: 28px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 999px; background: #f3e4d7; color: var(--wine); font-size: 11px; font-weight: 500; }
.order-lines { display: grid; gap: 9px; margin: 0 0 14px; padding: 0; list-style: none; }
.order-lines li { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; font-size: 14px; }
.order-lines small { display: block; color: var(--muted); font-size: 11px; }
.order-note { padding: 9px 11px; border-radius: 10px; background: #fff5df; color: #76541a; font-size: 12px; }
.order-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 13px; border-top: 1px solid var(--line); }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.order-actions button { min-height: 44px; flex: 1; }
.empty-board { grid-column: 1/-1; min-height: 260px; display: grid; place-content: center; text-align: center; color: var(--muted); border: 1px dashed #d7c8bb; border-radius: 24px; background: rgba(255,255,255,.45); }
.kitchen-columns { display: grid; grid-template-columns: repeat(3, minmax(280px, 1fr)); gap: 16px; overflow-x: auto; align-items: start; }
.kitchen-column { padding: 15px; border-radius: 24px; background: rgba(255,255,255,.46); border: 1px solid var(--line); }
.column-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 13px; }
.column-title h2 { margin: 0; font-size: 18px; }
.column-title span { min-width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--wine); color: white; font-size: 12px; }
.column-orders { display: grid; gap: 12px; }
.kitchen-column .order-card { min-height: 0; }
.tables-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); }
.table-card-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 19px 12px; }
.table-card h2 { margin: 0; color: var(--wine); font-size: 24px; }
.table-state { color: var(--green); font-size: 12px; }
.table-state.idle { color: var(--muted); }
.qr-wrap { margin: 0 18px; padding: 14px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 18px; background: var(--cream); }
.qr-wrap img { width: min(100%, 190px); aspect-ratio: 1; }
.table-stats { display: grid; grid-template-columns: 1fr 1fr; margin: 15px 18px; border-radius: 15px; background: #f8eee5; }
.table-stats div { padding: 12px; text-align: center; }
.table-stats div + div { border-left: 1px solid var(--line); }
.table-stats small { display: block; color: var(--muted); }
.table-stats strong { color: var(--wine); font-size: 19px; }
.table-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 18px 18px; }
.table-actions a { min-height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--wine); background: #f1dfd2; text-decoration: none; }
.table-actions .wide-action { grid-column: 1/-1; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding: 20px; background: rgba(35,22,19,.58); backdrop-filter: blur(6px); }
.modal { width: min(560px, 100%); max-height: min(820px, 90dvh); overflow-y: auto; padding: 23px; border-radius: 28px 28px 20px 20px; background: var(--paper); box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.modal .cart-panel { display: block; position: static; padding: 8px 0 0; border: 0; border-radius: 0; box-shadow: none; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.modal-head h2 { margin-bottom: 4px; color: var(--wine); }
.close { width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: #f4e8dc; color: var(--wine); font-size: 20px; }
.option-group { margin: 20px 0; }
.option-group h3 { margin-bottom: 10px; font-size: 15px; }
.option-list { display: grid; gap: 8px; }
.option { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 13px; }
.option label { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.option input { width: 19px; height: 19px; accent-color: var(--wine); }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 70; transform: translate(-50%, 120px); min-width: min(360px, calc(100% - 28px)); padding: 13px 17px; border-radius: 14px; background: #29221f; color: white; text-align: center; box-shadow: var(--shadow); opacity: 0; transition: .25s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: #9d3030; }
.notice { padding: 13px 15px; margin-bottom: 18px; border: 1px solid #ecd6ab; border-radius: 14px; background: #fff6dc; color: #694d1a; font-size: 13px; }
.toolbar { display: flex; gap: 9px; flex-wrap: wrap; }
.access-shell { min-height: calc(100dvh - 230px); display: grid; place-items: center; padding: 20px 0; }
.access-card { width: min(520px, 100%); padding: clamp(24px, 6vw, 42px); border: 1px solid rgba(113,31,37,.1); border-radius: 30px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.access-card h1 { font-size: clamp(27px, 6vw, 38px); }
.access-card > p:not(.eyebrow) { color: var(--muted); }
.demo-pin { display: grid; gap: 3px; margin: 20px 0 12px; padding: 15px 18px; border: 1px solid #e8c6ad; border-radius: 18px; background: #fff3df; color: var(--wine-dark); }
.demo-pin span { font-size: 12px; letter-spacing: .08em; }
.demo-pin strong { font-size: 32px; letter-spacing: .18em; }
.demo-pin small { color: var(--muted); font-size: 12px; font-weight: 300; }
.staff-pin-input { min-height: 52px; text-align: center; font-size: 22px; letter-spacing: .2em; }
.security-icon { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 24px; background: #f6e5d7; font-size: 34px; }
.access-card form { display: grid; gap: 12px; margin-top: 24px; text-align: left; }
.access-card form label { color: var(--muted); font-size: 13px; }
.code-input { width: 100%; height: 68px; border: 2px solid var(--line); border-radius: 17px; outline: none; background: var(--cream); color: var(--wine); text-align: center; font-size: 30px; font-weight: 600; letter-spacing: .42em; padding-left: .42em; }
.code-input:focus { border-color: var(--terracotta); box-shadow: 0 0 0 4px rgba(198,106,53,.12); }
.security-note { display: grid; gap: 4px; margin-top: 22px; padding: 13px 15px; border-radius: 15px; background: #eef6f0; color: #315b43; text-align: left; font-size: 12px; }
.security-note span { font-weight: 300; }
.code-modal { position: relative; text-align: center; }
.code-modal > .close { position: absolute; top: 18px; right: 18px; }
.access-code { margin: 20px 0 12px; padding: 18px; border: 2px dashed var(--terracotta); border-radius: 18px; background: #fff6e7; color: var(--wine); font-size: clamp(42px, 12vw, 64px); font-weight: 600; letter-spacing: .25em; padding-left: calc(18px + .25em); }
.code-expiry { color: var(--muted); font-size: 13px; }

@media (max-width: 1000px) {
  .customer-layout { grid-template-columns: 1fr; }
  .cart-panel { display: none; }
  .mobile-cart { position: fixed; z-index: 30; display: flex; left: 14px; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); min-height: 62px; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; border-radius: 19px; background: var(--wine); color: white; box-shadow: 0 16px 45px rgba(78,19,24,.34); }
  .mobile-cart strong { display: block; font-size: 18px; }
  .mobile-cart small { opacity: .8; }
  .order-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tables-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { min-height: 76px; padding: 10px 14px; }
  .brand-mark { width: 52px; height: 52px; flex-basis: 52px; }
  .brand strong { font-size: 22px; }
  .view-nav { top: 76px; padding-inline: 12px; }
  .view-nav a { flex: 0 0 auto; }
  main { padding-top: 22px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-head .table-pill { order: -1; }
  .page-head p { font-size: 13px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-card { min-height: 175px; padding: 14px; border-radius: 18px; }
  .product-card .emoji { width: 44px; height: 44px; margin-bottom: 13px; }
  .product-card h3 { font-size: 16px; }
  .order-grid, .tables-grid { grid-template-columns: 1fr; }
  .kitchen-columns { grid-template-columns: repeat(3, 86vw); }
  .modal-backdrop { padding: 0; }
  .modal { border-radius: 27px 27px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
@media (max-width: 410px) {
  .brand small { max-width: 184px; }
  .table-pill { min-height: 44px; padding-inline: 12px; }
  h1 { font-size: 28px; }
  .product-card p { display: none; }
  .product-card { min-height: 150px; }
}
