:root {
  --bg: #f6f3ee; --panel: #ffffff; --ink: #1d1b19; --muted: #6f6a63; --line: #e6e0d7;
  --accent: #c8402c; --accent-ink: #fff; --accent-soft: #fbe9e5;
  --green: #2f7d4f; --green-soft: #e3f2e8; --amber: #b7791f; --amber-soft: #fbf0dc; --blue: #2b5fa8; --blue-soft: #e4ecf8;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", Roboto, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.4; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
a { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; } .spacer { flex: 1; }
.stack > * + * { margin-top: 10px; }
.hidden { display: none !important; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 10px;
  padding: 9px 14px; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
button:hover, .btn:hover { border-color: #cfc7bb; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.ghost { background: transparent; border-color: transparent; }
.danger { color: var(--accent); }
.big { padding: 14px 20px; font-size: 17px; border-radius: 12px; }
.pill { border-radius: 999px; }

input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; accent-color: var(--accent); transform: scale(1.15); }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 15px; }
.field { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; } .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }

.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--ink); }
.badge.new { background: var(--accent-soft); color: var(--accent); } .badge.cooking { background: var(--amber-soft); color: var(--amber); }
.badge.ready { background: var(--green-soft); color: var(--green); } .badge.done { background: #eee; color: #555; } .badge.cancelled { background: #eee; color: #999; text-decoration: line-through; }
.badge.ayce { background: var(--blue-soft); color: var(--blue); } .badge.pending { background: var(--amber-soft); color: var(--amber); } .badge.confirmed { background: var(--green-soft); color: var(--green); }
.badge.seated { background: var(--blue-soft); color: var(--blue); } .badge.noshow { background: #eee; color: #888; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }

/* top bar used by staff/admin */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; letter-spacing: .3px; }
.topbar .brand span { color: #ff8a74; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a, .topbar nav button { color: #ddd; background: transparent; border: 0; padding: 7px 12px; border-radius: 8px; text-decoration: none; font-weight: 500; }
.topbar nav a.on, .topbar nav button.on { background: rgba(255,255,255,.14); color: #fff; }
.topbar select.lang { width: auto; background: transparent; color: #fff; border-color: rgba(255,255,255,.3); padding: 5px 8px; }
.topbar select.lang option { color: #000; }
.page { padding: 18px; max-width: 1300px; margin: 0 auto; }

/* modal + toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(20,18,16,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 100; padding: 12px; }
@media (min-width: 700px) { .modal-wrap { align-items: center; } }
.modal { background: var(--panel); border-radius: 18px; padding: 20px; width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; position: relative; }
.modal.wide { max-width: 860px; }
.modal > h2:first-of-type, .modal > .row:first-of-type { padding-right: 36px; }
.modal-x { position: absolute; top: 8px; right: 8px; border: 0; background: transparent; font-size: 26px; line-height: 1; padding: 6px 10px; color: var(--muted); }
#tf-toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); transition: opacity .35s, transform .35s; max-width: 90vw; }
.toast.error { background: var(--accent); } .toast.ok { background: var(--green); } .toast.out { opacity: 0; transform: translateY(-8px); }

/* qty stepper */
.qty { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.qty button { border: 0; border-radius: 0; padding: 6px 12px; font-size: 18px; line-height: 1; background: transparent; }
.qty span { min-width: 24px; text-align: center; font-weight: 600; }
.add-btn { width: 36px; height: 36px; border-radius: 50%; padding: 0; font-size: 22px; background: var(--accent); color: #fff; border: 0; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-size: 11px; color: var(--muted); }
.bars .b .stack { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 6px 6px 0 0; overflow: hidden; }
.bars .b .s1 { background: var(--accent); } .bars .b .s2 { background: #e8a495; }
.kpi .v { font-size: 26px; font-weight: 700; } .kpi .l { color: var(--muted); font-size: 13px; }
.legend { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* PIN pad */
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pinpad button { font-size: 24px; padding: 16px 0; border-radius: 14px; }
.pindots { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.pindots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.pindots i.on { background: var(--ink); }

@media print {
  .topbar, .no-print, .modal-x, #tf-toasts { display: none !important; }
  .modal-wrap { position: static; background: none; padding: 0; } .modal { box-shadow: none; max-height: none; }
  body { background: #fff; }
}
