/* =============================================
   OTPGet Platform — Global Styles
   Dark-first, neon-accent, monospace grid aesthetic
============================================= */

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

:root {
  --bg:       #0a0c0f;
  --bg2:      #11141a;
  --bg3:      #181c24;
  --border:   #1e2530;
  --border2:  #2a3040;
  --text:     #e2e8f0;
  --muted:    #64748b;
  --accent:   #00e5ff;
  --accent2:  #7c3aed;
  --green:    #00e676;
  --red:      #ff1744;
  --yellow:   #ffea00;
  --orange:   #ff6d00;
  --card-bg:  #0d1017;
  --radius:   10px;
  --font-ui:  'Syne', sans-serif;
  --font-mono:'Space Mono', monospace;
  --sidebar-w:240px;
  --transition: 0.18s ease;
}

/* =============================================
   LIGHT MODE OVERRIDE
============================================= */
body.light {
  --bg:       #f0f2f5;
  --bg2:      #ffffff;
  --bg3:      #f8f9fb;
  --border:   #dde1e7;
  --border2:  #c8cdd6;
  --text:     #1a202c;
  --muted:    #718096;
  --accent:   #0097a7;
  --accent2:  #6d28d9;
  --green:    #16a34a;
  --red:      #dc2626;
  --yellow:   #b45309;
  --orange:   #c2410c;
  --card-bg:  #ffffff;
}

body.light ::-webkit-scrollbar-track { background: var(--bg3); }
body.light ::-webkit-scrollbar-thumb { background: var(--border2); }
body.light .otp-code {
  background: rgba(22,163,74,0.1);
  border-color: rgba(22,163,74,0.25);
  color: var(--green);
}
body.light .badge-pending { background: rgba(180,83,9,0.1); border-color: rgba(180,83,9,0.2); color: var(--yellow); }
body.light .badge-success { background: rgba(22,163,74,0.1); border-color: rgba(22,163,74,0.2); color: var(--green); }
body.light .badge-cancel  { background: rgba(220,38,38,0.1); border-color: rgba(220,38,38,0.2); color: var(--red); }
body.light .badge-active  { background: rgba(0,151,167,0.1); border-color: rgba(0,151,167,0.2); color: var(--accent); }
body.light .btn-success   { background: rgba(22,163,74,0.1); border-color: rgba(22,163,74,0.3); color: var(--green); }
body.light .btn-danger    { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.2); color: var(--red); }
body.light .btn-ghost     { background: transparent; border-color: var(--border2); color: var(--muted); }
body.light .btn-ghost:hover { color: var(--text); }
body.light .get-number-card { background: linear-gradient(135deg,#fff 0%,#f0f4f8 100%); }
body.light .stat-card     { background: #fff; }
body.light thead th       { background: var(--bg3); }
body.light .auth-card     { background: #fff; }
body.light input, body.light select, body.light textarea {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--text);
}


/* =============================================
   THEME TOGGLE BUTTON
   — Fully reset from browser defaults (user-agent
     sets cursor:default on buttons; we override with !important)
============================================= */
#themeToggle,
#themeIcon {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  cursor: pointer !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto !important;
}

.theme-toggle {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  width: 44px;
  height: 24px;
  cursor: pointer !important;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
  outline: none;
  pointer-events: auto !important;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 0;
  display: inline-block;
  vertical-align: middle;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 4px; left: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--transition), background var(--transition);
  pointer-events: none;
}
body.light .theme-toggle {
  background: rgba(0,151,167,0.12);
  border-color: var(--accent);
}
body.light .theme-toggle::after {
  transform: translateX(20px);
  background: var(--accent);
}
.theme-icon {
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding: 5px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: inherit;
  transition: background var(--transition);
  pointer-events: auto !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.theme-icon:hover { background: var(--bg3); }


*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =============================================
   SCROLLBAR
============================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* =============================================
   LAYOUT — SIDEBAR + MAIN
============================================= */
.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 22px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #000;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.sidebar-logo span {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 8px 16px 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--text);
  background: var(--bg3);
  border-left-color: var(--accent);
}

.sidebar-nav a.active { color: var(--accent); }

.sidebar-nav a .icon {
  width: 18px;
  text-align: center;
  font-style: normal;
  font-size: 1rem;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.sidebar-footer .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer .uname {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .urole {
  font-size: 0.7rem;
  color: var(--muted);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--red) !important;
  padding: 6px 0 !important;
  background: none !important;
  border: none !important;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 600;
  text-decoration: none;
}

/* Main content */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}

.topbar-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

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

.balance-badge {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--green);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.content {
  padding: 28px;
  flex: 1;
}

/* =============================================
   STAT CARDS
============================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent-c, var(--accent));
}

.stat-card.green  { --accent-c: var(--green); }
.stat-card.purple { --accent-c: var(--accent2); }
.stat-card.yellow { --accent-c: var(--yellow); }
.stat-card.red    { --accent-c: var(--red); }
.stat-card.orange { --accent-c: var(--orange); }

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text);
  line-height: 1;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
}

/* =============================================
   CARDS
============================================= */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-body { padding: 20px; }

/* =============================================
   TABLES
============================================= */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--bg2); }

.mono { font-family: var(--font-mono); font-size: 0.78rem; }

/* =============================================
   BADGES / STATUS
============================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-pending  { background: rgba(255,234,0,0.12); color: var(--yellow); border: 1px solid rgba(255,234,0,0.2); }
.badge-success  { background: rgba(0,230,118,0.12); color: var(--green); border: 1px solid rgba(0,230,118,0.2); }
.badge-cancel   { background: rgba(255,23,68,0.12); color: var(--red); border: 1px solid rgba(255,23,68,0.2); }
.badge-expired  { background: rgba(100,116,139,0.12); color: var(--muted); border: 1px solid rgba(100,116,139,0.2); }
.badge-active   { background: rgba(0,229,255,0.1); color: var(--accent); border: 1px solid rgba(0,229,255,0.2); }

.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-anim 1.4s ease infinite;
  display: inline-block;
}

@keyframes pulse-anim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* =============================================
   BUTTONS
============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: #00c8e0;
  box-shadow: 0 0 18px rgba(0,229,255,0.3);
}

.btn-success {
  background: rgba(0,230,118,0.12);
  color: var(--green);
  border-color: rgba(0,230,118,0.3);
}
.btn-success:hover:not(:disabled) { background: rgba(0,230,118,0.2); }

.btn-danger {
  background: rgba(255,23,68,0.1);
  color: var(--red);
  border-color: rgba(255,23,68,0.25);
}
.btn-danger:hover:not(:disabled) { background: rgba(255,23,68,0.2); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border2);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

.btn-sm { padding: 5px 11px; font-size: 0.74rem; border-radius: 5px; }

.btn-big {
  padding: 14px 32px;
  font-size: 1rem;
  letter-spacing: -0.01em;
  border-radius: 10px;
}

/* =============================================
   FORMS
============================================= */
.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=url],
select,
textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  color: var(--text);
  padding: 9px 13px;
  font-size: 0.88rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}

select { cursor: pointer; }
select option { background: var(--bg2); }

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) { .input-row { grid-template-columns: 1fr; gap: 0; } }

/* =============================================
   TOAST NOTIFICATIONS
============================================= */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.25s ease forwards;
  min-width: 240px;
  max-width: 360px;
  pointer-events: auto;
  border-left: 3px solid var(--muted);
}

.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.info    { border-left-color: var(--accent); }
.toast.warn    { border-left-color: var(--yellow); }

.toast .t-icon { font-size: 1rem; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* =============================================
   MODAL
============================================= */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  padding: 24px;
  animation: modalIn 0.2s ease;
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  position: relative;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
}

.modal-title {
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
}

.modal-close {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--border2); }

/* =============================================
   OTP CODE DISPLAY
============================================= */
.otp-code {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.2em;
  background: rgba(0,230,118,0.08);
  border: 1px solid rgba(0,230,118,0.2);
  border-radius: 8px;
  padding: 10px 18px;
  display: inline-block;
}

.number-display {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* =============================================
   GET NUMBER CARD (hero)
============================================= */
.get-number-card {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 100%);
  border: 1px solid var(--border2);
  border-radius: 14px;
  padding: 36px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto 28px;
  position: relative;
  overflow: hidden;
}

.get-number-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,255,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.service-info {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.service-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.service-price {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--yellow);
  font-weight: 700;
}

/* =============================================
   AUTH PAGES
============================================= */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 14px;
  font-size: 1.4rem;
  font-weight: 800;
  color: #000;
  font-family: var(--font-mono);
  margin-bottom: 12px;
}

.auth-logo h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.auth-logo p {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* =============================================
   EMPTY STATE
============================================= */
.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state p { font-size: 0.88rem; }

/* =============================================
   LOADING SPINNER
============================================= */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   MOBILE HAMBURGER
============================================= */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  flex-shrink: 0;
}
.hamburger:hover { background: var(--bg3); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
}

/* =============================================
   MOBILE — max-width 768px
============================================= */
@media (max-width: 768px) {
  /* Sidebar slides in/out */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 6px 0 40px rgba(0,0,0,0.7);
  }
  .sidebar.open + .sidebar-overlay,
  .sidebar-overlay.open {
    display: block;
  }

  /* Main takes full width */
  .main { margin-left: 0; }

  /* Show hamburger */
  .hamburger { display: block; }

  /* Topbar */
  .topbar { padding: 10px 14px; }
  .topbar-title { font-size: 0.9rem; }
  .balance-badge { display: none; } /* hidden on mobile — shows on dashboard */

  /* Content padding */
  .content { padding: 12px; }

  /* Stats grid: 2 cols on mobile */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-value { font-size: 1.4rem; }

  /* Tables: horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* Input rows: stack on mobile */
  .input-row {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
  }

  /* Cards */
  .card-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
  }

  /* Service/payment method grid: 1 col on mobile */
  #serviceGrid,
  #methodGrid {
    grid-template-columns: 1fr !important;
  }

  /* Modals: full-width on mobile */
  .modal {
    margin: 0 8px;
    padding: 20px 16px;
    max-width: calc(100vw - 16px) !important;
    max-height: 88vh;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-overlay .modal {
    border-radius: 16px 16px 0 0;
    margin: 0;
    max-width: 100vw !important;
    width: 100%;
  }

  /* Auth pages */
  .auth-card { padding: 24px 18px; margin: 10px; }

  /* Get number card */
  .get-number-card { padding: 20px 16px; }

  /* Buttons: full width in action areas on mobile */
  .btn-big { padding: 12px 20px; font-size: 0.92rem; }

  /* Balance badge: show smaller */
  .topbar-right .balance-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.7rem;
  }

  /* Theme toggle smaller on mobile */
  .theme-toggle { width: 38px; height: 22px; }
  .theme-toggle::after { width: 14px; height: 14px; top: 4px; left: 4px; }
  body.light .theme-toggle::after { transform: translateX(16px); }
  .theme-icon { font-size: 0.9rem; padding: 4px; }
}

/* Very small screens */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card  { padding: 14px; }
  .stat-value { font-size: 1.2rem; }
  .content    { padding: 10px; }
  .topbar-right .balance-badge { display: none; }
  .topbar-title { font-size: 0.85rem; }
}

/* =============================================
   MISC UTILITIES
============================================= */
.flex    { display: flex; }
.flex-1  { flex: 1; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.mt-8    { margin-top: 8px; }
.mt-16   { margin-top: 16px; }
.mb-0    { margin-bottom: 0; }
.text-muted { color: var(--muted); }
.text-sm    { font-size: 0.8rem; }
.text-mono  { font-family: var(--font-mono); }
.text-right { text-align: right; }
.hidden     { display: none !important; }
.w-full     { width: 100%; }
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Sidebar overlay (mobile backdrop) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 150;
  backdrop-filter: blur(1px);
}

/* =============================================
   MULTI-PURCHASE HINT
============================================= */
.buy-hint {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
  font-family: var(--font-mono);
}
.buy-hint span { color: var(--accent); }

/* =============================================
   SERVICE CARDS (multi-service grid)
============================================= */
.service-card:hover:not(.service-card--broke) {
  border-color: var(--accent) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,229,255,0.08);
}
body.light .service-card {
  background: #fff;
  border-color: var(--border);
}
body.light .service-card:hover:not(.service-card--broke) {
  border-color: var(--accent) !important;
  box-shadow: 0 6px 24px rgba(0,151,167,0.1);
}

/* Number count badge in table */
.num-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,229,255,0.12);
  color: var(--accent);
  border: 1px solid rgba(0,229,255,0.2);
  border-radius: 20px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 1px 8px;
  margin-left: 6px;
}

/* Transition for status badges changing */
.badge {
  transition: all 0.3s ease;
}

/* Light mode topbar */
body.light .topbar {
  background: var(--bg2);
  border-bottom-color: var(--border);
}
body.light .sidebar {
  background: var(--bg2);
  border-right-color: var(--border);
}
body.light .card {
  background: var(--card-bg);
  border-color: var(--border);
}
body.light .modal {
  background: var(--bg2);
  border-color: var(--border2);
}
body.light .toast {
  background: var(--bg2);
  border-color: var(--border2);
  color: var(--text);
}
body.light .balance-badge {
  background: var(--bg3);
  border-color: var(--border2);
  color: var(--green);
}
body.light tbody tr:hover td {
  background: var(--bg3);
}
body.light .get-number-card::before {
  background: radial-gradient(circle, rgba(0,151,167,0.06) 0%, transparent 70%);
}
body.light .service-info {
  background: var(--bg3);
  border-color: var(--border);
}


/* =============================================
   PAYMENT METHOD CARDS
============================================= */
.pm-card {
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.pm-card:hover {
  border-color: var(--accent) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,229,255,0.08);
}
body.light .pm-card {
  background: #fff;
  border-color: var(--border);
}
body.light .pm-card:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 6px 20px rgba(0,151,167,0.1);
}

/* =============================================
   DEPOSIT STATUS
============================================= */
.dep-pending  { background: rgba(255,234,0,0.12); color: var(--yellow); border: 1px solid rgba(255,234,0,0.2); }
.dep-approved { background: rgba(0,230,118,0.12); color: var(--green);  border: 1px solid rgba(0,230,118,0.2); }
.dep-rejected { background: rgba(255,23,68,0.12);  color: var(--red);   border: 1px solid rgba(255,23,68,0.2); }

/* =============================================
   ADMIN DEPOSIT BADGE ON NAV
============================================= */
.nav-badge {
  background: var(--red);
  color: #fff;
  border-radius: 10px;
  font-size: 0.6rem;
  font-family: var(--font-mono);
  padding: 1px 6px;
  margin-left: auto;
  font-weight: 700;
}

/* =============================================
   FLASH PREVENTION (applied to html before body ready)
============================================= */
html.pre-light body {
  background: #f0f2f5 !important;
}

/* =============================================
   LIGHT MODE — sidebar overlay
============================================= */
body.light .sidebar-overlay {
  background: rgba(0,0,0,0.35);
}

/* =============================================
   LIGHT MODE — topbar & sidebar
============================================= */
body.light .topbar {
  background: #ffffff;
  border-bottom-color: var(--border);
}
body.light .sidebar {
  background: #ffffff;
  border-right-color: var(--border);
}
body.light .card  { background: #ffffff; }
body.light .stat-card { background: #ffffff; }
body.light .modal { background: #ffffff; }
body.light .auth-card { background: #ffffff; }

/* =============================================
   ENSURE TOPBAR-RIGHT NEVER OVERFLOWS
============================================= */
.topbar-right {
  flex-shrink: 0;
  white-space: nowrap;
}

/* =============================================
   MOBILE: Keep theme toggle always visible & tappable
============================================= */
@media (max-width: 768px) {
  .topbar-right {
    gap: 8px;
  }
  .theme-toggle {
    width: 38px;
    height: 22px;
  }
  .theme-toggle::after {
    width: 14px;
    height: 14px;
    top: 4px; left: 4px;
  }
  body.light .theme-toggle::after {
    transform: translateX(16px);
  }
  /* Inline grids in admin pages need to stack */
  div[style*="display:grid"],
  div[style*="display: grid"] {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================
   FIX INLINE STYLED GRIDS IN PAGES (payments modal etc)
============================================= */
@media (max-width: 640px) {
  /* Target the view-user stats grid in admin/users */
  #viewBody div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Deposit / service card grids */
  div[style*="minmax(260px"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="minmax(270px"] {
    grid-template-columns: 1fr !important;
  }
}

/* =============================================
   ADMIN PAGES: handle inline grid overrides
============================================= */
@media (max-width: 768px) {
  /* Payments page modal wider form groups */
  .modal .input-row {
    grid-template-columns: 1fr !important;
  }
  /* IMAP section in payments modal */
  #imapSection .input-row,
  #imapSection > .form-group {
    width: 100%;
  }
}

/* =============================================
   SITE FOOTER
============================================= */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: var(--sidebar-w);
  transition: background var(--transition), border-color var(--transition);
}
@media (max-width: 768px) {
  .site-footer { margin-left: 0; }
}

/* =============================================
   v9 ADDITIONS — Mobile, Auth, Footer fixes
============================================= */

/* Auth page theme toggle row */
.auth-theme-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 16px;
}
.auth-theme-row .themeIconBtn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  color: inherit;
}
.auth-links {
  text-align: center;
  margin-top: 18px;
  font-size: 0.85rem;
  color: var(--muted);
}
.auth-links a { color: var(--accent); }

/* Auth footer bar (login/signup pages) */
.auth-footer-bar {
  text-align: center;
  padding: 14px 20px;
  font-size: 0.78rem;
  color: var(--muted);
  background: transparent;
  margin-top: 8px;
}

/* Site footer (inside app with sidebar) */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: var(--sidebar-w);
  transition: background var(--transition), border-color var(--transition);
}

/* =============================================
   MOBILE FIXES — Comprehensive
============================================= */
@media (max-width: 768px) {

  /* Sidebar hidden off-screen on mobile */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main takes full width */
  .main { margin-left: 0 !important; width: 100% !important; }

  /* Footer full width */
  .site-footer { margin-left: 0; }

  /* Topbar */
  .topbar { padding: 0 12px; height: 52px; }
  .topbar-title { font-size: 0.95rem; }

  /* Content padding */
  .content { padding: 14px 12px; }

  /* Cards */
  .card { border-radius: 10px; }
  .card-body { padding: 14px 12px; }
  .card-header { padding: 12px 14px; }

  /* Tables — horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; font-size: 0.78rem; }

  /* Stats grid — 2 cols */
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .stat-card { padding: 14px 12px !important; }
  .stat-value { font-size: 1.4rem !important; }

  /* Input rows — stack */
  .input-row { grid-template-columns: 1fr !important; gap: 0 !important; }

  /* Modals — full width */
  .modal {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    margin: 10px !important;
    border-radius: 12px !important;
    max-height: 92vh;
    overflow-y: auto;
  }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* Buttons */
  .btn { font-size: 0.82rem; padding: 8px 14px; }
  .btn-big { font-size: 0.92rem; padding: 12px; }

  /* Hide balance badge in topbar (show on dashboard) */
  .balance-badge { display: none; }

  /* Auth card mobile */
  .auth-wrap { padding: 16px; align-items: flex-start; padding-top: 40px; }
  .auth-card { padding: 22px 18px; border-radius: 14px; }
  .auth-card h1 { font-size: 1.3rem; }

  /* Branding page pos labels */
  #posLabelLeft, #posLabelRight { padding: 8px 12px; font-size: 0.85rem; }

  /* Payment method grid — 1 col */
  #methodGrid { grid-template-columns: 1fr !important; }

  /* Service grid */
  .services-grid { grid-template-columns: 1fr !important; }

  /* Theme toggle size */
  .theme-toggle { width: 38px; height: 22px; }
  .theme-toggle::after { width: 14px; height: 14px; top: 4px; left: 4px; }
  body.light .theme-toggle::after,
  .theme-toggle.wa-on::after,
  .theme-toggle.maint-on::after { transform: translateX(16px) !important; }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 199;
  }
  .sidebar.open ~ .main .sidebar-overlay,
  .sidebar-overlay.active { display: block; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .card-title { font-size: 0.9rem; }
  table { font-size: 0.72rem; }
  .content { padding: 10px 8px; }
}

/* Tablet (sidebar auto-hide) */
@media (min-width: 769px) {
  .hamburger { display: none; }
  .sidebar { transform: none !important; }
  .main { margin-left: var(--sidebar-w); }
}
