@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  /* Monochrome Nebula Palette */
  --bg-deep: #000000;
  --bg-surface: #080808;
  --bg-glass: rgba(20, 20, 20, 0.6);
  --bg-glass-strong: #0a0a0a;

  --primary: #ffffff;
  --primary-dim: rgba(255, 255, 255, 0.1);
  --primary-glow: rgba(255, 255, 255, 0.2);

  --text-main: #ffffff;
  --text-muted: #666666;
  --text-dim: #444444;

  --border: #1a1a1a;
  --border-hover: #333333;

  --success: #ffffff;
  --warning: #cccccc;
  --danger: #ff3333;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-main: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 260px;

  --shadow-glass: none;
  --glow-text: none;
}

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

body {
  margin: 0;
  background-color: var(--bg-deep);
  background-image: radial-gradient(circle at 50% 0%, #111111, #000000 80%);
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: #fff;
  text-shadow: var(--glow-text);
}

/* Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-glass-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: fixed;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 40px;
  padding: 0 8px;
  flex-shrink: 0;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #000;
  font-size: 1.2rem;
  box-shadow: 0 0 20px rgba(0, 242, 255, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 4px;
  margin-right: -4px;
}

/* Scrollbar styles for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: rgba(0, 242, 255, 0.2);
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.1);
}

.nav-link.active svg {
  opacity: 1;
  filter: drop-shadow(0 0 5px var(--primary));
}

/* Navigation Groups */
.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  user-select: none;
}

.nav-group-header svg:first-child {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.nav-group-header:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.nav-group-header:hover svg:first-child {
  opacity: 1;
}

.nav-group-arrow {
  width: 16px !important;
  height: 16px !important;
  margin-left: auto;
  opacity: 0.5 !important;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.nav-group.expanded .nav-group-arrow {
  transform: rotate(90deg);
  opacity: 0.8 !important;
}

.nav-group-content {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
  margin-top: 4px;
  overflow: hidden;
}

.nav-group.expanded .nav-group-content {
  display: flex;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nav-sublink {
  font-size: 0.9rem;
  padding: 10px 16px;
  margin-left: 8px;
  border-left: 2px solid transparent;
}

.nav-sublink:hover {
  border-left-color: rgba(255, 255, 255, 0.1);
}

.nav-sublink.active {
  border-left-color: var(--primary);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(to bottom right, #2a2a35, #1a1a20);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  border: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
}

.sidebar-user span {
  font-weight: 600;
  font-size: 0.9rem;
}

.sidebar-user a {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Main Content */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 30px 40px;
  max-width: 1600px;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.page-heading h1 {
  font-size: 2.5rem;
  margin: 0;
  font-weight: 700;
  background: linear-gradient(to right, #fff, #a5a5a5);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
}

.eyebrow {
  color: var(--primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
  text-shadow: 0 0 10px rgba(0, 242, 255, 0.4);
}

.muted {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 8px;
}

/* Cards & Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

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

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.5;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin: 12px 0 4px;
  font-family: var(--font-mono);
  color: #fff;
}

.stat-subtitle {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* Generic Card */
.card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-glass);
}

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

.card h2 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
}

/* Buttons & Chips */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  gap: 8px;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-main);
}

.btn.primary {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.btn.primary:hover {
  background: #e0e0e0;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.chip-group {
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  gap: 4px;
}

.chip {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  color: var(--text-main);
}

.chip.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Charts */
.chart-shell {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px dashed var(--border);
  height: 340px;
  /* Fixed height instead of min-height to contain canvas */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#trafficChart {
  width: 100%;
  height: 100%;
}

.chart-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

/* Tables */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-card header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
}

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

.data-table th {
  text-align: left;
  padding: 16px 32px;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: 20px 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-size: 0.95rem;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Forms */
input,
select,
textarea {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #222;
  padding: 12px 16px;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #444;
  background: #0f0f0f;
  box-shadow: none;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    padding: 16px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }

  .sidebar-brand {
    margin-bottom: 0;
    margin-right: 24px;
    flex-shrink: 0;
  }

  .sidebar-brand img {
    width: 32px;
    height: 32px;
  }

  .brand-text {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0;
    gap: 8px;
    flex: 1;
    -webkit-overflow-scrolling: touch;
  }

  .nav-link {
    flex-direction: column;
    padding: 12px 16px;
    gap: 6px;
    min-width: auto;
    white-space: nowrap;
  }

  .nav-link svg {
    width: 20px;
    height: 20px;
  }

  .nav-link span {
    font-size: 11px;
    font-weight: 500;
  }

  .sidebar-footer {
    display: none;
  }

  .app-main {
    margin-left: 0;
    padding: 20px;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .stat-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 20px;
  }

  .data-table th,
  .data-table td {
    padding: 12px 8px;
    font-size: 13px;
  }

  /* Make tables horizontally scrollable on mobile */
  .table-card section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    min-width: 100%;
  }

  /* Hide less critical columns on mobile for domains table */
  body[data-page="domains"] .data-table th:nth-child(2),
  body[data-page="domains"] .data-table td:nth-child(2),
  body[data-page="domains"] .data-table th:nth-child(3),
  body[data-page="domains"] .data-table td:nth-child(3) {
    display: none;
  }

  /* Reports page mobile */
  .modal-content {
    width: 95%;
    max-width: 95%;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .button-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .button-group .btn {
    width: 100%;
  }

  .stats-section h3 {
    font-size: 14px;
  }

  .stat-value {
    font-size: 20px;
  }

  table {
    font-size: 12px;
  }

  .pagination {
    flex-direction: column;
    gap: 8px;
  }

  .pagination .btn {
    width: 100%;
  }
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
  .data-table th,
  .data-table td {
    padding: 10px 6px;
    font-size: 12px;
  }

  /* Further optimize domains table for very small screens */
  body[data-page="domains"] .data-table th:nth-child(4),
  body[data-page="domains"] .data-table td:nth-child(4) {
    display: none;
  }

  /* Make action buttons stack or smaller */
  .data-table .btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .page-heading h1 {
    font-size: 24px;
  }

  .page-heading .muted {
    font-size: 13px;
  }
}

/* Utilities */
[hidden] {
  display: none !important;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.w-full {
  width: 100%;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.success {
  background: rgba(0, 255, 157, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 255, 157, 0.2);
}

.status-badge.warning {
  background: rgba(255, 184, 0, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 184, 0, 0.2);
}

.status-badge.error {
  background: rgba(255, 51, 102, 0.1);
  color: var(--danger);
  border: 1px solid rgba(255, 51, 102, 0.2);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* Login Page */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 50%, #111 0%, #000 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: #050505;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  padding: 40px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  text-align: center;
}

.login-card h1 {
  margin: 16px 0 8px;
  font-size: 1.8rem;
}

.login-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 32px;
  line-height: 1.5;
}

.login-footer {
  margin-top: 24px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.login-error {
  margin-top: 16px;
  color: var(--danger);
  font-size: 0.9rem;
  background: rgba(255, 51, 102, 0.1);
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* Panels / Modals */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  opacity: 1;
  transition: opacity 0.2s;
}

.panel-overlay[hidden] {
  display: none;
  opacity: 0;
}

.panel-card {
  width: 100%;
  max-width: 600px;
  background: #0f0f13;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.4rem;
}

.inline-callout {
  background: rgba(255, 184, 0, 0.05);
  border: 1px dashed rgba(255, 184, 0, 0.3);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  color: var(--text-muted);
}

.inline-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-field {
  margin-bottom: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
}

.input-locked {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  cursor: not-allowed;
}

/* Toast */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 3000;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color: var(--text-main);
  min-width: 250px;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(20px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== Security page scoped styles ===== */
body[data-page="security"] {
  --sec-accent: rgba(79, 142, 247, 0.12);
}

body[data-page="security"] .page-heading {
  padding: 8px 0 6px;
}

body[data-page="security"] .page-heading .eyebrow {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  margin-bottom: 6px;
}

body[data-page="security"] .page-heading h1 {
  font-size: 28px;
  margin: 0 0 6px;
  font-weight: 700;
}

body[data-page="security"] .page-heading .muted {
  margin: 0 0 8px;
  color: var(--text-muted);
  max-width: 820px;
}

body[data-page="security"] .page-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 6px 0
}

/* compact table-card */
body[data-page="security"] .table-card {
  border-radius: 12px;
  overflow: visible
}

body[data-page="security"] .table-card header {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02)
}

body[data-page="security"] .table-card section {
  padding: 14px 22px
}

/* Inline forms */
body[data-page="security"] .form-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap
}

body[data-page="security"] .form-inline input {
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.02)
}

body[data-page="security"] .form-inline .btn {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700
}

/* data-table styling */
body[data-page="security"] .data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px
}

body[data-page="security"] .data-table thead th {
  background: transparent;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase
}

body[data-page="security"] .data-table tbody tr {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.00));
  border-radius: 8px
}

body[data-page="security"] .data-table td {
  padding: 12px 12px;
  border-bottom: none;
  color: var(--text-main)
}

body[data-page="security"] .data-table td:last-child {
  text-align: right;
  width: 120px
}

body[data-page="security"] .data-table tr:hover td {
  background: rgba(255, 255, 255, 0.01)
}

/* empty states */
body[data-page="security"] .empty-state {
  padding: 14px;
  color: var(--text-muted);
  background: transparent;
  border-radius: 8px
}

/* form-grid adjustments */
body[data-page="security"] .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px
}

body[data-page="security"] .form-field label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px
}

body[data-page="security"] .form-field input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  background: rgba(255, 255, 255, 0.02)
}

body[data-page="security"] .form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px
}

/* checkboxes */
body[data-page="security"] .form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px
}

body[data-page="security"] .form-check input {
  width: 16px;
  height: 16px
}

/* subtle divider between sections */
body[data-page="security"] .card+.card {
  border-top: 1px solid rgba(255, 255, 255, 0.02)
}

/* tone down primary in this page to be less jarring */
body[data-page="security"] .btn.primary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none
}

@media (max-width:900px) {
  body[data-page="security"] .form-inline input {
    min-width: 140px
  }
}

/* End security scoped styles */

/* ===== Theme System ===== */
/* Light Theme Override */
[data-theme="light"] {
  --bg-deep: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.9);
  --bg-glass-strong: #fafafa;

  --primary: #0066cc;
  --primary-dim: rgba(0, 102, 204, 0.1);
  --primary-glow: rgba(0, 102, 204, 0.3);

  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --text-dim: #86868b;

  --border: #d2d2d7;
  --border-hover: #999999;

  --success: #34c759;
  --warning: #ff9500;
  --danger: #ff3b30;

  --shadow-glass: 0 4px 16px rgba(0, 0, 0, 0.08);
  --glow-text: none;
}

[data-theme="light"] body {
  background-image: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.8);
  border-right: 1px solid var(--border);
}

[data-theme="light"] .sidebar-logo {
  background: linear-gradient(135deg, #0066cc, #0052a3);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

[data-theme="light"] .sidebar-avatar {
  background: linear-gradient(135deg, #e8e8e8, #d0d0d0);
  color: #333;
}

[data-theme="light"] .nav-link.active {
  background: var(--primary-dim);
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.15);
}

[data-theme="light"] .page-heading h1 {
  background: linear-gradient(to right, #1d1d1f, #6e6e73);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .btn.primary {
  background: #0066cc;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 102, 204, 0.25);
}

[data-theme="light"] .btn.primary:hover {
  background: #0052a3;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.35);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Theme Toggle Button */
.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-right: auto;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.theme-icon-dark {
  display: none;
}

[data-theme="light"] .theme-icon-light {
  display: none;
}

[data-theme="light"] .theme-icon-dark {
  display: block;
}

/* Smooth theme transition */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ========== Dropdown Menu Styles ========== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.1);
  min-width: 200px;
  z-index: 1000;
  padding: 6px;
  backdrop-filter: blur(10px);
}

.dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-main);
  border-radius: 6px;
  margin-bottom: 2px;
}

.dropdown-menu button:last-child {
  margin-bottom: 0;
}

.dropdown-menu button:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateX(2px);
}

.dropdown-menu button:active {
  transform: translateX(2px) scale(0.98);
}

/* Icon button styles */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: var(--text-muted);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  color: var(--text-main);
  transform: scale(1.05);
}

/* Reports page styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

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

.stat-item {
  padding: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.stat-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-value.green {
  color: #22c55e;
}

.stat-value.red {
  color: #ef4444;
}

.stats-section {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.stats-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.stats-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 16px;
  color: var(--text-main);
  font-weight: 600;
}

.info-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 16px;
  font-style: italic;
}

.btn-icon:active {
  transform: scale(0.95);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* Domain Cards */
.domains-header {
  margin-bottom: 30px;
}

.domains-header h2 {
  font-size: 1.8rem;
  margin-top: 8px;
}

.domains-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.domain-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.domain-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.domain-card-preview {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.domain-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  transition: opacity 0.3s ease;
}

.domain-card-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-muted);
}

.domain-card-preview-placeholder svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
}

.domain-card-preview-placeholder span {
  font-size: 0.85rem;
  opacity: 0.6;
}

.domain-card-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.domain-card-hostname {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
  word-break: break-all;
}

.domain-card-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.domain-card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.domain-card-meta-row svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.domain-card-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.domain-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.domain-card-actions .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 8px 12px;
}

/* Responsive domain cards */
@media (max-width: 1200px) {
  .domains-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .domains-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .domain-card-preview {
    height: 180px;
  }
}

@media (max-width: 480px) {
  .domain-card-content {
    padding: 16px;
  }

  .domain-card-preview {
    height: 160px;
  }
}
