:root {
  --bg: #140f0e;
  --bg-2: #1c1513;
  --surface: #241b18;
  --surface-2: #2d221e;
  --line: rgba(201, 168, 160, 0.22);
  --rose: #c9a8a0;
  --rose-deep: #a67f76;
  --gold: #d4b896;
  --cream: #f6efe6;
  --muted: #9a8a82;
  --burgundy: #7a3030;
  --olive: #7a8a62;
  --danger: #c45c5c;
  --ok: #8faf6e;
  --warn: #d4a05a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --ui: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--cream); }
body {
  font-family: var(--ui);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(201, 168, 160, 0.12), transparent 50%),
    radial-gradient(800px 500px at 110% 10%, rgba(122, 48, 48, 0.18), transparent 45%),
    var(--bg);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.app-hidden { display: none !important; }

#pin-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(12, 8, 7, 0.72);
  backdrop-filter: blur(10px);
}
.pin-card {
  width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
  text-align: center;
}
.pin-card img { height: 72px; width: auto; margin-bottom: 8px; }
.pin-card h1 { font-family: var(--font); font-weight: 500; font-size: 1.6rem; margin: 0 0 6px; }
.pin-card p { color: var(--muted); margin: 0 0 16px; }
.pin-display {
  letter-spacing: 0.45em;
  font-size: 1.5rem;
  min-height: 2rem;
  margin-bottom: 14px;
  color: var(--gold);
}
.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.pin-pad button, .btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 14px;
  padding: 14px 12px;
  color: var(--cream);
}
.pin-pad button:active, .btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #8b3a3a, #6a2828);
  border-color: #a04a4a;
  width: 100%;
}
.pin-error { color: var(--danger); min-height: 1.2em; font-size: 0.9rem; }

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 15, 14, 0.88);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { height: 52px; width: auto; }
.brand h1 {
  font-family: var(--font);
  font-size: 1.25rem;
  font-weight: 500;
  margin: 0;
}
.brand small { display: block; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; }
.badge-demo {
  border: 1px solid rgba(212, 184, 150, 0.45);
  color: var(--gold);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav button, .meal-toggle button, .lang-switch button, .tab-bar button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 10px;
}
.date-nav input[type="date"] {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 8px;
  color-scheme: dark;
}
.meal-toggle, .lang-switch, .tab-bar { display: flex; gap: 4px; }
.meal-toggle button.active, .lang-switch button.active, .tab-bar button.active {
  background: #3a2420;
  border-color: var(--rose-deep);
  color: var(--gold);
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}
.live .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
}
.live.on .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(143, 175, 110, 0.18); }

.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px 0;
}
.hours-note { color: var(--muted); font-size: 0.85rem; }
.banner {
  margin: 10px 18px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #3a2420;
  border: 1px solid rgba(212, 184, 150, 0.25);
  color: var(--gold);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.8fr);
  gap: 16px;
  padding: 16px 18px 28px;
}
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 420px;
}
.panel h2 {
  font-family: var(--font);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 0 0 12px;
}

.floor {
  display: grid;
  gap: 14px;
}
.zone {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 10px;
}
.zone header {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 8px;
}
.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}
.table-card {
  aspect-ratio: 1;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #3a2a22, #241812);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
  text-align: center;
}
.table-card.round { border-radius: 50%; }
.table-card.booked {
  background: linear-gradient(180deg, #6b2a2a, #3a1515);
  border-color: #c45c5c;
}
.table-card .label { font-weight: 650; color: var(--gold); }
.table-card .guest {
  font-size: 0.68rem;
  color: var(--cream);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-card .meta { font-size: 0.68rem; color: var(--muted); }

.res-list { display: flex; flex-direction: column; gap: 8px; }
.res-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 8px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.res-item time { color: var(--gold); font-weight: 650; }
.res-item .who { font-weight: 600; }
.res-item .sub { color: var(--muted); font-size: 0.8rem; }
.empty {
  color: var(--muted);
  text-align: center;
  padding: 36px 12px;
}

.stock-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.stock-table th, .stock-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
}
.pill.ok { background: rgba(143, 175, 110, 0.18); color: var(--ok); }
.pill.low { background: rgba(212, 160, 90, 0.18); color: var(--warn); }
.pill.out { background: rgba(196, 92, 92, 0.18); color: var(--danger); }

.fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: linear-gradient(180deg, #8b3a3a, #6a2828);
  color: var(--cream);
  box-shadow: var(--shadow);
  z-index: 15;
}

.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(8, 5, 4, 0.62);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 16px;
}
.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 32px);
  overflow: auto;
}
.modal h3 { font-family: var(--font); margin: 0 0 12px; }
.form-grid { display: grid; gap: 10px; }
.form-grid label { display: grid; gap: 4px; font-size: 0.82rem; color: var(--muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.form-actions { display: flex; gap: 8px; margin-top: 12px; }
.form-actions .btn { flex: 1; }
.danger { background: #4a1e1e; border-color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #2a2018;
  border: 1px solid var(--gold);
  color: var(--cream);
  padding: 10px 14px;
  border-radius: 12px;
  z-index: 50;
}

.footer-meta {
  padding: 0 18px 20px;
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.footer-meta img { height: 28px; opacity: 0.85; }

.skeleton {
  height: 88px;
  border-radius: 14px;
  background: linear-gradient(90deg, #241b18, #2d221e, #241b18);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; padding-bottom: 90px; }
  .app-header { flex-wrap: wrap; }
  .brand img { height: 42px; }
  .header-tools { width: 100%; justify-content: flex-start; }
}

/* Demo PINs on gate */
.pin-demo-codes {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.pin-demo-codes div {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.92rem;
}
.pin-demo-codes code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  color: #f3e6d8;
}

/* Pianzo demo footer */
.footer-meta {
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}
.footer-demo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 280px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.pianzo-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #0b0b0b;
}
.footer-demo-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.footer-demo-text strong {
  font-size: 0.95rem;
}
.footer-demo-text span {
  font-size: 0.8rem;
  color: var(--muted);
}
.footer-demo-link {
  margin-left: auto;
  color: #f3e6d8;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.footer-demo-link:hover { text-decoration: underline; }
.footer-resto {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  opacity: 0.85;
  font-size: 0.85rem;
}
