/* ============================================================
   GSM.CX — Main Stylesheet
   Bootstrap 5.3 base, custom components on top
   ============================================================ */

/* ---------- Theme tokens ----------
   Light is the default. `prefers-color-scheme: dark` auto-switches when
   the user hasn't picked anything. Explicit [data-theme] attributes on
   <html> (set by theme-toggle.js) override the system preference.
   Brand-dark surfaces (topbar, sidebar, footer, hero, CTA, auth-page
   gradient) intentionally stay dark in both themes — they're a design
   choice, not a surface that flips. */
:root {
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --surface-alt: #f1f5f9;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
  --primary:     #6366f1;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0a0e1a;
    --surface:     #151b2e;
    --surface-alt: #1e2538;
    --text:        #f1f5f9;
    --text-muted:  #94a3b8;
    --border:      #2d3548;
    /* Bootstrap var remap — makes modals, dropdowns, forms, borders
       inherit our dark palette without per-component overrides. */
    --bs-body-bg:                  var(--bg);
    --bs-body-color:               var(--text);
    --bs-body-color-rgb:           241, 245, 249;
    --bs-secondary-color:          var(--text-muted);
    --bs-secondary-color-rgb:      148, 163, 184;
    --bs-tertiary-color:           var(--text-muted);
    --bs-border-color:             var(--border);
    --bs-border-color-translucent: var(--border);
    --bs-secondary-bg:             var(--surface-alt);
    --bs-tertiary-bg:              var(--surface-alt);
    --bs-modal-bg:                 var(--surface);
    --bs-modal-color:              var(--text);
    --bs-modal-border-color:       var(--border);
    --bs-dropdown-bg:              var(--surface);
    --bs-dropdown-color:           var(--text);
    --bs-dropdown-border-color:    var(--border);
    --bs-dropdown-link-color:      var(--text);
    --bs-dropdown-link-hover-bg:   var(--surface-alt);
    --bs-dropdown-link-hover-color:var(--text);
    --bs-emphasis-color:           var(--text);
    --bs-emphasis-color-rgb:       241, 245, 249;
    --bs-table-color:              var(--text);
    --bs-table-bg:                 transparent;
    --bs-table-border-color:       var(--border);
    --bs-table-striped-color:      var(--text);
    --bs-table-striped-bg:         var(--surface-alt);
    --bs-table-hover-color:        var(--text);
    --bs-table-hover-bg:           var(--surface-alt);
  }
}
[data-theme="light"] {
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --surface-alt: #f1f5f9;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
}
[data-theme="dark"] {
  --bg:          #0a0e1a;
  --surface:     #151b2e;
  --surface-alt: #1e2538;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --border:      #2d3548;
  --bs-body-bg:                  var(--bg);
  --bs-body-color:               var(--text);
  --bs-body-color-rgb:           241, 245, 249;
  --bs-secondary-color:          var(--text-muted);
  --bs-secondary-color-rgb:      148, 163, 184;
  --bs-tertiary-color:           var(--text-muted);
  --bs-border-color:             var(--border);
  --bs-border-color-translucent: var(--border);
  --bs-secondary-bg:             var(--surface-alt);
  --bs-tertiary-bg:              var(--surface-alt);
  --bs-modal-bg:                 var(--surface);
  --bs-modal-color:              var(--text);
  --bs-modal-border-color:       var(--border);
  --bs-dropdown-bg:              var(--surface);
  --bs-dropdown-color:           var(--text);
  --bs-dropdown-border-color:    var(--border);
  --bs-dropdown-link-color:      var(--text);
  --bs-dropdown-link-hover-bg:   var(--surface-alt);
  --bs-dropdown-link-hover-color:var(--text);
  --bs-emphasis-color:           var(--text);
  --bs-emphasis-color-rgb:       241, 245, 249;
  --bs-table-color:              var(--text);
  --bs-table-bg:                 transparent;
  --bs-table-border-color:       var(--border);
  --bs-table-striped-color:      var(--text);
  --bs-table-striped-bg:         var(--surface-alt);
  --bs-table-hover-color:        var(--text);
  --bs-table-hover-bg:           var(--surface-alt);
}

/* ---------- Bootstrap utility overrides for dark theme ----------
   Pages use `.bg-light`, `.bg-white`, `.text-dark` (mostly on badges and
   info boxes) — these hardcode near-white/near-black and ignore the theme.
   Remap them to theme vars so every table badge and panel stays legible. */
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-white { background-color: var(--surface-alt) !important; color: var(--text) !important; }
[data-theme="dark"] .text-dark { color: var(--text) !important; }
/* Bootstrap `.table-light` thead keeps a hard-coded light fill — remap to
   the theme's surface so table headers don't glow in dark mode. */
[data-theme="dark"] .table-light,
[data-theme="dark"] .table-light > th,
[data-theme="dark"] .table-light > td,
[data-theme="dark"] thead.table-light th {
  background-color: var(--surface-alt) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .navbar.bg-white { background-color: var(--surface) !important; border-bottom: 1px solid var(--border); }
[data-theme="dark"] .navbar-light .navbar-brand,
[data-theme="dark"] .navbar-light .nav-link { color: var(--text); }
[data-theme="dark"] .navbar-light .nav-link:hover { color: var(--primary); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bg-light,
  :root:not([data-theme="light"]) .bg-white { background-color: var(--surface-alt) !important; color: var(--text) !important; }
  :root:not([data-theme="light"]) .text-dark { color: var(--text) !important; }
  :root:not([data-theme="light"]) .navbar.bg-white { background-color: var(--surface) !important; border-bottom: 1px solid var(--border); }
  :root:not([data-theme="light"]) .navbar-light .navbar-brand,
  :root:not([data-theme="light"]) .navbar-light .nav-link { color: var(--text); }
  :root:not([data-theme="light"]) .navbar-light .nav-link:hover { color: var(--primary); }
}

/* ---------- Reset / Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  transition: background-color .2s, color .2s;
}
a { text-decoration: none; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.font-mono { font-family: 'Courier New', monospace; }

/* ---------- Topbar ---------- */
.topbar {
  background: #0f172a;
  color: #94a3b8;
  font-size: .78rem;
  padding: .4rem 0;
  position: relative;
  z-index: 1030; /* above .navbar.sticky-top (1020) so currency/lang dropdowns render over it */
}
.topbar a, .topbar-link {
  color: #94a3b8;
  transition: color .2s;
}
.topbar a:hover, .topbar-link:hover { color: #fff; }
.topbar .dropdown-menu { font-size: .82rem; min-width: 100px; z-index: 1031; }

/* ---------- Navbar ---------- */
.navbar-brand .brand-text {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.navbar { border-bottom: 1px solid var(--border); transition: background-color .2s, border-color .2s; }
.navbar-light.bg-white { background: var(--surface) !important; }
.nav-link { font-weight: 500; color: var(--text-muted) !important; font-size: .9rem; }
.nav-link:hover, .nav-link.active { color: var(--primary) !important; }

/* ---------- Hero Section ---------- */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  padding: 90px 0 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(99,102,241,.25) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(139,92,246,.2) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(99,102,241,.15);
  border: 1px solid rgba(99,102,241,.4);
  color: #a5b4fc;
  font-size: .78rem; font-weight: 600; letter-spacing: .05em;
  padding: 4px 12px; border-radius: 20px;
  margin-bottom: 1.2rem;
}
/* Hero is a brand-dark zone (purple gradient, both themes) — force light text. */
.hero, .hero * { color: #f8fafc; }
.hero h1,
.hero .hero-title { color: #ffffff; font-weight: 800; line-height: 1.15; }
.hero h1 span,
.hero .hero-accent { background: linear-gradient(135deg,#818cf8,#c084fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; color: transparent; }
.hero .lead,
.hero .hero-subtitle { color: #cbd5e1; font-size: 1.1rem; }
.hero-stats { display: flex; gap: 2.5rem; margin-top: 2.5rem; }
.hero-stat-num,
.hero .stat-num { font-size: 1.6rem; font-weight: 800; color: #ffffff; line-height: 1.1; display: block; }
.hero-stat-label,
.hero .stat-label { font-size: .78rem; color: #94a3b8; display: block; }
.hero-illustration { font-size: 10rem; color: rgba(255,255,255,.15); }

/* Hero buttons — always on dark background */
.btn-hero-primary { background: #ffffff; color: #1e1b4b; border: 1px solid #ffffff; font-weight: 600; }
.btn-hero-primary:hover, .btn-hero-primary:focus { background: #e0e7ff; color: #1e1b4b; border-color: #e0e7ff; }
.btn-hero-outline { background: transparent; color: #ffffff; border: 1px solid rgba(255,255,255,.5); font-weight: 600; }
.btn-hero-outline:hover, .btn-hero-outline:focus { background: rgba(255,255,255,.1); color: #ffffff; border-color: #ffffff; }
.hero-card {
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px; padding: 2rem;
}
.hero-card h5 { color: #e2e8f0; font-weight: 600; }
.hero-card .table { color: #cbd5e1; font-size: .88rem; }
.hero-card .table thead th { color: #94a3b8; border-color: rgba(255,255,255,.08); }
.hero-card .table td { border-color: rgba(255,255,255,.06); }

/* ---------- Section ---------- */
.section-title { font-size: 1.75rem; font-weight: 800; color: var(--text); }
.section-subtitle { color: var(--text-muted); font-size: 1rem; }

/* ---------- Feature Cards ---------- */
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  height: 100%;
  transition: transform .25s, box-shadow .25s, border-color .25s, background-color .2s;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 35px rgba(99,102,241,.1);
  border-color: #a5b4fc;
}
.feature-icon {
  width: 52px; height: 52px;
  background: linear-gradient(135deg,#ede9fe,#e0e7ff);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #6366f1;
  margin-bottom: 1rem;
}
.feature-card h6 { font-weight: 700; font-size: .95rem; color: var(--text); }
.feature-card p { font-size: .85rem; color: var(--text-muted); line-height: 1.6; margin: 0; }

/* ---------- CTA ---------- */
.cta-section {
  background: linear-gradient(135deg,#6366f1,#8b5cf6);
  border-radius: 20px;
  padding: 3rem;
  text-align: center;
  color: #fff;
}
.cta-section h2 { font-weight: 800; }
.cta-section p { opacity: .85; }

/* ---------- Footer ---------- */
.footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3.5rem 0 1.5rem;
  margin-top: 0;
}
.footer-brand { font-size: 1.2rem; font-weight: 800; color: #fff; margin-bottom: .5rem; }
.footer h6 { color: #e2e8f0; font-weight: 600; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 1rem; }
.footer a { color: #64748b; font-size: .87rem; display: block; margin-bottom: .4rem; transition: color .2s; }
.footer a:hover { color: #a5b4fc; }
.footer-divider { border-color: #1e293b; margin: 2rem 0 1rem; }
.footer-bottom { font-size: .82rem; color: #475569; }
.social-links { display: flex; gap: .75rem; margin-top: 1rem; }
.social-link {
  width: 34px; height: 34px;
  background: #1e293b; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #64748b; font-size: .85rem;
  transition: background .2s, color .2s;
}
.social-link:hover { background: #6366f1; color: #fff !important; }

/* ---------- Auth Pages ---------- */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg,#0f172a,#1e1b4b);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: var(--surface);
  color: var(--text);
  border-radius: 18px;
  padding: 2.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  transition: background-color .2s, color .2s;
}
.auth-card-wide { max-width: 720px; }
.auth-logo { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 1.5rem; }
.auth-logo span { background: linear-gradient(135deg,#6366f1,#8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-title { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: .35rem; color: var(--text); }
.auth-sub { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 1.75rem; }

/* Step indicators */
.step-indicators { display: flex; justify-content: center; gap: 0; margin-bottom: 2rem; }
.step-ind {
  display: flex; align-items: center;
}
.step-ind-dot {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #e2e8f0;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #94a3b8;
  background: #fff;
  transition: all .3s;
  position: relative; z-index: 1;
}
.step-ind-dot.active { border-color: #6366f1; color: #6366f1; background: #ede9fe; }
.step-ind-dot.done { border-color: #6366f1; background: #6366f1; color: #fff; }
.step-ind-line { width: 50px; height: 2px; background: #e2e8f0; }
.step-ind-line.done { background: #6366f1; }
.step-label { font-size: .7rem; color: #94a3b8; text-align: center; margin-top: .25rem; }
.step-label.active { color: #6366f1; font-weight: 600; }

.step-pane { display: none; }
.step-pane.active { display: block; }

/* ---------- Panel Layout ---------- */
.panel-body { background: var(--surface-alt); overflow-x: hidden; transition: background-color .2s; }
.panel-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: #0f172a;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform .3s;
  z-index: 100;
}
.sidebar-brand {
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid #1e293b;
  text-align: center;
  /* Subtle indigo→transparent overlay anchors the brand area visually
     so the logo doesn't float in unmotivated dark padding. */
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.10), transparent 80%);
}
/* Sidebar is always brand-dark in both themes. Force muted-on-dark colors
   so .text-muted / .small labels inside don't inherit Bootstrap's light-theme
   near-black (which would be invisible against the dark sidebar bg). */
.sidebar .text-muted,
.sidebar small,
.sidebar .small { color: #94a3b8 !important; }
.sidebar i { color: inherit; }
/* Brand area redesign (1.0.298+). Logo grows to ~56px tall + an uppercase
   gradient app-name caption sits below — fills the previously-empty
   horizontal space without crowding. Text-only fallback keeps the old
   look (large gradient app-name, no caption). */
.sidebar-brand .brand-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  text-decoration: none;
  transition: opacity .2s ease, transform .2s ease;
}
.sidebar-brand .brand-link:hover { opacity: .85; }
.sidebar-brand .brand-link:hover .brand-logo { transform: scale(1.03); }
.sidebar-brand .brand-logo {
  max-height: 56px;
  max-width: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform .2s ease;
}
.sidebar-brand .brand-icon {
  font-size: 1.75rem;
  color: #818cf8;
}
.sidebar-brand .brand-name {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}
/* Text-only fallback (no logo uploaded): make the app name visually
   weighty so it owns the brand area on its own. */
.sidebar-brand .brand-link-text-only .brand-name {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: none;
}
/* Admin "Admin Panel" subtitle, sits under the brand name. */
.sidebar-brand .brand-subtitle {
  display: block;
  margin-top: .4rem;
  font-size: .65rem;
  color: #64748b !important;
  text-transform: uppercase;
  letter-spacing: .2em;
  font-weight: 600;
}
.sidebar-user {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #1e293b;
  margin-bottom: .5rem;
}
.sidebar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg,#6366f1,#8b5cf6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .85rem;
  flex-shrink: 0;
}
.sidebar-username { font-size: .85rem; font-weight: 600; color: #e2e8f0; }
.sidebar-balance { font-size: .75rem; color: #4ade80; }
.sidebar-nav { padding: .5rem 0; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.5rem;
  /* Inactive: slate-400 on dark sidebar — was slate-500 (#64748b) which read
     as "ghost" against #0f172a; bumped one stop brighter. */
  color: #94a3b8;
  font-size: .86rem; font-weight: 500;
  transition: background .2s, color .2s, box-shadow .2s;
  border-left: 3px solid transparent;
}
.sidebar-link i { width: 18px; text-align: center; font-size: .9rem; }
.sidebar-link:hover {
  background: rgba(255, 255, 255, .06);
  color: #e2e8f0;
}
/* Active: punchy indigo pill that scans even from peripheral vision.
   Dark sidebar surface (#0f172a) → indigo-400 background reads as a
   soft glow; bold white text + thicker left border lock the focus. */
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(129, 140, 248, .25), rgba(129, 140, 248, .08));
  color: #ffffff !important;
  font-weight: 600;
  border-left-color: #818cf8;
  box-shadow: inset 3px 0 16px rgba(129, 140, 248, .20);
}
.sidebar-divider { border-color: #1e293b; margin: .5rem 1rem; }
.sidebar-section {
  padding: .6rem 1.5rem .25rem;
  font-size: .68rem; font-weight: 700; color: #64748b;
  letter-spacing: .08em; text-transform: uppercase;
}

/* Sidebar collapsibles (Services / Orders submenu) */
button.sidebar-link.has-submenu {
  background: transparent; border: 0; border-left: 3px solid transparent;
  width: 100%; text-align: left; cursor: pointer;
}
.sidebar-link.has-submenu .submenu-arrow {
  margin-left: auto; transition: transform .2s;
}
.sidebar-link.has-submenu[aria-expanded="true"] .submenu-arrow { transform: rotate(180deg); }
/* Submenu = row of compact pills, wraps onto a second line if the sidebar
   gets narrow. Pills inherit the link colour scheme so "active" still reads. */
.sidebar-submenu {
  display: flex; flex-wrap: wrap;
  gap: .3rem;
  padding: .15rem 1rem .6rem 3rem;
}
.sidebar-submenu a {
  padding: .2rem .6rem;
  color: #94a3b8; font-size: .75rem; font-weight: 500;
  text-decoration: none; border-radius: 999px;
  background: rgba(255,255,255,.04);
}
.sidebar-submenu a:hover  { background: rgba(255, 255, 255, .1); color: #e2e8f0; }
.sidebar-submenu a.active {
  background: #818cf8;
  color: #1e1b4b !important;
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(129, 140, 248, .3);
}

/* Panel main */
.panel-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.panel-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .875rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background-color .2s, border-color .2s;
}
.panel-header-title { font-weight: 700; font-size: 1rem; flex: 1; color: var(--text); }
.panel-header-right { display: flex; align-items: center; gap: .75rem; }
.panel-content { padding: 1.5rem; flex: 1; }
.sidebar-toggle { background: none; border: none; font-size: 1.1rem; color: var(--text-muted); cursor: pointer; }

/* ---------- Dashboard Stat Cards ---------- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  transition: box-shadow .2s, background-color .2s, border-color .2s;
}
.stat-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.07); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.blue   { background: #dbeafe; color: #2563eb; }
.stat-icon.green  { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.cyan   { background: #cffafe; color: #0891b2; }
.stat-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .2rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-change { font-size: .75rem; color: #16a34a; margin-top: .15rem; }
.stat-change.neg { color: #dc2626; }

/* ---------- Cards ---------- */
.card { border-radius: 12px !important; background-color: var(--surface); border-color: var(--border); color: var(--text); transition: background-color .2s, border-color .2s, color .2s; }
.card-header { background: var(--surface) !important; border-bottom: 1px solid var(--border) !important; padding: .875rem 1.25rem !important; color: var(--text); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; color: var(--text); }
.table th { font-size: .78rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-muted); border-bottom-color: var(--border); }
.table td { font-size: .875rem; vertical-align: middle; border-bottom-color: var(--border); }
.table tbody tr { border-bottom: 1px solid var(--border); transition: background-color .15s ease; }
.table tbody tr:hover,
.table-hover tbody tr:hover { background: var(--surface-alt); color: var(--text); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .72rem; }
.bg-indigo-soft { background: #ede9fe !important; }
.text-indigo { color: #6366f1 !important; }
.btn-xs { font-size: .72rem; padding: .2rem .5rem; }

/* ---------- Payment Method Cards ---------- */
.payment-method-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  text-align: center;
  position: relative;
}
.payment-method-card:hover { border-color: var(--primary); background: var(--surface-alt); }
.payment-method-card.selected { border-color: var(--primary); background: #ede9fe; }
.payment-method-card .check {
  position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #6366f1; color: #fff;
  display: none; align-items: center; justify-content: center;
  font-size: .65rem;
}
.payment-method-card.selected .check { display: flex; }
.payment-icon { font-size: 1.75rem; margin-bottom: .5rem; }
.payment-name { font-size: .85rem; font-weight: 600; color: var(--text); }

/* ---------- User avatar (dashboard list rows) ---------- */
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .82rem;
  flex: 0 0 32px;
}
.quick-amount {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem .9rem;
  cursor: pointer;
  font-size: .85rem; font-weight: 600;
  transition: all .2s;
  background: var(--surface);
  color: var(--text);
}
.quick-amount:hover { border-color: var(--primary); color: var(--primary); background: var(--surface-alt); }

/* ---------- Tickets ---------- */
.ticket-item {
  padding: .875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
  transition: background .15s;
}
.ticket-item:hover { background: var(--surface-alt); }
.ticket-item:last-child { border-bottom: none; }

/* ---------- Misc ---------- */
.cursor-pointer { cursor: pointer; }
.copy-btn { cursor: pointer; }
code { background: var(--surface-alt); padding: .15rem .4rem; border-radius: 4px; font-size: .85rem; color: var(--primary); }

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: .25rem .55rem;
  border-radius: 8px;
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.theme-toggle:hover { background: var(--surface-alt); color: var(--text); }
.theme-toggle i { pointer-events: none; }
/* Topbar variant — sits on brand-dark topbar, not on surface */
.topbar .theme-toggle { border-color: rgba(255,255,255,.15); color: #94a3b8; }
.topbar .theme-toggle:hover { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.25); }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
  }
  /* 1.0.183: switched the overlay from a fake `box-shadow: 0 0 0 9999px` (not
     clickable, can't dismiss the sidebar) to a real `.sidebar-backdrop`
     element managed from app.js. */
  .sidebar.show { transform: translateX(0); }
  .panel-wrapper { flex-direction: column; }
  .hero { padding: 60px 0; }
  .hero-stats { flex-wrap: wrap; gap: 1.5rem; }
}

.sidebar-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 99;                 /* sidebar itself is z-index:100 */
  opacity: 0;
  transition: opacity .2s ease;
  display: none;
}
.sidebar-backdrop.show { display: block; opacity: 1; }
@media (min-width: 992px) {
  .sidebar-backdrop { display: none !important; }
}

/* 1.0.182: mobile-only tightening for public pages.
   - Topbar phone/email get hidden on <sm so the right-side controls fit.
   - Hero/Section/CTA shrink so they don't overflow 360–414px viewports.
   - Auth-card padding is reduced so input width stays usable on 360px.
   - Register stepper rows wrap and shrink instead of overflowing the card. */
@media (max-width: 575.98px) {
  .topbar { font-size: .72rem; }
  .topbar > .container-fluid > .d-flex { flex-wrap: wrap; gap: .35rem; }
  .topbar-left { display: none; }
  .topbar-right { width: 100%; justify-content: flex-end; }

  .hero { padding: 50px 0 40px; }
  .hero-title, .hero h1 { font-size: 2rem; line-height: 1.2; }
  .hero-subtitle, .hero .lead { font-size: 1rem; }
  .hero-stats { gap: 1.25rem; }
  .hero-stat-num, .hero .stat-num { font-size: 1.35rem; }

  .section-title { font-size: 1.35rem; }
  .section-subtitle { font-size: .9rem; }
  .py-6 { padding-top: 2.5rem; padding-bottom: 2.5rem; }

  .feature-card { padding: 1.25rem; }
  .feature-icon { width: 44px; height: 44px; font-size: 1.1rem; }

  .cta-section { padding: 1.75rem 1.25rem; border-radius: 14px; }
  .cta-card    { padding: 1.5rem 1.25rem; }
  .partnership-card { padding: 1.5rem 1.25rem; }

  .auth-page { padding: 1rem; }
  .auth-card { padding: 1.5rem 1.25rem; border-radius: 14px; }
  .auth-card-wide { padding: 1.5rem 1.25rem; }

  /* Register stepper — fits on narrow screens by wrapping and shrinking the
     dots/lines. Without this, 4 steps × 80px + 3 lines × 48px = 464px and
     the indicator overflows the auth-card on any phone. */
  .step-indicators { flex-wrap: wrap; gap: .35rem; row-gap: .5rem; }
  .step-item { min-width: auto; flex: 0 0 auto; padding: 0 .25rem; }
  .step-item .step-num { width: 26px; height: 26px; font-size: .72rem; }
  .step-item .step-label { font-size: .65rem; }
  .step-line { flex: 1 1 12px; min-width: 12px; margin-bottom: .9rem; }

  .page-banner { padding: 1.5rem 0; }
  .page-banner-title { font-size: 1.4rem; }
  .page-banner-sub { font-size: .9rem; }
}

/* ---------- Landing section spacing ---------- */
/* Bootstrap 5 ships utilities up to py-5 (3rem). The landing uses py-6 for
   taller hero-adjacent sections — define it here. */
.py-6 { padding-top: 4rem; padding-bottom: 4rem; }

/* ---------- Register stepper (matches markup + JS in register.php) ---------- */
.step-indicators { display: flex; justify-content: center; align-items: flex-start; gap: 0; margin-bottom: 2rem; }
.step-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 0 .5rem; min-width: 80px;
}
.step-item .step-num {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  transition: all .2s;
}
.step-item.active .step-num { border-color: var(--primary); color: var(--primary); background: #ede9fe; }
.step-item.done   .step-num { border-color: var(--primary); background: var(--primary); color: #fff; }
.step-item.active .step-label { color: var(--primary); font-weight: 600; }
.step-item.done   .step-label { color: var(--primary); }
.step-line {
  flex: 0 0 48px; height: 2px; background: var(--border);
  align-self: center; margin: 0 .25rem; margin-bottom: 1.1rem;
  transition: background-color .2s;
}
.step-line.done { background: var(--primary); }

/* ---------- Role badge in top-bar ---------- */
.role-badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.role-badge-user     { background: rgba(100,116,139,.15); color: #64748b; }
.role-badge-reseller { background: rgba(249,115,22,.15); color: #ea580c; }

/* ---------- Partnership tiers (home page bottom) ---------- */
.section-partnership { background: #f8fafc; }
.partnership-card {
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  height: 100%;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.partnership-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}
.partnership-card.featured {
  border-color: var(--primary, #6366f1);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
  position: relative;
}
.partnership-card.featured::before {
  content: "★";
  position: absolute;
  top: -14px;
  right: 20px;
  background: var(--primary, #6366f1);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.partnership-name {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary, #6366f1);
  margin-bottom: 0.25rem;
}
.partnership-for {
  font-style: italic;
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border, #e2e8f0);
}
.partnership-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.partnership-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
  color: #334155;
  line-height: 1.45;
  font-size: 0.94rem;
}
.partnership-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--primary, #6366f1);
  font-weight: 700;
}

/* ---------- Info rows (label/value pairs in cards) ----------
   Used by /client/profile Account Info card and any future "Key: Value"
   layout. 1.0.191: previously the class was referenced in the markup but
   never defined here, so the two <span>s collapsed against each other —
   "Member since20 Apr 2026", "RoleUser", etc. */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row > span:first-child { color: var(--text-muted); }

/* ---------- imba.ink watermark (admin + client panels) ---------- */
.imba-watermark {
  position: fixed;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  z-index: 1;
  user-select: none;
  pointer-events: none;
}
.imba-watermark a {
  color: rgba(0, 0, 0, 0.15);
  text-decoration: none;
  pointer-events: auto;
  transition: color .15s;
}
.imba-watermark a:hover {
  color: rgba(0, 0, 0, 0.35);
}

/* ============================================================
   Light-theme overrides for landing surfaces (topbar / hero /
   footer / pricing thead). Defaults stay dark so existing dark-
   theme users see no change. When user toggles to [data-theme="light"]
   these blocks repaint to match the light palette.
   ============================================================ */

/* Topbar */
[data-theme="light"] .topbar {
  background: #f1f5f9;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
}
[data-theme="light"] .topbar a,
[data-theme="light"] .topbar-link { color: #475569; }
[data-theme="light"] .topbar a:hover,
[data-theme="light"] .topbar-link:hover { color: #0f172a; }

/* Hero */
[data-theme="light"] .hero {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #c7d2fe 100%);
}
[data-theme="light"] .hero::before {
  background: radial-gradient(circle, rgba(99,102,241,.18) 0%, transparent 70%);
}
[data-theme="light"] .hero::after {
  background: radial-gradient(circle, rgba(139,92,246,.12) 0%, transparent 70%);
}
[data-theme="light"] .hero,
[data-theme="light"] .hero * { color: #1e1b4b; }
[data-theme="light"] .hero h1,
[data-theme="light"] .hero .hero-title { color: #1e1b4b; }
/* hero-accent gradient already works on light bg, keep as-is */
[data-theme="light"] .hero .hero-subtitle,
[data-theme="light"] .hero .lead { color: #475569; }
[data-theme="light"] .hero-badge {
  background: rgba(99,102,241,.12);
  border-color: rgba(99,102,241,.35);
  color: #4338ca;
}
[data-theme="light"] .hero-stat-num,
[data-theme="light"] .hero .stat-num { color: #1e1b4b; }
[data-theme="light"] .hero-stat-label,
[data-theme="light"] .hero .stat-label { color: #6366f1; }
[data-theme="light"] .hero-illustration { color: rgba(99,102,241,.18); }
[data-theme="light"] .btn-hero-primary {
  background: #6366f1; color: #fff; border-color: #6366f1;
}
[data-theme="light"] .btn-hero-primary:hover,
[data-theme="light"] .btn-hero-primary:focus {
  background: #4f46e5; color: #fff; border-color: #4f46e5;
}
[data-theme="light"] .btn-hero-outline {
  color: #4338ca; border-color: rgba(99,102,241,.5); background: transparent;
}
[data-theme="light"] .btn-hero-outline:hover,
[data-theme="light"] .btn-hero-outline:focus {
  background: rgba(99,102,241,.1); color: #4338ca; border-color: #6366f1;
}
[data-theme="light"] .hero-card {
  background: rgba(255,255,255,.6);
  border-color: rgba(99,102,241,.2);
}
[data-theme="light"] .hero-card h5 { color: #1e1b4b; }
[data-theme="light"] .hero-card .table { color: #334155; }
[data-theme="light"] .hero-card .table thead th { color: #64748b; border-color: rgba(99,102,241,.15); }
[data-theme="light"] .hero-card .table td { border-color: rgba(99,102,241,.1); }

/* Footer */
[data-theme="light"] .footer {
  background: #f1f5f9;
  color: #475569;
  border-top: 1px solid #e2e8f0;
}
[data-theme="light"] .footer-brand,
[data-theme="light"] .footer h5 { color: #0f172a; }
[data-theme="light"] .footer h6 { color: #1e293b; }
[data-theme="light"] .footer a { color: #475569; }
[data-theme="light"] .footer a:hover { color: #4f46e5; }
[data-theme="light"] .text-footer-muted { color: #64748b !important; }
[data-theme="light"] .footer-divider { border-color: #e2e8f0; }
[data-theme="light"] .footer-bottom { color: #64748b; }
[data-theme="light"] .social-link { background: #e2e8f0; color: #475569; }
[data-theme="light"] .social-link:hover { background: #6366f1; color: #fff !important; }

/* Pricing / popular-services tables — Bootstrap's .table-dark thead reads
   "this is a dark-themed header" but on a light page it clashes. Repaint to
   a light header that matches body surface. */
[data-theme="light"] .table-dark,
[data-theme="light"] .table-dark > th,
[data-theme="light"] .table-dark > td,
[data-theme="light"] thead.table-dark th {
  --bs-table-bg: var(--surface-alt);
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  background-color: var(--surface-alt) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Sidebar — light theme overrides (admin + client share .sidebar; admin
   layout also has .admin-sidebar but we don't need to differentiate). The
   defaults above keep the dark "brand" sidebar; on [data-theme="light"]
   we repaint surface, borders, link colors and submenu pills to match the
   light palette so admin/client cabinets look consistent. */
[data-theme="light"] .sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
}
[data-theme="light"] .sidebar-brand,
[data-theme="light"] .sidebar-user { border-bottom-color: var(--border); }
[data-theme="light"] .sidebar .text-muted,
[data-theme="light"] .sidebar small,
[data-theme="light"] .sidebar .small { color: var(--text-muted) !important; }
[data-theme="light"] .sidebar-username { color: var(--text); }
/* Keep .sidebar-balance green — it reads on both themes */
[data-theme="light"] .sidebar-link {
  /* Was --text-muted (slate-500 = 4.86:1 on white). Bumped to slate-600
     for AAA-grade legibility. Aligns with the sub-tab inactive treatment. */
  color: #475569;
}
[data-theme="light"] .sidebar-link:hover {
  background: rgba(99, 102, 241, .08);
  color: #4338ca;
}
[data-theme="light"] .sidebar-link.active {
  /* Solid indigo on white sidebar — mirrors the active sub-tab pill style. */
  background: linear-gradient(90deg, var(--primary), #818cf8);
  color: #ffffff !important;
  font-weight: 600;
  border-left-color: #4338ca;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .35);
}
[data-theme="light"] .sidebar-divider { border-color: var(--border); }
[data-theme="light"] .sidebar-section { color: var(--text-muted); }
[data-theme="light"] .sidebar-submenu a {
  color: var(--text-muted);
  background: var(--surface-alt);
}
[data-theme="light"] .sidebar-submenu a:hover {
  background: #e2e8f0;
  color: var(--text);
}
[data-theme="light"] .sidebar-submenu a.active {
  background: var(--primary);
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(99, 102, 241, .35);
}

/* ─── Sub-tab pills (1.0.296+) ──────────────────────────────────────────────
   Bootstrap defaults for `.nav-pills .nav-link.active` use --bs-primary
   (= --primary, indigo #6366f1) on the active pill background. On dark
   theme the indigo blends with #151b2e card surface; on light theme it
   reads fine but the inactive pills are too muted to look related. We
   override both states with a brighter dark-theme palette + softer
   inactive style so the active sub-tab always pops against either
   background. Scoped to [data-subtabs] (used in /admincp/settings).
   ────────────────────────────────────────────────────────────────────── */
[data-subtabs] {
  gap: .375rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: .25rem;
  margin-bottom: 1rem !important;
}
/* All `color:` declarations here use !important because line 181 declares
   `.nav-link { color: var(--text-muted) !important }` and line 182 declares
   `.nav-link:hover, .nav-link.active { color: var(--primary) !important }`
   for the legacy in-page nav-link styling. Without !important on our sub-tab
   rules, the active pill rendered as indigo text on indigo background
   (invisible) and the inactive pills rendered as slate-500 (low contrast).
   Specificity alone can't beat !important — fight fire with fire. */
[data-subtabs] .nav-link {
  color: #475569 !important;
  background-color: transparent;
  border: 1px solid transparent;
  font-weight: 500;
  padding: .45rem .9rem;
  border-radius: .5rem;
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
[data-subtabs] .nav-link:hover {
  color: #4338ca !important;
  background-color: rgba(99, 102, 241, 0.10);
}

/* Light theme — saturated indigo bg + WHITE text on white card. */
[data-subtabs] .nav-link.active,
[data-theme="light"] [data-subtabs] .nav-link.active {
  color: #fff !important;
  background-color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

/* Dark theme — brighter indigo bg + dark text for contrast against #151b2e
   card. Inactive text returns to muted slate-400 since dark surfaces
   already provide enough contrast. */
@media (prefers-color-scheme: dark) {
  [data-subtabs] .nav-link {
    color: var(--text-muted) !important;
  }
  [data-subtabs] .nav-link.active {
    color: #1e1b4b !important;
    background-color: #a5b4fc; /* indigo-300 */
    border-color: #a5b4fc;
    box-shadow: 0 2px 12px rgba(165, 180, 252, 0.45);
  }
  [data-subtabs] .nav-link:hover {
    color: #c7d2fe !important;
    background-color: rgba(165, 180, 252, 0.14);
  }
}
/* Explicit [data-theme="light"] overrides — beat the @media (prefers-color-scheme: dark)
   rule above when the user's OS is dark but they've manually toggled the panel
   to light. Without these, system-dark + manual-light gave slate-500 on white
   (4.86:1, "barely visible"). Specificity 0,3,1 vs media's 0,2,1. */
[data-theme="light"] [data-subtabs] .nav-link {
  color: #475569 !important;
}
[data-theme="light"] [data-subtabs] .nav-link:hover {
  color: #4338ca !important;
  background-color: rgba(99, 102, 241, 0.10);
}
[data-theme="dark"] [data-subtabs] .nav-link {
  color: var(--text-muted) !important;
}
[data-theme="dark"] [data-subtabs] .nav-link.active {
  color: #1e1b4b !important;
  background-color: #a5b4fc;
  border-color: #a5b4fc;
  box-shadow: 0 2px 12px rgba(165, 180, 252, 0.45);
}
[data-theme="dark"] [data-subtabs] .nav-link:hover {
  color: #c7d2fe !important;
  background-color: rgba(165, 180, 252, 0.14);
}

/* ─── Favorites star button (1.0.303) ───────────────────────────────────────
   Used in /client/services tables and /client/dashboard favorites widget.
   `is-fav` toggles the gold filled state; default = outline grey. */
.btn-fav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0 .25rem;
  cursor: pointer;
  font-size: 1rem;
  color: #94a3b8;
  transition: color .15s ease, transform .15s ease;
  line-height: 1;
}
.btn-fav:hover {
  color: #fbbf24;
  transform: scale(1.15);
}
.btn-fav.is-fav {
  color: #fbbf24; /* amber-400 — classic gold star */
  filter: drop-shadow(0 1px 4px rgba(251, 191, 36, .35));
}
.btn-fav.is-fav:hover {
  color: #d97706; /* amber-600 on hover when already favorited (signals "click to remove") */
  transform: scale(1.15);
}
.btn-fav[data-busy="1"] {
  opacity: .5;
  pointer-events: none;
}

/* Favorites widget on /client/dashboard */
.favorites-widget .favorite-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: .5rem;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.favorites-widget .favorite-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, .15);
  transform: translateY(-1px);
}
.favorites-widget .favorite-name {
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
  margin-bottom: .35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.favorites-widget .favorite-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: .55rem;
}
.favorites-widget .favorite-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: auto;
}
.favorites-widget .favorite-actions .btn-fav-move {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: .35rem;
  padding: .2rem .4rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .75rem;
  transition: all .15s ease;
}
.favorites-widget .favorite-actions .btn-fav-move:hover {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
}
.favorites-widget .favorite-actions .btn-fav-move:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.favorites-widget .favorite-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: .5rem;
}

/* ─── Language segmented switcher (1.0.305) ─────────────────────────────────
   Replaces the old dropdown in topbar (public_top.php) and navbar
   (client_top.php). All available languages shown side-by-side as pill
   buttons; active language highlighted in indigo. Theme-aware: dark/light
   surface backgrounds adapt for hover/inactive states. */
.lang-switcher {
  display: inline-flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: .4rem;
  padding: 2px;
  vertical-align: middle;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .55rem;
  border-radius: .3rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
  line-height: 1;
}
.lang-btn:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-1px);
}
.lang-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(99, 102, 241, 0.4);
}
.lang-btn.active:hover { transform: none; } /* don't lift the active one */
.lang-flag {
  font-size: .9rem;
  line-height: 1;
  filter: grayscale(.2);
}
.lang-btn.active .lang-flag,
.lang-btn:hover .lang-flag { filter: none; }

/* Topbar context (always dark navy) — invert hover/inactive contrast. */
.topbar .lang-switcher {
  background: rgba(255, 255, 255, 0.06);
}
.topbar .lang-btn { color: #94a3b8; }
.topbar .lang-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
}
.topbar .lang-btn.active {
  background: var(--primary);
  color: #ffffff !important;
}

/* Dark theme (full-page) — same dark-bg behaviour as topbar. */
@media (prefers-color-scheme: dark) {
  .lang-switcher {
    background: rgba(255, 255, 255, 0.05);
  }
  .lang-btn:hover {
    color: #c7d2fe;
    background: rgba(255, 255, 255, 0.08);
  }
}
[data-theme="dark"] .lang-switcher {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .lang-btn:hover {
  color: #c7d2fe;
  background: rgba(255, 255, 255, 0.08);
}

/* ─── Mobile defensive fixes (1.0.309) ─────────────────────────────────────
   Operator reported "/client/funds doesn't fit on mobile". Targeted
   defenses: (a) tighter padding on the content area at ≤sm so 360px
   phones get more usable width, (b) overflow guard on panel-content so
   nothing inside can push the page wider than the viewport, (c) word-
   break on long code blocks (Binance Pay IDs / order references) so
   they wrap instead of overflowing, (d) form-control min-width safety
   so input-groups don't blow past the column on narrow widths. */
@media (max-width: 575.98px) {
  .panel-content { padding: 1rem .85rem; }
  .panel-content .card-body { padding: 1rem; }
  /* Long balance strings on funds.php (e.g. "1 250 000 so'm") shouldn't
     overflow — wrap to next line if needed. */
  .balance-display .h3 { font-size: 1.6rem; word-break: break-word; }
  /* Big payment-method-card padding eats too much width on narrow
     phones — tighten to keep label + descriptor readable. */
  .payment-method-card { padding: .85rem .6rem; }
  .payment-method-card .fa-2x { font-size: 1.5rem; }
  .payment-method-card small { font-size: .7rem; }
  /* Funds page transaction history table — max-width on ref column was
     100px which was already sane; keep it but ensure date col stays one
     line so the table doesn't reflow weirdly. */
  .table > :not(caption) > * > td .badge { white-space: nowrap; }
}

/* Universal: panel-content should NEVER cause horizontal scroll. Anything
   inside that wants to overflow gets clipped to viewport, not pushed
   beyond it. Cards / forms / tables individually handle their own
   horizontal scroll via .table-responsive + similar wrappers. */
.panel-content { min-width: 0; }
.panel-content .col, .panel-content [class*="col-"] { min-width: 0; }
.panel-content > .row { margin-left: 0; margin-right: 0; }

/* Long inline codes (Binance Pay IDs, order refs, hashes) should always
   wrap on narrow widths instead of pushing the parent flex item wide.
   .text-break (Bootstrap) on the element gives word-wrap explicitly,
   but defaulting on every <code> inside cards is safer. */
.card code, .alert code { word-break: break-word; }

/* Input groups containing long placeholders / values shouldn't overflow
   on mobile. Bootstrap already handles this via flex shrink, but
   browsers occasionally bump min-content widths from the inner input. */
.input-group .form-control { min-width: 0; }

/* ─── Language switcher: collapsible disclosure mode (1.0.310) ───────────────
   `.is-collapsible` opt-in. Default state shows only the active pill + a
   chevron caret; clicking the active pill toggles `.is-expanded` (handled
   by app.js) which reveals the inactive options inline. Click-outside or
   Esc collapses. The non-collapsible flat-segmented look from 1.0.305
   stays available for any caller that doesn't add `.is-collapsible`. */
.lang-switcher.is-collapsible:not(.is-expanded) .lang-btn:not(.active) {
  display: none;
}
.lang-switcher.is-collapsible .lang-btn.active {
  cursor: pointer;
}
.lang-caret {
  display: none; /* hidden in non-collapsible mode */
  margin-left: .35rem;
  font-size: .6rem;
  opacity: .75;
  transition: transform .2s ease;
  vertical-align: middle;
}
.lang-switcher.is-collapsible .lang-caret { display: inline-block; }
.lang-switcher.is-collapsible.is-expanded .lang-caret { transform: rotate(180deg); }

/* Smooth fade-in for the inactive pills as they appear on expand. */
.lang-switcher.is-collapsible.is-expanded .lang-btn:not(.active) {
  animation: lang-pill-in .15s ease both;
}
@keyframes lang-pill-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: none; }
}
