/* ============================================================
   Vireon Admin Panel — Complete Stylesheet
   Dark theme, glassmorphism, SaaS-grade professional design
   ============================================================ */

/* ── Google Font import ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ───────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:        #09090f;
  --bg-card:        #12121c;
  --bg-surface:     #1a1a2e;
  --bg-hover:       #1e1e30;
  --bg-active:      #252540;

  /* Brand */
  --gradient-start: #7B2FF7;
  --gradient-end:   #F107A3;
  --gradient:       linear-gradient(135deg, #7B2FF7, #F107A3);
  --gradient-soft:  linear-gradient(135deg, rgba(123,47,247,0.18), rgba(241,7,163,0.18));
  --primary:        #6839ce;
  --primary-hover:  #7b4de8;
  --accent:         #a855f7;

  /* Text */
  --text-primary:   #f0f0ff;
  --text-secondary: #a0a0c0;
  --text-muted:     #5a5a80;
  --text-inverse:   #09090f;

  /* Borders */
  --border:         rgba(255,255,255,0.06);
  --border-hover:   rgba(255,255,255,0.12);
  --border-active:  rgba(120,60,240,0.4);

  /* Status Colors */
  --success:        #22c55e;
  --success-bg:     rgba(34,197,94,0.12);
  --error:          #ef4444;
  --error-bg:       rgba(239,68,68,0.12);
  --warning:        #f59e0b;
  --warning-bg:     rgba(245,158,11,0.12);
  --info:           #3b82f6;
  --info-bg:        rgba(59,130,246,0.12);

  /* Sidebar */
  --sidebar-width:  260px;
  --topnav-height:  64px;

  /* Shadows */
  --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:      0 8px 24px rgba(0,0,0,0.5);
  --shadow-lg:      0 16px 48px rgba(0,0,0,0.6);
  --glow-primary:   0 0 24px rgba(104,57,206,0.35);

  /* Transitions */
  --trans-fast:     0.15s ease;
  --trans-med:      0.25s ease;
  --trans-slow:     0.4s ease;

  /* Border radius */
  --radius-sm:      6px;
  --radius-md:      10px;
  --radius-lg:      16px;
  --radius-xl:      24px;
  --radius-full:    9999px;
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--trans-fast);
}
a:hover { color: var(--text-primary); }

h1,h2,h3,h4,h5,h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

p { color: var(--text-secondary); }

ul, ol { list-style: none; }

img { max-width: 100%; display: block; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: var(--bg-active);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── Utility Classes ─────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Background Gradient Animation ──────────────────────── */
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
  0%   { background-position: -468px 0; }
  100% { background-position: 468px 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

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

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(110%); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-base);
}

.login-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(123,47,247,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(241,7,163,0.12) 0%, transparent 55%),
              radial-gradient(ellipse at 60% 80%, rgba(104,57,206,0.1) 0%, transparent 50%);
  z-index: 0;
}

.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 0;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: pulse 6s ease-in-out infinite;
  z-index: 0;
}
.login-orb-1 {
  width: 400px; height: 400px;
  background: var(--gradient-start);
  top: -100px; left: -100px;
  animation-delay: 0s;
}
.login-orb-2 {
  width: 350px; height: 350px;
  background: var(--gradient-end);
  bottom: -80px; right: -80px;
  animation-delay: 3s;
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: rgba(18,18,28,0.8);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(123,47,247,0.1);
  animation: scaleIn 0.4s ease;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: var(--glow-primary);
}

.login-logo-text {
  font-size: 26px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 32px;
}

.login-card h1 {
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(104,57,206,0.2);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a5a80' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

#login-error {
  display: none;
  padding: 10px 14px;
  background: var(--error-bg);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
  white-space: nowrap;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(123,47,247,0.3);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px rgba(123,47,247,0.45);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(168,85,247,0.06);
}

.btn-danger {
  background: var(--error-bg);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--error);
}
.btn-danger:hover:not(:disabled) {
  background: var(--error);
  color: #fff;
}

.btn-success {
  background: var(--success-bg);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--success);
}
.btn-success:hover:not(:disabled) {
  background: var(--success);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
}
.btn-icon:hover {
  background: var(--bg-active);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

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

.btn-lg {
  padding: 13px 24px;
  font-size: 15px;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text { opacity: 0.7; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--trans-med);
  overflow: hidden;
}

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

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  box-shadow: var(--glow-primary);
}

.sidebar-logo-text {
  font-size: 17px;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.sidebar-logo-badge {
  font-size: 9px;
  color: var(--text-muted);
  display: block;
  font-weight: 400;
  -webkit-text-fill-color: var(--text-muted);
}

#sidebar nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--trans-fast);
  margin-bottom: 2px;
  position: relative;
  overflow: hidden;
}

#sidebar nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#sidebar nav a.active {
  background: var(--gradient-soft);
  color: var(--accent);
  font-weight: 600;
  border: 1px solid rgba(168,85,247,0.15);
}

#sidebar nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 3px;
  background: var(--gradient);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

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

.sidebar-footer .version {
  display: block;
  margin-bottom: 2px;
}

/* ── Main Content ────────────────────────────────────────── */
#main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

/* ── Top Navigation ──────────────────────────────────────── */
#topnav {
  height: var(--topnav-height);
  background: rgba(18,18,28,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

#menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--trans-fast);
}
#menu-toggle:hover { color: var(--text-primary); }

.nav-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.nav-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

.nav-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all var(--trans-fast);
}
.nav-search input:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.07);
}
.nav-search input::placeholder { color: var(--text-muted); }

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 8px;
}

.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  transition: all var(--trans-fast);
}
.notif-btn:hover {
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--trans-fast);
  position: relative;
}
.admin-profile:hover {
  background: var(--bg-active);
  border-color: var(--border-hover);
}

.admin-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.admin-info { line-height: 1.2; }
.admin-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.admin-role-label { font-size: 11px; color: var(--text-muted); }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: scaleIn 0.15s ease;
}

.profile-dropdown a,
.profile-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: all var(--trans-fast);
  text-decoration: none;
}
.profile-dropdown a:hover,
.profile-dropdown button:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.profile-dropdown .divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.profile-dropdown .danger-btn { color: var(--error); }
.profile-dropdown .danger-btn:hover { background: var(--error-bg); }

/* ── Content Area ────────────────────────────────────────── */
#content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

.section { animation: fadeIn 0.3s ease; }

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.section-title p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

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

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--trans-fast);
}
.card:hover { border-color: var(--border-hover); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--trans-fast);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity var(--trans-fast);
}

.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon-box {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon-box.purple { background: rgba(123,47,247,0.15); }
.stat-icon-box.pink   { background: rgba(241,7,163,0.15); }
.stat-icon-box.green  { background: rgba(34,197,94,0.12); }
.stat-icon-box.blue   { background: rgba(59,130,246,0.12); }
.stat-icon-box.amber  { background: rgba(245,158,11,0.12); }
.stat-icon-box.red    { background: rgba(239,68,68,0.12); }
.stat-icon-box.cyan   { background: rgba(6,182,212,0.12); }
.stat-icon-box.indigo { background: rgba(99,102,241,0.12); }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-trend {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--error); }
.stat-trend.neutral { color: var(--text-muted); }

/* ── Charts Grid ─────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 16px;
  margin-bottom: 24px;
}

.charts-row-equal {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-card canvas {
  max-height: 240px;
}

/* ── Tables ──────────────────────────────────────────────── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

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

.table-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-search {
  position: relative;
}
.table-search input {
  padding: 7px 12px 7px 32px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  width: 220px;
  transition: all var(--trans-fast);
}
.table-search input:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.07);
}
.table-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.filter-select {
  padding: 7px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: all var(--trans-fast);
}
.filter-select:focus { border-color: var(--primary); }
.filter-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

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

tbody tr {
  transition: background var(--trans-fast);
}
tbody tr:hover td {
  background: rgba(255,255,255,0.025);
  color: var(--text-primary);
}

.td-name {
  font-weight: 600;
  color: var(--text-primary);
}

.td-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* User avatar in table */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.user-email { font-size: 12px; color: var(--text-muted); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--trans-fast);
  padding: 0 6px;
}
.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(168,85,247,0.06);
}
.page-btn.active {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Badges / Status Pills ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-active, .badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34,197,94,0.2);
}
.badge-expired, .badge-error, .badge-cancelled {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239,68,68,0.2);
}
.badge-pending, .badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,0.2);
}
.badge-info, .badge-trial {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59,130,246,0.2);
}
.badge-premium {
  background: linear-gradient(135deg, rgba(123,47,247,0.2), rgba(241,7,163,0.2));
  color: var(--accent);
  border: 1px solid rgba(168,85,247,0.25);
}
.badge-free {
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-admin {
  background: rgba(59,130,246,0.15);
  color: var(--info);
  border: 1px solid rgba(59,130,246,0.2);
}
.badge-super-admin {
  background: var(--gradient-soft);
  color: var(--accent);
  border: 1px solid rgba(168,85,247,0.25);
}
.badge-open { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }
.badge-in-progress { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.badge-resolved { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.badge-closed { background: rgba(255,255,255,0.04); color: var(--text-muted); border: 1px solid var(--border); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Priority Badges ─────────────────────────────────────── */
.priority-low    { color: var(--success); }
.priority-medium { color: var(--info); }
.priority-high   { color: var(--warning); }
.priority-urgent { color: var(--error); }

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; width: 80%; margin-bottom: 6px; }
.skeleton-text.short { width: 40%; }
.skeleton-text.long  { width: 95%; }
.skeleton-value { height: 28px; width: 60%; margin-bottom: 8px; border-radius: var(--radius-sm); }
.skeleton-stat { height: 80px; border-radius: var(--radius-md); }
.skeleton-row  { height: 48px; border-radius: var(--radius-sm); margin-bottom: 4px; }
.skeleton-chart{ height: 200px; border-radius: var(--radius-md); }
.skeleton-sm   { height: 10px; }
.skeleton-lg   { height: 20px; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 300px;
}

/* ============================================================
   MODALS
   ============================================================ */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

#modal-container {
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}

#modal-container.modal-sm  { max-width: 480px; }
#modal-container.modal-lg  { max-width: 920px; }
#modal-container.modal-xl  { max-width: 1100px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  transition: all var(--trans-fast);
}
.modal-close:hover {
  background: var(--error-bg);
  border-color: rgba(239,68,68,0.3);
  color: var(--error);
}

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── Modal: User Detail ──────────────────────────────────── */
.user-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.user-detail-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  box-shadow: var(--glow-primary);
}

.user-detail-info { flex: 1; }
.user-detail-name { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.user-detail-email { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.user-detail-badges { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.modal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.modal-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--trans-fast);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.modal-tab:hover { color: var(--text-primary); }
.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Info Grid ───────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.info-item {}
.info-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.info-value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

/* ============================================================
   CONFIRM DIALOG
   ============================================================ */
#confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

#confirm-dialog {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s ease;
}

#confirm-dialog .confirm-icon {
  font-size: 36px;
  text-align: center;
  margin-bottom: 14px;
}

#confirm-message {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.6;
}

.confirm-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-buttons button {
  flex: 1;
  max-width: 150px;
}

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

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border-left: 3px solid;
  animation: toastSlideIn 0.3s ease;
  position: relative;
  min-width: 300px;
}

.toast.removing {
  animation: toastSlideOut 0.25s ease forwards;
}

.toast-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title  { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.toast-message{ font-size: 12px; color: var(--text-secondary); }

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--trans-fast);
}
.toast-close:hover { color: var(--text-primary); }

.toast.success { border-left-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
.toast.error   { border-left-color: var(--error); }
.toast.error .toast-icon   { color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info    { border-left-color: var(--info); }
.toast.info .toast-icon    { color: var(--info); }

/* ============================================================
   FORM ELEMENTS (in-page, not login)
   ============================================================ */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

/* ── Toggle Switch ───────────────────────────────────────── */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all var(--trans-fast);
}
.toggle-wrapper:hover { border-color: var(--border-hover); }

.toggle-info { flex: 1; }
.toggle-label { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.toggle-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-full);
  transition: background var(--trans-fast), border-color var(--trans-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform var(--trans-fast), background var(--trans-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  border-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px) translateY(-50%);
  background: #fff;
}

/* Maintenance mode toggle — big warning style */
.maintenance-toggle.toggle-wrapper {
  border-color: rgba(239,68,68,0.2);
  background: rgba(239,68,68,0.04);
}
.maintenance-toggle.toggle-wrapper.active {
  border-color: rgba(239,68,68,0.4);
  background: rgba(239,68,68,0.08);
}

/* ── Range Input ─────────────────────────────────────────── */
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--bg-active);
  border-radius: var(--radius-full);
  outline: none;
  margin: 8px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gradient);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(123,47,247,0.4);
}

/* ============================================================
   SECTION-SPECIFIC STYLES
   ============================================================ */

/* ── Dashboard ───────────────────────────────────────────── */
.recent-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Users ───────────────────────────────────────────────── */
.user-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── Subscriptions ───────────────────────────────────────── */
.revenue-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* ── System Settings ─────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.settings-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.announcement-preview {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-top: 12px;
  border-left: 3px solid;
}
.announcement-preview.info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info); }
.announcement-preview.warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.announcement-preview.success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.announcement-preview.error   { background: var(--error-bg);   border-color: var(--error);   color: var(--error); }

/* ── Support ─────────────────────────────────────────────── */
.ticket-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.ticket-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
}

.ticket-stat-num {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}

.ticket-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.ticket-message-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 16px;
  max-height: 200px;
  overflow-y: auto;
}

.admin-reply-box {
  background: rgba(123,47,247,0.05);
  border: 1px solid rgba(123,47,247,0.15);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

/* ── AI Analytics ────────────────────────────────────────── */
.ai-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

/* ============================================================
   MOBILE SIDEBAR OVERLAY
   ============================================================ */
#sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

/* ============================================================
   LOADING SPINNER (full-page)
   ============================================================ */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

/* ── Dividers ────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* ── Alert Boxes ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-info    { background: var(--info-bg);    border: 1px solid rgba(59,130,246,0.2);  color: var(--info); }
.alert-warning { background: var(--warning-bg); border: 1px solid rgba(245,158,11,0.2); color: var(--warning); }
.alert-success { background: var(--success-bg); border: 1px solid rgba(34,197,94,0.2);  color: var(--success); }
.alert-error   { background: var(--error-bg);   border: 1px solid rgba(239,68,68,0.2);  color: var(--error); }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }
.breadcrumb-sep { color: var(--text-muted); }

/* ── Live indicator ──────────────────────────────────────── */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--gradient);
  transition: width 0.5s ease;
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ── 1200px ──────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid         { grid-template-columns: repeat(2, 1fr); }
  .charts-row         { grid-template-columns: 1fr; }
  .recent-tables-row  { grid-template-columns: 1fr; }
  .settings-grid      { grid-template-columns: 1fr; }
  .charts-row-equal   { grid-template-columns: 1fr; }
  .ai-stats-grid      { grid-template-columns: repeat(2, 1fr); }
}

/* ── 1024px ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .revenue-summary { grid-template-columns: 1fr 1fr; }
  .info-grid       { grid-template-columns: 1fr; }
  .form-row        { grid-template-columns: 1fr; }
}

/* ── 768px ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: 100;
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  #main { margin-left: 0; }

  #menu-toggle { display: flex; }

  #topnav { padding: 0 16px; gap: 10px; }

  .nav-search { max-width: 200px; }

  .admin-info { display: none; }

  #content { padding: 16px; }

  .stats-grid        { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ticket-stats      { grid-template-columns: 1fr 1fr; }
  .revenue-summary   { grid-template-columns: 1fr; }
  .section-header    { flex-direction: column; }
  .section-actions   { width: 100%; }

  table { font-size: 12px; }
  thead th, tbody td { padding: 10px 12px; }

  #modal-container { max-height: 90vh; }
  .modal-body  { padding: 16px; }
  .modal-header{ padding: 14px 16px 12px; }

  #toast-container { right: 12px; left: 12px; max-width: unset; }
  .toast { min-width: unset; }
}

/* ── 480px ───────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stats-grid    { grid-template-columns: 1fr; }
  .ticket-stats  { grid-template-columns: 1fr 1fr; }
  .ai-stats-grid { grid-template-columns: 1fr 1fr; }

  .nav-search  { display: none; }

  .table-controls { flex-direction: column; align-items: stretch; }
  .table-search input { width: 100%; }

  .btn-lg { padding: 11px 18px; font-size: 14px; }

  .login-card { padding: 28px 20px; }

  #confirm-dialog { padding: 24px 20px; }

  .confirm-buttons { flex-direction: column; }
  .confirm-buttons button { max-width: unset; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  #sidebar, #topnav, .btn, #toast-container { display: none !important; }
  #main { margin-left: 0; }
  body  { background: #fff; color: #000; }
}
