/*
 * Viber Order Bot — Ultra Premium CSS v2.1
 * FIXED: Hardcoded gradient values (no nested CSS vars)
 * FIXED: Responsive layout
 * FIXED: Light + dark themes
 */

/* ══════════════════════════════════════════════
   CSS RESET
══════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ══════════════════════════════════════════════
   CUSTOM PROPERTIES
══════════════════════════════════════════════ */

/* ── DARK (default) ── */
:root {
  /* Brand — hardcoded, no nested vars */
  --purple:        #7c3aed;
  --pink:          #ec4899;

  /* Dark surfaces */
  --bg:            #0b0b18;
  --surface:       #14142a;
  --surface2:      #1a1a32;
  --surface3:      #201e3c;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.14);

  /* Text */
  --text:          #e8e8f5;
  --text2:         #9090b8;
  --muted:         #5c5c80;

  /* Status */
  --ok:            #10b981;
  --warn:          #f59e0b;
  --err:           #ef4444;
  --info:          #3b82f6;

  /* Misc */
  --r-xs:  6px;
  --r-sm:  10px;
  --r:     16px;
  --r-lg:  22px;
  --r-xl:  32px;
  --dur:   180ms;
  --ease:  cubic-bezier(.4,0,.2,1);

  --sidebar-w: 320px;
}

/* ── LIGHT override ── */
[data-theme="light"] {
  --bg:            #f0edff;
  --surface:       #ffffff;
  --surface2:      #f8f5ff;
  --surface3:      #eeeaff;
  --border:        rgba(124,58,237,0.12);
  --border-strong: rgba(124,58,237,0.24);
  --text:          #16162a;
  --text2:         #44446a;
  --muted:         #7070a0;
}

/* ══════════════════════════════════════════════
   BASE
══════════════════════════════════════════════ */
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 15% 0%,   rgba(124,58,237,0.14) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 85% 100%,  rgba(236,72,153,0.09) 0%, transparent 70%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-decoration: none; }
a:hover { opacity: 0.85; }
strong { font-weight: 700; }

h1 { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.1rem;  font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }

.muted { color: var(--muted) !important; }
.small { font-size: .8rem !important; }

code {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  background: var(--surface3);
  padding: 2px 7px;
  border-radius: var(--r-xs);
  font-size: .8em;
}

/* ══════════════════════════════════════════════
   GRADIENT UTILITIES  (hardcoded — no var nesting)
══════════════════════════════════════════════ */
.grad-bg {
  background: linear-gradient(135deg, #7c3aed, #ec4899) !important;
  color: #fff !important;
}
.grad-text {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Fallback for Firefox < 122 */
  color: #7c3aed;
}

/* ══════════════════════════════════════════════
   LAYOUT SHELL
══════════════════════════════════════════════ */
.shell {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ══════════════════════════════════════════════
   TOPBAR
══════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  /* FIXED: direct gradient, no CSS vars */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  box-shadow: 0 4px 20px rgba(124,58,237,0.45);
}

.topbar-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
  /* gradient text */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #7c3aed; /* fallback */
}
.topbar-sub { font-size: .72rem; color: var(--muted); margin-top: 1px; }

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════
   CARDS
══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 40px rgba(124,58,237,0.08);
}

[data-theme="light"] .card {
  box-shadow: 0 4px 20px rgba(124,58,237,0.07), 0 1px 3px rgba(0,0,0,0.06);
}
[data-theme="light"] .card:hover {
  box-shadow: 0 8px 32px rgba(124,58,237,0.12);
}

.card-sm { max-width: 440px; width: 100%; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.card-title {
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text2);
}
.card-actions { display: flex; align-items: center; gap: 8px; }

/* ══════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  text-decoration: none;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  line-height: 1.2;
  -webkit-user-select: none;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  vertical-align: middle;
}
.btn:hover {
  background: var(--surface3);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-decoration: none;
  color: var(--text);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* FIXED: Direct gradient — no CSS var nesting */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #ec4899) !important;
  border-color: transparent !important;
  color: #fff !important;
  box-shadow: 0 4px 18px rgba(124,58,237,0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #6d28d9, #db2777) !important;
  color: #fff !important;
  box-shadow: 0 6px 26px rgba(124,58,237,0.55);
  border-color: transparent !important;
}

.btn-danger { border-color: rgba(239,68,68,0.3); color: var(--err); }
.btn-danger:hover { background: rgba(239,68,68,0.12); color: var(--err); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); border-color: var(--border); }

.btn-icon { padding: 9px 10px; min-width: 38px; justify-content: center; }
.btn-sm   { padding: 6px 12px; font-size: .8rem; }
.btn-lg   { padding: 13px 22px; font-size: 1rem; }
.btn-xl   { padding: 16px 32px; font-size: 1.05rem; border-radius: var(--r); }
.btn-full { width: 100%; display: flex; }

/* ══════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════ */
.form { display: grid; gap: 16px; }
.form-group { display: grid; gap: 6px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; align-items: end; }

.form-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text2);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  font-family: inherit;
  font-size: .95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface2);
  color: var(--text);
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
}
.form-input::placeholder { color: var(--muted); }
.form-input-lg { font-size: 1.3rem; font-weight: 800; padding: 14px 16px; }

[data-theme="light"] .form-input { background: #fff; border-color: rgba(124,58,237,0.2); }

/* ══════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: .875rem;
  border: 1px solid transparent;
  animation: slideDown .25s var(--ease);
}
.alert-ok   { background: rgba(16,185,129,.14); color: #34d399; border-color: rgba(16,185,129,.2); }
.alert-err  { background: rgba(239,68,68,.14);  color: #f87171; border-color: rgba(239,68,68,.2); }
.alert-warn { background: rgba(245,158,11,.14); color: #fbbf24; border-color: rgba(245,158,11,.2); }
.alert-info { background: rgba(59,130,246,.14); color: #60a5fa; border-color: rgba(59,130,246,.2); }

[data-theme="light"] .alert-ok   { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
[data-theme="light"] .alert-err  { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
[data-theme="light"] .alert-warn { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
[data-theme="light"] .alert-info { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* ══════════════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════════════ */
.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 130px);
  padding: 20px 0;
}

.login-card {
  display: grid;
  gap: 0;
  width: 100%;
}
.login-logo {
  width: 64px;
  height: 64px;
  /* FIXED: direct gradient */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 20px;
  box-shadow: 0 8px 30px rgba(124,58,237,0.5);
}
.login-card h1 { text-align: center; margin-bottom: 6px; }
.login-card > .muted { text-align: center; margin-bottom: 22px; }
.login-card .form { margin-top: 4px; }

/* ══════════════════════════════════════════════
   DASHBOARD LAYOUT
══════════════════════════════════════════════ */
.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 20px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 20px;
}

.main-col {
  display: grid;
  gap: 16px;
  min-width: 0; /* prevent overflow */
}

/* ── Create card ── */
.create-card { }
.create-card h1 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* ── Scanner ── */
.scanner-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px dashed rgba(124,58,237,0.35);
  border-radius: var(--r-sm);
  background: rgba(124,58,237,0.04);
}
#camera {
  display: none;
  width: 100%;
  margin-top: 10px;
  border-radius: var(--r-sm);
  background: #000;
  min-height: 160px;
}

/* ── Stats sidebar card ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 10px;
  text-align: center;
}
.stat-val {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  /* FIXED: direct gradient */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #7c3aed; /* fallback */
}
.stat-lbl {
  font-size: .68rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stats-extra {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* ── Brand preview ── */
.brand-preview-btns { display: grid; gap: 8px; margin-top: 12px; }
.brand-btn-preview {
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: .83rem;
  text-align: center;
}

/* ══════════════════════════════════════════════
   ORDERS TABLE
══════════════════════════════════════════════ */
.orders-card { padding: 0; overflow: hidden; }
.orders-card .card-header { padding: 18px 20px 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }
thead th {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur);
}
tbody tr:hover { background: rgba(124,58,237,0.04); }
tbody tr:last-child { border-bottom: none; }
td { padding: 12px 16px; vertical-align: middle; font-size: .85rem; }

/* Status row highlights */
.st-ready td    { background: rgba(124,58,237,0.04); }
.st-picked_up   { opacity: .65; }
.st-cancelled   { opacity: .4; }

.order-num { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.order-customer { font-size: .78rem; color: var(--text2); margin-top: 2px; font-weight: 600; }
.order-rating { font-size: .8rem; }

.inline-form { display: inline-block; vertical-align: middle; }
.actions-cell {
  white-space: nowrap;
  text-align: right;
}
.actions-cell .btn { margin-left: 3px; }
.actions-cell .inline-form { margin-left: 3px; }
.actions-cell .inline-form:first-child { margin-left: 0; }

/* ══════════════════════════════════════════════
   STATUS BADGES + PILLS
══════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
}
.st-pending    { background: rgba(100,116,139,.18); color: #94a3b8; }
.st-linked     { background: rgba(59,130,246,.18);  color: #60a5fa; }
.st-ready      { background: rgba(124,58,237,.22);  color: #a78bfa; box-shadow: 0 0 10px rgba(124,58,237,.25); }
.st-picked_up  { background: rgba(16,185,129,.18);  color: #34d399; }
.st-cancelled  { background: rgba(239,68,68,.15);   color: #f87171; }
.st-done       { background: rgba(100,116,139,.12); color: #64748b; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  margin-left: 4px;
  white-space: nowrap;
}
.pill-ok   { background: rgba(16,185,129,.14);  color: #34d399; }
.pill-warn { background: rgba(245,158,11,.14);  color: #fbbf24; }
.pill-wait { background: rgba(100,116,139,.12); color: #94a3b8; }
.pill-info { background: rgba(59,130,246,.14);  color: #60a5fa; }
.pill-err  { background: rgba(239,68,68,.14);   color: #f87171; }

[data-theme="light"] .pill-ok   { background: #d1fae5; color: #065f46; }
[data-theme="light"] .pill-wait { background: #f1f5f9; color: #475569; }
[data-theme="light"] .pill-warn { background: #fef3c7; color: #92400e; }

.timing-badge, .timing-pill {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  background: rgba(124,58,237,.14);
  color: #a78bfa;
  margin-left: 4px;
}

.seg-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
}
.seg-vip       { background: rgba(251,191,36,.18); color: #fbbf24; }
.seg-regular   { background: rgba(124,58,237,.18); color: #a78bfa; }
.seg-returning { background: rgba(59,130,246,.18); color: #60a5fa; }
.seg-new       { background: rgba(100,116,139,.14); color: #94a3b8; }

/* ══════════════════════════════════════════════
   POLL INDICATOR
══════════════════════════════════════════════ */
.poll-indicator {
  font-size: .72rem;
  font-weight: 700;
  color: #10b981;
  animation: blink 2.5s ease-in-out infinite;
}
.poll-indicator.offline { color: var(--err); animation: none; }

/* ══════════════════════════════════════════════
   LIVE TIMER
══════════════════════════════════════════════ */
.live-timer {
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

/* ══════════════════════════════════════════════
   LOYAL CUSTOMERS + REVIEWS
══════════════════════════════════════════════ */
.avg-rating-badge {
  font-size: .95rem;
  font-weight: 800;
  color: #fbbf24;
}
.star-display { color: #fbbf24; font-weight: 800; }

.reviews-list { display: grid; gap: 10px; }
.reviews-list-lg { gap: 14px; }
.review-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  transition: border-color var(--dur);
}
.review-item:hover { border-color: rgba(124,58,237,.3); }
.review-stars { font-size: .9rem; margin-bottom: 5px; }
.review-msg {
  font-size: .875rem;
  color: var(--text2);
  line-height: 1.55;
  margin-bottom: 6px;
  font-style: italic;
}
.review-meta { font-size: .75rem; color: var(--muted); }

/* ══════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════ */
.empty-state {
  text-align: center !important;
  padding: 40px 20px !important;
  color: var(--muted) !important;
  font-size: .875rem !important;
}

/* ══════════════════════════════════════════════
   PRINT PAGE (Thermal Ticket)
══════════════════════════════════════════════ */
.print-wrap { max-width: 380px; margin: 0 auto; }

.ticket {
  text-align: center;
  background: var(--surface);
  border: 2px dashed rgba(124,58,237,.35);
  border-radius: var(--r-xl);
  padding: 28px 22px;
  box-shadow: 0 16px 48px rgba(0,0,0,.3);
}
[data-theme="light"] .ticket { box-shadow: 0 8px 32px rgba(124,58,237,.12); }

.ticket-merchant {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.ticket-label {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 2px;
}
.order-no {
  font-size: 84px;
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1.05;
  margin: 8px 0;
  /* FIXED: direct gradient */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #7c3aed; /* fallback */
}
.qr-img {
  width: 240px;
  max-width: 100%;
  height: auto;
  margin: 14px auto;
  display: block;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
.ticket-instruction { font-size: .88rem; font-weight: 600; color: var(--text2); margin: 8px 0 5px; }
.ticket-ref { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.link-text { font-size: .65rem; color: var(--muted); margin-top: 8px; word-break: break-all; }
.print-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.qr-error {
  background: rgba(239,68,68,.1);
  color: #f87171;
  border: 1px dashed rgba(239,68,68,.4);
  border-radius: var(--r-sm);
  padding: 14px;
  margin: 14px 0;
  font-weight: 600;
}

/* ══════════════════════════════════════════════
   JOIN PAGE
══════════════════════════════════════════════ */
.join-page .join-card {
  text-align: center;
  max-width: 420px;
  width: 100%;
  padding: 36px 28px;
}
.join-merchant-badge {
  display: inline-block;
  /* FIXED: direct gradient */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: #fff;
  border-radius: 99px;
  padding: 6px 18px;
  font-weight: 700;
  font-size: .8rem;
  margin-bottom: 16px;
}
.join-emoji { font-size: 3rem; margin-bottom: 12px; }
.join-card h1 { margin-bottom: 12px; }
.join-card p { color: var(--text2); margin-bottom: 24px; line-height: 1.7; }

/* ══════════════════════════════════════════════
   ANALYTICS PAGE
══════════════════════════════════════════════ */
.analytics-page { display: grid; gap: 20px; }

/* Period tabs */
.period-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  width: fit-content;
  max-width: 100%;
}
.period-tab {
  padding: 7px 14px;
  border-radius: 7px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  transition: all var(--dur);
  text-decoration: none;
}
.period-tab:hover { color: var(--text); background: var(--surface2); text-decoration: none; }
.period-tab.active {
  /* FIXED: direct gradient */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: #fff;
}

/* Content tabs */
.content-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.content-tab {
  padding: 10px 18px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: all var(--dur);
  text-decoration: none;
  white-space: nowrap;
  margin-bottom: -1px;
}
.content-tab:hover { color: var(--text); text-decoration: none; }
.content-tab.active { color: #7c3aed; border-bottom-color: #7c3aed; }

/* Summary grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 14px;
  text-align: center;
  transition: all var(--dur);
}
.summary-card:hover {
  border-color: rgba(124,58,237,.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124,58,237,.1);
}
.summary-icon { font-size: 1.3rem; margin-bottom: 8px; }
.summary-val {
  font-size: 1.65rem;
  font-weight: 900;
  line-height: 1;
  /* FIXED: direct gradient */
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #7c3aed;
}
.summary-lbl {
  font-size: .65rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 5px;
}
.summary-sub { font-size: .72rem; color: #7c3aed; margin-top: 3px; font-weight: 600; }

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.chart-card-full { grid-column: 1 / -1; }
.chart-wrap { width: 100%; overflow: hidden; }

.bar-chart { width: 100%; height: 130px; display: block; }

.chart-legend { display: flex; gap: 16px; margin-top: 10px; font-size: .72rem; color: var(--muted); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* History table */
.history-table { font-size: .78rem; }
.history-table th { font-size: .65rem; }
.history-table td { padding: 10px 12px; }

/* Pagination */
.pagination { display: flex; gap: 5px; padding: 16px 0 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text2);
  font-size: .78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--dur);
}
.page-btn:hover { background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff; border-color: transparent; text-decoration: none; }
.page-btn.active { background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff; border-color: transparent; }

/* ══════════════════════════════════════════════
   SETTINGS PAGE
══════════════════════════════════════════════ */
.settings-page { max-width: 820px; }
.settings-form { display: grid; gap: 16px; }
.settings-section { }

.color-pickers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}
.color-picker-group { display: grid; gap: 7px; }
.color-input-wrap { display: flex; align-items: center; gap: 8px; }
.color-swatch {
  width: 44px;
  height: 44px;
  border: 2px solid var(--border-strong);
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 2px;
  background: var(--surface2);
  flex-shrink: 0;
}
.color-hex { flex: 1; font-family: monospace; font-size: .85rem; }
.emoji-input { font-size: 1.4rem; text-align: center; }

/* Viber preview */
.viber-preview {
  margin-top: 18px;
  background: #111827;
  border-radius: var(--r);
  padding: 16px;
  border: 1px solid rgba(255,255,255,.08);
}
[data-theme="light"] .viber-preview { background: #1f2937; }
.vp-label { font-size: .68rem; color: #6b7280; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; font-weight: 700; }
.vp-keyboard { display: grid; gap: 8px; }
.vp-btn { padding: 11px 16px; border-radius: 8px; font-weight: 700; font-size: .83rem; text-align: center; }
.vp-btn-primary { background: #7c3aed; color: #fff; }
.vp-btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vp-btn-small { padding: 9px 10px; font-size: .78rem; }
.vp-btn-star { background: #1f2937; color: #fbbf24; }

/* Module toggles */
.modules-grid { display: grid; gap: 10px; }
.module-toggle {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color var(--dur);
}
.module-toggle:hover { border-color: rgba(124,58,237,.4); }
.module-toggle input[type="checkbox"] { display: none; }

.toggle-track {
  width: 44px;
  height: 24px;
  background: var(--surface3);
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  position: relative;
  flex-shrink: 0;
  transition: background var(--dur);
}
.toggle-track::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: var(--muted);
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: all var(--dur) var(--ease);
}
.module-toggle input:checked ~ .toggle-track {
  /* FIXED: direct purple */
  background: #7c3aed;
  border-color: transparent;
}
.module-toggle input:checked ~ .toggle-track::after { left: 22px; background: #fff; }

.toggle-label { font-weight: 700; font-size: .875rem; }
.toggle-desc { font-size: .75rem; color: var(--muted); margin-top: 2px; }

.settings-actions { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 6px; }

/* ══════════════════════════════════════════════
   ADMIN PAGE
══════════════════════════════════════════════ */
.admin-page { display: grid; gap: 16px; }
.admin-edit-page .card { }
.row-inactive { opacity: .5; }

/* ══════════════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: .875rem;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  animation: toastIn .25s var(--ease);
  pointer-events: all;
  cursor: pointer;
}
.toast-ok   { border-left: 4px solid #10b981; }
.toast-warn { border-left: 4px solid #f59e0b; }
.toast-err  { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid #7c3aed; }
.toast.removing { animation: toastOut .22s var(--ease) forwards; }

/* ══════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════ */
@keyframes slideDown {
  from { opacity:0; transform:translateY(-8px); }
  to   { opacity:1; transform:translateY(0);    }
}
@keyframes blink {
  0%,100% { opacity:1; }
  50%      { opacity:.35; }
}
@keyframes toastIn {
  from { opacity:0; transform:translateX(32px); }
  to   { opacity:1; transform:translateX(0);    }
}
@keyframes toastOut {
  from { opacity:1; transform:translateX(0); }
  to   { opacity:0; transform:translateX(32px); }
}
@keyframes newRow {
  0%   { background:rgba(124,58,237,.2); }
  100% { background:transparent; }
}
.new-row-flash { animation: newRow 1.8s ease forwards; }

/* ══════════════════════════════════════════════
   DASHBOARD REWRITE UTILITIES (SINGLE COLUMN, TABS, MODALS)
══════════════════════════════════════════════ */
.dashboard-root-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* Stats Ribbon */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  width: 100%;
}
.ribbon-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  transition: all var(--dur) var(--ease);
}
.ribbon-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 8px 30px rgba(124,58,237,0.06);
}
.ribbon-val {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1.2;
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #7c3aed;
}
.ribbon-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text2);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* Dashboard Tab Bar & Switcher */
.dash-tabs-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.dash-tabs {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 4px;
}
.dash-tab {
  background: transparent;
  border: none;
  color: var(--text2);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-tab:hover {
  color: var(--text);
}
.dash-tab.active {
  background: var(--surface3);
  color: var(--purple);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
[data-theme="light"] .dash-tab.active {
  color: var(--purple);
  background: #ffffff;
}
.dash-tab-content {
  animation: fadeIn var(--dur) var(--ease);
}

/* Custom Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(11, 11, 24, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s var(--ease);
}
.modal.active {
  display: flex;
}
.modal-content {
  background-color: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  animation: modalScaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
[data-theme="light"] .modal-content {
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.15);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text2);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  transition: all var(--dur);
}
.modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalScaleUp {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

/* POS Table styling (separated card rows) */
.pos-table-card table {
  border-collapse: separate !important;
  border-spacing: 0 12px !important;
}
.pos-table-card thead th {
  border-bottom: none !important;
  padding: 0 16px 8px !important;
}
.pos-table-card tbody tr {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all var(--dur) var(--ease);
}
[data-theme="light"] .pos-table-card tbody tr {
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.pos-table-card tbody tr:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}
.pos-table-card tbody td {
  padding: 16px !important;
  border-top: 1px solid var(--border) !important;
  border-bottom: 1px solid var(--border) !important;
}
.pos-table-card tbody td:first-child {
  border-left: 1px solid var(--border) !important;
  border-top-left-radius: var(--r) !important;
  border-bottom-left-radius: var(--r) !important;
}
.pos-table-card tbody td:last-child {
  border-right: 1px solid var(--border) !important;
  border-top-right-radius: var(--r) !important;
  border-bottom-right-radius: var(--r) !important;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 920px) {
  .dashboard-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    /* On mobile, show sidebar in column order */
  }
  .main-col { }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card-full { grid-column: auto; }
  .summary-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

@media (max-width: 640px) {
  .shell { padding: 0 12px 40px; }
  .topbar { padding: 12px 0; margin-bottom: 16px; }
  .topbar-nav { gap: 4px; }
  .topbar-sub { display: none; }
  .card { padding: 16px; }
  .orders-card .card-header { padding: 14px 16px 0; }
  .hide-sm { display: none !important; }
  .order-no { font-size: 60px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-center { min-height: calc(100vh - 100px); }
  h1 { font-size: 1.25rem; }
  .btn-lg { padding: 11px 18px; }
  .period-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .print-wrap { max-width: 100%; }
}

/* ══════════════════════════════════════════════
   PRINT  (Thermal ticket — no colours/bg)
══════════════════════════════════════════════ */
@media print {
  *, body { background: #fff !important; color: #000 !important; }
  .shell { max-width: 100%; padding: 0; }
  .topbar, .alert, .no-print, .print-actions, .scanner-box { display: none !important; }
  .ticket {
    border: 2px dashed #999 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 300px;
    margin: 0 auto;
    padding: 16px !important;
  }
  .order-no {
    -webkit-text-fill-color: #000 !important;
    background: none !important;
    color: #000 !important;
    font-size: 72px !important;
  }
  .qr-img { width: 220px !important; }
  .ticket-merchant, .ticket-label, .ticket-instruction, .ticket-ref {
    color: #333 !important;
  }
}

/* ══════════════════════════════════════════════
   VISUAL KEYBOARD BUILDER & ADMIN LOGIN STYLES
   ══════════════════════════════════════════════ */

/* Admin / Config Tabs */
.admin-tabs, .vbb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.admin-tab, .vbb-tab {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.admin-tab:hover, .vbb-tab:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-strong);
}
.admin-tab.active, .vbb-tab.active {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(124,58,237,0.25);
}

/* Viber Grid Preview */
.vbb-grid-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-gap: 8px;
  background: #f4f5f7;
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  min-height: 120px;
  user-select: none;
}
[data-theme="light"] .vbb-grid-container {
  background: #eef1f6;
}

/* Viber Button Block */
.vbb-button-block {
  position: relative;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  padding: 10px;
  min-height: 48px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  cursor: grab;
  transition: transform var(--dur), box-shadow var(--dur), border-color var(--dur);
  border: 1px solid rgba(0,0,0,0.15);
}
.vbb-button-block:active {
  cursor: grabbing;
}
.vbb-button-block.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  border: 2px dashed #7c3aed;
}
.vbb-button-block.drag-over {
  border: 2px solid #ec4899;
}

/* Button Actions overlay on Hover */
.vbb-btn-actions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 20, 42, 0.9);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.vbb-button-block:hover .vbb-btn-actions {
  opacity: 1;
  visibility: visible;
}
.vbb-action-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all var(--dur) var(--ease);
}
.vbb-action-icon:hover {
  background: var(--purple);
  color: #fff;
  transform: scale(1.1);
}
.vbb-action-icon.delete:hover {
  background: var(--err);
}

/* Viber preview overrides */
.vbb-preview-col {
  margin-top: 15px;
  margin-bottom: 20px;
}
.vbb-grid-header {
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Response list */
.vbb-responses-section {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Viber User profiles and Broadcast styling */
.user-avatar-initials {
  border: 1px solid var(--border-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.modal-content-lg {
  max-width: 800px !important;
}
.modal-stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.loader-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 40px 0;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
  text-indent: -9999px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.review-comment {
  font-family: inherit;
  color: var(--text2);
  margin-top: 4px;
  border-left: 2px solid var(--purple);
  padding-left: 8px;
}
.progress-bar-wrap {
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}
#bc-log {
  max-height: 180px;
  line-height: 1.5;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}
#bc-log div {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.security-mask {
  -webkit-text-security: disc !important;
  text-security: disc !important;
}

/* Grouped Viber bot designer tabs layout */
.vbb-tabs-grouped {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.vbb-tab-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.vbb-tab-group-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.vbb-group-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.vbb-group-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vbb-tab-group-card .vbb-tab {
  text-align: left;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 10px 12px;
}
.vbb-tab-group-card.settings-card {
  border-left: 3px solid var(--purple);
}
.vbb-tab-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
}
.vbb-tab-wrapper .vbb-tab {
  padding-right: 50px;
}


