/* ============================================
   QR RESTAURANT — Warm Dark Slate Theme v2
   Easier on the eyes, clear contrast, modern
   ============================================ */

:root {
  /* Primary — soft amber/orange */
  --primary:        #f0a43a;
  --primary-dark:   #c97f1a;
  --primary-light:  #f8c46a;
  --primary-glow:   rgba(240, 164, 58, 0.15);
  --primary-glow-strong: rgba(240, 164, 58, 0.30);

  /* Backgrounds — warm slate (not pitch black) */
  --bg-base: #111318;
  --bg-01:   #161a22;
  --bg-02:   #1c2130;
  --bg-03:   #212638;
  --bg-04:   #283044;
  --bg-05:   #2f3a52;

  /* Borders — more visible */
  --border:       rgba(148, 163, 184, 0.10);
  --border-light: rgba(148, 163, 184, 0.18);
  --border-focus: rgba(240, 164, 58, 0.55);

  /* Text — warm whites */
  --text-primary:   #eef0f6;
  --text-secondary: #bdc5d9;
  --text-muted:     #8a96b0;
  --text-faint:     #5a6580;

  /* Semantic */
  --success:    #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --warning:    #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --error:      #f87171;
  --error-bg:   rgba(248, 113, 113, 0.12);
  --info:       #60a5fa;
  --info-bg:    rgba(96, 165, 250, 0.12);

  /* Radius */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  /* Shadows */
  --shadow-sm:      0 2px 8px  rgba(0,0,0,0.28);
  --shadow:         0 4px 20px rgba(0,0,0,0.38);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.48);
  --shadow-primary: 0 4px 24px rgba(240,164,58,0.24);

  /* Fonts */
  --font-thai: 'Prompt', sans-serif;
  --font-en:   'Inter', sans-serif;

  /* Transitions */
  --transition:      0.18s cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 0.32s cubic-bezier(0.4,0,0.2,1);
}

/* === RESET === */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; scroll-behavior:smooth; }
body {
  font-family: var(--font-thai);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family:inherit; cursor:pointer; border:none; outline:none; }
input,textarea,select { font-family:inherit; outline:none; }
img { max-width:100%; display:block; }
a { color:inherit; text-decoration:none; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--bg-05); border-radius:999px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-faint); }

/* === LOADING SCREEN === */
#loading-screen {
  position:fixed; inset:0; background:var(--bg-base);
  display:flex; align-items:center; justify-content:center;
  z-index:9999; transition:opacity var(--transition-slow),visibility var(--transition-slow);
}
#loading-screen.hidden { opacity:0; visibility:hidden; pointer-events:none; }
.loading-content { text-align:center; }
.loading-logo { font-size:60px; animation:pulse-float 2.2s ease-in-out infinite; margin-bottom:16px; }
.loading-brand { font-size:26px; font-weight:700; color:var(--primary); letter-spacing:-0.5px; margin-bottom:4px; }
.loading-sub { color:var(--text-muted); font-size:14px; margin-bottom:30px; }
.loading-bar-wrap { width:180px; height:3px; background:var(--bg-04); border-radius:999px; overflow:hidden; margin:0 auto; }
.loading-bar { height:100%; background:linear-gradient(90deg,var(--primary-dark),var(--primary-light)); border-radius:999px; animation:loading-progress 1.6s ease-in-out infinite; }

@keyframes loading-progress { 0%{width:0%;margin-left:0} 50%{width:80%;margin-left:0} 100%{width:0%;margin-left:100%} }
@keyframes pulse-float { 0%,100%{transform:translateY(0) scale(1)} 50%{transform:translateY(-8px) scale(1.04)} }

/* === UTILITIES === */
.hidden { display:none !important; }
.flex { display:flex; } .flex-col { flex-direction:column; }
.items-center { align-items:center; } .justify-center { justify-content:center; } .justify-between { justify-content:space-between; }
.gap-4{gap:4px} .gap-8{gap:8px} .gap-12{gap:12px} .gap-16{gap:16px}
.w-full{width:100%} .text-center{text-align:center}

/* === TOAST === */
#toast-container { position:fixed; top:20px; right:20px; z-index:9998; display:flex; flex-direction:column; gap:8px; pointer-events:none; }
.toast {
  display:flex; align-items:center; gap:10px; padding:12px 18px;
  background:var(--bg-03); border:1px solid var(--border-light);
  border-radius:var(--radius); box-shadow:var(--shadow-lg);
  font-size:14px; font-weight:500; pointer-events:auto;
  animation:toast-in 0.28s var(--transition) forwards;
  max-width:300px; backdrop-filter:blur(20px); color:var(--text-primary);
}
.toast.exit { animation:toast-out 0.28s forwards; }
.toast-icon { font-size:18px; flex-shrink:0; }
.toast-success { border-color:rgba(52,211,153,0.35); background:rgba(52,211,153,0.06); }
.toast-error   { border-color:rgba(248,113,113,0.35); background:rgba(248,113,113,0.06); }
.toast-info    { border-color:rgba(96,165,250,0.35);  background:rgba(96,165,250,0.06); }
.toast-warning { border-color:rgba(251,191,36,0.35);  background:rgba(251,191,36,0.06); }
@keyframes toast-in  { from{opacity:0;transform:translateX(16px)} to{opacity:1;transform:translateX(0)} }
@keyframes toast-out { from{opacity:1;transform:translateX(0)}    to{opacity:0;transform:translateX(16px)} }

/* === MODAL === */
#modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.65); backdrop-filter:blur(8px); z-index:900; animation:fade-in 0.2s ease; }
#modal-overlay.hidden { display:none; }
#modal-container { position:fixed; inset:0; z-index:901; display:flex; align-items:center; justify-content:center; padding:20px; pointer-events:none; }
#modal-container.hidden { display:none; }
.modal {
  background:var(--bg-02); border:1px solid var(--border-light);
  border-radius:var(--radius-xl); box-shadow:var(--shadow-lg);
  max-width:520px; width:100%; max-height:90dvh; overflow-y:auto;
  pointer-events:auto; animation:modal-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-header { padding:22px 24px 16px; display:flex; align-items:center; justify-content:space-between; border-bottom:1px solid var(--border); }
.modal-title { font-size:18px; font-weight:700; color:var(--text-primary); }
.modal-close { width:34px; height:34px; border-radius:50%; background:var(--bg-04); color:var(--text-muted); font-size:16px; display:flex; align-items:center; justify-content:center; transition:all var(--transition); cursor:pointer; }
.modal-close:hover { background:var(--error-bg); color:var(--error); }
.modal-body { padding:20px 24px 24px; }
@keyframes modal-in { from{opacity:0;transform:scale(0.93) translateY(18px)} to{opacity:1;transform:scale(1) translateY(0)} }
@keyframes fade-in  { from{opacity:0} to{opacity:1} }

/* === BUTTONS === */
.btn {
  display:inline-flex; align-items:center; justify-content:center;
  gap:7px; padding:10px 20px; border-radius:var(--radius);
  font-size:14px; font-weight:600; font-family:var(--font-thai);
  transition:all var(--transition); white-space:nowrap; cursor:pointer; letter-spacing:0.1px;
}
.btn-primary { background:linear-gradient(135deg,var(--primary-light),var(--primary-dark)); color:#1a1200; box-shadow:var(--shadow-primary); }
.btn-primary:hover { transform:translateY(-1px); box-shadow:0 6px 28px rgba(240,164,58,0.38); filter:brightness(1.07); }
.btn-primary:active { transform:translateY(0); }
.btn-secondary { background:var(--bg-04); color:var(--text-secondary); border:1px solid var(--border-light); }
.btn-secondary:hover { background:var(--bg-05); color:var(--text-primary); }
.btn-danger  { background:var(--error-bg);   color:var(--error);   border:1px solid rgba(248,113,113,0.3); }
.btn-danger:hover  { background:var(--error);   color:white; }
.btn-success { background:var(--success-bg); color:var(--success); border:1px solid rgba(52,211,153,0.3); }
.btn-success:hover { background:var(--success); color:#001a0e; }
.btn-ghost   { background:transparent; color:var(--text-muted); }
.btn-ghost:hover { background:var(--bg-04); color:var(--text-primary); }
.btn-sm  { padding:6px 14px; font-size:13px; border-radius:var(--radius-sm); }
.btn-lg  { padding:13px 28px; font-size:16px; border-radius:var(--radius-lg); }
.btn-full { width:100%; }
.btn-icon { width:38px; height:38px; border-radius:var(--radius); display:flex; align-items:center; justify-content:center; background:var(--bg-04); color:var(--text-muted); font-size:17px; transition:all var(--transition); cursor:pointer; border:1px solid var(--border); }
.btn-icon:hover { background:var(--bg-05); color:var(--text-primary); }

/* === FORM ELEMENTS === */
.form-group { margin-bottom:16px; }
.form-label { display:block; font-size:12px; font-weight:600; color:var(--text-muted); margin-bottom:7px; text-transform:uppercase; letter-spacing:0.6px; }
.form-input {
  width:100%; padding:11px 14px;
  background:var(--bg-04); border:1.5px solid var(--border-light);
  border-radius:var(--radius); color:var(--text-primary);
  font-size:14px; transition:all var(--transition); font-family:var(--font-thai); line-height:1.5;
}
.form-input:focus { border-color:var(--border-focus); background:var(--bg-05); box-shadow:0 0 0 3px var(--primary-glow); }
.form-input::placeholder { color:var(--text-faint); }
textarea.form-input { resize:vertical; min-height:80px; }
select.form-input { cursor:pointer; }

/* === CARDS === */
.card { background:var(--bg-03); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; transition:all var(--transition); }
.card:hover { border-color:var(--border-light); }

/* === BADGE === */
.badge { display:inline-flex; align-items:center; gap:4px; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; }
.badge-pending   { background:rgba(251,191,36,0.14);  color:#fcd34d; border:1px solid rgba(251,191,36,0.2); }
.badge-preparing { background:rgba(96,165,250,0.14);  color:#7ab8fa; border:1px solid rgba(96,165,250,0.2); }
.badge-ready     { background:rgba(52,211,153,0.14);  color:#5de0af; border:1px solid rgba(52,211,153,0.2); }
.badge-completed { background:rgba(100,116,139,0.14); color:#94a3b8; border:1px solid rgba(100,116,139,0.2); }
.badge-cancelled { background:rgba(248,113,113,0.14); color:#fca5a5; border:1px solid rgba(248,113,113,0.2); }

/* ==========================================
   SETUP WIZARD
   ========================================== */
.setup-container {
  min-height:100dvh; display:flex; align-items:center; justify-content:center; padding:20px;
  background:
    radial-gradient(ellipse at 25% 15%,rgba(240,164,58,0.07) 0%,transparent 55%),
    radial-gradient(ellipse at 75% 85%,rgba(96,165,250,0.05) 0%,transparent 55%),
    var(--bg-base);
}
.setup-box { background:var(--bg-02); border:1px solid var(--border-light); border-radius:var(--radius-xl); padding:40px; max-width:480px; width:100%; box-shadow:var(--shadow-lg); }
.setup-header { text-align:center; margin-bottom:32px; }
.setup-icon { font-size:52px; margin-bottom:14px; }
.setup-title { font-size:26px; font-weight:800; margin-bottom:8px; background:linear-gradient(135deg,var(--primary),var(--primary-light)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.setup-desc { color:var(--text-muted); font-size:14px; line-height:1.65; }
.setup-steps { display:flex; gap:6px; margin-bottom:28px; }
.setup-step-dot { flex:1; height:3px; border-radius:999px; background:var(--bg-05); transition:background var(--transition-slow); }
.setup-step-dot.active { background:var(--primary); }
.setup-step-dot.done   { background:var(--success); }
.setup-note { padding:13px 16px; background:var(--info-bg); border:1px solid rgba(96,165,250,0.2); border-radius:var(--radius); font-size:13px; color:#93c5fd; line-height:1.6; margin-bottom:18px; }
.setup-note strong { color:#7ab8fa; }
.setup-firebase-guide { background:var(--bg-04); border-radius:var(--radius); padding:16px; margin-bottom:18px; }
.setup-firebase-guide ol { padding-left:18px; }
.setup-firebase-guide li { font-size:13px; color:var(--text-muted); margin-bottom:8px; line-height:1.5; }
.setup-firebase-guide li a { color:var(--primary); }
.setup-firebase-guide code { font-size:12px; background:var(--bg-05); padding:2px 6px; border-radius:4px; color:#f8c46a; font-family:monospace; }

/* ==========================================
   HOME PAGE
   ========================================== */
.home-container {
  min-height:100dvh; display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:20px; text-align:center;
  background:radial-gradient(ellipse at 50% 30%,rgba(240,164,58,0.09) 0%,transparent 55%),var(--bg-base);
}
.home-icon { font-size:72px; margin-bottom:20px; animation:pulse-float 3s ease-in-out infinite; }
.home-title { font-size:36px; font-weight:800; margin-bottom:8px; }
.home-title span { background:linear-gradient(135deg,var(--primary),var(--primary-light)); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
.home-subtitle { color:var(--text-muted); font-size:15px; margin-bottom:38px; line-height:1.55; }
.home-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(185px,1fr)); gap:14px; max-width:640px; width:100%; }
.home-card { background:var(--bg-03); border:1px solid var(--border-light); border-radius:var(--radius-xl); padding:26px 20px; cursor:pointer; transition:all var(--transition-slow); }
.home-card:hover { border-color:var(--primary); transform:translateY(-4px); box-shadow:var(--shadow-primary); background:var(--bg-04); }
.home-card-icon { font-size:36px; margin-bottom:12px; }
.home-card-title { font-size:16px; font-weight:700; margin-bottom:4px; color:var(--text-primary); }
.home-card-desc { font-size:13px; color:var(--text-muted); line-height:1.4; }

/* ==========================================
   CUSTOMER VIEW
   ========================================== */
.customer-app { display:flex; flex-direction:column; height:100dvh; overflow:hidden; }

.customer-header {
  flex-shrink:0; padding:13px 18px;
  display:flex; align-items:center; justify-content:space-between;
  background:rgba(22,26,34,0.96); backdrop-filter:blur(20px);
  border-bottom:1px solid var(--border); position:sticky; top:0; z-index:100;
}
.customer-restaurant { font-size:16px; font-weight:700; color:var(--text-primary); }
.customer-table-badge { background:linear-gradient(135deg,var(--primary-light),var(--primary-dark)); color:#1a1200; font-weight:700; font-size:13px; padding:5px 14px; border-radius:999px; }
.cart-btn-wrap { position:relative; }
.cart-btn { width:42px; height:42px; background:var(--bg-04); border:1px solid var(--border-light); border-radius:var(--radius); display:flex; align-items:center; justify-content:center; font-size:21px; cursor:pointer; transition:all var(--transition); }
.cart-btn:hover { background:var(--bg-05); }
.cart-count { position:absolute; top:-6px; right:-6px; background:var(--primary); color:#1a1200; font-size:11px; font-weight:800; width:20px; height:20px; border-radius:50%; display:flex; align-items:center; justify-content:center; transition:transform 0.2s cubic-bezier(0.34,1.56,0.64,1); }
.cart-count.bump { transform:scale(1.45); }

.category-tabs { flex-shrink:0; display:flex; gap:8px; padding:12px 18px; overflow-x:auto; background:var(--bg-01); border-bottom:1px solid var(--border); scrollbar-width:none; }
.category-tabs::-webkit-scrollbar { display:none; }
.cat-tab { flex-shrink:0; padding:7px 18px; border-radius:999px; background:var(--bg-04); border:1.5px solid transparent; color:var(--text-muted); font-size:13px; font-weight:500; cursor:pointer; transition:all var(--transition); white-space:nowrap; font-family:var(--font-thai); }
.cat-tab:hover { color:var(--text-secondary); background:var(--bg-05); }
.cat-tab.active { background:var(--primary-glow); border-color:var(--primary); color:var(--primary); font-weight:600; }

.menu-scroll { flex:1; overflow-y:auto; padding:18px; background:var(--bg-base); }
.menu-section-title { font-size:17px; font-weight:700; margin-bottom:14px; display:flex; align-items:center; gap:8px; color:var(--text-primary); }
.menu-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(155px,1fr)); gap:12px; margin-bottom:28px; }
@media (min-width:540px) { .menu-grid { grid-template-columns:repeat(auto-fill,minmax(175px,1fr)); } }
@media (min-width:768px) { .menu-grid { grid-template-columns:repeat(auto-fill,minmax(195px,1fr)); } }

.menu-item { background:var(--bg-03); border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; cursor:pointer; transition:all var(--transition-slow); position:relative; }
.menu-item:hover { border-color:rgba(240,164,58,0.38); transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,0.35); }
.menu-item.unavailable { opacity:0.45; pointer-events:none; }
.menu-item-img { width:100%; aspect-ratio:4/3; object-fit:contain; background:var(--bg-04); }
.menu-item-img-placeholder { width:100%; aspect-ratio:4/3; background:linear-gradient(135deg,var(--bg-04),var(--bg-05)); display:flex; align-items:center; justify-content:center; font-size:38px; }
.menu-item-body { padding:12px 12px 6px 12px; }
.menu-item-name { font-size:14px; font-weight:600; margin-bottom:4px; line-height:1.35; color:var(--text-primary); }
.menu-item-desc { font-size:12px; color:var(--text-muted); margin-bottom:10px; line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.menu-item-footer { display:flex; align-items:center; justify-content:space-between; }
.menu-item-price { font-size:15px; font-weight:700; color:var(--primary); }
.menu-item-add { width:32px; height:32px; background:linear-gradient(135deg,var(--primary-light),var(--primary-dark)); color:#1a1200; border-radius:var(--radius-sm); display:flex; align-items:center; justify-content:center; font-size:20px; font-weight:700; transition:all var(--transition); }
.menu-item-add:hover { transform:scale(1.12); filter:brightness(1.1); }
.menu-item-badge { position:absolute; top:8px; left:8px; background:rgba(0,0,0,0.65); backdrop-filter:blur(8px); color:var(--text-muted); font-size:11px; padding:2px 8px; border-radius:999px; border:1px solid var(--border-light); }

.cart-bottom-bar { flex-shrink:0; padding:13px 18px; background:rgba(22,26,34,0.96); backdrop-filter:blur(20px); border-top:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; gap:16px; }
.cart-summary { font-size:13px; color:var(--text-muted); }
.cart-total-amount { font-size:20px; font-weight:700; color:var(--primary); }

.cart-modal { max-width:480px; }
.cart-item-row { display:flex; align-items:center; gap:12px; padding:13px 0; border-bottom:1px solid var(--border); }
.cart-item-row:last-child { border-bottom:none; }
.cart-item-img { width:50px; height:50px; border-radius:var(--radius-sm); object-fit:cover; background:var(--bg-04); flex-shrink:0; }
.cart-item-info { flex:1; min-width:0; }
.cart-item-name { font-size:14px; font-weight:600; margin-bottom:3px; color:var(--text-primary); }
.cart-item-price-unit { font-size:12px; color:var(--text-muted); }
.cart-item-subtotal { font-size:14px; font-weight:700; color:var(--primary); margin-right:8px; }
.qty-control { display:flex; align-items:center; gap:8px; margin-top:6px; }
.qty-btn { width:28px; height:28px; border-radius:var(--radius-sm); background:var(--bg-05); border:1px solid var(--border-light); color:var(--text-primary); font-size:16px; display:flex; align-items:center; justify-content:center; cursor:pointer; transition:all var(--transition); }
.qty-btn:hover { background:var(--primary-glow); border-color:var(--primary); color:var(--primary); }
.qty-num { font-size:15px; font-weight:700; min-width:22px; text-align:center; }
.cart-notes-input { margin-top:6px; width:100%; padding:6px 10px; background:var(--bg-04); border:1px solid var(--border-light); border-radius:var(--radius-sm); color:var(--text-primary); font-size:12px; font-family:var(--font-thai); resize:none; }
.cart-notes-input:focus { border-color:var(--border-focus); }
.cart-total-section { padding:16px 0 8px; border-top:1px solid var(--border-light); }
.cart-total-row { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }
.cart-total-label { color:var(--text-muted); font-size:14px; }
.cart-total-value { font-size:22px; font-weight:800; color:var(--primary); }

.order-status-container { padding:20px; text-align:center; }
.order-status-icon { font-size:60px; margin-bottom:14px; animation:pulse-float 2.2s ease-in-out infinite; }
.order-status-title { font-size:22px; font-weight:700; margin-bottom:8px; color:var(--text-primary); }
.order-status-desc { color:var(--text-muted); margin-bottom:28px; font-size:14px; }
.order-timeline { display:flex; flex-direction:column; gap:0; margin-bottom:28px; text-align:left; }
.timeline-item { display:flex; gap:16px; position:relative; }
.timeline-item:not(:last-child)::before { content:''; position:absolute; left:19px; top:40px; bottom:-4px; width:2px; background:var(--border); }
.timeline-item.done::before { background:linear-gradient(to bottom,var(--primary),var(--border)); }
.timeline-dot { width:40px; height:40px; border-radius:50%; background:var(--bg-04); border:2px solid var(--border-light); display:flex; align-items:center; justify-content:center; font-size:17px; flex-shrink:0; margin-bottom:20px; transition:all var(--transition-slow); }
.timeline-item.done   .timeline-dot { background:var(--primary-glow); border-color:var(--primary); }
.timeline-item.active .timeline-dot { background:var(--primary-glow-strong); border-color:var(--primary); animation:pulse-ring 1.6s ease-in-out infinite; }
.timeline-text { padding-top:8px; }
.timeline-label { font-size:14px; font-weight:600; margin-bottom:2px; color:var(--text-primary); }
.timeline-sub { font-size:12px; color:var(--text-muted); }
@keyframes pulse-ring { 0%{box-shadow:0 0 0 0 var(--primary-glow-strong)} 70%{box-shadow:0 0 0 10px transparent} 100%{box-shadow:0 0 0 0 transparent} }

/* ==========================================
   KITCHEN VIEW
   ========================================== */
.kitchen-app { min-height:100dvh; background:var(--bg-base); display:flex; flex-direction:column; }
.kitchen-header { background:linear-gradient(135deg,#1a2235,#212d44); border-bottom:1px solid var(--border-light); padding:14px 22px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; gap:12px; flex-wrap:wrap; }
.kitchen-header-left { display:flex; flex-direction:column; }
.kitchen-title { font-size:20px; font-weight:800; display:flex; align-items:center; gap:10px; color:var(--text-primary); }
.kitchen-live { width:8px; height:8px; background:var(--success); border-radius:50%; animation:pulse-ring 1.6s ease-in-out infinite; }
.kitchen-subtitle { font-size:13px; color:var(--text-muted); margin-top:2px; }
.kitchen-stats { display:flex; gap:10px; }
.kitchen-stat { text-align:center; background:rgba(255,255,255,0.06); border:1px solid var(--border-light); border-radius:var(--radius); padding:8px 14px; }
.kitchen-stat-num { font-size:20px; font-weight:800; }
.kitchen-stat-label { font-size:10px; color:var(--text-muted); text-transform:uppercase; letter-spacing:0.5px; margin-top:1px; }

.kitchen-board { flex:1; display:grid; grid-template-columns:repeat(3,1fr); gap:16px; padding:18px 20px; overflow-y:auto; }
@media (max-width:900px)  { .kitchen-board { grid-template-columns:1fr; } }
@media (min-width:900px) and (max-width:1200px) { .kitchen-board { grid-template-columns:repeat(2,1fr); } }

.kitchen-column { display:flex; flex-direction:column; gap:10px; }
.kitchen-col-header { padding:10px 14px; border-radius:var(--radius); font-size:13px; font-weight:700; display:flex; align-items:center; justify-content:space-between; text-transform:uppercase; letter-spacing:0.6px; position:sticky; top:0; }
.col-pending   .kitchen-col-header { background:rgba(251,191,36,0.12);  border:1px solid rgba(251,191,36,0.22);  color:#fcd34d; }
.col-preparing .kitchen-col-header { background:rgba(96,165,250,0.12);  border:1px solid rgba(96,165,250,0.22);  color:#7ab8fa; }
.col-ready     .kitchen-col-header { background:rgba(52,211,153,0.12);  border:1px solid rgba(52,211,153,0.22);  color:#5de0af; }

.kitchen-order-card { background:var(--bg-03); border:1px solid var(--border); border-radius:var(--radius-lg); padding:14px; transition:all var(--transition); animation:card-in 0.38s cubic-bezier(0.34,1.56,0.64,1); }
.kitchen-order-card:hover { border-color:var(--border-light); transform:translateY(-2px); box-shadow:var(--shadow); }
@keyframes card-in { from{opacity:0;transform:scale(0.92) translateY(-8px)} to{opacity:1;transform:scale(1) translateY(0)} }
.kitchen-card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.kitchen-table { font-size:17px; font-weight:800; color:var(--text-primary); }
.kitchen-time { font-size:12px; color:var(--text-muted); }
.kitchen-items { margin-bottom:12px; }
.kitchen-item-row { display:flex; justify-content:space-between; align-items:center; padding:6px 0; border-bottom:1px solid var(--border); }
.kitchen-item-row:last-child { border-bottom:none; }
.kitchen-item-name { font-size:14px; color:var(--text-secondary); }
.kitchen-item-qty { font-size:18px; font-weight:800; color:var(--primary); min-width:28px; text-align:right; }
.kitchen-item-notes { font-size:12px; color:var(--text-muted); font-style:italic; padding-bottom:4px; }
.kitchen-action-btn { width:100%; padding:10px; border-radius:var(--radius); font-size:14px; font-weight:700; font-family:var(--font-thai); transition:all var(--transition); cursor:pointer; border:none; }
.action-accept  { background:rgba(251,191,36,0.12); color:#fcd34d; border:1px solid rgba(251,191,36,0.25); }
.action-accept:hover  { background:var(--primary); color:#1a1200; }
.action-ready   { background:rgba(96,165,250,0.12); color:#7ab8fa; border:1px solid rgba(96,165,250,0.25); }
.action-ready:hover   { background:var(--info); color:white; }
.action-complete { background:rgba(52,211,153,0.12); color:#5de0af; border:1px solid rgba(52,211,153,0.25); }
.action-complete:hover { background:var(--success); color:#001a0e; }
.kitchen-empty { text-align:center; padding:40px 20px; color:var(--text-faint); font-size:14px; }

/* ==========================================
   ADMIN VIEW
   ========================================== */
.admin-app { display:flex; height:100dvh; overflow:hidden; }

.admin-sidebar { width:238px; flex-shrink:0; background:var(--bg-01); border-right:1px solid var(--border); display:flex; flex-direction:column; overflow:hidden; }
.sidebar-brand { padding:22px 18px 16px; border-bottom:1px solid var(--border); background:linear-gradient(160deg,var(--bg-02),var(--bg-01)); }
.sidebar-logo { font-size:26px; margin-bottom:4px; }
.sidebar-name { font-size:15px; font-weight:700; line-height:1.25; color:var(--text-primary); }
.sidebar-role { font-size:11px; color:var(--primary); background:var(--primary-glow); padding:2px 8px; border-radius:999px; display:inline-block; margin-top:5px; }
.sidebar-nav { flex:1; padding:10px 8px; overflow-y:auto; }
.nav-section-label { font-size:10px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:1px; padding:10px 10px 4px; }
.nav-item { display:flex; align-items:center; gap:9px; padding:9px 12px; border-radius:var(--radius); cursor:pointer; transition:all var(--transition); color:var(--text-muted); font-size:14px; font-weight:500; margin-bottom:1px; border:none; background:none; width:100%; font-family:var(--font-thai); text-align:left; }
.nav-item:hover { background:var(--bg-04); color:var(--text-primary); }
.nav-item.active { background:var(--primary-glow); color:var(--primary); font-weight:600; border:1px solid var(--primary-glow-strong); }
.nav-item-icon { font-size:17px; width:22px; text-align:center; }
.sidebar-footer { padding:10px 8px; border-top:1px solid var(--border); }

.mobile-menu-btn { display:none; position:fixed; top:14px; left:14px; z-index:200; width:42px; height:42px; background:var(--bg-03); border:1px solid var(--border-light); border-radius:var(--radius); align-items:center; justify-content:center; font-size:20px; cursor:pointer; }
@media (max-width:768px) {
  .mobile-menu-btn { display:flex; }
  .admin-sidebar { position:fixed; left:-240px; top:0; bottom:0; z-index:300; transition:left var(--transition-slow); }
  .admin-sidebar.open { left:0; box-shadow:var(--shadow-lg); }
  .sidebar-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:299; }
  .sidebar-overlay.open { display:block; }
}

.admin-main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.admin-topbar { flex-shrink:0; padding:15px 26px; background:var(--bg-02); border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.admin-page-title { font-size:20px; font-weight:800; color:var(--text-primary); }
.admin-page-subtitle { font-size:13px; color:var(--text-muted); margin-top:2px; }
.admin-content { flex:1; overflow-y:auto; padding:24px; background:var(--bg-base); }

.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(175px,1fr)); gap:14px; margin-bottom:24px; }
.stat-card { background:var(--bg-03); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; position:relative; overflow:hidden; transition:all var(--transition); }
.stat-card:hover { border-color:var(--border-light); transform:translateY(-2px); box-shadow:var(--shadow); }
.stat-card::before { content:''; position:absolute; top:-10px; right:-10px; width:64px; height:64px; border-radius:50%; opacity:0.10; }
.stat-revenue::before { background:var(--primary); } .stat-orders::before { background:var(--info); }
.stat-pending::before { background:var(--warning); } .stat-tables::before { background:var(--success); }
.stat-icon { font-size:26px; margin-bottom:12px; }
.stat-value { font-size:26px; font-weight:800; margin-bottom:4px; letter-spacing:-0.5px; }
.stat-label { font-size:12px; color:var(--text-muted); }

.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; }
.section-title { font-size:17px; font-weight:700; color:var(--text-primary); }

.menu-admin-tabs { display:flex; gap:6px; margin-bottom:18px; overflow-x:auto; padding-bottom:2px; }
.menu-admin-tab { flex-shrink:0; padding:7px 16px; border-radius:999px; background:var(--bg-04); border:1.5px solid transparent; color:var(--text-muted); font-size:13px; font-weight:500; cursor:pointer; transition:all var(--transition); font-family:var(--font-thai); }
.menu-admin-tab:hover { color:var(--text-secondary); }
.menu-admin-tab.active { background:var(--primary-glow); border-color:var(--primary); color:var(--primary); font-weight:600; }

.admin-menu-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(225px,1fr)); gap:14px; }
.admin-menu-card { background:var(--bg-03); border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; transition:all var(--transition); }
.admin-menu-card:hover { border-color:var(--border-light); }
.admin-menu-img { width:100%; aspect-ratio:16/9; object-fit:cover; background:var(--bg-04); }
.admin-menu-img-placeholder { width:100%; aspect-ratio:16/9; background:linear-gradient(135deg,var(--bg-04),var(--bg-05)); display:flex; align-items:center; justify-content:center; font-size:34px; }
.admin-menu-info { padding:13px; }
.admin-menu-name { font-size:14px; font-weight:700; margin-bottom:4px; color:var(--text-primary); }
.admin-menu-cat { font-size:12px; color:var(--text-muted); margin-bottom:8px; }
.admin-menu-footer { display:flex; align-items:center; justify-content:space-between; }
.admin-menu-price { font-size:17px; font-weight:800; color:var(--primary); }
.admin-menu-actions { display:flex; gap:6px; }
.avail-toggle { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-muted); padding:8px 13px; border-top:1px solid var(--border); background:var(--bg-04); }
.toggle { width:36px; height:20px; background:var(--bg-05); border-radius:999px; position:relative; cursor:pointer; transition:background var(--transition); flex-shrink:0; }
.toggle.on { background:var(--success); }
.toggle::after { content:''; position:absolute; top:2px; left:2px; width:16px; height:16px; background:white; border-radius:50%; transition:transform var(--transition); box-shadow:0 1px 4px rgba(0,0,0,0.35); }
.toggle.on::after { transform:translateX(16px); }

.tables-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(185px,1fr)); gap:14px; }
.table-qr-card { background:var(--bg-03); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px; text-align:center; transition:all var(--transition); }
.table-qr-card:hover { border-color:var(--primary); }
.table-qr-num { font-size:18px; font-weight:800; margin-bottom:12px; color:var(--text-primary); }
.table-qr-code { margin:0 auto 12px; }
.table-qr-url { font-size:11px; color:var(--text-faint); word-break:break-all; margin-bottom:12px; }

.orders-table { width:100%; border-collapse:collapse; }
.orders-table th { text-align:left; padding:10px 14px; font-size:11px; font-weight:700; color:var(--text-faint); text-transform:uppercase; letter-spacing:0.6px; border-bottom:1px solid var(--border); background:var(--bg-03); }
.orders-table td { padding:12px 14px; font-size:14px; border-bottom:1px solid var(--border); vertical-align:middle; color:var(--text-secondary); }
.orders-table tr:hover td { background:var(--bg-04); }
.orders-table tr:last-child td { border-bottom:none; }

.settings-section { margin-bottom:28px; }
.settings-section-title { font-size:15px; font-weight:700; margin-bottom:16px; padding-bottom:10px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:8px; color:var(--text-primary); }
.settings-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:14px; }
.color-picker-wrap { display:flex; align-items:center; gap:12px; }
.color-preview { width:40px; height:40px; border-radius:var(--radius); border:2px solid var(--border-light); overflow:hidden; }
.color-preview input[type=color] { width:100%; height:100%; border:none; padding:0; cursor:pointer; background:none; }

.receipt-preview { background:white; color:#000; max-width:380px; margin:0 auto; padding:20px; font-family:'Courier New',monospace; font-size:13px; border-radius:var(--radius); border:1px solid var(--border-light); }
.receipt-header { text-align:center; margin-bottom:16px; padding-bottom:12px; border-bottom:1px dashed #bbb; }
.receipt-shop-name { font-size:18px; font-weight:800; }
.receipt-info { font-size:12px; color:#555; margin-top:4px; }
.receipt-row { display:flex; justify-content:space-between; padding:3px 0; }
.receipt-row.header { font-weight:700; border-bottom:1px solid #000; padding-bottom:4px; margin-bottom:4px; }
.receipt-divider { border:none; border-top:1px dashed #bbb; margin:10px 0; }
.receipt-total-row { display:flex; justify-content:space-between; font-weight:800; font-size:15px; border-top:1px solid #000; padding-top:6px; }
.receipt-footer { text-align:center; margin-top:14px; font-size:12px; color:#777; }
@media print {
  body * { visibility:hidden; }
  .print-receipt,.print-receipt * { visibility:visible; }
  .print-receipt { position:absolute; top:0; left:0; width:80mm; background:white; color:black; font-family:'Courier New',monospace; font-size:12px; padding:8mm; }
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width:600px) {
  .setup-box { padding:24px 18px; }
  .admin-topbar { padding:13px 18px; }
  .admin-content { padding:16px; }
  .kitchen-board { padding:14px; }
  .kitchen-header { padding:12px 14px; flex-wrap:wrap; gap:10px; }
  .kitchen-stats { flex-wrap:wrap; gap:6px; }
  #toast-container { top:10px; right:10px; }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
.fade-in  { animation:fade-in  0.38s ease forwards; }
.slide-up { animation:slide-up 0.38s cubic-bezier(0.34,1.56,0.64,1) forwards; }
@keyframes slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }
@keyframes spin { to { transform:rotate(360deg); } }

.spinner { width:38px; height:38px; border:3px solid var(--bg-05); border-top-color:var(--primary); border-radius:50%; animation:spin 0.65s linear infinite; }
.loading-center { display:flex; flex-direction:column; align-items:center; justify-content:center; padding:60px 20px; gap:14px; color:var(--text-muted); }

.empty-state { text-align:center; padding:54px 20px; }
.empty-state-icon { font-size:50px; margin-bottom:14px; opacity:0.42; }
.empty-state-title { font-size:18px; font-weight:700; margin-bottom:8px; color:var(--text-primary); }
.empty-state-desc { color:var(--text-muted); font-size:14px; margin-bottom:22px; }

.img-preview-wrap { position:relative; }
.img-preview { width:100%; height:140px; object-fit:cover; border-radius:var(--radius); border:1px solid var(--border); background:var(--bg-04); }
.img-preview-placeholder { width:100%; height:140px; background:var(--bg-04); border:2px dashed var(--border-light); border-radius:var(--radius); display:flex; flex-direction:column; align-items:center; justify-content:center; color:var(--text-faint); font-size:13px; gap:6px; }
.img-preview-placeholder span { font-size:30px; }

.order-detail-items { margin:12px 0; }
.order-detail-item { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid var(--border); font-size:14px; color:var(--text-secondary); }
.order-detail-item:last-child { border-bottom:none; }
