/* ==========================================================================
   ZelWall WAF — Gruvbox Dark Theme
   Pure CSS, no external frameworks
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Google Fonts Import
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Fira+Code:wght@400;500&display=swap');

/* --------------------------------------------------------------------------
   2. CSS Custom Properties — Gruvbox Dark Palette
   -------------------------------------------------------------------------- */
:root {
  /* --- Core Gruvbox Colors --- */
  --gb-bg0-h:   #1d2021;
  --gb-bg0:     #282828;
  --gb-bg1:     #3c3836;
  --gb-bg2:     #504945;
  --gb-bg3:     #665c54;
  --gb-bg4:     #7c6f64;

  --gb-fg:      #ebdbb2;
  --gb-fg1:     #ebdbb2;
  --gb-fg2:     #d5c4a1;
  --gb-fg3:     #bdae93;
  --gb-fg4:     #a89984;

  --gb-red:     #cc241d;
  --gb-red-l:   #fb4934;
  --gb-green:   #98971a;
  --gb-green-l: #b8bb26;
  --gb-yellow:  #d79921;
  --gb-yellow-l:#fabd2f;
  --gb-blue:    #458588;
  --gb-blue-l:  #83a598;
  --gb-purple:  #b16286;
  --gb-purple-l:#d3869b;
  --gb-aqua:    #689d6a;
  --gb-aqua-l:  #8ec07c;
  --gb-orange:  #d65d0e;
  --gb-orange-l:#fe8019;

  /* --- Semantic Aliases --- */
  --color-bg:          var(--gb-bg0);
  --color-bg-deep:     var(--gb-bg0-h);
  --color-bg-raised:   var(--gb-bg1);
  --color-bg-subtle:   var(--gb-bg2);
  --color-bg-muted:    var(--gb-bg3);
  --color-border:      var(--gb-bg2);
  --color-border-muted:var(--gb-bg1);
  --color-text:        var(--gb-fg);
  --color-text-muted:  var(--gb-fg4);
  --color-text-subtle: var(--gb-fg3);

  --color-primary:     var(--gb-blue);
  --color-primary-l:   var(--gb-blue-l);
  --color-danger:      var(--gb-red);
  --color-danger-l:    var(--gb-red-l);
  --color-success:     var(--gb-green);
  --color-success-l:   var(--gb-green-l);
  --color-warning:     var(--gb-yellow);
  --color-warning-l:   var(--gb-yellow-l);
  --color-info:        var(--gb-aqua);
  --color-info-l:      var(--gb-aqua-l);
  --color-orange:      var(--gb-orange);
  --color-orange-l:    var(--gb-orange-l);
  --color-purple:      var(--gb-purple);
  --color-purple-l:    var(--gb-purple-l);

  /* --- Action Badge Colors --- */
  --badge-allow:      var(--gb-green);
  --badge-allow-bg:   rgba(152, 151, 26, 0.15);
  --badge-block:      var(--gb-red-l);
  --badge-block-bg:   rgba(204, 36, 29, 0.15);
  --badge-challenge:  var(--gb-yellow-l);
  --badge-challenge-bg: rgba(215, 153, 33, 0.15);
  --badge-rate:       var(--gb-orange-l);
  --badge-rate-bg:    rgba(214, 93, 14, 0.15);

  /* --- Layout Dimensions --- */
  --sidebar-width:     260px;
  --sidebar-collapsed: 64px;
  --topbar-height:     56px;
  --content-padding:   24px;
  --card-radius:       10px;
  --btn-radius:        6px;
  --input-radius:      6px;
  --badge-radius:      4px;
  --pill-radius:       100px;

  /* --- Shadows --- */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4),  0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:  0 8px 28px rgba(0,0,0,0.5),  0 4px 8px rgba(0,0,0,0.35);
  --shadow-xl:  0 20px 50px rgba(0,0,0,0.6);

  /* --- Transitions --- */
  --transition-fast:   120ms ease;
  --transition-base:   200ms ease;
  --transition-slow:   350ms ease;

  /* --- Typography --- */
  --font-sans:  'Fira Sans', system-ui, -apple-system, sans-serif;
  --font-mono:  'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  --font-size-xs:   11px;
  --font-size-sm:   12px;
  --font-size-base: 14px;
  --font-size-md:   15px;
  --font-size-lg:   17px;
  --font-size-xl:   20px;
  --font-size-2xl:  24px;
  --font-size-3xl:  30px;
  --line-height:    1.55;

  /* --- Z-index Layers --- */
  --z-base:    1;
  --z-dropdown:100;
  --z-sticky:  200;
  --z-sidebar: 300;
  --z-topbar:  400;
  --z-modal:   500;
  --z-toast:   600;
  --z-tooltip: 700;
}

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

html {
  font-size: var(--font-size-base);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary-l);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--gb-fg); text-decoration: underline; }

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

ul, ol { list-style: none; }

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
}

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

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-base); }

p { margin-bottom: 0.75em; }
p:last-child { margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 16px 0;
}

/* --------------------------------------------------------------------------
   4. Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gb-bg0-h); }
::-webkit-scrollbar-thumb {
  background: var(--gb-bg3);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--gb-bg4); }
* { scrollbar-width: thin; scrollbar-color: var(--gb-bg3) var(--gb-bg0-h); }

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

/* --------------------------------------------------------------------------
   6. Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gb-bg0-h);
  border-right: 1px solid var(--color-border-muted);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--transition-slow), transform var(--transition-slow);
  overflow: hidden;
}

/* Sidebar Logo / Branding */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid var(--color-border-muted);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
  justify-content: space-between;
}
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  display: block;
  object-fit: contain;
}

.sidebar-brand-name {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--gb-fg);
  letter-spacing: 0.02em;
}
.sidebar-brand-link:hover {
  text-decoration: none;
}

.sidebar-brand-tagline {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
  margin-top: 1px;
}

/* Sidebar scroll area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

/* Nav group / section */
.nav-group {
  margin-bottom: 4px;
}

.nav-group-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gb-bg4);
  padding: 12px 20px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow);
}

/* Nav Item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 20px;
  color: var(--gb-fg3);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  transition: background var(--transition-fast), color var(--transition-fast);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--gb-bg1);
  color: var(--gb-fg);
  text-decoration: none;
}

.nav-item.active {
  background: rgba(69, 133, 136, 0.12);
  color: var(--gb-blue-l);
  border-left-color: var(--gb-blue);
  font-weight: 600;
}

.nav-item.active .nav-icon { color: var(--gb-blue-l); }

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--transition-fast);
  opacity: .75;
}
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-icon svg {
  display: block;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
  transition: opacity var(--transition-slow);
  font-size: 13px;
}

.nav-group-label,
.nav-section-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gb-bg4);
  padding: 12px 20px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-badge {
  background: var(--gb-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--pill-radius);
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* Sub-nav (nested items) */
.nav-sub {
  padding-left: 16px;
}

.nav-sub .nav-item {
  padding-left: 20px;
  font-size: var(--font-size-xs);
  color: var(--gb-fg4);
}

.nav-sub .nav-item.active { color: var(--gb-blue-l); }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-muted);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-user:hover { background: var(--gb-bg1); }

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--gb-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-role {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* Collapse Toggle */
.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gb-bg2);
  color: var(--gb-fg4);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  border: none;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--gb-bg3); color: var(--gb-fg); }

/* --- Sidebar Collapsed State --- */
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-brand-name,
.sidebar.collapsed .sidebar-brand-tagline,
.sidebar.collapsed .sidebar-user-info {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}
.sidebar.collapsed .nav-item {
  padding: 9px;
  justify-content: center;
  border-left-color: transparent;
}
.sidebar.collapsed .nav-item.active {
  background: rgba(69,133,136,0.15);
}
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--gb-bg2);
  color: var(--gb-fg);
  padding: 5px 10px;
  border-radius: var(--btn-radius);
  font-size: var(--font-size-sm);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 0 12px;
}
.sidebar.collapsed .sidebar-brand-link {
  flex: 0;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-user {
  justify-content: center;
}

/* --------------------------------------------------------------------------
   7. Main Content Area
   -------------------------------------------------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left var(--transition-slow);
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* --------------------------------------------------------------------------
   8. Top Navigation Bar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: var(--gb-bg0-h);
  border-bottom: 1px solid var(--color-border-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--content-padding);
  z-index: var(--z-topbar);
  flex-shrink: 0;
}

.topbar-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gb-fg);
  white-space: nowrap;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.topbar-breadcrumb a { color: var(--color-text-muted); }
.topbar-breadcrumb a:hover { color: var(--gb-fg); text-decoration: none; }
.topbar-breadcrumb .sep { color: var(--gb-bg3); }
.topbar-breadcrumb .current { color: var(--gb-fg2); font-weight: 500; }

/* Search */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
  margin-left: auto;
}

.topbar-search-input {
  width: 100%;
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--pill-radius);
  color: var(--gb-fg);
  padding: 7px 14px 7px 36px;
  font-size: var(--font-size-sm);
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}
.topbar-search-input::placeholder { color: var(--gb-bg4); }
.topbar-search-input:focus {
  border-color: var(--gb-blue);
  background: var(--gb-bg0);
  box-shadow: 0 0 0 3px rgba(69,133,136,0.18);
}

.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gb-bg4);
  font-size: 14px;
  pointer-events: none;
  line-height: 1;
}

/* Topbar actions */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  color: var(--gb-fg4);
  font-size: 16px;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
  cursor: pointer;
  border: none;
}
.topbar-action-btn:hover { background: var(--gb-bg1); color: var(--gb-fg); }

.topbar-notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--gb-red-l);
  border-radius: 50%;
  border: 2px solid var(--gb-bg0-h);
}

/* --------------------------------------------------------------------------
   9. Page Content Wrapper
   -------------------------------------------------------------------------- */
.page-content {
  flex: 1;
  padding: var(--content-padding);
  overflow-y: auto;
}

.page-header {
  margin-bottom: 20px;
}

.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   10. Grid / Layout Utilities
   -------------------------------------------------------------------------- */
.grid { display: grid; gap: var(--content-padding); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.min-w-0 { min-width: 0; }

/* --------------------------------------------------------------------------
   11. Card Component
   -------------------------------------------------------------------------- */
.card {
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  gap: 8px;
}

.card-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--gb-fg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-icon {
  font-size: 16px;
  line-height: 1;
}

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

.card-body {
  padding: 18px;
}

.card-body-flush { padding: 0; }

.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  background: rgba(29,32,33,0.4);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   12. KPI / Stat Cards
   -------------------------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}
.kpi-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gb-bg3);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  background: var(--kpi-accent, var(--gb-blue));
}

.kpi-card--blue  { --kpi-accent: var(--gb-blue); }
.kpi-card--green { --kpi-accent: var(--gb-green-l); }
.kpi-card--red   { --kpi-accent: var(--gb-red-l); }
.kpi-card--yellow{ --kpi-accent: var(--gb-yellow-l); }
.kpi-card--orange{ --kpi-accent: var(--gb-orange-l); }
.kpi-card--purple{ --kpi-accent: var(--gb-purple-l); }
.kpi-card--aqua  { --kpi-accent: var(--gb-aqua-l); }

.kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  background: rgba(255,255,255,0.06);
  color: var(--kpi-accent, var(--gb-blue-l));
  flex-shrink: 0;
}

.kpi-trend {
  font-size: var(--font-size-xs);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  border-radius: var(--pill-radius);
  padding: 2px 8px;
}
.kpi-trend--up   { color: var(--gb-green-l); background: rgba(184,187,38,0.12); }
.kpi-trend--down { color: var(--gb-red-l);   background: rgba(251,73,52,0.12); }
.kpi-trend--flat { color: var(--gb-fg4);     background: rgba(168,153,132,0.12); }

.kpi-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--gb-fg);
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-label {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-subvalue {
  font-size: var(--font-size-sm);
  color: var(--color-text-subtle);
}

/* Sparkline area */
.kpi-sparkline {
  height: 36px;
  margin-top: 4px;
  position: relative;
  overflow: hidden;
  opacity: 0.7;
}

/* --------------------------------------------------------------------------
   13. Chart Container Cards
   -------------------------------------------------------------------------- */
.chart-card {
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.chart-card .card-header { border-bottom: 1px solid var(--color-border); }

.chart-container {
  padding: 16px 18px;
  position: relative;
}

.chart-placeholder {
  height: 220px;
  background: var(--gb-bg0);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gb-bg4);
  font-size: var(--font-size-sm);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 18px 14px;
  font-size: var(--font-size-xs);
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gb-fg3);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   14. Data Tables
   -------------------------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--card-radius);
}

table, .data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.data-table thead tr {
  border-bottom: 2px solid var(--color-border);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gb-fg4);
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
  transition: color var(--transition-fast);
}
.data-table th.sortable:hover { color: var(--gb-fg); }

.data-table th .sort-icon {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.4;
  font-size: 10px;
  vertical-align: middle;
}
.data-table th.sorted-asc .sort-icon,
.data-table th.sorted-desc .sort-icon { opacity: 1; color: var(--gb-blue-l); }

.data-table tbody tr {
  border-bottom: 1px solid var(--color-border-muted);
  transition: background var(--transition-fast);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(29,32,33,0.35);
}

.data-table tbody tr:hover {
  background: rgba(69,133,136,0.07);
}

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

.data-table td {
  padding: 10px 14px;
  color: var(--gb-fg2);
  vertical-align: middle;
}

.data-table td.monospace {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--gb-fg3);
}

.data-table .td-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

/* Table cell truncation */
.td-truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   15. Badge / Pill Components
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--badge-radius);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1.6;
}

.pill {
  border-radius: var(--pill-radius);
}

/* Action Badges */
.badge-allow {
  background: var(--badge-allow-bg);
  color: var(--gb-green-l);
  border: 1px solid rgba(152,151,26,0.3);
}

.badge-block {
  background: var(--badge-block-bg);
  color: var(--gb-red-l);
  border: 1px solid rgba(204,36,29,0.3);
}

.badge-challenge {
  background: var(--badge-challenge-bg);
  color: var(--gb-yellow-l);
  border: 1px solid rgba(215,153,33,0.3);
}

.badge-rate-limit {
  background: var(--badge-rate-bg);
  color: var(--gb-orange-l);
  border: 1px solid rgba(214,93,14,0.3);
}

/* General color badges */
.badge-blue   { background: rgba(69,133,136,0.15);  color: var(--gb-blue-l);   border: 1px solid rgba(69,133,136,0.3); }
.badge-green  { background: rgba(152,151,26,0.15);  color: var(--gb-green-l);  border: 1px solid rgba(152,151,26,0.3); }
.badge-red    { background: rgba(204,36,29,0.15);   color: var(--gb-red-l);    border: 1px solid rgba(204,36,29,0.3); }
.badge-yellow { background: rgba(215,153,33,0.15);  color: var(--gb-yellow-l); border: 1px solid rgba(215,153,33,0.3); }
.badge-orange { background: rgba(214,93,14,0.15);   color: var(--gb-orange-l); border: 1px solid rgba(214,93,14,0.3); }
.badge-purple { background: rgba(177,98,134,0.15);  color: var(--gb-purple-l); border: 1px solid rgba(177,98,134,0.3); }
.badge-aqua   { background: rgba(104,157,106,0.15); color: var(--gb-aqua-l);   border: 1px solid rgba(104,157,106,0.3); }
.badge-gray   { background: var(--gb-bg2);          color: var(--gb-fg4);      border: 1px solid var(--gb-bg3); }

/* --------------------------------------------------------------------------
   16. Risk Score Badge
   -------------------------------------------------------------------------- */
.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: 1;
}

.risk-badge--low    { background: rgba(152,151,26,0.2); color: var(--gb-green-l);  } /* 0-3 */
.risk-badge--medium { background: rgba(215,153,33,0.2); color: var(--gb-yellow-l); } /* 4-6 */
.risk-badge--high   { background: rgba(214,93,14,0.2);  color: var(--gb-orange-l); } /* 7-8 */
.risk-badge--critical { background: rgba(204,36,29,0.2); color: var(--gb-red-l);  } /* 9+  */

/* --------------------------------------------------------------------------
   17. Status Indicators
   -------------------------------------------------------------------------- */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot--running { background: var(--gb-green-l); box-shadow: 0 0 0 3px rgba(184,187,38,0.2); }
.status-dot--stopped { background: var(--gb-red-l);   box-shadow: 0 0 0 3px rgba(251,73,52,0.2); }
.status-dot--idle    { background: var(--gb-yellow-l); box-shadow: 0 0 0 3px rgba(250,189,47,0.2); }
.status-dot--unknown { background: var(--gb-bg4);     }

.status-dot--pulse {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: 3px 9px;
  border-radius: var(--pill-radius);
}
.status-chip--running { background: rgba(184,187,38,0.12); color: var(--gb-green-l); }
.status-chip--stopped { background: rgba(251,73,52,0.12);  color: var(--gb-red-l); }
.status-chip--idle    { background: rgba(250,189,47,0.12); color: var(--gb-yellow-l); }

/* --------------------------------------------------------------------------
   18. Avatar Badge
   -------------------------------------------------------------------------- */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  font-style: normal;
  background: var(--gb-bg2);
  color: var(--gb-fg);
  overflow: hidden;
}

.avatar--sm { width: 24px; height: 24px; font-size: 12px; }
.avatar--md { width: 36px; height: 36px; font-size: 18px; }
.avatar--lg { width: 48px; height: 48px; font-size: 22px; }

.avatar--blue   { background: rgba(69,133,136,0.25);  }
.avatar--green  { background: rgba(152,151,26,0.25);  }
.avatar--red    { background: rgba(204,36,29,0.25);   }
.avatar--yellow { background: rgba(215,153,33,0.25);  }
.avatar--purple { background: rgba(177,98,134,0.25);  }
.avatar--orange { background: rgba(214,93,14,0.25);   }
.avatar--aqua   { background: rgba(104,157,106,0.25); }

.avatar-group {
  display: flex;
  align-items: center;
}
.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--gb-bg1);
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* --------------------------------------------------------------------------
   19. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--btn-radius);
  font-family: var(--font-sans);
  font-size: var(--font-size-sm);
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    color var(--transition-fast),
    opacity var(--transition-fast);
  user-select: none;
}

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-icon {
  padding: 7px;
  border-radius: var(--btn-radius);
}

.btn-icon-round { border-radius: 50%; }

/* Primary */
.btn-primary {
  background: var(--gb-blue);
  color: var(--gb-fg);
  border-color: var(--gb-blue);
}
.btn-primary:hover {
  background: var(--gb-blue-l);
  border-color: var(--gb-blue-l);
  box-shadow: 0 0 0 3px rgba(69,133,136,0.22);
}

/* Danger */
.btn-danger {
  background: var(--gb-red);
  color: #fff;
  border-color: var(--gb-red);
}
.btn-danger:hover {
  background: var(--gb-red-l);
  border-color: var(--gb-red-l);
  box-shadow: 0 0 0 3px rgba(204,36,29,0.22);
}

/* Success */
.btn-success {
  background: var(--gb-green);
  color: var(--gb-fg);
  border-color: var(--gb-green);
}
.btn-success:hover {
  background: var(--gb-green-l);
  border-color: var(--gb-green-l);
  box-shadow: 0 0 0 3px rgba(152,151,26,0.22);
}

/* Warning */
.btn-warning {
  background: var(--gb-yellow);
  color: var(--gb-bg0-h);
  border-color: var(--gb-yellow);
}
.btn-warning:hover {
  background: var(--gb-yellow-l);
  border-color: var(--gb-yellow-l);
  box-shadow: 0 0 0 3px rgba(215,153,33,0.22);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--gb-fg3);
  border-color: var(--color-border);
}
.btn-ghost:hover {
  background: var(--gb-bg1);
  color: var(--gb-fg);
  border-color: var(--gb-bg3);
}

/* Ghost subtle */
.btn-ghost-subtle {
  background: transparent;
  color: var(--gb-fg4);
  border-color: transparent;
}
.btn-ghost-subtle:hover {
  background: var(--gb-bg1);
  color: var(--gb-fg);
}

/* Sizes */
.btn-sm { padding: 5px 10px; font-size: var(--font-size-xs); border-radius: 4px; }
.btn-lg { padding: 11px 22px; font-size: var(--font-size-md); }

/* Full width */
.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   20. Form Elements
   -------------------------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg3);
}

.form-label-required::after {
  content: ' *';
  color: var(--gb-red-l);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--gb-red-l);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Input / Select / Textarea shared styles */
.form-input,
.form-select,
.form-textarea {
  background: var(--gb-bg0);
  border: 1px solid var(--color-border);
  border-radius: var(--input-radius);
  color: var(--gb-fg);
  padding: 8px 12px;
  font-size: var(--font-size-sm);
  font-family: var(--font-sans);
  line-height: 1.5;
  width: 100%;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--gb-bg4); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gb-blue);
  box-shadow: 0 0 0 3px rgba(69,133,136,0.18);
  background: var(--gb-bg0-h);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--gb-red);
  box-shadow: 0 0 0 3px rgba(204,36,29,0.15);
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--gb-bg1);
}

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

/* Select arrow */
.form-select {
  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 d='M1 1l5 5 5-5' stroke='%237c6f64' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

/* Input with prefix/suffix */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-input {
  border-radius: 0;
  flex: 1;
}

.input-group .form-input:first-child { border-radius: var(--input-radius) 0 0 var(--input-radius); }
.input-group .form-input:last-child  { border-radius: 0 var(--input-radius) var(--input-radius) 0; }

.input-addon {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  color: var(--gb-fg4);
  font-size: var(--font-size-sm);
  white-space: nowrap;
}

.input-addon:first-child {
  border-right: none;
  border-radius: var(--input-radius) 0 0 var(--input-radius);
}

.input-addon:last-child {
  border-left: none;
  border-radius: 0 var(--input-radius) var(--input-radius) 0;
}

/* Checkbox */
.form-checkbox-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.form-checkbox {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--gb-bg4);
  border-radius: 4px;
  background: var(--gb-bg0);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin-top: 1px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.form-checkbox:checked {
  background: var(--gb-blue);
  border-color: var(--gb-blue);
}

.form-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(40deg);
}

.form-checkbox:focus-visible {
  outline: 2px solid var(--gb-blue);
  outline-offset: 2px;
}

.form-checkbox-label {
  font-size: var(--font-size-sm);
  color: var(--gb-fg2);
  line-height: 1.4;
}

/* Toggle Switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gb-bg3);
  border-radius: 22px;
  transition: background var(--transition-base);
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: var(--gb-fg4);
  border-radius: 50%;
  transition: transform var(--transition-base), background var(--transition-base);
}

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

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

.toggle input:focus-visible + .toggle-slider {
  outline: 2px solid var(--gb-blue);
  outline-offset: 2px;
}

.toggle-label {
  font-size: var(--font-size-sm);
  color: var(--gb-fg2);
}

/* Radio */
.form-radio {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--gb-bg4);
  border-radius: 50%;
  background: var(--gb-bg0);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color var(--transition-fast);
}

.form-radio:checked {
  border-color: var(--gb-blue);
}

.form-radio:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--gb-blue);
  border-radius: 50%;
}

/* --------------------------------------------------------------------------
   21. Tabs Component
   -------------------------------------------------------------------------- */
.tabs {
  display: flex;
  flex-direction: column;
}

.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg4);
  cursor: pointer;
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.tab-btn:hover { color: var(--gb-fg); }

.tab-btn.active {
  color: var(--gb-blue-l);
  border-bottom-color: var(--gb-blue);
}

.tab-btn .tab-count {
  background: var(--gb-bg2);
  color: var(--gb-fg4);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--pill-radius);
  padding: 1px 6px;
}

.tab-btn.active .tab-count {
  background: rgba(69,133,136,0.2);
  color: var(--gb-blue-l);
}

.tab-panel,
.tab-pane {
  display: none;
  padding-top: 16px;
}

.tab-panel.active,
.tab-pane.active { display: block; }

/* Pill tabs variant */
.tab-list--pills {
  border-bottom: none;
  gap: 4px;
  background: var(--gb-bg0-h);
  padding: 4px;
  border-radius: var(--btn-radius);
  display: inline-flex;
}

.tab-list--pills .tab-btn {
  border-bottom: none;
  margin-bottom: 0;
  border-radius: 4px;
  padding: 6px 14px;
}

.tab-list--pills .tab-btn.active {
  background: var(--gb-bg1);
  color: var(--gb-fg);
  box-shadow: var(--shadow-sm);
  border-bottom-color: transparent;
}

/* --------------------------------------------------------------------------
   22. Modals
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13,15,16,0.72);
  backdrop-filter: blur(3px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--transition-base);
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
}

.modal--sm { max-width: 360px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }

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

.modal-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--gb-fg);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--gb-fg4);
  font-size: 16px;
  cursor: pointer;
  border: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.modal-close:hover { background: var(--gb-bg2); color: var(--gb-fg); }

.modal-body { padding: 20px; }

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

/* --------------------------------------------------------------------------
   23. Side Drawer (Event Detail)
   -------------------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13,15,16,0.6);
  backdrop-filter: blur(2px);
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 480px;
  max-width: calc(100vw - 40px);
  background: var(--gb-bg1);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-xl);
  z-index: calc(var(--z-modal) + 1);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}

.drawer-backdrop.open .drawer,
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.drawer-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--gb-fg);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

/* Event detail sections */
.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gb-bg4);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border-muted);
}

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: var(--font-size-sm);
}

.detail-key {
  color: var(--gb-fg4);
  font-weight: 500;
  min-width: 120px;
  flex-shrink: 0;
}

.detail-val {
  color: var(--gb-fg2);
  word-break: break-all;
  flex: 1;
}

/* --------------------------------------------------------------------------
   24. Alert / Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: toast-in 0.25s ease;
  border-left-width: 4px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.removing { animation: toast-out 0.2s ease forwards; }

@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

.toast--success { border-left-color: var(--gb-green-l); }
.toast--error   { border-left-color: var(--gb-red-l); }
.toast--warning { border-left-color: var(--gb-yellow-l); }
.toast--info    { border-left-color: var(--gb-blue-l); }

.toast-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast--success .toast-icon { color: var(--gb-green-l); }
.toast--error   .toast-icon { color: var(--gb-red-l); }
.toast--warning .toast-icon { color: var(--gb-yellow-l); }
.toast--info    .toast-icon { color: var(--gb-blue-l); }

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

.toast-title {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--gb-fg);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--font-size-xs);
  color: var(--gb-fg4);
  line-height: 1.4;
}

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

/* Alert banners */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--card-radius);
  font-size: var(--font-size-sm);
  border: 1px solid transparent;
  margin-bottom: 16px;
}

.alert-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; margin-bottom: 2px; }

.alert--success {
  background: rgba(152,151,26,0.1);
  border-color: rgba(152,151,26,0.3);
  color: var(--gb-green-l);
}
.alert--error {
  background: rgba(204,36,29,0.1);
  border-color: rgba(204,36,29,0.3);
  color: var(--gb-red-l);
}
.alert--warning {
  background: rgba(215,153,33,0.1);
  border-color: rgba(215,153,33,0.3);
  color: var(--gb-yellow-l);
}
.alert--info {
  background: rgba(69,133,136,0.1);
  border-color: rgba(69,133,136,0.3);
  color: var(--gb-blue-l);
}

/* --------------------------------------------------------------------------
   25. Search Dropdown Results
   -------------------------------------------------------------------------- */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 340px;
  overflow-y: auto;
  display: none;
}

.search-dropdown.open { display: block; }

.search-dropdown-section {
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border-muted);
}
.search-dropdown-section:last-child { border-bottom: none; }

.search-dropdown-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gb-bg4);
  padding: 6px 14px 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover,
.search-result-item.focused {
  background: rgba(69,133,136,0.1);
  color: inherit;
  text-decoration: none;
}

.search-result-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--gb-bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.search-result-text { flex: 1; min-width: 0; }

.search-result-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-meta {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

.search-result-kbd {
  font-size: 10px;
  color: var(--gb-bg4);
  background: var(--gb-bg2);
  border-radius: 3px;
  padding: 2px 5px;
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   26. Code / Monospace Blocks
   -------------------------------------------------------------------------- */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--gb-bg2);
  color: var(--gb-green-l);
  padding: 2px 6px;
  border-radius: 4px;
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  background: var(--gb-bg0-h);
  color: var(--gb-fg2);
  padding: 16px 18px;
  border-radius: var(--card-radius);
  border: 1px solid var(--color-border-muted);
  overflow-x: auto;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.code-block {
  position: relative;
}

.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: var(--font-size-xs);
  background: var(--gb-bg2);
  color: var(--gb-fg4);
  border: 1px solid var(--gb-bg3);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.code-copy-btn:hover { background: var(--gb-bg3); color: var(--gb-fg); }

/* Syntax highlight token classes */
.token-keyword  { color: var(--gb-red-l); }
.token-string   { color: var(--gb-green-l); }
.token-number   { color: var(--gb-purple-l); }
.token-comment  { color: var(--gb-fg4); font-style: italic; }
.token-key      { color: var(--gb-blue-l); }
.token-value    { color: var(--gb-yellow-l); }

/* --------------------------------------------------------------------------
   27. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--btn-radius);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg4);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
  text-decoration: none;
}

.page-btn:hover {
  background: var(--gb-bg1);
  color: var(--gb-fg);
  border-color: var(--gb-bg3);
  text-decoration: none;
}

.page-btn.active {
  background: var(--gb-blue);
  color: var(--gb-fg);
  border-color: var(--gb-blue);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.page-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--gb-bg4);
  font-size: var(--font-size-sm);
}

.pagination-info {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-left: 8px;
}

/* --------------------------------------------------------------------------
   28. Wizard Step Indicator
   -------------------------------------------------------------------------- */
.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.wizard-step {
  display: flex;
  align-items: center;
  flex: 1;
  position: relative;
}

.wizard-step-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.wizard-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
  border: 2px solid var(--gb-bg3);
  color: var(--gb-fg4);
  background: var(--gb-bg0);
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.wizard-step-info {}

.wizard-step-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg4);
  white-space: nowrap;
  transition: color var(--transition-base);
}

.wizard-step-sublabel {
  font-size: var(--font-size-xs);
  color: var(--gb-bg4);
  display: block;
}

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--gb-bg2);
  margin: 0 8px;
  position: relative;
  overflow: hidden;
}

.wizard-step-line-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: var(--gb-blue);
  transition: width var(--transition-slow);
}

/* Active step */
.wizard-step.active .wizard-step-num {
  border-color: var(--gb-blue);
  color: var(--gb-blue-l);
  background: rgba(69,133,136,0.12);
}
.wizard-step.active .wizard-step-label { color: var(--gb-fg); }

/* Completed step */
.wizard-step.done .wizard-step-num {
  border-color: var(--gb-green);
  background: var(--gb-green);
  color: var(--gb-bg0);
}
.wizard-step.done .wizard-step-label { color: var(--gb-fg3); }
.wizard-step.done .wizard-step-line-fill { width: 100%; }

/* --------------------------------------------------------------------------
   29. World Map Container
   -------------------------------------------------------------------------- */
.world-map-container {
  position: relative;
  width: 100%;
  background: var(--gb-bg0);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.world-map-svg-wrap {
  width: 100%;
  aspect-ratio: 2 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.world-map-svg-wrap svg {
  width: 100%;
  height: 100%;
}

/* Map tooltip */
.map-tooltip {
  position: absolute;
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: var(--font-size-xs);
  color: var(--gb-fg2);
  pointer-events: none;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  display: none;
}

.map-country {
  fill: var(--gb-bg2);
  stroke: var(--gb-bg0);
  stroke-width: 0.5;
  transition: fill var(--transition-fast);
  cursor: pointer;
}

.map-country:hover { fill: var(--gb-bg3); }
.map-country.threat-low    { fill: rgba(152,151,26,0.35); }
.map-country.threat-medium { fill: rgba(215,153,33,0.4); }
.map-country.threat-high   { fill: rgba(214,93,14,0.45); }
.map-country.threat-critical { fill: rgba(204,36,29,0.5); }

/* Map dots / attack origins */
.map-dot {
  fill: var(--gb-red-l);
  opacity: 0.8;
  animation: map-dot-pulse 2s ease-in-out infinite;
}

@keyframes map-dot-pulse {
  0%, 100% { r: 3; opacity: 0.8; }
  50%       { r: 5; opacity: 0.4; }
}

/* Map legend */
.map-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--color-border-muted);
  font-size: var(--font-size-xs);
}

/* --------------------------------------------------------------------------
   30. Live Traffic Feed
   -------------------------------------------------------------------------- */
.traffic-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border-muted);
  font-size: var(--font-size-xs);
  transition: background var(--transition-fast);
  position: relative;
  cursor: pointer;
}

.feed-item:hover { background: rgba(69,133,136,0.05); }
.feed-item:last-child { border-bottom: none; }

.feed-item--allow { border-left: 3px solid var(--gb-green); }
.feed-item--block { border-left: 3px solid var(--gb-red-l); }
.feed-item--challenge { border-left: 3px solid var(--gb-yellow-l); }
.feed-item--rate { border-left: 3px solid var(--gb-orange-l); }

.feed-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.feed-item--allow .feed-indicator   { background: var(--gb-green-l); }
.feed-item--block .feed-indicator   { background: var(--gb-red-l); }
.feed-item--challenge .feed-indicator { background: var(--gb-yellow-l); }
.feed-item--rate .feed-indicator    { background: var(--gb-orange-l); }

.feed-ip {
  font-family: var(--font-mono);
  color: var(--gb-blue-l);
  min-width: 110px;
  flex-shrink: 0;
}

.feed-method {
  font-family: var(--font-mono);
  font-weight: 600;
  min-width: 38px;
  flex-shrink: 0;
}
.feed-method--GET  { color: var(--gb-green-l); }
.feed-method--POST { color: var(--gb-yellow-l); }
.feed-method--PUT  { color: var(--gb-blue-l); }
.feed-method--DELETE { color: var(--gb-red-l); }

.feed-path {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gb-fg3);
  font-family: var(--font-mono);
}

.feed-country {
  font-size: var(--font-size-xs);
  color: var(--gb-fg4);
  flex-shrink: 0;
}

.feed-time {
  color: var(--gb-bg4);
  flex-shrink: 0;
  min-width: 54px;
  text-align: right;
}

/* New item animation */
@keyframes feed-slide-in {
  from { opacity: 0; transform: translateY(-6px); background: rgba(69,133,136,0.12); }
  to   { opacity: 1; transform: translateY(0);    background: transparent; }
}
.feed-item--new { animation: feed-slide-in 0.4s ease; }

/* --------------------------------------------------------------------------
   31. Loading Skeleton Animations
   -------------------------------------------------------------------------- */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gb-bg1) 25%,
    var(--gb-bg2) 50%,
    var(--gb-bg1) 75%
  );
  background-size: 1200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  border-radius: 3px;
}
.skeleton-text--sm   { height: 11px; }
.skeleton-text--lg   { height: 18px; }
.skeleton-text--half { width: 50%; }
.skeleton-text--third { width: 33%; }
.skeleton-text--two-thirds { width: 66%; }

.skeleton-circle {
  border-radius: 50%;
}

.skeleton-rect {
  border-radius: var(--card-radius);
}

/* Skeleton KPI card */
.skeleton-kpi {
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   32. Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.empty-state-art {
  font-size: 48px;
  line-height: 1;
  filter: grayscale(0.3) opacity(0.7);
  margin-bottom: 4px;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gb-fg3);
}

.empty-state-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 340px;
  line-height: 1.5;
}

.empty-state-action { margin-top: 8px; }

/* Text-based ASCII art empty states */
.empty-state-ascii {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--gb-bg3);
  line-height: 1.2;
  margin-bottom: 8px;
  white-space: pre;
}

/* --------------------------------------------------------------------------
   33. Dropdown Menus
   -------------------------------------------------------------------------- */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--gb-bg1);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: var(--z-dropdown);
  padding: 4px 0;
  display: none;
}

.dropdown-menu.open { display: block; }
.dropdown-menu.left { right: auto; left: 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  font-size: var(--font-size-sm);
  color: var(--gb-fg3);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(69,133,136,0.08);
  color: var(--gb-fg);
  text-decoration: none;
}

.dropdown-item--danger:hover {
  background: rgba(204,36,29,0.1);
  color: var(--gb-red-l);
}

.dropdown-item-icon { font-size: 14px; line-height: 1; }

.dropdown-sep {
  height: 1px;
  background: var(--color-border-muted);
  margin: 4px 0;
}

.dropdown-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gb-bg4);
  padding: 6px 14px 2px;
}

/* --------------------------------------------------------------------------
   34. Tooltips
   -------------------------------------------------------------------------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gb-bg3);
  color: var(--gb-fg);
  font-size: var(--font-size-xs);
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: var(--z-tooltip);
  max-width: 220px;
  text-align: center;
  white-space: normal;
  box-shadow: var(--shadow-md);
}

[data-tooltip]:hover::after { opacity: 1; }
[data-tooltip-pos="right"]::after { left: auto; right: auto; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); bottom: auto; }
[data-tooltip-pos="left"]::after  { right: calc(100% + 6px); left: auto; top: 50%; transform: translateY(-50%); bottom: auto; }
[data-tooltip-pos="bottom"]::after { top: calc(100% + 6px); bottom: auto; }

/* --------------------------------------------------------------------------
   35. Progress / Gauge
   -------------------------------------------------------------------------- */
.progress-bar-wrap {
  height: 6px;
  background: var(--gb-bg2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--gb-blue);
  transition: width 0.4s ease;
}

.progress-bar--green  { background: var(--gb-green-l); }
.progress-bar--yellow { background: var(--gb-yellow-l); }
.progress-bar--orange { background: var(--gb-orange-l); }
.progress-bar--red    { background: var(--gb-red-l); }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

/* Stacked bar */
.stacked-bar {
  height: 8px;
  background: var(--gb-bg2);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
}

.stacked-bar-seg {
  height: 100%;
  transition: width 0.4s ease;
}

/* --------------------------------------------------------------------------
   36. Rule / Policy Builder UI
   -------------------------------------------------------------------------- */
.rule-condition {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gb-bg0);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--btn-radius);
  flex-wrap: wrap;
}

.rule-condition + .rule-condition {
  margin-top: 6px;
}

.rule-connector {
  font-size: var(--font-size-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gb-blue-l);
  background: rgba(69,133,136,0.12);
  border: 1px solid rgba(69,133,136,0.25);
  border-radius: var(--pill-radius);
  padding: 2px 8px;
  align-self: center;
  margin: 2px 0;
}

.rule-group {
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.rule-group-header {
  background: var(--gb-bg1);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg3);
}

.rule-group-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* --------------------------------------------------------------------------
   37. Timeline
   -------------------------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--gb-bg2);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -22px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gb-bg3);
  border: 2px solid var(--gb-bg0);
  z-index: 1;
}

.timeline-dot--green  { background: var(--gb-green-l); }
.timeline-dot--red    { background: var(--gb-red-l); }
.timeline-dot--yellow { background: var(--gb-yellow-l); }
.timeline-dot--blue   { background: var(--gb-blue-l); }

.timeline-time {
  font-size: var(--font-size-xs);
  color: var(--gb-bg4);
  margin-bottom: 3px;
}

.timeline-title {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gb-fg2);
}

.timeline-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 3px;
}

/* --------------------------------------------------------------------------
   38. Stat Comparison / Mini Table
   -------------------------------------------------------------------------- */
.stat-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border-muted);
  font-size: var(--font-size-sm);
  gap: 8px;
}

.stat-row:last-child { border-bottom: none; }

.stat-row-key {
  color: var(--gb-fg4);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-row-val {
  font-weight: 600;
  color: var(--gb-fg);
  font-variant-numeric: tabular-nums;
}

.stat-row-bar {
  width: 80px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   39. Utility / Helper Classes
   -------------------------------------------------------------------------- */
/* Text */
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-base{ font-size: var(--font-size-base); }
.text-md  { font-size: var(--font-size-md); }
.text-lg  { font-size: var(--font-size-lg); }
.text-xl  { font-size: var(--font-size-xl); }

.text-muted   { color: var(--color-text-muted); }
.text-subtle  { color: var(--color-text-subtle); }
.text-fg      { color: var(--gb-fg); }
.text-fg2     { color: var(--gb-fg2); }
.text-green   { color: var(--gb-green-l); }
.text-red     { color: var(--gb-red-l); }
.text-yellow  { color: var(--gb-yellow-l); }
.text-blue    { color: var(--gb-blue-l); }
.text-orange  { color: var(--gb-orange-l); }
.text-purple  { color: var(--gb-purple-l); }
.text-aqua    { color: var(--gb-aqua-l); }
.text-mono    { font-family: var(--font-mono); }

.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Spacing */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-0  { padding: 0; }
.p-8  { padding: 8px; }
.p-12 { padding: 12px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

/* Display */
.hidden        { display: none; }
.invisible     { visibility: hidden; }
.block         { display: block; }
.inline-block  { display: inline-block; }
.inline-flex   { display: inline-flex; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Border */
.border      { border: 1px solid var(--color-border); }
.border-top  { border-top: 1px solid var(--color-border); }
.border-bottom { border-bottom: 1px solid var(--color-border); }
.rounded     { border-radius: var(--btn-radius); }
.rounded-full{ border-radius: var(--pill-radius); }
.rounded-card{ border-radius: var(--card-radius); }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.select-none { user-select: none; }

/* --------------------------------------------------------------------------
   40. Responsive — Sidebar Collapse at Narrow Widths
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  :root { --sidebar-width: 220px; }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: var(--shadow-xl);
  }

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

  .main-content {
    margin-left: 0 !important;
  }

  .sidebar-mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13,15,16,0.65);
    z-index: calc(var(--z-sidebar) - 1);
    display: none;
  }
  .sidebar-mobile-backdrop.open { display: block; }

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

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-search { max-width: 200px; }
  .col-span-2, .col-span-3 { grid-column: span 1; }
  .wizard-steps { flex-direction: column; align-items: flex-start; }
  .wizard-step-line { display: none; }
  .page-content { padding: 16px; }
}

/* --------------------------------------------------------------------------
   41. Live Traffic Page — Stats Bar, Filters, Full Table
   -------------------------------------------------------------------------- */

/* Stats bar */
.live-stats-bar {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--gb-bg0-h);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 1rem;
  margin-bottom: .75rem;
  height: 48px;
  overflow: hidden;
  flex-wrap: nowrap;
}
.live-stat-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: 0 .9rem;
  border-right: 1px solid var(--color-border-muted);
  height: 100%;
  white-space: nowrap;
}
.live-stat-item:first-child { padding-left: 0; }
.live-stat-spacer { flex: 1; }
.live-stat-label {
  font-size: 11px;
  color: var(--gb-bg4);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}
.live-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--gb-fg);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
}
.live-stat-icon {
  display: flex;
  align-items: center;
  color: var(--gb-bg4);
  font-size: 15px;
}

/* Pulsing live indicator */
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gb-red-l);
  flex-shrink: 0;
}
.live-dot.pulse { animation: livePulse 1.4s ease-in-out infinite; }
@keyframes livePulse {
  0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(251,73,52,.6); }
  50%      { opacity: .7; box-shadow: 0 0 0 5px rgba(251,73,52,0); }
}
.live-indicator {
  position: relative;
  width: 14px; height: 14px;
  display: flex; align-items: center; justify-content: center;
}
.pulse-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--gb-green-l); position: relative; z-index: 1; }
.pulse-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--gb-green-l); opacity: 0;
  animation: pulseRing 1.6s ease-out infinite;
}
@keyframes pulseRing {
  0%   { transform: scale(.6); opacity: .8; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.filter-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--gb-bg4);
  white-space: nowrap;
}
.filter-actions { margin-left: auto; display: flex; gap: .4rem; }

/* card-flush removes horizontal padding from card-body */
.card-flush > .card-body { padding-left: 0; padding-right: 0; }

/* Full live table — 10 columns */
.live-header,
.live-row-full {
  display: grid;
  grid-template-columns: 72px 88px 132px 60px 56px 1fr 44px 130px 100px 50px;
  align-items: center;
  gap: 0;
}
.live-header {
  padding: .35rem 1rem;
  background: var(--gb-bg0-h);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--gb-bg3);
  border-bottom: 1px solid var(--gb-bg1);
  position: sticky;
  top: 0;
  z-index: 2;
}
.live-row-full {
  padding: .44rem 1rem;
  border-bottom: 1px solid #32302f;
  transition: background .1s;
  min-width: 0;
}
.live-row-full:hover { background: var(--gb-bg1); }
.live-row-full:last-child { border-bottom: none; }

/* Accent left border per action */
.live-row-full.live-action-block      { border-left: 2px solid #fb4934; }
.live-row-full.live-action-challenge  { border-left: 2px solid #fabd2f; }
.live-row-full.live-action-rate_limit { border-left: 2px solid #d3869b; }
.live-row-full.live-action-allow      { border-left: 2px solid #b8bb26; }

.live-reason {
  font-size: .72rem;
  color: var(--gb-bg4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: .5rem;
}
.live-site {
  font-size: .72rem;
  color: var(--gb-fg4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Feed container */
.live-feed-container {
  overflow-y: auto;
  overflow-x: auto;
}
.live-feed-full { max-height: calc(100vh - 260px); min-height: 200px; }
.live-feed-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 3rem 2rem;
  color: var(--gb-bg4);
  font-size: .88rem;
}

/* Live Traffic Feed (shared — 8 col dashboard widget) */
/* Shared grid: Time | Action | IP | Country | Method | Path | Risk | Actions */
.live-table-header,
.live-row {
  display: grid;
  grid-template-columns: 72px 88px 130px 58px 54px 1fr 44px 36px;
  align-items: center;
  gap: 0;
}

.live-table-header {
  padding: .35rem 1rem;
  background: var(--gb-bg0-h);
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--gb-bg3);
  border-bottom: 1px solid var(--gb-bg1);
  position: sticky;
  top: 0;
  z-index: 1;
}

.live-row {
  padding: .42rem 1rem;
  border-bottom: 1px solid #32302f;
  transition: background .1s;
  min-width: 0;
}
.live-row:hover { background: var(--gb-bg1); }
.live-row:last-child { border-bottom: none; }

/* Column cells */
.live-ts {
  font-family: var(--font-mono, 'Fira Code', monospace);
  font-size: .8rem;
  color: var(--gb-bg3);
  white-space: nowrap;
}
.live-action { display: flex; align-items: center; }
.live-action .badge {
  font-size: .7rem;
  padding: .15rem .4rem;
  border-radius: 3px;
  font-weight: 700;
  white-space: nowrap;
}
.live-ip {
  font-family: var(--font-mono, 'Fira Code', monospace);
  font-size: .8rem;
  color: var(--gb-fg4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: .5rem;
}
.live-country {
  font-size: .82rem;
  white-space: nowrap;
  overflow: hidden;
}
.live-method {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gb-blue-l);
  white-space: nowrap;
}
.live-path {
  font-family: var(--font-mono, 'Fira Code', monospace);
  font-size: .8rem;
  color: var(--gb-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: .5rem;
}
.live-score {
  font-size: .82rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.live-actions {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Left-border accent by action type */
.live-action-block   { border-left: 2px solid #fb4934; }
.live-action-challenge { border-left: 2px solid #fabd2f; }
.live-action-rate_limit { border-left: 2px solid #d3869b; }
.live-action-allow   { border-left: 2px solid #b8bb26; }

/* Slide-in animation for new rows */
@keyframes slideInRow {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   42. Print Styles
   -------------------------------------------------------------------------- */
@media print {
  .sidebar, .topbar, .topbar-actions, .btn, .dropdown { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: white; color: black; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}

/* --------------------------------------------------------------------------
   42. Focus Visible (Accessibility)
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--gb-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   43. Transition utility — reduce motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
