/* ============================================
   ShipGuard AI Governance Dashboard
   "Mission Control" Dark Theme
   ============================================ */

:root {
  /* Backgrounds */
  --bg-primary: #0b1120;
  --bg-card: #111827;
  --bg-card-hover: #151d2e;
  --bg-surface: #1a2332;
  --bg-input: #0f172a;

  /* Borders */
  --border: #1e293b;
  --border-hover: #334155;

  /* Text */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b1120;

  /* Accent colors */
  --critical: #ef4444;
  --critical-bg: rgba(239, 68, 68, 0.12);
  --critical-border: rgba(239, 68, 68, 0.3);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.3);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --success-border: rgba(34, 197, 94, 0.3);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --info-border: rgba(59, 130, 246, 0.3);
  --teal: #14b8a6;
  --teal-bg: rgba(20, 184, 166, 0.12);
  --teal-border: rgba(20, 184, 166, 0.3);
  --teal-hover: #0d9488;

  /* Sizing */
  --sidebar-width: 240px;
  --header-height: 56px;

  /* Typography */
  --font-heading: 'DM Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-heading);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0.035;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Subtle grid pattern background */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: 
    linear-gradient(rgba(20, 184, 166, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 184, 166, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
}

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

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

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

.shield-icon {
  width: 28px;
  height: 28px;
  color: var(--teal);
  flex-shrink: 0;
}

.shield-icon.small { width: 22px; height: 22px; }

.brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.93rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.nav-item:hover {
  background: rgba(20, 184, 166, 0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--teal-bg);
  color: var(--teal);
  font-weight: 600;
}

.nav-item.active svg {
  color: var(--teal);
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

.footer-item { margin-bottom: 12px; }

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
}

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

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

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================================
   Mobile Header & Hamburger
   ============================================ */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 90;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.hamburger svg { width: 24px; height: 24px; }

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 95;
  backdrop-filter: blur(2px);
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 28px 32px 40px;
  position: relative;
  z-index: 1;
}

/* View transitions */
.view {
  animation: fadeIn 0.2s ease;
}

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

/* ============================================
   Cards
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.04), 0 0 0 1px rgba(20, 184, 166, 0.06);
}

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

.card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

/* ============================================
   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: 10px;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.04);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.teal { background: var(--teal-bg); color: var(--teal); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.red { background: var(--critical-bg); color: var(--critical); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }

.stat-content { flex: 1; }

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.stat-trend {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--critical); }

/* ============================================
   Charts Grid
   ============================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 280px;
  padding: 0 4px;
}

.chart-container canvas {
  max-height: 280px;
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-badge {
  background: var(--teal-bg);
  color: var(--teal);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 2px 10px;
  border-radius: 100px;
  font-weight: 600;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-heading);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}
.btn-primary:hover {
  background: var(--teal-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
}

.btn-outline {
  background: transparent;
  color: var(--teal);
  border: 1px solid var(--teal-border);
}
.btn-outline:hover {
  background: var(--teal-bg);
}

.btn-danger {
  background: var(--critical-bg);
  color: var(--critical);
  border: 1px solid var(--critical-border);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ============================================
   Severity Badges
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-critical { background: var(--critical-bg); color: var(--critical); border: 1px solid var(--critical-border); }
.badge-high { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-border); }
.badge-medium { background: rgba(234, 179, 8, 0.12); color: #eab308; border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-low { background: var(--info-bg); color: var(--info); border: 1px solid var(--info-border); }
.badge-resolved { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-active { background: var(--success-bg); color: var(--success); }
.badge-inactive { background: rgba(100, 116, 139, 0.12); color: var(--text-muted); }

/* ============================================
   Tables
   ============================================ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: rgba(20, 184, 166, 0.04);
}

.data-table tbody td {
  padding: 10px 14px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.data-table .truncate {
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Event detail row */
.event-detail-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border);
}

.event-detail {
  background: var(--bg-surface);
  padding: 16px 20px;
  font-size: 0.85rem;
  border-left: 3px solid var(--teal);
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 300px; }
}

.event-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.event-detail-item label {
  display: block;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.event-detail-item span {
  font-size: 0.85rem;
  color: var(--text-primary);
}

/* ============================================
   Filters
   ============================================ */
.filters-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: var(--font-heading);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-bg);
}

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

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8' stroke='%2364748b' stroke-width='2'/%3E%3Cpath d='M21 21L16.65 16.65' stroke='%2364748b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  padding-left: 36px;
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.page-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  background: var(--teal-bg);
  color: var(--teal);
  border-color: var(--teal-border);
}

.page-btn.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

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

/* ============================================
   Policy Cards Grid
   ============================================ */
.policy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.policy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.policy-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 0 20px rgba(20, 184, 166, 0.04);
}

.policy-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.policy-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.policy-card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  flex: 1;
}

.policy-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.policy-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.policy-card-footer .meta-text {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  transition: var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
  background: var(--teal);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(16px);
  background: #fff;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

/* ============================================
   Alert Cards
   ============================================ */
.alert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  overflow: hidden;
  margin-bottom: 12px;
  transition: all var(--transition-normal);
}

.alert-card:hover {
  border-color: var(--border-hover);
}

.alert-card.dismissed {
  opacity: 0.5;
}

.alert-card.dismissed .alert-title {
  text-decoration: line-through;
}

.alert-severity-bar {
  width: 4px;
  flex-shrink: 0;
}

.alert-severity-bar.critical { background: var(--critical); }
.alert-severity-bar.high { background: var(--warning); }
.alert-severity-bar.medium { background: #eab308; }
.alert-severity-bar.low { background: var(--info); }
.alert-severity-bar.resolved { background: var(--success); }

.alert-body {
  flex: 1;
  padding: 16px 20px;
}

.alert-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.alert-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-time {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
}

.alert-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}

.alert-meta {
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-bottom: 12px;
}

.alert-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.alert-actions {
  display: flex;
  gap: 8px;
}

.alert-detail {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 3px solid var(--teal);
  animation: slideDown 0.2s ease;
}

/* Summary bar */
.summary-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.summary-dot.critical { background: var(--critical); }
.summary-dot.high { background: var(--warning); }
.summary-dot.medium { background: #eab308; }
.summary-dot.resolved { background: var(--success); }

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-heading);
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text-primary);
}

.filter-tab.active {
  background: var(--teal);
  color: #fff;
}

/* ============================================
   Report View
   ============================================ */
.report-wrapper {
  max-width: 900px;
  margin: 0 auto;
}

.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  margin-bottom: 20px;
}

.report-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.report-header h1 {
  font-size: 1.75rem;
  margin-bottom: 8px;
}

.report-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.report-generated {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 4px;
}

.report-section {
  margin-bottom: 28px;
}

.report-section h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-section h2::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--teal);
  border-radius: 2px;
}

.report-summary {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.92rem;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.report-metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}

.report-metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.report-metric-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.report-metric-change {
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.report-metric-change.up { color: var(--critical); }
.report-metric-change.down { color: var(--success); }
.report-metric-change.neutral { color: var(--text-muted); }

.recommendation-list {
  list-style: none;
}

.recommendation-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.5;
}

.recommendation-list li::before {
  content: '→';
  color: var(--teal);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================
   Heatmap
   ============================================ */
.heatmap-grid {
  display: grid;
  grid-template-columns: 60px repeat(24, 1fr);
  gap: 2px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
}

.heatmap-label {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  padding-right: 8px;
  justify-content: flex-end;
}

.heatmap-header {
  text-align: center;
  color: var(--text-muted);
  padding: 2px 0;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  min-height: 18px;
  transition: all var(--transition-fast);
  cursor: default;
  position: relative;
}

.heatmap-cell:hover {
  outline: 1px solid var(--teal);
  z-index: 1;
}

/* Heatmap intensity levels */
.heat-0 { background: rgba(20, 184, 166, 0.04); }
.heat-1 { background: rgba(20, 184, 166, 0.12); }
.heat-2 { background: rgba(20, 184, 166, 0.24); }
.heat-3 { background: rgba(20, 184, 166, 0.40); }
.heat-4 { background: rgba(20, 184, 166, 0.60); }
.heat-5 { background: rgba(20, 184, 166, 0.85); }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
  font-size: 1.15rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

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

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

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

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  width: 100%;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.rule-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.rule-row select {
  width: 120px;
}

.rule-row input {
  flex: 1;
}

.rule-remove {
  background: none;
  border: none;
  color: var(--critical);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
  line-height: 1;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
  .policy-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    margin-left: 0;
    padding: 72px 16px 24px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .report-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .event-detail-grid {
    grid-template-columns: 1fr;
  }

  .filters-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filters-row .form-input {
    width: 100%;
  }

  .data-table {
    font-size: 0.78rem;
  }

  .data-table .hide-mobile {
    display: none;
  }

  .report-card {
    padding: 20px;
  }

  .summary-bar {
    flex-wrap: wrap;
  }

  .heatmap-grid {
    overflow-x: auto;
    min-width: 600px;
  }
}

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

  .report-metrics {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-critical { color: var(--critical); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }
.text-info { color: var(--info); }
.text-teal { color: var(--teal); }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); }

.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* Recent alerts mini-list */
.recent-alert-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.recent-alert-item:last-child {
  border-bottom: none;
}

.recent-alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.recent-alert-content {
  flex: 1;
}

.recent-alert-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.4;
}

.recent-alert-time {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Top users table */
.compact-table {
  width: 100%;
  border-collapse: collapse;
}

.compact-table th {
  text-align: left;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.compact-table td {
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.compact-table tr:hover {
  background: rgba(20, 184, 166, 0.04);
}

/* Ranked list for report */
.ranked-list {
  list-style: none;
}

.ranked-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.ranked-list .rank {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 0.78rem;
  width: 24px;
}

.ranked-list .name {
  flex: 1;
  color: var(--text-primary);
}

.ranked-list .count {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--teal);
}
