:root {
  --bg-page: #090e24;
  --bg-sidebar: #090e24;
  --sidebar-active: #131e45;
  --bg-card: #101735;
  --bg-input: #17234d;
  --border-color: #1b2857;
  
  --text-main: #ffffff;
  --text-muted: #7c8db5;
  --accent-blue: #3874ff;
  --accent-cyan: #06b6d4;
  --accent-orange: #f97316;
  
  --btn-purple: #7c3aed;
  --btn-teal: #0891b2;
  --btn-blue: #1d4ed8;
  --btn-orange: #c2410c;
  --btn-green: #059669;
  --btn-red: #dc2626;
}

[data-theme="light"] {
  --bg-page: #f1f5f9;
  --bg-sidebar: #1e293b;
  --sidebar-active: #334155;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-blue: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { background: var(--bg-page); color: var(--text-main); display: flex; min-height: 100vh; overflow-x: hidden; }

/* SCVA Sidebar */
.sidebar {
  width: 250px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
}
.sidebar.collapsed { width: 0; overflow: hidden; border: none; }
.sidebar-brand { padding: 18px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border-color); }
.brand-badge { background: #ef4444; color: white; font-weight: 800; font-size: 0.75rem; padding: 4px 8px; border-radius: 4px; }

.nav-link {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: 0.15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--accent-blue);
}

/* Layout */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow-x: hidden; width: 100%; }
.top-header {
  padding: 14px 28px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.page-container { padding: 26px; overflow-y: auto; flex: 1; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 22px;
}

/* Form inputs */
.input-control, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  width: 100%;
}
.input-control:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-blue); }

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn:hover { opacity: 0.92; }

/* SCVA Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-box { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; }
.stat-icon { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: 14px; }

/* Results Table */
table.scva-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.scva-table th, table.scva-table td { padding: 12px 14px; border-bottom: 1px solid var(--border-color); text-align: left; }
table.scva-table th { color: var(--text-muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; background: rgba(0,0,0,0.1); }
table.scva-table tr:hover { background: rgba(255,255,255,0.02); }

.btn-abs {
  background: #fee2e2;
  color: #ef4444;
  border: 1px solid #fca5a5;
  padding: 5px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: bold;
}
.btn-abs.active { background: #ef4444; color: #fff; }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 1000; align-items: center; justify-content: center; padding: 15px; }
.modal-window { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }

.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ==========================================
   MOBILE RESPONSIVENESS OVERRIDES
   ========================================== */
@media (max-width: 768px) {
  /* Admin Sidebar Overlay */
  .sidebar {
    position: fixed;
    z-index: 1000;
    height: 100vh;
    left: -260px; /* Hidden by default */
    width: 260px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.5);
  }
  .sidebar.mobile-open {
    left: 0;
  }
  
  /* Layout Padding */
  .top-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 16px;
  }
  .top-header > div { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .page-container { padding: 14px; }
  .card { padding: 18px; margin-bottom: 16px; }
  
  /* Grids */
  .stats-grid { grid-template-columns: 1fr; }
  .admin-grid-2 { grid-template-columns: 1fr; }
  
  /* Tables */
  .scva-table th, .scva-table td { padding: 10px 8px; font-size: 0.85rem; }
}