:root {
  --bg: #f4efe6;
  --bg-2: #fffaf3;
  --ink: #1c1915;
  --muted: #6d655b;
  --line: #e4d8c6;
  --brand: #9a3b24;
  --brand-2: #c45c38;
  --gold: #c9a227;
  --ok: #2f6d4f;
  --warn: #a15c12;
  --card: #fffdf8;
  --shadow: 0 14px 40px rgba(73, 49, 28, 0.08);
  --radius: 20px;
  --sidebar: #221c16;
  --sidebar-text: #f6ead8;
  --sidebar-hover: #3a2f26;
  --surface-2: #efe4d4;
  --customer-top: #fbf4ea;
  --wash-1: #f3d9b4;
  --wash-2: #ead3c0;
  --kitchen-bg: #161311;
  --kitchen-col: #221c16;
  --kitchen-ticket: #2c241c;
  --kitchen-line: #3a2f26;
  --font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }

.page-auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(circle at 10% 10%, var(--wash-1, #f3d9b4), transparent 28%),
    radial-gradient(circle at 90% 0%, var(--wash-2, #ead3c0), transparent 24%),
    var(--bg);
}
.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px;
  box-shadow: var(--shadow);
}
.eyebrow { letter-spacing: 0.16em; text-transform: uppercase; font-size: 11px; color: var(--brand); font-weight: 700; }
h1, h2, h3, h4 { font-family: var(--font); margin: 0 0 10px; }
.muted { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 16px; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 700;
}
.btn.secondary { background: var(--surface-2); color: var(--ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.tiny { padding: 7px 10px; font-size: 12px; }
.btn.danger { background: #8d2a22; }
.btn.ok { background: var(--ok); }

.flash { padding: 10px 12px; border-radius: 12px; margin-bottom: 14px; }
.flash.ok { background: #e7f4ec; color: #21553a; }
.flash.err { background: #fde8e4; color: #7a261d; }

.admin-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text, #f6ead8); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 18px;
}
.brand { font-family: var(--font); font-size: 24px; }
.brand-logo {
  width: 44px; height: 44px; object-fit: cover; border-radius: 12px;
  background: var(--surface-2); display: block; flex-shrink: 0;
}
.brand-logo.lg { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 14px; }
.sidebar-logo { width: 48px; height: 48px; border-radius: 14px; margin: 8px 0; }
.customer-brand { display: flex; gap: 10px; align-items: center; }
.logo-preview { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.logo-preview .brand-logo { width: 88px; height: 88px; border-radius: 20px; }
.nav a {
  display: block; padding: 10px 12px; border-radius: 12px; color: #e8d8c3; margin-bottom: 4px;
}
.nav a.active, .nav a:hover { background: var(--sidebar-hover, #3a2f26); color: #fff; }
.main { padding: 28px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 22px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
.badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); font-size: 12px; }
.badge.on { background: #e4f2e9; color: #21553a; }
.badge.off { background: #f3e2de; color: #7a261d; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.check { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.step { padding: 6px 10px; border-radius: 999px; background: var(--surface-2); font-size: 12px; }
.step.on { background: var(--brand); color: #fff; }

.customer-shell {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
}
.customer-top {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--customer-top); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.lang-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.lang-switch button, .lang-switch span {
  border: 0; background: var(--surface-2); border-radius: 999px; padding: 6px 10px; cursor: pointer; font-size: 12px;
}
.lang-switch .on { background: var(--brand); color: #fff; }
.customer-main { width: min(880px, 100%); margin: 0 auto; padding: 18px 16px 120px; }
.customer-main.has-service { padding-bottom: 176px; }
.chips { display: flex; gap: 8px; overflow: auto; padding-bottom: 8px; }
.chip { white-space: nowrap; padding: 8px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.product-photo {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 14px; background: var(--surface-2); display: block;
}
.product-thumb, .product-thumb-lg {
  object-fit: cover; border-radius: 10px; background: var(--surface-2); display: block;
}
.product-thumb { width: 48px; height: 48px; }
.product-thumb-lg { width: 160px; height: 120px; margin-bottom: 8px; }
.product-row { display: flex; gap: 10px; align-items: center; }
.price { font-weight: 800; color: var(--brand); }
.old-price { text-decoration: line-through; color: var(--muted); margin-inline-end: 6px; }
.cart-bar {
  position: fixed; inset-inline: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--sidebar); color: #fff;
}
.service-bar {
  position: fixed; inset-inline: 0; bottom: 48px; z-index: 6;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 8px 16px 10px; background: var(--card); border-top: 1px solid var(--line);
}
.service-bar .btn { width: 100%; }
.service-bar .btn:disabled { opacity: 0.65; cursor: default; }
.option-block { margin: 8px 0; padding: 8px; border: 1px dashed var(--line); border-radius: 12px; }
.track { display: grid; gap: 10px; }
.track-step { padding: 12px; border-radius: 14px; background: var(--surface-2); }
.track-step.on { background: #e7f4ec; }

.kitchen-shell { min-height: 100vh; background: var(--kitchen-bg, #161311); color: var(--sidebar-text, #f6ead8); }
.kitchen-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--kitchen-line, #3a2f26); }
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px; }
.col { background: var(--kitchen-col, #221c16); border-radius: 16px; padding: 12px; min-height: 70vh; }
.ticket { background: var(--kitchen-ticket, #2c241c); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.ticket h3 { font-size: 18px; }
.pin-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pin-form input { width: 88px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; }
.kitchen-tables {
  display: flex; gap: 10px; overflow: auto; padding: 12px 20px;
  border-bottom: 1px solid var(--kitchen-line, #3a2f26);
}
.kitchen-table {
  min-width: 140px; background: var(--kitchen-ticket, #2c241c); border-radius: 14px; padding: 10px 12px;
  display: grid; gap: 6px;
}
.kitchen-table.on { background: #243328; }
.kitchen-tools { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.kitchen-tools label { display: grid; gap: 4px; }
.kitchen-tools select {
  border: 1px solid var(--kitchen-line, #3a2f26); background: var(--kitchen-ticket, #2c241c);
  color: inherit; border-radius: 10px; padding: 8px 10px;
}
.kitchen-requests {
  margin: 12px 20px; padding: 12px; border-radius: 16px;
  background: var(--kitchen-col, #221c16);
}
.kitchen-requests h2 { font-size: 16px; display: flex; gap: 8px; align-items: center; }
.kitchen-requests [data-request-tickets] { display: flex; gap: 10px; flex-wrap: wrap; }
.request-ticket {
  min-width: 180px; background: #3a2a18; border-radius: 14px; padding: 12px;
  display: grid; gap: 6px;
}
.request-ticket.bill { background: #243044; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.theme-card {
  border: 2px solid var(--line); border-radius: 16px; padding: 12px; cursor: pointer;
  background: #fff; text-align: start; color: inherit;
}
.theme-card.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.theme-swatch { display: flex; height: 42px; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.theme-swatch span { flex: 1; }
.theme-preview {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 16px; padding: 16px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--line);
}
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type="color"] {
  width: 46px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.color-row input[type="text"], .color-row input:not([type="color"]) { flex: 1; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 4; }
  .grid-2, .grid-3, .board { grid-template-columns: 1fr; }
}
