/* =====================================================================
   SIGMINT BUILDER — responsive.css
   ---------------------------------------------------------------------
   Loaded LAST, after style.css and dashboard.css. Covers every screen
   from 1440px down to 320px: phone, phablet, tablet, small laptops.

   Breakpoints
     1280  small laptop     1024  tablet landscape
      900   tablet portrait   768  large phone
      640   phone             480  small phone
      380   tiny phone (SE)

   Principles
     • Nothing overflows horizontally — grids collapse, tables scroll
     • Every tap target is at least 40px tall
     • Sticky/preview panels become static on phones
     • Safe-area insets for notches and home indicators
   ===================================================================== */

/* ------------------------------------------------------------------ */
/*  Global helpers                                                     */
/* ------------------------------------------------------------------ */
html { -webkit-text-size-adjust: 100%; }

body {
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

img, svg, video, canvas, table, pre, code {
  max-width: 100%;
}

/* Long words (package names, licence keys) must not break the layout. */
body, .panel, .card, .kv, .stat-card, .data td, .data th, .empty-state {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ------------------------------------------------------------------ */
/*  ≤1280 — small laptops                                              */
/* ------------------------------------------------------------------ */
@media (max-width: 1280px) {
  .app-content { padding: 26px 22px 36px; }
  .container   { max-width: 100%; }
  .builder     { grid-template-columns: 1fr 330px; }
}

/* ------------------------------------------------------------------ */
/*  ≤1024 — tablet landscape / small laptop                            */
/* ------------------------------------------------------------------ */
@media (max-width: 1024px) {
  .stat-cards                 { grid-template-columns: repeat(2, 1fr); }
  .quick-actions              { grid-template-columns: repeat(2, 1fr); }
  .dash-grid.cols-3,
  .grid-3                     { grid-template-columns: repeat(2, 1fr); }
  .grid-4                     { grid-template-columns: repeat(2, 1fr); }
  .option-grid.cols-4         { grid-template-columns: repeat(2, 1fr); }
  .builder                    { grid-template-columns: 1fr; }
  .preview-panel              { position: static !important; order: -1; }
  .footer-grid                { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid               { grid-template-columns: repeat(2, 1fr); }
  .dash-grid.cols-2           { gap: 18px; }
}

/* ------------------------------------------------------------------ */
/*  ≤900 — tablet portrait: sidebar becomes a drawer                    */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .app-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 268px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    z-index: 80;
  }
  body.sidebar-open .app-sidebar { transform: none; }

  .sidebar-toggle { display: grid; place-items: center; }
  .sidebar-close  { display: grid; place-items: center; }

  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    z-index: 70; opacity: 0; visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
  }
  body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }

  .app-content { padding: 20px 16px 32px; }
  .app-topbar  { padding: 0 16px; gap: 10px; }
  .topbar-title h1 { font-size: 1rem; }
  .user-menu-meta { display: none; }

  .field-grid, .kv-grid, .dash-grid.cols-3, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .option-grid.cols-3, .option-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

  /* Wizard: steps scroll sideways instead of wrapping into a wall. */
  .wizard-steps {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .wizard-steps::-webkit-scrollbar { display: none; }
  .wizard-step { flex: 0 0 auto; min-width: 132px; }
}

/* ------------------------------------------------------------------ */
/*  ≤768 — large phones                                                */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
  /* Typography */
  .section                  { padding: 56px 0; }
  .container                { padding: 0 18px; }
  h1                        { font-size: 1.85rem !important; }
  h2                        { font-size: 1.45rem !important; }
  .hero h1, .hero-title     { font-size: 2.1rem !important; }
  .section-head h2          { font-size: 1.5rem !important; }

  /* Layout: everything single column */
  .grid-2, .grid-3, .grid-4, .steps, .stats,
  .footer-grid, .pricing-grid,
  .dash-grid.cols-2, .dash-grid.cols-2-even,
  .dash-grid.cols-3,
  .stat-cards, .quick-actions,
  .field-grid, .kv-grid,
  .option-grid.cols-2, .option-grid.cols-3, .option-grid.cols-4 {
    grid-template-columns: 1fr !important;
  }
  .form-row                 { grid-template-columns: 1fr; }
  .footer-brand             { grid-column: 1 / -1; }

  /* Panels */
  .panel-head               { padding: 16px 18px; align-items: flex-start; }
  .panel-body               { padding: 18px; }
  .panel-foot               { padding: 16px 18px; }
  .stat-card                { padding: 16px; gap: 13px; }
  .stat-card .sc-value      { font-size: 1.45rem; }

  /* Tables: keep them readable with a hint of scroll */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }
  .data { min-width: 620px; }
  .data.compact, .data.no-scroll { min-width: 0; }
  .data th, .data td { padding: 10px 12px; }

  /* Buttons & inputs: comfortable touch targets */
  .btn                      { padding: 11px 16px; }
  .btn-sm                   { padding: 8px 12px; font-size: .84rem; }
  .btn-lg                   { padding: 14px 22px; font-size: 1rem; }
  .btn-block-mobile         { width: 100%; }
  .form-control, .form-select, textarea.form-control { font-size: 16px; } /* stops iOS zoom */
  .icon-btn, .icon-btn-sm   { min-width: 40px; min-height: 40px; }
  .btn-group                { flex-wrap: wrap; }
  .btn-group > .btn         { flex: 1 1 auto; }

  /* Filter bars wrap instead of overflowing */
  .filter-bar {
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
  }
  .filter-bar .form-control,
  .filter-bar select,
  .filter-bar input { width: 100%; min-width: 0; }
  .filter-bar form  { width: 100%; }
  .filter-bar > a.btn,
  .filter-bar > button { flex: 1 1 auto; }

  /* Builder */
  .builder                  { grid-template-columns: 1fr; gap: 18px; }
  .preview-panel            { position: static !important; order: -1; }
  .phone, .phone-frame      { width: 250px !important; height: 510px !important; }
  .preview-meta             { grid-template-columns: 1fr 1fr; }
  .wizard-nav               { flex-direction: column-reverse; gap: 10px; }
  .wizard-nav .btn          { width: 100%; min-width: 0; }

  /* Cards & lists */
  .app-cell                 { gap: 10px; }
  .activity-list li         { gap: 10px; }
  .showcase, .showcase-grid { grid-template-columns: 1fr; }
  .kv                       { padding: 12px 14px; }

  /* Modal / toast */

  .toast-host { top: 12px; left: 12px; right: 12px; align-items: stretch; }
  .toast      { max-width: 100%; }

  /* Auth pages */
  .auth-wrap                { grid-template-columns: 1fr; }
  .auth-side                { display: none; }
  .auth-main                { padding: 26px 18px; }

  /* Hero */
  .hero-grid                { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .hero-visual              { order: -1; }
  .float-badge              { display: none; }
  .url-builder              { flex-direction: column; }
  .url-builder .btn         { width: 100%; }

  /* Charts made of flex bars still work, just shorter */
  /* Inline-height bar charts (analytics / revenue) get shorter on phones. */
  [style*="height:190px"], [style*="height:170px"],
  [style*="height:160px"], [style*="height:180px"] { height: 150px !important; }
}

/* ------------------------------------------------------------------ */
/*  ≤640 — phones                                                      */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
  .app-content              { padding: 16px 13px 28px; }
  .stat-cards, .quick-actions { gap: 12px; }
  .stat-card                { flex-direction: row; align-items: center; }
  .stat-card .sc-icon       { width: 40px; height: 40px; }

  .panel-head h2, .panel-head h3 { font-size: .98rem; }
  .data                     { min-width: 540px; }

  /* Stack table action buttons */
  .actions                  { flex-wrap: wrap; gap: 6px; }
  .actions form             { display: inline-flex; gap: 6px; }

  /* Stepper dots/labels shrink */
  .wizard-step              { min-width: 118px; padding: 10px 12px; }
  .wizard-step .ws-label    { font-size: .8rem; }

  /* Footer */
  .footer-grid              { grid-template-columns: 1fr; gap: 26px; }
  .footer-bottom            { flex-direction: column; gap: 10px; text-align: center; }

  /* Phone preview inside the builder */
  .phone, .phone-frame      { width: 232px !important; height: 474px !important; }
  .preview-meta             { grid-template-columns: 1fr; }

  /* Long code blocks */
  pre.code-block, .code-block {
    font-size: .72rem;
    max-height: 260px;
  }

  /* Empty states */
  .empty-state              { padding: 34px 18px; }
  .empty-state h3           { font-size: 1.15rem; }
}

/* ------------------------------------------------------------------ */
/*  ≤480 — small phones                                                */
/* ------------------------------------------------------------------ */
@media (max-width: 480px) {
  h1                        { font-size: 1.6rem !important; }
  h2                        { font-size: 1.3rem !important; }
  .hero h1, .hero-title     { font-size: 1.75rem !important; }

  .container                { padding: 0 14px; }
  .app-content              { padding: 14px 12px 24px; }
  .panel-body               { padding: 15px; }
  .panel-head               { padding: 14px 15px; }

  .stat-card                { padding: 14px; }
  .stat-card .sc-value      { font-size: 1.3rem; }
  .stat-cards               { grid-template-columns: 1fr; gap: 10px; }
  .quick-actions            { grid-template-columns: 1fr; }

  /* Two tiny columns where it still helps */
  .preview-meta, .kv-grid   { grid-template-columns: 1fr 1fr; }

  .btn                      { width: auto; }
  .btn-block, .btn-group > .btn { width: 100%; }
  .header-actions .btn-sm   { padding: 8px 11px; font-size: .82rem; }

  .phone, .phone-frame      { width: 210px !important; height: 430px !important; }

  .data                     { min-width: 480px; }
  .activity-time            { display: none; }

  .topbar-title h1          { font-size: .95rem; }
  .app-footer               { flex-direction: column; gap: 6px; text-align: center; }
}

/* ------------------------------------------------------------------ */
/*  ≤380 — iPhone SE and smaller                                       */
/* ------------------------------------------------------------------ */
@media (max-width: 380px) {
  .container, .app-content  { padding-left: 10px; padding-right: 10px; }
  .stat-card .sc-value      { font-size: 1.2rem; }
  .data                     { min-width: 440px; }
  .phone, .phone-frame      { width: 190px !important; height: 390px !important; }
  .wizard-step              { min-width: 108px; }
  .btn                      { padding: 10px 13px; font-size: .88rem; }
}

/* ------------------------------------------------------------------ */
/*  Landscape phones — keep the shell usable                            */
/* ------------------------------------------------------------------ */
@media (max-height: 520px) and (orientation: landscape) {
  .app-sidebar              { width: 240px; }
  .app-content              { padding-top: 14px; }
  .stat-cards               { grid-template-columns: repeat(4, 1fr); }
  .phone, .phone-frame      { height: 380px !important; }

}

/* ------------------------------------------------------------------ */
/*  Touch devices: bigger hit areas, no hover-only affordances          */
/* ------------------------------------------------------------------ */
@media (hover: none) and (pointer: coarse) {
  .sidebar-link,
  .qa,
  .btn,
  .wizard-step,
  .option-card {
    min-height: 44px;
  }
  .icon-btn, .icon-btn-sm {
    min-width: 44px; min-height: 44px;
  }
  /* Reveal hover-only controls permanently on touch. */
  .card-hover:hover { transform: none; }

}

/* ------------------------------------------------------------------ */
/*  Safe areas (notch / home indicator)                                 */
/* ------------------------------------------------------------------ */
@supports (padding: env(safe-area-inset-bottom)) {
  .app-sidebar   { padding-bottom: env(safe-area-inset-bottom); }
  .app-footer    { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toast-host    { top: calc(12px + env(safe-area-inset-top)); }
  .site-header   { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

/* ------------------------------------------------------------------ */
/*  Print — invoices and build logs                                     */
/* ------------------------------------------------------------------ */
@media print {
  .site-header, .site-footer, .app-sidebar, .app-topbar,
  .sidebar-backdrop, .btn, .actions, .filter-bar, .wizard-nav { display: none !important; }
  .app-main, .app-content { margin: 0; padding: 0; }
  .panel { border: 0; box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

/* =====================================================================
   Phase 4 — payout + A/B controls
   ===================================================================== */
.payout-inline { width: 118px; padding: 6px 8px; font-size: .78rem; }
.ab-variant-select { width: auto; padding: 6px 8px; font-size: .8rem; }

@media (max-width: 900px) {
  .data td form.payout-form,
  .data td form { flex-wrap: wrap; }
  .payout-inline { width: 100%; max-width: 180px; }
  .ab-variant-select { width: 88px; }
}

@media (max-width: 640px) {
  /* Settle form inside the payouts table stacks into a small card. */
  .data td form.payout-form,
  .data td form[action="/admin/payouts.php"] {
    flex-direction: column;
    align-items: stretch !important;
    gap: 6px;
  }
  .payout-inline { width: 100%; max-width: none; }
  .data td form .btn,
  .data td form .icon-btn-sm { width: 100%; justify-content: center; }

  /* Retention / cohort tables are wide by nature — keep them scrollable. */
  .cohort-grid { min-width: 560px; }
}

@media (max-width: 480px) {
  #ab-fields { padding-left: 10px !important; }
  .swatch-row .btn { font-size: .74rem; padding: 5px 8px; }
}

/* =====================================================================
   Phase 5 — scoped API keys + settings screens
   ===================================================================== */
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 9px; }
.option-card.compact { padding: 10px 12px; }
.option-card.compact .oc-body b { display: block; }
.option-card.compact .oc-body small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.twofa-qr { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
.twofa-qr .qr-frame { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--border); line-height: 0; }
.twofa-qr .qr-frame svg { display: block; }
.backup-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.backup-codes code { display: block; text-align: center; padding: 8px 6px; background: var(--surface-2, #f8fafc); border: 1px solid var(--border); border-radius: 8px; font-size: .86rem; }

@media (max-width: 640px) {
  .scope-grid { grid-template-columns: 1fr; }
  .twofa-qr { flex-direction: column; }
  .twofa-qr .qr-frame { align-self: flex-start; }
  .backup-codes { grid-template-columns: repeat(2, 1fr); }
  .data td form[action="/dashboard/api-keys.php"] { justify-content: flex-start; }
}

@media (max-width: 480px) {
  .twofa-qr .qr-frame svg { width: 180px; height: 180px; }
}

/* =====================================================================
   Phase 6 — languages, Play Store listing, monetisation, status page
   ===================================================================== */

/* ---------- language switcher ---------- */
.lang-switch { margin: 0; }
.lang-switch-inner { display: inline-flex; align-items: center; gap: 6px; }
.lang-switch select {
  border: 1px solid var(--border);
  background: var(--surface, #fff);
  color: var(--text, inherit);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .82rem;
  line-height: 1.2;
  max-width: 150px;
  cursor: pointer;
}
.lang-flag { font-size: 1rem; line-height: 1; }
.lang-list { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  color: #cbd5e1; font-size: .82rem; text-decoration: none;
}
.lang-pill:hover { border-color: rgba(255, 255, 255, .45); color: #fff; }
.lang-pill.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.footer-lang { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; margin-top: 14px; gap: 12px; flex-wrap: wrap; }
.footer-lang .muted { color: #94a3b8; font-size: .85rem; }
.app-topbar .lang-switch select { max-width: 130px; }

/* ---------- Play Store listing ---------- */
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.check-list li { display: flex; gap: 9px; align-items: flex-start; font-size: .92rem; }
.check-list li svg { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.check-list li.ok svg { color: var(--success); }
.check-list li.bad svg { color: var(--danger, #ef4444); }
.check-list li small { display: block; font-size: .8rem; }
.counter { transition: color .15s ease; }
.counter.over { color: #b91c1c; font-weight: 600; }
.store-file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.store-file { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2, #f8fafc); }
.store-file-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; background: rgba(148, 163, 184, .12); }
.store-file-head code { font-size: .78rem; }
.store-file-body { margin: 0; padding: 10px; font-size: .76rem; line-height: 1.45; max-height: 190px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* ---------- monetisation ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ad-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: var(--surface-2, #f8fafc); }
.ad-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.ad-card .form-control { font-size: .82rem; }
.stat-inline { display: inline-flex; gap: 7px; flex-wrap: wrap; }

/* ---------- status page & uptime ---------- */
.status-hero {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 24px 26px; border-radius: 16px; color: #fff;
  background: linear-gradient(120deg, #0f172a, #1e293b);
}
.status-hero.status-success { background: linear-gradient(120deg, #065f46, #0f766e); }
.status-hero.status-warning { background: linear-gradient(120deg, #92400e, #b45309); }
.status-hero.status-danger  { background: linear-gradient(120deg, #991b1b, #b91c1c); }
.status-hero h1 { color: #fff; font-size: 1.7rem; }
.status-dot { width: 15px; height: 15px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 6px rgba(74, 222, 128, .18); flex: none; }
.status-hero.status-warning .status-dot { background: #fbbf24; box-shadow: 0 0 0 6px rgba(251, 191, 36, .18); }
.status-hero.status-danger .status-dot { background: #f87171; box-shadow: 0 0 0 6px rgba(248, 113, 113, .18); }
.status-hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.status-hero-stats b { display: block; font-size: 1.25rem; }
.status-hero-stats small { opacity: .8; font-size: .76rem; }

.status-list { display: grid; gap: 14px; }
.status-row { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--surface, #fff); }
.status-row-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-row-stats { display: flex; gap: 20px; flex-wrap: wrap; text-align: right; }
.status-row-stats b { display: block; font-size: .98rem; }
.status-row-stats small { color: var(--muted); font-size: .74rem; }
.status-row-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: .78rem; }
.status-pill {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.status-pill-up { background: #d1fae5; color: #065f46; }
.status-pill-down { background: #fee2e2; color: #991b1b; }

.uptime-strip { display: flex; gap: 2px; margin-top: 10px; }
.uptime-day { flex: 1 1 0; height: 26px; border-radius: 3px; background: var(--line-soft); }
.uptime-strip.compact .uptime-day { height: 18px; }
.uptime-ok { background: #34d399; }
.uptime-warn { background: #fbbf24; }
.uptime-bad { background: #f87171; }
.uptime-void { background: var(--line-soft); }

@media (max-width: 1024px) {
  .status-hero-stats { gap: 18px; }
}

@media (max-width: 768px) {
  .status-hero { padding: 20px; }
  .status-hero h1 { font-size: 1.4rem; }
  .status-row-stats { text-align: left; gap: 14px; }
  .ad-grid, .store-file-grid { grid-template-columns: 1fr 1fr; }
  .footer-lang { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 640px) {
  .ad-grid, .store-file-grid { grid-template-columns: 1fr; }
  .status-row-head { gap: 8px; }
  .status-pill { padding: 3px 8px; font-size: .68rem; }
  .uptime-day { height: 22px; }
  .lang-switch select { max-width: 110px; font-size: .78rem; }
  .app-topbar .lang-switch select { max-width: 100px; }
  .store-file-body { max-height: 150px; }
}

@media (max-width: 480px) {
  .status-hero { flex-direction: column; align-items: flex-start; }
  .status-hero-stats { width: 100%; justify-content: space-between; gap: 10px; }
  .status-row-foot { flex-direction: column; gap: 4px; }
  .uptime-day { height: 18px; border-radius: 2px; }
  .lang-pill { font-size: .78rem; padding: 4px 9px; }
}

/* =====================================================================
   Public header — progressive collapse
   ---------------------------------------------------------------------
   960px  links + CTAs move into the burger drawer   (style.css)
   640px  drawer gets tighter, logo shrinks
   480px  burger + logo only; everything else lives in the drawer
   380px  logo wordmark shortens so nothing wraps or overflows
   ===================================================================== */

/* Progressive text hiding for secondary header labels. */
@media (max-width: 1180px) { .hide-sm { display: none !important; } }
@media (max-width: 640px)  { .hide-xs { display: none !important; } }

@media (max-width: 960px) {
  .site-header { z-index: 60; }
  .nav-backdrop { z-index: 55; }
  /* the drawer paints over the hero; give it a solid backdrop */
  .nav-open .site-header { background: #fff; border-bottom-color: var(--line); }
}

@media (max-width: 640px) {
  .header-inner { gap: 8px; height: var(--header-h); }
  .logo { font-size: 1rem; gap: 8px; }
  .logo svg { width: 28px; height: 28px; }
  .nav-toggle { width: 40px; height: 40px; border-radius: 10px; }

  .nav-open .main-nav { padding: 8px 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
  .nav-open .main-nav-links a { padding: 12px 12px; font-size: .97rem; min-height: 44px; }
  .nav-open .main-nav-actions { gap: 9px; padding-top: 14px; margin-top: 10px; }
  .main-nav-lang .lang-pill { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 480px) {
  .header-inner { gap: 6px; }
  .logo { font-size: .95rem; }
  .logo svg { width: 26px; height: 26px; }
  .nav-toggle { width: 38px; height: 38px; }
  .nav-toggle span, .nav-toggle span::before, .nav-toggle span::after { width: 17px; }
  .nav-toggle span::before { top: -5px; }
  .nav-toggle span::after { top: 5px; }
  .nav-open .nav-toggle span::before { transform: translateY(5px) rotate(45deg); }
  .nav-open .nav-toggle span::after { transform: translateY(-5px) rotate(-45deg); }

  .nav-open .main-nav { max-height: calc(100dvh - var(--header-h) - 6px); }
  .nav-open .main-nav-links a { min-height: 44px; }
  .nav-open .main-nav-actions .btn { min-height: 44px; font-size: .94rem; }
}

@media (max-width: 380px) {
  .logo span, .logo-text { max-width: 92px; }
  .container { padding: 0 12px; }
  .nav-open .main-nav { padding-left: 12px; padding-right: 12px; }
}

/* Landscape phones: a full-height drawer would hide everything, so cap it
   and let it scroll. */
@media (max-height: 520px) and (orientation: landscape) {
  .nav-open .main-nav { max-height: calc(100dvh - var(--header-h) - 4px); }
  .nav-open .main-nav-links a { padding: 8px 12px; min-height: 38px; }
  .nav-open .main-nav-actions { margin-top: 8px; padding-top: 10px; }
}

/* =====================================================================
   Live demo preview inside the phone mockup — small-screen tuning
   ===================================================================== */
@media (max-width: 768px) {
  .pv-live-bar { height: 30px; gap: 6px; padding: 0 7px; font-size: .6rem; }
  .pv-live-bar .mw-icon { width: 16px; height: 16px; border-radius: 5px; }
  .pv-live-host { font-size: .55rem; padding: 2px 7px; }
  .pv-live-reload { width: 18px; height: 18px; }
  .pv-live-reload svg { width: 10px; height: 10px; }
}

@media (max-width: 480px) {
  .pv-live-bar { height: 27px; font-size: .56rem; }
  .pv-live-title { display: none; }          /* keep the address readable */
  .pv-live-host { font-size: .52rem; }
  .pv-live-status { font-size: .64rem; }
  .pv-live-error { font-size: .58rem; left: 6px; right: 6px; bottom: 6px; padding: 7px 8px; }
}
