@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  --bg: #080810;
  --bg2: #0d0d1a;
  --bg3: #111120;
  --surface: rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --blue: #3b82f6;
  --blue2: #2563eb;
  --blue-bright: #60a5fa;
  --blue-glow: rgba(59,130,246,0.3);
  --gold: #f59e0b;
  --gold-light: #fcd34d;
  --white: #f1f5f9;
  --muted: #64748b;
  --muted2: #94a3b8;
  --green: #10b981;
  --red: #ef4444;
  --purple: #8b5cf6;
  --sidebar-w: 240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}
h1,h2,h3,h4,h5,h6 { font-family: 'Syne', sans-serif; line-height: 1.2; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: 'DM Sans', sans-serif; }
input, textarea, select { font-family: 'DM Sans', sans-serif; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 4px; }

/* LAYOUT */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform 0.3s;
}
.sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.25rem;
  background: linear-gradient(135deg, var(--blue-bright), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-shop {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.shop-avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.shop-name { font-family: 'Syne', sans-serif; font-size: 0.85rem; font-weight: 700; }
.shop-plan { font-size: 0.7rem; color: var(--gold); }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-section-label {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--muted); padding: 10px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 9px; margin-bottom: 2px;
  font-size: 0.87rem; font-weight: 500; color: var(--muted);
  transition: all 0.2s; cursor: pointer;
}
.nav-item:hover { background: var(--surface2); color: var(--white); }
.nav-item.active { background: rgba(59,130,246,0.15); color: var(--blue-bright); font-weight: 600; }
.nav-item .nav-icon { font-size: 1.05rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red);
  color: white; font-size: 0.65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 100px;
}
.sidebar-footer {
  padding: 14px 20px; border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted);
}

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  background: rgba(8,8,16,0.85); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.05rem; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page-content { padding: 28px; flex: 1; }

/* CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px;
}
.card-hover { transition: all 0.25s; }
.card-hover:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,0.3); }

/* STAT CARDS */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px;
  transition: all 0.2s;
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.stat-icon { font-size: 1.5rem; margin-bottom: 12px; }
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 1.6rem; font-weight: 800; }
.stat-change { font-size: 0.75rem; margin-top: 4px; }
.stat-up { color: var(--green); }
.stat-down { color: var(--red); }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 9px; font-size: 0.87rem;
  font-weight: 600; border: none; transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 7px; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; font-family: 'Syne', sans-serif; }
.btn-primary { background: linear-gradient(135deg,var(--blue),var(--blue2)); color: white; box-shadow: 0 4px 14px var(--blue-glow); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(59,130,246,0.5); transform: translateY(-1px); }
.btn-success { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.25); }
.btn-success:hover { background: rgba(16,185,129,0.25); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.22); }
.btn-ghost { background: var(--surface2); color: var(--white); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); border-color: var(--border2); }
.btn-gold { background: rgba(245,158,11,0.12); color: var(--gold); border: 1px solid rgba(245,158,11,0.25); }
.btn-gold:hover { background: rgba(245,158,11,0.22); }
.btn-wa { background: rgba(37,211,102,0.12); color: #25D366; border: 1px solid rgba(37,211,102,0.25); }
.btn-wa:hover { background: rgba(37,211,102,0.22); }

/* FORM ELEMENTS */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted2); margin-bottom: 7px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 9px; padding: 10px 14px;
  color: var(--white); font-size: 0.9rem; outline: none;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }
.form-input::placeholder { color: var(--muted); }
select.form-input { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { font-family: 'Syne', sans-serif; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.87rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.td-bold { font-family: 'Syne', sans-serif; font-weight: 700; }

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 100px; font-size: 0.72rem; font-weight: 600; }
.badge-green { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge-blue { background: rgba(59,130,246,0.12); color: var(--blue-bright); border: 1px solid rgba(59,130,246,0.2); }
.badge-gold { background: rgba(245,158,11,0.12); color: var(--gold); border: 1px solid rgba(245,158,11,0.2); }
.badge-red { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-purple { background: rgba(139,92,246,0.12); color: #a78bfa; border: 1px solid rgba(139,92,246,0.2); }

/* AVATAR */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-weight: 800; flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-md { width: 40px; height: 40px; font-size: 0.9rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }

/* SEARCH */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 14px; transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--blue); }
.search-bar input { background: none; border: none; outline: none; color: var(--white); font-size: 0.87rem; flex: 1; }
.search-bar input::placeholder { color: var(--muted); }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 18px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform 0.25s;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  padding: 22px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: 'Syne', sans-serif; font-size: 1.05rem; font-weight: 700; }
.modal-close { background: var(--surface2); border: none; color: var(--muted2); width: 30px; height: 30px; border-radius: 7px; font-size: 1rem; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.modal-close:hover { color: var(--white); background: rgba(255,255,255,0.1); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 10px; padding: 12px 18px;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.87rem; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: slideUp 0.3s ease;
  min-width: 260px; max-width: 340px;
}
@keyframes slideUp { from { opacity:0; transform: translateY(16px); } to { opacity:1; transform: translateY(0); } }
.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--blue); }

/* GRADIENT TEXT */
.gradient-text {
  background: linear-gradient(135deg, var(--blue-bright), var(--gold-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.page-header-left h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.page-header-left p { font-size: 0.87rem; color: var(--muted); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-title { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.empty-desc { font-size: 0.88rem; color: var(--muted); max-width: 320px; margin: 0 auto 20px; }

/* CHART BARS */
.mini-bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.mini-bar { flex: 1; background: rgba(59,130,246,0.3); border-radius: 3px 3px 0 0; transition: background 0.2s; }
.mini-bar:hover { background: var(--blue); }
.mini-bar.gold { background: rgba(245,158,11,0.35); }
.mini-bar.gold:hover { background: var(--gold); }

/* PROGRESS BAR */
.progress-bar { background: var(--surface2); border-radius: 100px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 100px; background: linear-gradient(to right, var(--blue), var(--blue-bright)); transition: width 0.8s ease; }
.progress-fill.gold { background: linear-gradient(to right, var(--gold), var(--gold-light)); }
.progress-fill.green { background: linear-gradient(to right, var(--green), #34d399); }

/* TABS */
.tabs { display: flex; gap: 4px; background: var(--bg3); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab { padding: 7px 16px; border-radius: 7px; font-size: 0.85rem; font-weight: 500; cursor: pointer; color: var(--muted); transition: all 0.2s; border: none; background: none; }
.tab.active { background: var(--surface2); color: var(--white); font-weight: 600; }
.tab:hover:not(.active) { color: var(--muted2); }

/* MOBILE TOPBAR TOGGLE */
.sidebar-toggle { display: none; background: var(--surface2); border: 1px solid var(--border); color: var(--white); padding: 7px 10px; border-radius: 8px; font-size: 1rem; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 500; width: 240px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; gap: 10px; }
  .page-header-left h1 { font-size: 1.25rem; }
  .topbar-actions .btn { padding: 6px 10px; font-size: 0.75rem; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }
  .modal { width: 96%; border-radius: 14px; }
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }
  .cust-grid { grid-template-columns: 1fr !important; }
  #chart-row, #bottom-row, #main-grid, #bottom-grid { grid-template-columns: 1fr !important; }
  .billing-grid { grid-template-columns: 1fr !important; }
  .billing-grid > div:last-child .card { position: static !important; }
  .product-grid { grid-template-columns: repeat(2,1fr) !important; max-height: 240px; }
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-content { padding: 12px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar-title { font-size: 0.95rem; }
  .form-row-3 { grid-template-columns: 1fr; }
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 1.3rem; }
  .card { padding: 14px; }
  .btn-lg { padding: 11px 16px; font-size: 0.87rem; }
  .search-bar input { width: 120px; }
  .plan-chips { flex-wrap: wrap; }
  .plan-chip { font-size: 0.74rem; padding: 5px 10px; }
  .pay-opt { padding: 6px 10px; font-size: 0.78rem; }
}

@media (max-width: 380px) {
  .stats-row { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr !important; }
}

/* Sidebar overlay when open on mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 499;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

.sidebar-toggle{
  display:flex;align-items:center;justify-content:center;
  width:36px;height:36px;border-radius:8px;
  background:var(--surface2);border:1px solid var(--border);
  color:var(--white);font-size:1.1rem;cursor:pointer;
  flex-shrink:0;
}
@media(min-width:769px){
  .sidebar-toggle{display:none;}
}

@media(max-width:900px){
  #wa-grid{grid-template-columns:1fr !important;}
  .wa-bubble{font-size:0.8rem;}
}

/* ── MOBILE APP SHELL ── */

.mobile-bottom-nav{display:none;}

@media(max-width:768px){


      /* Kill ALL horizontal overflow */
  body{overflow-x:hidden !important;}
  .main-content{overflow-x:hidden !important;}
    .page-content{overflow-x:auto !important;}
  
  /* Force all grids to respect container */
  .stats-row,.card,
  [style*="display:grid"],[style*="display: grid"]{
    max-width:100% !important;
    overflow:hidden !important;
  }
  
  /* Stats always 2 col regardless of inline style */
  .stats-row{
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    width:100% !important;
  }


  /* Hide desktop sidebar */
  .sidebar{
    transform:translateX(-100%);
    position:fixed;top:0;left:0;bottom:0;
    z-index:500;width:270px;
    box-shadow:4px 0 24px rgba(0,0,0,0.5);
    transition:transform 0.28s cubic-bezier(0.4,0,0.2,1);
    display:flex !important;
    overflow-y:auto;
  }
  .sidebar.open{transform:translateX(0) !important;}
  .main-content{margin-left:0 !important;}

  /* Topbar */
  .topbar{
    padding:0 12px !important;
    height:52px;min-height:52px;
    position:sticky;top:0;z-index:100;
    display:flex;align-items:center;gap:10px;
  }
  .topbar-title{font-size:1rem !important;flex:1;}
  .topbar-actions .btn-text{display:none;}

  /* Hamburger button in topbar */
  .sidebar-toggle{
    display:flex !important;
    align-items:center;justify-content:center;
    width:36px;height:36px;flex-shrink:0;
    background:var(--surface2);border:1px solid var(--border);
    color:var(--white);border-radius:8px;font-size:1.1rem;cursor:pointer;
  }

  /* Bottom nav */
  .mobile-bottom-nav{
    display:flex !important;
    position:fixed;bottom:0;left:0;right:0;
    background:var(--bg2);border-top:1px solid var(--border);
    z-index:200;height:58px;
    box-shadow:0 -4px 20px rgba(0,0,0,0.35);
  }
    .mob-nav-item{
    flex:1;display:flex;flex-direction:column;
    align-items:center;justify-content:center;
    gap:3px;cursor:pointer;color:var(--muted);
    font-size:0.58rem;font-weight:600;
    text-transform:uppercase;letter-spacing:0.3px;
    text-decoration:none;border:none;background:none;
    padding:6px 2px 4px;transition:color 0.2s;
    -webkit-tap-highlight-color:transparent;
  }
  .mob-icon{font-size:1.3rem;line-height:1;display:block;}
  .mob-nav-item.active{color:var(--blue-bright);}
  .mob-nav-item.active .mob-icon-wrap{
    background:rgba(59,130,246,0.15);
    border-radius:12px;
  }
  .mob-icon-wrap{
    padding:4px 14px;border-radius:12px;
    transition:background 0.15s;
  }
  .mob-nav-item:active .mob-icon-wrap{
    background:rgba(255,255,255,0.08);
  }

  /* Page bottom padding for nav */
  .main-content{padding-bottom:64px !important;}
  .page-content{padding:12px 12px 72px !important;}

    /* Stats: always 2 col on mobile, no overflow */
  .stats-row{
    grid-template-columns:1fr 1fr !important;
    gap:8px !important;margin-bottom:12px !important;
    width:100% !important;
    overflow:hidden !important;
  }
  .stats-row > *{min-width:0 !important;width:100% !important;}
  .stat-card{padding:12px 10px !important;border-radius:12px !important;}
  .stat-value{font-size:1.15rem !important;}
  .stat-icon{font-size:1.1rem !important;margin-bottom:5px !important;}
  .stat-label{font-size:0.62rem !important;}
  .stat-change{font-size:0.7rem !important;}

  /* All multi-col grids → single col */
  .stats-row[style*="repeat(3"],
  .stats-row[style*="repeat(4"],
  .stats-row[style*="repeat(5"]{
    grid-template-columns:1fr 1fr !important;
  }

  /* Dashboard grids */
  #main-grid,#bottom-grid,#chart-row,
  #bottom-row,#wa-grid{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }

  /* Any inline grid styles */
  [style*="grid-template-columns"]{
    grid-template-columns:1fr !important;
  }
  /* Exception: stats and 2-col things we want to keep 2 cols */
  .stats-row,[style*="grid-template-columns:1fr 1fr"]{
    grid-template-columns:1fr 1fr !important;
  }

  /* Cards */
  .card{padding:12px !important;border-radius:12px !important;}

  /* ── TABLES → HORIZONTAL SCROLL ── */
  .table-wrap{
    overflow-x:auto !important;
    -webkit-overflow-scrolling:touch;
    display:block;
    width:100%;
  }
  .table-wrap table{
    display:table !important;
    min-width:650px;
    width:max-content;
  }
  .table-wrap thead{display:table-header-group !important;}
  .table-wrap tbody{display:table-row-group !important;}
  .table-wrap tr{
    display:table-row !important;
  }
  .table-wrap td{
    display:table-cell !important;
    padding:10px 12px !important;
    white-space:nowrap;
    font-size:0.8rem !important;
    border-bottom:1px solid rgba(255,255,255,0.04) !important;
  }
  .table-wrap td::before{display:none !important;}

  /* Page header */
  .page-header{
    flex-direction:column !important;
    gap:10px !important;
    margin-bottom:12px !important;
  }
  .page-header-left h1{font-size:1.25rem !important;}
  .page-header > div:last-child{
    width:100% !important;
    display:flex !important;
    flex-direction:column !important;
    gap:8px !important;
  }

  /* Search bars */
  .search-bar{width:100% !important;}
  .search-bar input{width:100% !important;min-width:0 !important;}

  /* Selects full width */
  .page-header select,.page-header .form-input{
    width:100% !important;
  }

  /* Modals slide up from bottom */
  .modal-overlay{
    padding:0 !important;
    align-items:flex-end !important;
  }
  .modal{
    border-radius:20px 20px 0 0 !important;
    max-height:88vh !important;
    width:100% !important;
    max-width:100% !important;
  }
  .modal-header{padding:14px 16px !important;}
  .modal-body{padding:12px 16px !important;}
  .modal-footer{
    padding:12px 16px !important;
    flex-wrap:wrap !important;
  }
  .modal-footer .btn{flex:1 !important;justify-content:center !important;}

  /* Forms */
  .form-row,.form-row-3{grid-template-columns:1fr !important;}
  .form-input{font-size:16px !important;} /* prevent iOS zoom */

  /* Billing page */
  .billing-grid{grid-template-columns:1fr !important;}
  .product-grid{
    grid-template-columns:1fr 1fr !important;
    max-height:230px !important;
  }
  .prod-card{padding:9px 8px !important;}
  .prod-name{font-size:0.75rem !important;}
  .prod-price{font-size:0.82rem !important;}

  /* Customer grid */
  .cust-grid{grid-template-columns:1fr !important;}

  /* Tabs scrollable */
  .tabs,.bc-tabs{
    overflow-x:auto;flex-wrap:nowrap !important;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;padding-bottom:2px;
  }
  .tabs::-webkit-scrollbar,.bc-tabs::-webkit-scrollbar{display:none;}
  .tab,.bc-tab{white-space:nowrap !important;flex-shrink:0 !important;}

  /* Plan chips */
  .plan-chips{gap:6px !important;}
  .plan-chip{font-size:0.74rem !important;padding:5px 10px !important;}

  /* Barcode page */
  #tab-products > div[style]{grid-template-columns:1fr !important;}
  #size-picker{grid-template-columns:1fr 1fr !important;}
  .bc-prod-row{padding:8px 6px !important;}

  /* Settings page */
  .wa-mode-card{padding:10px !important;}
  [style*="grid-template-columns:1fr 1fr"]:not(.stats-row):not(#size-picker){
    grid-template-columns:1fr !important;
  }

  /* Buttons in topbar — icon only on mobile */
  .topbar-actions .btn-sm{
    padding:6px 10px !important;
    font-size:0.78rem !important;
  }

  /* Hide non-essential topbar items on mobile */
  .topbar-actions .btn-ghost:not(:last-child){
    display:none !important;
  }
}

@media(max-width:380px) {
  .stats-row { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr !important; }
}

/* ══════════════════════════════════════
   RESTAURANT MODE THEME
   ══════════════════════════════════════ */
body.resto-mode {
  --bg: #0a0700;
  --bg2: #120e05;
  --bg3: #1a1505;
  --surface: rgba(245,158,11,0.05);
  --surface2: rgba(245,158,11,0.09);
  --border: rgba(245,158,11,0.12);
  --border2: rgba(245,158,11,0.22);
  --blue: #f59e0b;
  --blue2: #d97706;
  --blue-bright: #fcd34d;
  --blue-glow: rgba(245,158,11,0.25);
}
body.resto-mode .sidebar { background: var(--bg2); border-color: var(--border); }
body.resto-mode .sidebar-logo { background: linear-gradient(135deg,#fcd34d,#ef4444); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }
body.resto-mode .topbar { background: rgba(10,7,0,0.9); border-color: var(--border); }
body.resto-mode .btn-primary { background: linear-gradient(135deg,#f59e0b,#d97706); box-shadow: 0 4px 14px rgba(245,158,11,0.3); }
body.resto-mode .btn-primary:hover { box-shadow: 0 6px 20px rgba(245,158,11,0.5); }
body.resto-mode .nav-item.active { background: rgba(245,158,11,0.15); color: var(--blue-bright); }
body.resto-mode .stat-card:hover { border-color: rgba(245,158,11,0.3); }
body.resto-mode .shop-avatar { background: linear-gradient(135deg,#f59e0b,#ef4444); }
body.resto-mode .progress-fill { background: linear-gradient(to right,#f59e0b,#fcd34d); }
body.resto-mode ::-webkit-scrollbar-thumb { background: #f59e0b; }
body.resto-mode .form-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.12); }
body.resto-mode .search-bar:focus-within { border-color: #f59e0b; }
body.resto-mode .gradient-text { background: linear-gradient(135deg,#fcd34d,#ef4444); -webkit-background-clip:text; -webkit-text-fill-color:transparent; }

/* TABLE GRID */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 10px; }
.table-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 10px; text-align: center;
  cursor: pointer; transition: all 0.2s;
}
.table-tile:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.table-tile.occupied { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.08); }
.table-tile.running { border-color: rgba(245,158,11,0.4); background: rgba(245,158,11,0.08); }
.table-tile.free { border-color: rgba(16,185,129,0.3); background: rgba(16,185,129,0.06); }
.table-num { font-family:'Syne',sans-serif; font-weight:800; font-size:1.1rem; }
.table-status-label { font-size:0.68rem; margin-top:4px; font-weight:600; }

/* KOT TOKEN */
.kot-token {
  background: white; color: #1a1a1a; border-radius: 10px;
  padding: 14px; font-family: monospace; font-size: 0.82rem;
  line-height: 1.8; border: 2px dashed #333; margin-bottom: 10px;
  max-width: 260px;
}
.kot-header { font-weight: 700; font-size: 0.95rem; text-align: center; border-bottom: 2px solid #333; padding-bottom: 6px; margin-bottom: 8px; }

/* MENU ITEM CARD */
.menu-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 12px; cursor: pointer;
  transition: all 0.2s; position: relative;
}
.menu-card:hover:not(.out-of-stock) { border-color: rgba(245,158,11,0.4); transform: translateY(-2px); }
.menu-card.out-of-stock { opacity: 0.45; cursor: not-allowed; }
.menu-veg { width: 14px; height: 14px; border: 1.5px solid #16a34a; border-radius: 2px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.menu-veg::after { content:''; width:8px; height:8px; background:#16a34a; border-radius:50%; }
.menu-nonveg { width: 14px; height: 14px; border: 1.5px solid #dc2626; border-radius: 2px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; }
.menu-nonveg::after { content:''; width:8px; height:8px; background:#dc2626; border-radius:50%; }

/* CATEGORY TABS */
.cat-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; scrollbar-width:none; }
.cat-scroll::-webkit-scrollbar { display:none; }
.cat-chip { padding: 6px 16px; border-radius: 100px; border: 1px solid var(--border); background: var(--surface); font-size: 0.8rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.2s; color: var(--muted2); flex-shrink: 0; }
.cat-chip.active { border-color: var(--blue); background: rgba(245,158,11,0.15); color: var(--blue-bright); }

/* ORDER ITEM ROW */
.order-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.order-row:last-child { border-bottom: none; }


@media(max-width:600px){
  .footer-top{grid-template-columns:1fr;}
  .hero-title{letter-spacing:-1px;}
  nav{padding:12px 5%;}
  .nav-logo{font-size:1.15rem;}
  .btn-nav-login{padding:7px 14px;font-size:0.8rem;}
  .btn-nav-primary{padding:7px 14px;font-size:0.8rem;}
  .hero{padding:110px 5% 60px;}
  .hero-badge{font-size:0.7rem;padding:5px 14px;}
  .hero-sub{font-size:0.95rem;}
  .hero-btns{gap:10px;}
  .btn-hero-primary,.btn-hero-secondary{padding:12px 22px;font-size:0.9rem;}
  .stats-bar{gap:20px;padding:20px 5%;}
  .stat-num{font-size:1.5rem;}
  #demo-choice-overlay > div{padding:32px 20px 28px;}
  #demo-choice-overlay [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr !important;}
  #demo-choice-overlay [style*="font-size:1.9rem"]{font-size:1.4rem !important;}
  #demo-choice-overlay > div{padding:28px 16px 24px !important;border-radius:20px !important;margin:12px !important;width:calc(100% - 24px) !important;}
  #demo-choice-overlay [style*="grid-template-columns:1fr 1fr"]{grid-template-columns:1fr !important;}
  #demo-choice-overlay a[href*="dashboard"]{padding:24px 16px 20px !important;}
  #demo-choice-overlay a[href*="restaurant"]{padding:24px 16px 20px !important;}
  #demo-choice-overlay [style*="width:72px"]{width:56px !important;height:56px !important;font-size:1.5rem !important;}
}