:root {
  --bg-dark: #020805;
  --bg-card: rgba(8, 22, 16, 0.78);
  --bg-card-hover: rgba(13, 34, 25, 0.92);
  --bg-input: #06150e;
  --border: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-active: rgba(0, 223, 130, 0.38);
  --primary: #00DF82;
  --primary-subtle: rgba(0, 223, 130, 0.12);
  --danger: #ef4444;
  --warning: #f59e0b;
  --cyan: #0284c7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 50% -10%, rgba(0, 223, 130, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 15% 35%, rgba(2, 132, 199, 0.05) 0%, transparent 45%);
  background-attachment: fixed;
}

.wrap {
  max-width: 1420px;
  margin: 0 auto;
  padding: 24px 24px 90px;
}

/* ==========================================================================
   Header Master & Live Server Status (Clean & Minimalist)
   ========================================================================== */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 18px;
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-crown {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #cbd5e1;
}

.logo-text {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.4px;
  line-height: 1;
}

.logo-text span {
  color: var(--primary);
}

.master-badge {
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
}

.header-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00DF82;
  box-shadow: 0 0 10px rgba(0, 223, 130, 0.85);
}

.admin-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: #cbd5e1;
  font-weight: 500;
}

/* ==========================================================================
   Quick Actions Bar (Harmonious & Professional)
   ========================================================================== */
.master-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.quick-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.quick-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons (Unified & Tasteful)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #00DF82;
  color: #020805;
  border-color: #00DF82;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 223, 130, 0.25);
}

.btn-primary:hover {
  background: #05d374;
  border-color: #05d374;
  color: #020805;
  box-shadow: 0 6px 20px rgba(0, 223, 130, 0.4);
}

.btn-gold {
  background: #f59e0b;
  color: #04140b;
  border-color: #f59e0b;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}

.btn-gold:hover {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-cyan {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.25);
}

.btn-cyan:hover {
  background: #0369a1;
  border-color: #0369a1;
  color: #fff;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.35);
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.btn-subtle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-success {
  background: rgba(0, 223, 130, 0.12);
  color: #00DF82;
  border-color: rgba(0, 223, 130, 0.3);
}

.btn-success:hover {
  background: rgba(0, 223, 130, 0.22);
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-ic {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.btn-ic-spin {
  animation: spin-ic 0.9s linear infinite;
}

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

/* ==========================================================================
   Top KPIs (Clean, Unified, Executive Slate Design)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kpi-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-active);
  transform: translateY(-2px);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: #94a3b8;
}

.kpi-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  letter-spacing: -0.4px;
}

.kpi-lbl {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.kpi-footer-sub {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   Navigation Tabs (Subtle & Elegant)
   ========================================================================== */
.admin-tabs {
  display: flex;
  gap: 6px;
  background: rgba(6, 18, 12, 0.75);
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 22px;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: rgba(0, 223, 130, 0.12);
  color: #00DF82;
  border-color: rgba(0, 223, 130, 0.32);
}

.badge-count {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

/* ==========================================================================
   Panels & Containers
   ========================================================================== */
.panel-box {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  margin-bottom: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 18px;
  margin-bottom: 24px;
}

@media (max-width: 1080px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: rgba(8, 22, 16, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.chart-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 200px;
}

.svg-chart {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Device Breakdown */
.device-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.device-bar-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.device-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7, #00DF82);
}

/* Activity Stream */
.activity-stream {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.activity-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
}

.activity-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* ==========================================================================
   B2B Section (Clean & Focused)
   ========================================================================== */
.b2b-calc-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
  padding: 18px;
  background: rgba(8, 22, 16, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

@media (max-width: 900px) {
  .b2b-calc-grid {
    grid-template-columns: 1fr;
  }
}

.calc-box-left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-slider-val {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.calc-range {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.calc-box-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(8, 22, 16, 0.85);
  border: 1px solid rgba(0, 223, 130, 0.2);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
}

.calc-result-price {
  font-size: 30px;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.api-snippet-box {
  background: #060910;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #94a3b8;
  position: relative;
  overflow-x: auto;
  line-height: 1.5;
}

.copy-snippet-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-approved {
  background: rgba(0, 223, 130, 0.1);
  color: #00DF82;
  border-color: rgba(0, 223, 130, 0.28);
}

.status-pending {
  background: rgba(245, 158, 11, 0.08);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

.status-blocked {
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-green { background: #00DF82; }
.dot-yellow { background: #f59e0b; }
.dot-red { background: #ef4444; }

/* Filter Pills */
.filter-bar {
  display: flex;
  gap: 5px;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.filter-pill.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.85);
  backdrop-filter: blur(14px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: rgba(8, 22, 16, 0.96);
  border: 1px solid rgba(0, 223, 130, 0.22);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  padding: 24px;
  position: relative;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 223, 130, 0.05);
}

.modal-x {
  position: absolute;
  top: 16px;
  right: 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-x:hover {
  color: #fff;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-active);
}

textarea.form-control {
  resize: vertical;
  min-height: 75px;
}

/* Master Gate Screen */
.master-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-card {
  width: 100%;
  max-width: 420px;
  background: rgba(8, 22, 16, 0.95);
  border: 1px solid rgba(0, 223, 130, 0.25);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 223, 130, 0.06);
}

.gate-crown {
  margin-bottom: 14px;
  color: #cbd5e1;
}

.gate-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.gate-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.master-email-badge {
  display: inline-block;
  padding: 3px 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #e2e8f0;
  font-weight: 600;
  font-size: 12px;
  margin-top: 4px;
}

/* Toast */
#toastBox {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-width: 240px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast-success {
  background: rgba(4, 30, 18, 0.95);
  color: #00DF82;
  border-color: rgba(0, 223, 130, 0.35);
  box-shadow: 0 10px 25px rgba(0, 223, 130, 0.15);
}

.toast-error {
  background: #450a0a;
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Mobile-First & Ultra-Responsive Breakpoints (Central Master Admin)
   ========================================================================== */
@media (max-width: 1024px) {
  .wrap {
    padding: 18px 16px 80px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
  }

  .admin-header > div:nth-child(2) {
    justify-content: space-between;
    width: 100%;
  }

  .admin-nav {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }

  .admin-nav .btn {
    width: 100%;
    min-height: 44px;
  }

  .master-quick-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .quick-bar-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 100%;
  }

  .quick-bar-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .admin-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    scrollbar-width: none;
    padding: 4px;
    gap: 4px;
  }

  .admin-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex-shrink: 0;
    min-height: 44px;
    padding: 8px 14px;
    font-size: 12.5px;
  }

  .panel-box {
    padding: 16px 14px;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .panel-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 10px;
  }

  .panel-actions .filter-bar {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .panel-actions input.form-control {
    width: 100% !important;
    min-height: 44px;
    font-size: 14px;
  }

  .panel-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 680px;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-box {
    width: 100%;
    max-width: 96vw;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px 16px;
    border-radius: var(--radius-lg);
  }

  .form-control {
    font-size: 16px; /* Prevents auto-zoom in iOS Safari */
    min-height: 44px;
  }
}

@media (max-width: 520px) {
  .wrap {
    padding: 12px 10px 70px;
  }

  .admin-nav {
    grid-template-columns: 1fr;
  }

  .quick-bar-actions {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    padding: 14px;
  }

  .kpi-val {
    font-size: 24px;
  }

  .gate-card {
    padding: 24px 18px;
  }

  .logo-text {
    font-size: 19px;
  }

  .master-badge {
    display: none;
  }
}
