:root {
  --bg: #f3f0e8;
  --bg-elev: #fffdf8;
  --ink: #1c1914;
  --muted: #6d655b;
  --line: #e4dccf;
  --brand: #14352a;
  --brand-2: #1f6a4e;
  --brass: #b8893a;
  --brass-2: #e7d3a1;
  --danger: #8d2f2f;
  --ok: #1d7a4d;
  --warn: #9a5b12;
  --sidebar: #10241c;
  --sidebar-ink: #e7efe9;
  --shadow: 0 18px 40px rgba(28, 24, 18, .08);
  --radius: 18px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
  --sidebar-w: 248px;
}
[data-theme="dark"] {
  --bg: #121411;
  --bg-elev: #1c201b;
  --ink: #f4f0e6;
  --muted: #b7b1a4;
  --line: #31362f;
  --brand: #d7ecdf;
  --brand-2: #8fbfa4;
  --sidebar: #0c100e;
  --shadow: 0 18px 40px rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  letter-spacing: -.01em;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  z-index: 30;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 6px 10px 18px; }
.mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #e7d3a1, #b8893a);
  color: #1b1710; font-family: var(--display); font-weight: 650;
}
.brand strong { display: block; font-size: 14px; letter-spacing: .08em; }
.brand span { color: #b7c6bd; font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; padding-bottom: 12px; }
.nav a, .nav-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: #d5e2da;
  padding: 9px 12px; border-radius: 12px; font-size: 14.5px;
}
.nav a:hover, .nav a.active { background: rgba(231, 211, 161, .12); color: white; }
.nav a.active { box-shadow: inset 3px 0 0 #e7d3a1; }
[dir="rtl"] .nav a.active { box-shadow: inset -3px 0 0 #e7d3a1; }
.icon { width: 18px; height: 18px; flex: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb b { color: var(--ink); font-size: 18px; display: block; font-weight: 620; }
.top-actions, .row-actions, .filters, .inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content { padding: 6px 22px 40px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.page-head h1 { font-family: var(--display); font-weight: 560; font-size: 34px; margin: 0; letter-spacing: -.03em; }
.lede { color: var(--muted); margin: 4px 0 0; }
.grid-stats, .grid-2, .grid-3 { display: grid; gap: 14px; }
.grid-stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.grid-2 { grid-template-columns: 1.4fr .8fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card, .stat {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 16px 18px; }
.stat { padding: 16px 18px; }
.stat em { display: block; color: var(--muted); font-style: normal; font-size: 13px; }
.stat strong { display: block; margin-top: 8px; font-family: var(--display); font-size: 28px; font-weight: 560; }
.btn, button.btn {
  border: 1px solid transparent; background: var(--brand); color: #f6f3ea;
  border-radius: 12px; padding: 10px 14px; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px;
}
[data-theme="dark"] .btn { color: #102117; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.brass { background: var(--brass); color: #1b1710; }
.btn.danger { background: var(--danger); color: white; }
.btn.small { min-height: 34px; padding: 6px 10px; border-radius: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span, .label { font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; outline: none; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brass); box-shadow: 0 0 0 4px rgba(184, 137, 58, .15); }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-elev); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 620; }
tr:last-child td { border-bottom: 0; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; font-size: 12px; background: #efe8da; }
.badge.ok { background: #e5f4ec; color: var(--ok); }
.badge.warn { background: #f8ecd9; color: var(--warn); }
.badge.danger { background: #f8e4e4; color: var(--danger); }
.badge.muted { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.toast-stack { position: fixed; inset-inline-end: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 70; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 14px; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); color: white; }
.modal { position: fixed; inset: 0; background: rgba(16, 20, 16, .46); display: none; place-items: center; z-index: 80; padding: 18px; }
.modal.open { display: grid; }
.modal-card { width: min(460px, 100%); background: var(--bg-elev); border-radius: 20px; padding: 20px; }
.menu-toggle, .backdrop { display: none; }
.chart { display: flex; align-items: flex-end; gap: 8px; height: 160px; }
.chart i { display: block; flex: 1; background: linear-gradient(180deg, var(--brass), var(--brand-2)); border-radius: 8px 8px 3px 3px; min-height: 4px; position: relative; }
.chart i span { position: absolute; top: -18px; inset-inline-start: 0; font-size: 10px; color: var(--muted); }
.pos-mode .content { padding: 0 14px 14px; }
.pos-mode .topbar { padding-block: 10px; }
.pos {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 380px;
  gap: 12px;
  height: calc(100vh - 78px);
  min-height: 560px;
}
.pos-rail, .pos-stage, .pos-bill {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.pos-rail, .pos-bill { display: flex; flex-direction: column; overflow: hidden; }
.pos-rail { background: var(--sidebar); color: var(--sidebar-ink); border-color: transparent; }
.pos-kicker {
  margin: 0;
  padding: 16px 16px 8px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #b7c6bd;
}
.pos-rail-scroll, .pos-lines, .product-grid { overflow: auto; }
.pos-rail-scroll { padding: 0 12px 12px; }
.table-grid, .product-grid { display: grid; gap: 8px; }
.table-grid { grid-template-columns: 1fr 1fr; }
.product-grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); padding: 4px 2px 12px; align-content: start; }
.table-tile, .product, .order-chip, .cat, .sale-type {
  border: 1px solid transparent;
  cursor: pointer;
  text-align: start;
}
.table-tile {
  background: rgba(255,255,255,.04);
  color: #f4efe4;
  border-radius: 16px;
  padding: 12px 10px 10px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.table-tile b { font-family: var(--display); font-size: 26px; font-weight: 560; line-height: 1; }
.table-tile span { color: #c9d6ce; font-size: 12px; }
.table-tile .badge { margin-top: auto; align-self: flex-start; background: rgba(255,255,255,.08); color: #e7efe9; }
.table-tile.available { box-shadow: inset 0 0 0 1px rgba(143, 191, 164, .55); }
.table-tile.occupied { background: linear-gradient(180deg, #8a5a22, #5c3a16); }
.table-tile.reserved { background: #24343c; }
.sale-types, .order-list { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 14px; }
.sale-type, .order-chip {
  background: rgba(255,255,255,.06);
  color: #f6f3ea;
  border-radius: 14px;
  padding: 12px 14px;
}
.sale-type b, .order-chip b { display: block; }
.sale-type span, .order-chip span { color: #b7c6bd; font-size: 12px; }
.sale-type.primary { background: linear-gradient(160deg, #e7d3a1, #b8893a); color: #1b1710; }
.sale-type.primary span { color: #4a3b22; }
.pos-stage { display: flex; flex-direction: column; padding: 14px; background:
  radial-gradient(700px 180px at 100% 0%, rgba(184,137,58,.16), transparent 50%),
  var(--bg-elev);
}
.pos-search { display: flex; gap: 8px; }
.pos-search input {
  height: 52px;
  border-radius: 16px;
  padding-inline: 16px;
  font-size: 16px;
  background: var(--bg);
}
.cat-row { display: flex; gap: 8px; overflow: auto; padding: 12px 0; }
.cat {
  flex: none;
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
}
.cat.is-on { background: var(--brand); color: #f6f3ea; border-color: transparent; }
[data-theme="dark"] .cat.is-on { color: #102117; }
.pos-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pos-tools input { background: var(--bg); }
#modifiers { display: flex; flex-wrap: wrap; gap: 6px; }
#modifiers label {
  display: inline-flex; gap: 6px; align-items: center;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; background: var(--bg); font-size: 13px;
}
.product {
  position: relative;
  min-height: 132px;
  padding: 14px;
  border-radius: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform .15s ease, border-color .15s ease;
}
.product:hover { transform: translateY(-2px); border-color: var(--brass); }
.product .mark {
  width: 34px; height: 34px; border-radius: 11px; margin-bottom: 8px;
  background: #14352a; color: #f6f3ea; font-size: 12px;
}
[data-theme="dark"] .product .mark { background: #e7d3a1; color: #1b1710; }
.product b { font-size: 15px; line-height: 1.25; }
.product em { font-style: normal; color: var(--muted); font-size: 12px; }
.product .price {
  margin-top: auto;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 560;
  color: #8a6230;
}
[data-theme="dark"] .product .price { color: #e7d3a1; }
.pos-bill { background: var(--bg-elev); }
.pos-lines { flex: 1; padding: 8px 14px 0; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0 12px; }
.ticket-head b { font-family: var(--display); font-size: 22px; font-weight: 560; }
.ticket-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ticket-line > div:last-child { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ticket-line b { display: block; }
.ticket-line small { color: var(--muted); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button, .drop {
  width: 30px; height: 30px; border: 0; background: transparent; cursor: pointer;
}
.stepper span { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.drop { color: var(--danger); width: auto; padding: 0 4px; }
.line-total { text-align: end; font-variant-numeric: tabular-nums; }
.totals { margin: 8px 0 4px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--muted); }
.totals .grand { color: var(--ink); font-size: 20px; padding-top: 8px; }
.totals .grand b { font-family: var(--display); font-weight: 560; }
.pos-dock {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 65%, var(--bg-elev));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dock-grid .field span { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.dock-grid input, .dock-grid select { padding: 8px 10px; border-radius: 10px; background: var(--bg-elev); }
.pay-go { width: 100%; justify-content: center; min-height: 52px; font-size: 16px; border-radius: 14px; }
.pos-hint { margin: 0; color: var(--muted); font-size: 12px; }
.login-shell, .auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.login-brand {
  padding: 48px;
  color: #f4efe4;
  background:
    radial-gradient(900px 400px at 0% 0%, rgba(184, 137, 58, .45), transparent 50%),
    linear-gradient(165deg, #1b4636, #0d1d17 70%);
  display: flex; flex-direction: column; justify-content: space-between;
}
.login-brand h1 { font-family: var(--display); font-weight: 560; font-size: 64px; line-height: .95; margin: 0; }
.login-panel { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: min(440px, 100%); }
.check { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 1100px) {
  .grid-stats, .pos, .login-shell, .auth-shell, .grid-2 { grid-template-columns: 1fr; }
  .pos { height: auto; min-height: 0; }
  .pos-rail, .pos-stage, .pos-bill { min-height: 420px; }
}
@media (max-width: 860px) {
  .menu-toggle, .backdrop { display: inline-flex; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(-105%); transition: transform .2s ease; }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  .sidebar.open { transform: none; }
  .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .grid-stats, .grid-3 { grid-template-columns: 1fr 1fr; }
  .content, .topbar { padding-inline: 14px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head h1 { font-size: 28px; }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: white; color: black; }
  .receipt { width: 80mm; margin: 0 auto; font-size: 12px; }
  .receipt.paper-58 { width: 58mm; }
  .receipt.paper-a4 { width: 100%; }
  .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
