/* ═══════════════════════════════════════════════
   QR Menu SaaS — Main Stylesheet v2.0
   Brand: Need Infotech (#1A6B3F Green · #E8821A Orange)
   ═══════════════════════════════════════════════ */
:root {
  --primary:       #1A6B3F;
  --primary-dark:  #0F4526;
  --primary-light: #D1F0E0;
  --accent:        #E8821A;
  --accent-dark:   #C96D0E;
  --accent-light:  #FDE8D0;
  --success:       #22c55e;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #1A6B3F;
  --dark:          #0A2E1A;
  --dark2:         #1A6B3F;
  --dark3:         #2A8A55;
  --muted:         #64748b;
  --border:        #e2e8f0;
  --bg:            #F4F7FA;
  --white:         #ffffff;
  --text:          #0F2D1A;
  --text-muted:    #4a7060;
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 25px rgba(0,0,0,.1);
  --sidebar-w:     260px;
  --header-h:      64px;
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
input, textarea, select, button { font-family: inherit; }

/* ── Typography ─────────────────────── */
h1,h2,h3,h4,h5 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }
p  { margin-bottom: 1rem; }

/* ── Container ──────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Buttons ─────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1.4rem; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; transition: all .2s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger    { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-outline   { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost     { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-dark      { background: var(--dark); color: #fff; border-color: var(--dark); }
.btn-sm  { padding: .4rem .9rem; font-size: .8rem; }
.btn-lg  { padding: .85rem 2rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* ── Form Controls ──────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.form-control {
  width: 100%; padding: .65rem 1rem;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--text); background: var(--white);
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,63,107,.15); }
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: .3rem; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ── Cards ───────────────────────────── */
.card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-body   { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }
.card-title  { font-size: 1.05rem; font-weight: 700; }

/* ── Badges ─────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: .2rem .65rem; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger  { background: #fee2e2; color: #dc2626; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-info    { background: #D1F0E0; color: #1A6B3F; }
.badge-muted   { background: var(--border); color: var(--muted); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ── Tables ──────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th { padding: .75rem 1rem; text-align: left; font-weight: 600; color: var(--text-muted); background: var(--bg); border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Alerts / Flash ─────────────────── */
.flash { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-size: .9rem; font-weight: 500; }
.flash-icon { font-size: 1.1rem; }
.flash-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.flash-info    { background: #D1F0E0; color: #1A6B3F; border: 1px solid #2A8A55; }

/* ── Modal ───────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; place-items: center; }
.modal-overlay.open { display: grid; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: 90%; max-width: 540px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: fadeUp .2s ease; }
.modal-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }
.modal-close  { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--muted); line-height: 1; }

/* ── Dashboard Sidebar ───────────────── */
.dash-layout { display: flex; min-height: 100vh; }
.dash-sidebar {
  width: var(--sidebar-w); background: var(--dark); color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column; z-index: 100; transition: transform .3s;
}
.sidebar-logo { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--dark3); }
.sidebar-logo a { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; text-decoration: none; }
.sidebar-logo .site-logo { height: 36px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0; }
.sidebar-section { padding: .4rem 1.25rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; color: var(--dark3); text-transform: uppercase; margin-top: .75rem; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem; color: #94a3b8;
  font-size: .875rem; font-weight: 500;
  transition: all .15s; border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-nav a:hover { color: #fff; background: var(--dark2); text-decoration: none; }
.sidebar-nav a.active { color: #fff; background: var(--dark2); border-left-color: var(--primary); }
.sidebar-nav a svg, .sidebar-nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--dark3); }
.dash-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.dash-topbar {
  height: var(--header-h); background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.75rem;
}
.dash-topbar-left { display: flex; align-items: center; gap: 1rem; }
.dash-topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-title { font-size: 1rem; font-weight: 600; }
.dash-content { padding: 2rem 1.75rem; flex: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.75rem; }
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { font-size: .875rem; color: var(--text-muted); margin-top: .2rem; }

/* ── Stat Cards ─────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: .5rem; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.stat-change { font-size: .8rem; color: var(--success); font-weight: 600; }
.stat-change.down { color: var(--danger); }
.stat-icon { font-size: 2rem; margin-bottom: .25rem; }

/* ── Subscription Banner ─────────────── */
.sub-banner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.5rem; border-radius: var(--radius-sm); margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.sub-banner.trial { background: linear-gradient(135deg, #D1F0E0, #E8F7EF); border: 1px solid #2A8A55; }
.sub-banner.expired { background: #fee2e2; border: 1px solid #fecaca; }
.sub-banner.active  { background: #dcfce7; border: 1px solid #bbf7d0; }

/* ── Animations ─────────────────────── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.fade-up { animation: fadeUp .3s ease; }

/* ── Logo Image ─────────────────────── */
.site-logo { height: 42px; width: auto; display: block; object-fit: contain; transition: opacity .2s; }
.site-logo:hover { opacity: .85; }
/* on dark green sidebar/footer — make logo white */
.site-logo-white { filter: brightness(0) invert(1); }
/* on light backgrounds — apply green tint to match theme */
.site-logo-green { filter: sepia(1) saturate(4) hue-rotate(95deg) brightness(.75); }
/* on light nav — show natural logo colours */
.site-logo-light { filter: none; height: 38px; }

/* ── Landing Page ───────────────────── */
.lp-nav { background: var(--white); border-bottom: 1px solid var(--border); padding: 1rem 0; position: sticky; top: 0; z-index: 100; }
.lp-nav-inner { display: flex; align-items: center; justify-content: space-between; }
.lp-logo { font-size: 1.3rem; font-weight: 800; color: var(--dark); display: flex; align-items: center; gap: .5rem; }
.lp-logo-dot { width: 10px; height: 10px; background: var(--primary); border-radius: 50%; }
.lp-nav-links { display: flex; align-items: center; gap: 1.5rem; }
.lp-nav-links a { color: var(--text-muted); font-size: .9rem; font-weight: 500; transition: color .2s; text-decoration: none; }
.lp-nav-links a:hover { color: var(--text); text-decoration: none; }
.lp-nav-links .btn-primary { color: #fff !important; }
.lp-nav-links .btn-primary:hover { color: #fff !important; }
.hero { padding: 5rem 0 4rem; text-align: center; background: linear-gradient(180deg, #E8F7EF 0%, var(--bg) 100%); }
.hero h1 { font-size: 3.25rem; font-weight: 900; line-height: 1.15; margin-bottom: 1.25rem; }
.hero h1 span { background: linear-gradient(135deg, #1A6B3F, #E8821A); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: 1.15rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 2.5rem; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.hero-badge { display: inline-flex; align-items: center; gap: .4rem; background: var(--accent-light); color: var(--accent-dark); padding: .35rem .9rem; border-radius: 999px; font-size: .8rem; font-weight: 700; margin-bottom: 1.25rem; }
.features { padding: 5rem 0; background: var(--white); }
.features h2 { text-align: center; margin-bottom: .75rem; }
.features .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 3rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.feature-card { padding: 2rem; border: 1px solid var(--border); border-radius: var(--radius); transition: box-shadow .2s, transform .2s; }
.feature-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.feature-icon { font-size: 2.25rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.feature-card p { color: var(--text-muted); font-size: .9rem; margin: 0; }
.pricing { padding: 5rem 0; background: var(--bg); }
.pricing h2 { text-align: center; margin-bottom: .75rem; }
.pricing .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 3rem; }
.pricing-card {
  max-width: 420px; margin: 0 auto;
  background: var(--white); border: 2px solid var(--primary); border-radius: var(--radius-lg);
  padding: 2.5rem; text-align: center; box-shadow: var(--shadow-lg);
}
.pricing-badge { display: inline-block; background: var(--primary); color: #fff; font-size: .75rem; font-weight: 700; padding: .3rem .9rem; border-radius: 999px; margin-bottom: 1.25rem; }
.pricing-price { font-size: 3.5rem; font-weight: 900; line-height: 1; margin-bottom: .5rem; }
.pricing-price span { font-size: 1.25rem; color: var(--text-muted); font-weight: 400; }
.pricing-features { list-style: none; text-align: left; margin: 1.5rem 0 2rem; }
.pricing-features li { padding: .5rem 0; font-size: .9rem; display: flex; align-items: center; gap: .6rem; border-bottom: 1px solid var(--border); }
.pricing-features li:last-child { border-bottom: none; }
.pricing-features li::before { content: '✓'; color: var(--success); font-weight: 800; }
.lp-footer { background: var(--dark); color: #94a3b8; padding: 2.5rem 0; text-align: center; font-size: .875rem; }

/* ── Auth Pages ─────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #D1F0E0 0%, #E8F7EF 100%); padding: 2rem 1rem; }
.auth-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2.5rem; width: 100%; max-width: 440px; }
.auth-logo { text-align: center; margin-bottom: 2rem; display: flex; justify-content: center; }
.auth-logo a { display: inline-flex; flex-direction: column; align-items: center; gap: .4rem; }
.auth-logo .site-logo { height: 52px; }
.auth-title { text-align: center; margin-bottom: .4rem; font-size: 1.5rem; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: .875rem; margin-bottom: 2rem; }
.auth-divider { text-align: center; color: var(--text-muted); font-size: .8rem; margin: 1.25rem 0; position: relative; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: calc(50% - 1.5rem); height: 1px; background: var(--border); }
.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }
.auth-footer-link { text-align: center; font-size: .875rem; margin-top: 1.25rem; color: var(--text-muted); }

/* ── Mobile sidebar backdrop ─────────── */
/* Full-screen dim overlay that appears behind the off-canvas drawer on
 * mobile. Hidden on desktop; pointer-events switched on only when the
 * drawer is open. Tapping the backdrop closes the drawer. */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 99;
  opacity: 0;
  transition: opacity .25s ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Mobile sidebar-toggle button in the topbar — visible only < 900px.
 * Styled as a clean square icon button so it sits well on the left of
 * the topbar where we already have one on all dashboard pages. */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: var(--text-muted);
  padding: .4rem .55rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background .15s, color .15s;
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

/* ── Responsive ─────────────────────── */

/* ─ Tablet landscape / small desktop (< 1024px) ─ */
@media (max-width: 1024px) {
  .container { padding: 0 1.25rem; }
  .dash-content { padding: 1.5rem 1.25rem; }
  .dash-topbar { padding: 0 1.25rem; }
  .hero { padding: 3.5rem 0 3rem; }
  .hero h1 { font-size: 2.75rem; }
  .features, .pricing, .how-it-works, .testimonials, .demo-section, .faq-section { padding: 4rem 0; }
}

/* ─ Tablet portrait / mobile drawer breakpoint (< 900px) ─ */
@media (max-width: 900px) {
  /* Dashboard sidebar becomes off-canvas */
  .dash-sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0, 0, 0, .35);
  }
  .dash-sidebar.open { transform: translateX(0); }
  .dash-main { margin-left: 0; }
  .sidebar-backdrop.open { display: block; }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }

  /* Typography scales */
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.5rem; }
  .hero h1 { font-size: 2.25rem; }
  .hero p { font-size: 1rem; }

  /* Landing nav — hide desktop links, use a compact mobile layout */
  .lp-nav-links a:not(.btn) { display: none; }
  .lp-nav-links { gap: .5rem; }

  /* Feature/demo/footer grids compress */
  .features-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Topbar — allow title to truncate */
  .dash-topbar { padding: 0 1rem; }
  .topbar-title {
    max-width: 55vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ─ Mobile (≤ 600px) ─ */
@media (max-width: 600px) {
  .container { padding: 0 1rem; }
  .container-sm { padding: 0 1rem; }

  /* Typography */
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.15rem; }
  .hero { padding: 2.5rem 0 2rem; }
  .hero h1 { font-size: 1.9rem; line-height: 1.2; }
  .hero p { font-size: .95rem; }
  .features, .pricing, .how-it-works, .testimonials, .demo-section, .faq-section, .cta-section { padding: 3rem 0; }

  /* Dashboard spacing */
  .dash-topbar { padding: 0 .9rem; height: 56px; }
  .dash-content { padding: 1.25rem .9rem; }
  .dash-topbar-right { gap: .5rem; }
  .dash-topbar-right .btn-sm { padding: .35rem .7rem; font-size: .75rem; }

  /* Hide the user's name next to the avatar on phones — the restaurant name
     already shows in .topbar-title at the left, so it's redundant and
     wrapping it under the avatar (as in the bug report) looks broken. */
  .topbar-user-name { display: none; }

  /* Page header stacks cleanly */
  .page-header { flex-direction: column; align-items: flex-start; gap: .85rem; margin-bottom: 1.25rem; }
  .page-header > div { width: 100%; }
  .page-header .btn-block,
  .page-header [class*="btn"]:only-child { width: 100%; justify-content: center; }
  .page-title { font-size: 1.3rem; }

  /* Stat cards */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .85rem; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.5rem; }
  .stat-label { font-size: .72rem; }

  /* Cards */
  .card-header, .card-footer { padding: 1rem 1.1rem; }
  .card-body { padding: 1.1rem; }

  /* Subscription banner */
  .sub-banner { flex-direction: column; align-items: flex-start; padding: 1rem; }
  .sub-banner .btn { width: 100%; justify-content: center; }

  /* Modals */
  .modal { width: 100%; max-width: 100%; margin: .75rem; border-radius: var(--radius); }
  .modal-header, .modal-footer { padding: 1rem 1.1rem; }
  .modal-body { padding: 1.1rem; }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  /* Tables: already have overflow-x on .table-wrap; shrink padding */
  thead th, tbody td { padding: .6rem .65rem; font-size: .8rem; }

  /* Buttons */
  .btn { padding: .55rem 1rem; font-size: .85rem; }
  .btn-lg { padding: .75rem 1.4rem; font-size: .95rem; }
  .btn-sm { padding: .35rem .7rem; font-size: .78rem; }

  /* Forms: prevent iOS zoom on focus by ensuring ≥16px input text */
  .form-control, .input, .textarea, .select { font-size: 16px; }

  /* Hero button group */
  .hero-btns { flex-direction: column; align-items: stretch; max-width: 320px; margin: 0 auto; }
  .hero-btns .btn { width: 100%; justify-content: center; }

  /* Pricing */
  .pricing-card { padding: 1.75rem 1.25rem; }
  .pricing-price { font-size: 2.5rem; }

  /* Landing nav: compact */
  .lp-nav { padding: .65rem 0; }
  .lp-logo img { height: 32px; }

  /* Tabs scroll horizontally */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { flex-shrink: 0; padding: .55rem .95rem; font-size: .82rem; }

  /* Avatar shrink */
  .avatar { width: 32px; height: 32px; font-size: .82rem; }

  /* Dropdown menus full-width on mobile */
  .dropdown-menu { min-width: 200px; right: -.5rem; }

  /* Empty state */
  .empty-state { padding: 2.5rem 1rem; }
  .empty-state-icon { font-size: 2.5rem; }

  /* Auth card */
  .auth-card { padding: 1.75rem 1.25rem; }
  .auth-title { font-size: 1.3rem; }

  /* Sidebar width on mobile */
  .dash-sidebar { width: min(280px, 85vw); }
}

/* ─ Small mobile (≤ 400px) ─ */
@media (max-width: 400px) {
  .dash-content { padding: 1rem .75rem; }
  .dash-topbar { padding: 0 .75rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.15rem; }
  .hero h1 { font-size: 1.55rem; }
  .btn { padding: .5rem .85rem; }
  .btn-lg { padding: .65rem 1.15rem; font-size: .9rem; }
  .pricing-price { font-size: 2rem; }
  .topbar-title { max-width: 38vw; font-size: .85rem; }
}

/* ─ Ensure images never overflow ─ */
img, video, canvas, svg { max-width: 100%; height: auto; }

/* ─ Print tweak: hide sidebar/topbar for clean printouts ─ */
@media print {
  .dash-sidebar, .dash-topbar, .sidebar-backdrop, .sidebar-toggle, .sticky-cta, .scroll-top { display: none !important; }
  .dash-main { margin-left: 0 !important; }
  .dash-content { padding: 0 !important; }
}

/* ── Super Admin specific ────────────── */
.sa-sidebar { background: #0A2E1A; }
.sa-sidebar .sidebar-nav a.active { border-left-color: #E8821A; }
.sa-sidebar .sidebar-logo a { color: #fff; }

/* ── Avatar ──────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }

/* ── Toggle switch ───────────────────── */
.toggle { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .3s; }
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ── Search bar ──────────────────────── */
.search-bar { position: relative; }
.search-bar input { padding-left: 2.5rem; }
.search-bar .search-icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }

/* ── Empty state ─────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { margin-bottom: .5rem; color: var(--text); }

/* ── Tabs ────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: .65rem 1.25rem; font-size: .875rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -2px; transition: color .2s; text-decoration: none; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Progress bar ────────────────────── */
.progress { background: var(--border); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--primary); transition: width .4s; }

/* ── Tooltip ─────────────────────────── */
[data-tip] { position: relative; }
[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff; padding: .35rem .75rem; border-radius: 6px; font-size: .75rem; white-space: nowrap; z-index: 999; pointer-events: none; }

/* ── Dropdown menu ───────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 180px; z-index: 200; overflow: hidden; }
.dropdown.open .dropdown-menu { display: block; animation: fadeUp .15s ease; }
.dropdown-item { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; font-size: .875rem; color: var(--text); cursor: pointer; transition: background .15s; text-decoration: none; }
.dropdown-item:hover { background: var(--bg); text-decoration: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* ── Misc ────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ── Responsive collapse for inline "display:grid;grid-template-columns:repeat(N,1fr)"
 * patterns used across dashboard pages. These selectors override the inline
 * style via higher-specificity !important on small screens only. */
@media (max-width: 700px) {
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
}
@media (min-width: 701px) and (max-width: 900px) {
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}
@media (max-width: 480px) {
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }

/* ═══════════════════════════════════════════════════════════════════════
   MOBILE-FIRST RESPONSIVE POLISH (v2.1)
   Global safety nets, form/input fixes, table/menu-item fixes,
   page-header & action-row wrapping, dashboard menu item cards,
   and super-admin small-screen polish.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Global safety net: prevent horizontal page scroll on phones.
 *    Any element wider than 100vw (e.g. tables, pre blocks, iframes)
 *    should now expose its own scroll instead of overflowing body.
 *    NOTE: we intentionally apply overflow-x only to <html>, NOT <body>.
 *    Putting overflow-x:hidden on a position:sticky element's ancestor
 *    breaks sticky behavior — see https://developer.mozilla.org/en-US/
 *    docs/Web/CSS/position#sticky_positioning. <html> as the viewport
 *    root is the exception the browser doesn't treat as a scroll container
 *    for sticky children. */
html { max-width: 100%; overflow-x: hidden; }
body { max-width: 100%; }
.dash-layout, .dash-main { max-width: 100%; }

/* Anything that can contain wide content should wrap / scroll safely. */
pre, code, iframe { max-width: 100%; }
pre { overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; }

/* Images / media never overflow */
img, video, canvas, svg, embed, object { max-width: 100%; height: auto; }

/* iOS-safe inputs — ≥16px font avoids auto-zoom on focus.
 * We scope by input type so it targets even inline-styled inputs. */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="url"],
input[type="search"], input[type="date"], input[type="time"],
input[type="datetime-local"], textarea, select {
  max-width: 100%;
}
@media (max-width: 600px) {
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="tel"], input[type="url"],
  input[type="search"], input[type="date"], input[type="time"],
  input[type="datetime-local"], textarea, select,
  .form-control, .input, .textarea {
    font-size: 16px !important;
  }
}

/* ── Page header (dashboard + super-admin) — wrap & stack gracefully. */
.page-header { flex-wrap: wrap; gap: .85rem; }
.page-header > div:last-child { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 700px) {
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header > div:last-child { width: 100%; }
  .page-header > div:last-child > .btn { flex: 1 1 auto; justify-content: center; }
}

/* ── Dashboard menu-item card (dashboard/menu.php).
 *    On phones the 56px image + text + actions row overflows. We stack
 *    actions onto their own row and let the text column wrap. */
@media (max-width: 600px) {
  .menu-item-card {
    flex-wrap: wrap;
    padding: .85rem;
    gap: .75rem;
    align-items: flex-start;
  }
  .menu-item-card > *:not(.item-img):not(.item-actions) {
    flex: 1 1 calc(100% - 68px);
    min-width: 0;
  }
  .menu-item-card .item-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: .25rem;
  }
  .menu-item-card .item-actions .btn,
  .menu-item-card .item-actions button {
    flex: 0 0 auto;
  }
  /* Category header action row */
  .category-header {
    flex-wrap: wrap;
    gap: .5rem;
  }
  .category-header > div:last-child {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── Generic action-row wrapping inside cards (settings, subscription) */
@media (max-width: 600px) {
  .card-header { flex-wrap: wrap; gap: .5rem; }
  .card-header > * { min-width: 0; }
}

/* ── Tables — enforce horizontal scroll when NOT wrapped in .table-wrap.
 *    Many pages forget the wrapper; this targets any bare table on
 *    small screens and lets it scroll inside its parent without
 *    blowing out the page width. */
@media (max-width: 900px) {
  .dash-content table,
  .card-body > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .table-wrap { -webkit-overflow-scrolling: touch; }
}

/* ── Buttons: ensure tap targets ≥ 40px high on mobile (WCAG) */
@media (max-width: 600px) {
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
}

/* ── Subscription / billing page tweaks — plan cards, feature lists */
@media (max-width: 600px) {
  .pricing-plans, .plans-grid { grid-template-columns: 1fr !important; gap: 1rem !important; }
  .plan-card, .pricing-plan-card { padding: 1.5rem 1.25rem !important; }
}

/* ── Dashboard topbar — on very narrow screens drop the "Live Menu ↗"
 *    button label but keep the icon-only affordance by shortening. */
@media (max-width: 420px) {
  .dash-topbar-right .btn-sm,
  .dash-topbar-right .btn-ghost {
    padding: .35rem .5rem;
    font-size: .7rem;
  }
  .topbar-title { font-size: .82rem; max-width: 40vw; }
}

/* ── Super-admin: ensure the admin content column doesn't underlap
 *    the fixed sidebar on tablet-width; page padding shrinks. */
@media (max-width: 768px) {
  .sa-sidebar, .dash-sidebar { width: min(280px, 85vw); }
}

/* ── Dropdown menu — keep inside viewport on small screens */
@media (max-width: 480px) {
  .dropdown-menu {
    right: 0 !important;
    min-width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
  }
}

/* ── Modal — full-width with rounded top corners on very small phones */
@media (max-width: 480px) {
  .modal-overlay { padding: 0; }
  .modal {
    margin: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 95vh;
    align-self: flex-end;
  }
  .modal-overlay.open { align-items: flex-end; }
}

/* ── Flex utility rows that use inline style="display:flex" often need
 *    wrapping on mobile. Catch the common pattern. */
@media (max-width: 600px) {
  [style*="display:flex"][style*="gap"],
  [style*="display: flex"][style*="gap"] {
    flex-wrap: wrap;
  }
}

/* ── Container padding on ultra-narrow screens */
@media (max-width: 360px) {
  .container, .container-sm { padding-left: .75rem; padding-right: .75rem; }
  .dash-content { padding: .9rem .6rem; }
  h1 { font-size: 1.45rem; }
  h2 { font-size: 1.2rem; }
  .page-title { font-size: 1.05rem; }
  .btn { padding: .5rem .8rem; font-size: .82rem; }
}

/* ── Long unbreakable strings (IDs, slugs) should not overflow rows */
.break-word { word-break: break-word; overflow-wrap: anywhere; }
td, .card-body, .stat-value, .topbar-title { overflow-wrap: anywhere; }

/* ── Sidebar backdrop — ensure it's always below the drawer but
 *    above all content even when inline z-indexes fight. */
.sidebar-backdrop { z-index: 99; }
.dash-sidebar { z-index: 101; }
