@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Cormorant+Garamond:ital,wght@0,500;1,500&display=swap');

:root {
  --serif: 'Playfair Display', Georgia, 'Iowan Old Style', serif;
  --script: 'Cormorant Garamond', Georgia, serif;

  --bg: #14120e;
  --bg-elev: #1b1812;
  --surface: #201c15;
  --surface-2: #262119;
  --border: rgba(201, 162, 39, 0.16);
  --border-strong: rgba(201, 162, 39, 0.32);
  --text: #f3ecdd;
  --text-dim: #b3a891;
  --text-faint: #7c7360;

  --gold: #c9a227;
  --gold-2: #e3c467;
  --gold-dark: #96770f;
  --gold-light: rgba(201, 162, 39, 0.16);

  --primary: var(--gold);
  --primary-dark: var(--gold-dark);
  --primary-light: var(--gold-light);

  --danger: #e2665c;
  --danger-light: rgba(226, 102, 92, 0.16);
  --warn: #d99a3d;
  --warn-light: rgba(217, 154, 61, 0.16);
  --ok: #4fae74;
  --ok-light: rgba(79, 174, 116, 0.16);

  --paper: #f8f3e6;
  --paper-text: #2a251c;

  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 26px -8px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 28px 60px -18px rgba(0, 0, 0, 0.75);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(700px 420px at 50% -120px, rgba(201, 162, 39, 0.14), transparent 70%),
    radial-gradient(500px 300px at 100% 100%, rgba(201, 162, 39, 0.05), transparent 70%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea, button { font-size: 16px; } /* iOS zoom oldini olish */

::selection { background: var(--gold-light); color: var(--gold-2); }

/* ---------------- Login ---------------- */

.login-body {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background-image: radial-gradient(640px 400px at 50% 4%, rgba(201, 162, 39, 0.22), transparent 70%);
}
.login-wrap { width: 100%; max-width: 360px; padding: 24px; }
.login-card {
  background: linear-gradient(165deg, var(--surface-2) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  position: relative;
}
.login-card::before {
  content: ''; position: absolute; top: 0; left: 14%; right: 14%; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
}
.login-mark {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(155deg, var(--gold-2), var(--gold-dark)); color: #1b1812;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 24px; margin-bottom: 10px;
  box-shadow: 0 10px 26px -6px rgba(201, 162, 39, 0.5), inset 0 0 0 1px rgba(255,255,255,0.25);
}
.login-boot p { margin: 0; }
.login-boot strong {
  font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: 0.02em; color: var(--text);
}
.login-boot .dim { color: var(--text-dim); font-size: 14px; margin-top: 6px; }
.login-label { font-size: 12px; color: var(--text-faint); margin-top: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.login-card input {
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2); color: var(--text); outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.login-card input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light); }
.login-card button {
  margin-top: 12px; padding: 13px; border-radius: var(--radius-sm); border: none;
  background: linear-gradient(155deg, var(--gold-2), var(--gold-dark)); color: #1b1812; font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase; font-size: 13px;
  box-shadow: var(--shadow-md);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease);
}
.login-card button:active { transform: scale(0.98); filter: brightness(0.95); }
.error-msg { color: var(--danger); font-size: 14px; min-height: 18px; }

/* ---------------- App shell ---------------- */

.app-body { padding-bottom: calc(var(--nav-h) + 16px); min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(20, 18, 14, 0.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.topbar h1 {
  font-family: var(--serif); font-size: 20px; font-weight: 700; margin: 0; letter-spacing: 0.01em;
}
.topbar .logout-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em;
  transition: border-color .15s var(--ease), color .15s var(--ease);
}
.topbar .logout-btn:active { border-color: var(--gold); color: var(--gold-2); }

main { max-width: 900px; margin: 0 auto; padding: 16px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h);
  background: rgba(20, 18, 14, 0.92); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 20px -8px rgba(0, 0, 0, 0.5);
  display: flex; z-index: 10;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--text-faint); font-size: 11px; min-height: 44px;
  transition: color .15s var(--ease);
}
.bottom-nav a .ic { font-size: 18px; }
.bottom-nav a.active { color: var(--gold-2); font-weight: 600; }

@media (min-width: 720px) {
  .bottom-nav {
    position: sticky; top: 0; height: auto; flex-direction: column; width: 200px;
    border-top: none; border-right: 1px solid var(--border); padding-top: 12px;
    box-shadow: none;
  }
  .bottom-nav a { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 10px 20px; font-size: 14px; }
  .app-shell { display: flex; }
  main { flex: 1; padding: 24px; margin: 0; max-width: 900px; }
  .app-body { padding-bottom: 0; }
}

/* ---------------- Cards / tables ---------------- */

.card {
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.card-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-title { font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; }
.card-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.badge.low { background: var(--danger-light); color: var(--danger); }
.badge.ok { background: var(--ok-light); color: var(--ok); }
.badge.debt { background: var(--warn-light); color: var(--warn); }

/* ---------------- Afitsiant "Tayyor" bildirishnomalari ---------------- */
/* public/app.js'dagi initWaiterNotifications() shu konteynerni topbar'dan keyin
   dinamik yaratadi (har waiter/*.html sahifada) — oshpaz taomni tayyor deb
   belgilagach, "Qabul qildim" tugmasi bosilmaguncha shu yerda turadi. */
.notif-list { padding: 10px 16px 0; display: flex; flex-direction: column; gap: 8px; max-width: 900px; margin: 0 auto; }
.notif-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--warn-light); border: 1px solid var(--warn); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; box-shadow: var(--shadow-sm);
}
.notif-card.done { background: var(--ok-light); border-color: var(--ok); }
.notif-card .notif-msg { color: var(--text); flex: 1; }
.notif-card .notif-ack { color: var(--ok); font-weight: 600; white-space: nowrap; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

@media (max-width: 640px) { .table-desktop { display: none; } }
@media (min-width: 641px) { .card-list-mobile { display: none; } }

/* ---------------- Forms ---------------- */

.form-grid { display: flex; flex-direction: column; gap: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-faint); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-light);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px; min-height: 44px;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), filter .15s var(--ease), border-color .15s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(155deg, var(--gold-2), var(--gold-dark)); border-color: var(--gold-dark); color: #1b1812;
  box-shadow: var(--shadow-sm); font-weight: 700; letter-spacing: 0.01em;
}
.btn.primary:active { filter: brightness(0.95); }
.btn.danger { background: rgba(226, 102, 92, 0.08); border-color: var(--danger); color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 13px; }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--nav-h) + 16px);
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(155deg, var(--gold-2), var(--gold-dark)); color: #1b1812; border: none; font-size: 26px;
  box-shadow: 0 12px 28px -6px rgba(201, 162, 39, 0.55);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
  z-index: 9;
}
.fab:active { transform: scale(0.94); }
@media (min-width: 720px) { .fab { bottom: 24px; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6, 5, 3, 0.65);
  display: flex; align-items: flex-end; justify-content: center; z-index: 20;
}
@media (min-width: 640px) { .modal-backdrop { align-items: center; } }
.modal {
  background: linear-gradient(165deg, var(--surface-2), var(--bg-elev)); border: 1px solid var(--border-strong);
  border-radius: 18px 18px 0 0; padding: 20px;
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 640px) { .modal { border-radius: var(--radius-lg); } }
.modal h2 { margin-top: 0; font-family: var(--serif); font-size: 19px; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }

.hidden { display: none !important; }
.dim { color: var(--text-dim); }
.text-right { text-align: right; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 480px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile {
  background: linear-gradient(165deg, var(--surface-2), var(--surface)); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm);
}
.stat-tile .label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-tile .value { font-family: var(--serif); font-size: 21px; font-weight: 700; margin-top: 6px; color: var(--gold-2); }

.tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; }
.tabs button {
  flex: 0 0 auto; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600; min-height: 44px; white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.tabs button.active { background: linear-gradient(155deg, var(--gold-2), var(--gold-dark)); color: #1b1812; border-color: var(--gold-dark); }

.toast {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--gold-dark);
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 14px; z-index: 50;
  box-shadow: var(--shadow-lg);
}
.toast.error { background: #2a1614; border-color: var(--danger); color: var(--text); }

.item-row { display: flex; gap: 8px; align-items: flex-end; border-bottom: 1px dashed var(--border); padding-bottom: 10px; margin-bottom: 10px; }
.item-row .field { flex: 1; }
.item-row .field.qty, .item-row .field.price { max-width: 90px; }
.item-row .remove-item { border: none; background: none; color: var(--danger); font-size: 20px; min-height: 44px; min-width: 32px; }

/* ---------------- Afitsiant: stollar tarmog'i ---------------- */

.table-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 480px) { .table-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 720px) { .table-grid { grid-template-columns: repeat(4, 1fr); } }

.table-tile {
  border-radius: var(--radius); padding: 18px 14px; min-height: 96px;
  display: flex; flex-direction: column; justify-content: space-between;
  border: 1px solid var(--border); background: linear-gradient(165deg, var(--surface-2), var(--surface));
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.table-tile:active { transform: scale(0.97); }
.table-tile.free { border-color: rgba(79, 174, 116, 0.45); background: linear-gradient(165deg, rgba(79, 174, 116, 0.12), var(--surface)); }
.table-tile.occupied { border-color: rgba(217, 154, 61, 0.45); background: linear-gradient(165deg, rgba(217, 154, 61, 0.14), var(--surface)); }
.table-tile .t-name { font-family: var(--serif); font-size: 18px; font-weight: 700; }
.table-tile .t-status { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.table-tile .t-total { font-size: 15px; font-weight: 700; margin-top: 8px; color: var(--gold-2); }
.table-tile.free .t-status { color: var(--ok); }
.table-tile.occupied .t-status { color: var(--warn); }

/* ---------------- Afitsiant: buyurtma ekrani ---------------- */

.order-total-bar {
  position: sticky; bottom: calc(var(--nav-h) + 12px); z-index: 8;
  background: linear-gradient(155deg, var(--gold-2), var(--gold-dark)); color: #1b1812; border-radius: var(--radius);
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 12px 28px -8px rgba(201, 162, 39, 0.55); margin-top: 12px;
}
@media (min-width: 720px) { .order-total-bar { bottom: 16px; } }
.order-total-bar .amount { font-size: 20px; font-weight: 700; }

.menu-item-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.menu-item-row .mi-name { font-weight: 600; }
.menu-item-row .mi-price { color: var(--text-dim); font-size: 13px; }
.menu-item-row .btn.add { min-width: 44px; }

.qty-stepper { display: flex; align-items: center; gap: 8px; }
.qty-stepper button {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 16px; font-weight: 700;
  transition: transform .15s var(--ease), border-color .15s var(--ease);
}
.qty-stepper button:active { transform: scale(0.92); }
.qty-stepper .qty-val { min-width: 24px; text-align: center; font-weight: 700; }

.order-line { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--border); gap: 8px; }
.order-line .ol-name { font-weight: 600; }
.order-line .ol-meta { font-size: 12px; color: var(--text-dim); }
.order-line .ol-subtotal { font-weight: 700; white-space: nowrap; color: var(--gold-2); }

/* ---------------- Chek (print-friendly, qog'oz ko'rinishi) ---------------- */

.receipt {
  background: var(--paper); color: var(--paper-text); border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius);
  padding: 24px; max-width: 380px; margin: 0 auto; font-size: 14px;
  box-shadow: var(--shadow-lg);
}
.receipt h2 { text-align: center; margin: 0 0 4px; font-family: var(--serif); font-weight: 700; letter-spacing: 0.02em; }
.receipt .r-sub { text-align: center; color: #6b6152; font-size: 12px; margin-bottom: 12px; font-family: var(--script); font-style: italic; font-size: 15px; }
.receipt table td { padding: 4px 2px; font-size: 13px; border-color: rgba(0,0,0,0.1); }
.receipt .r-total-row td { border-top: 2px solid var(--paper-text); font-weight: 700; font-size: 16px; }
.receipt hr { border: none; border-top: 1px dashed rgba(0,0,0,0.2); margin: 10px 0; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .receipt { border: none; box-shadow: none; max-width: 100%; }
  main { padding: 0; }
}

canvas { max-width: 100%; }
