/* ZelCode — Gruvbox Dark Premium UI */

/* ============================================================
   FONTS & RESET
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; overflow-x: hidden; }

/* ============================================================
   GRUVBOX DARK VARIABLES
   ============================================================ */
:root {
  /* Backgrounds */
  --bg:         #282828;
  --bg-hard:    #1d2021;
  --bg-soft:    #32302f;
  --bg-1:       #3c3836;
  --bg-2:       #504945;
  --bg-3:       #665c54;
  --bg-4:       #7c6f64;

  /* Foregrounds */
  --fg:         #ebdbb2;
  --fg-1:       #d5c4a1;
  --fg-2:       #bdae93;
  --fg-3:       #a89984;
  --fg-4:       #928374;

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

  /* UI */
  --border:        #504945;
  --border-light:  #3c3836;
  --shadow:        rgba(0,0,0,0.4);
  --shadow-lg:     rgba(0,0,0,0.6);
  --glow-blue:     0 0 16px rgba(69,133,136,0.25);
  --glow-orange:   0 0 16px rgba(214,93,14,0.25);
  --glow-green:    0 0 16px rgba(152,151,26,0.20);

  --sidebar-w:     260px;
  --topbar-h:      60px;
  --radius:        8px;
  --radius-lg:     12px;
  --transition:    0.2s ease;

  /* Semantic aliases — used by module views */
  --bg-card:       var(--bg-soft);
  --bg-surface:    var(--bg-hard);
  --bg-hover:      var(--bg-1);
  --border-color:  var(--border);
  --text-primary:  var(--fg);
  --text-secondary:var(--fg-1);
  --text-muted:    var(--fg-3);
  --shadow-sm:     0 2px 6px rgba(0,0,0,0.35);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.45);
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Fira Sans', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-4); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; color: var(--fg); }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }
p  { color: var(--fg-1); }
a  { color: var(--blue-bright); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--yellow-bright); }
code, pre { font-family: 'Fira Code', monospace; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-hard);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
}

.sidebar-logo {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--orange), var(--red-bright));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-orange);
  flex-shrink: 0;
}

.sidebar-logo-icon svg { width: 20px; height: 20px; fill: white; }

.sidebar-logo-text { display: flex; flex-direction: column; }
.sidebar-logo-name {
  font-size: 1.05rem; font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.5px;
}
.sidebar-logo-sub {
  font-size: 0.65rem; font-weight: 400;
  color: var(--fg-4);
  letter-spacing: 1px;
  text-transform: uppercase;
}

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

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 0.65rem; font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 10px 20px 4px;
  display: block;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  color: var(--fg-3);
  font-size: 0.875rem; font-weight: 400;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--bg-1);
  color: var(--fg);
  border-left-color: var(--bg-3);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(214,93,14,0.15) 0%, rgba(214,93,14,0.03) 100%);
  color: var(--orange-bright);
  border-left-color: var(--orange);
  font-weight: 500;
}

.nav-link.active .nav-icon svg { color: var(--orange-bright); }

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

.nav-icon svg {
  width: 16px; height: 16px;
  stroke-width: 1.8;
}

.nav-badge {
  margin-left: auto;
  background: var(--red-bright);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-badge.success { background: var(--green); }
.nav-badge.warning { background: var(--yellow); color: var(--bg-hard); }
.nav-badge.info    { background: var(--blue); }

/* New Scan button */
.new-scan-btn {
  margin: 14px 16px 10px;
  background: linear-gradient(135deg, var(--orange), #bf4b05);
  color: white;
  padding: 9px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: var(--glow-orange);
  border: none;
  cursor: pointer;
  width: calc(100% - 32px);
  justify-content: center;
}
.new-scan-btn:hover {
  background: linear-gradient(135deg, var(--orange-bright), var(--orange));
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(214,93,14,0.4);
}
.new-scan-btn svg { width: 15px; height: 15px; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-footer-text {
  font-size: 0.65rem;
  color: var(--fg-4);
  text-align: center;
  letter-spacing: 0.5px;
}
.zelfire-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.62rem;
  color: var(--fg-4);
  margin-top: 6px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 90;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 8px 16px 8px 38px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: 'Fira Sans', sans-serif;
  transition: all var(--transition);
  outline: none;
}

.topbar-search input:focus {
  border-color: var(--blue);
  box-shadow: var(--glow-blue);
  background: var(--bg-2);
}

.topbar-search input::placeholder { color: var(--fg-4); }

.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-4);
  pointer-events: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
  max-height: 400px;
  overflow-y: auto;
}
.search-results.show { display: block; }

.search-result-item {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border-light);
  text-decoration: none;
  color: var(--fg);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-2); }
.search-result-type {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.topbar-spacer { flex: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-icon-btn {
  width: 36px; height: 36px;
  background: var(--bg-1);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-3);
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}
.topbar-icon-btn:hover { background: var(--bg-2); color: var(--fg); }
.topbar-icon-btn svg  { width: 16px; height: 16px; }

.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--red-bright);
  border-radius: 50%;
  border: 2px solid var(--bg-soft);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.topbar-user:hover { background: var(--bg-1); }

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--fg); line-height: 1.2; }
.user-role {
  font-size: 0.65rem;
  color: var(--orange-bright);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  display: none;
  z-index: 200;
}
.user-dropdown.show { display: block; }
.user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--fg-2);
  font-size: 0.85rem;
  transition: all var(--transition);
  border-bottom: 1px solid var(--border-light);
}
.user-dropdown a:last-child { border-bottom: none; }
.user-dropdown a:hover { background: var(--bg-2); color: var(--fg); }
.user-dropdown a svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  background: var(--bg);
}

.page-container {
  padding: 28px 32px;
  max-width: 1600px;
  overflow-x: hidden;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-header-left { flex: 1; min-width: 0; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--fg); }
.page-subtitle { font-size: 0.85rem; color: var(--fg-3); margin-top: 3px; }

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--fg-4);
  margin-bottom: 6px;
}
.breadcrumb a { color: var(--fg-3); }
.breadcrumb a:hover { color: var(--fg); }
.breadcrumb-sep { color: var(--fg-4); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-elevated {
  background: var(--bg-1);
  border-color: var(--border);
  box-shadow: 0 2px 12px var(--shadow);
}

.card-glow-blue  { box-shadow: var(--glow-blue); }
.card-glow-orange{ box-shadow: var(--glow-orange); }
.card-glow-green { box-shadow: var(--glow-green); }

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

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

.card-title svg { width: 15px; height: 15px; }

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-hard);
}

/* ============================================================
   METRIC CARDS
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.metric-card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--shadow);
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}
.metric-card.critical::before { background: var(--red-bright); }
.metric-card.high::before     { background: var(--orange); }
.metric-card.medium::before   { background: var(--yellow); }
.metric-card.low::before      { background: var(--green); }
.metric-card.info::before     { background: var(--blue); }
.metric-card.purple::before   { background: var(--purple); }
.metric-card.aqua::before     { background: var(--aqua); }

.metric-label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}
.metric-card.critical .metric-value { color: var(--red-bright); }
.metric-card.high .metric-value     { color: var(--orange-bright); }
.metric-card.medium .metric-value   { color: var(--yellow-bright); }
.metric-card.low .metric-value      { color: var(--green-bright); }
.metric-card.info .metric-value     { color: var(--blue-bright); }
.metric-card.purple .metric-value   { color: var(--purple-bright); }
.metric-card.aqua .metric-value     { color: var(--aqua-bright); }

.metric-sub {
  font-size: 0.75rem;
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.metric-trend-up   { color: var(--green-bright); }
.metric-trend-down { color: var(--red-bright); }

.metric-icon {
  position: absolute;
  top: 16px; right: 16px;
  opacity: 0.15;
}
.metric-icon svg { width: 36px; height: 36px; }

/* ============================================================
   CHARTS GRID
   ============================================================ */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.chart-col-4  { grid-column: span 4; }
.chart-col-6  { grid-column: span 6; }
.chart-col-8  { grid-column: span 8; }
.chart-col-12 { grid-column: span 12; }

@media (max-width: 1200px) {
  .chart-col-4, .chart-col-6 { grid-column: span 6; }
}
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: 1fr; }
  .chart-col-4, .chart-col-6, .chart-col-8, .chart-col-12 { grid-column: span 1; }
}

.chart-wrapper {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  min-width: 0;
  overflow: hidden;
}

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

.chart-wrapper-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
}

.chart-canvas { width: 100% !important; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-toolbar {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-1); }

tbody td {
  padding: 11px 16px;
  color: var(--fg-1);
  vertical-align: middle;
}

.table-actions {
  display: flex;
  gap: 6px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-critical { background: rgba(204,36,29,0.2);   color: var(--red-bright);    border: 1px solid rgba(204,36,29,0.3); }
.badge-high     { background: rgba(214,93,14,0.2);   color: var(--orange-bright); border: 1px solid rgba(214,93,14,0.3); }
.badge-medium   { background: rgba(215,153,33,0.2);  color: var(--yellow-bright); border: 1px solid rgba(215,153,33,0.3); }
.badge-low      { background: rgba(152,151,26,0.2);  color: var(--green-bright);  border: 1px solid rgba(152,151,26,0.3); }
.badge-info     { background: rgba(69,133,136,0.2);  color: var(--blue-bright);   border: 1px solid rgba(69,133,136,0.3); }
.badge-success  { background: rgba(152,151,26,0.2);  color: var(--green-bright);  border: 1px solid rgba(152,151,26,0.3); }
.badge-warning  { background: rgba(215,153,33,0.2);  color: var(--yellow-bright); border: 1px solid rgba(215,153,33,0.3); }
.badge-muted    { background: rgba(80,73,69,0.5);    color: var(--fg-4);          border: 1px solid var(--border); }
.badge-purple   { background: rgba(177,98,134,0.2);  color: var(--purple-bright); border: 1px solid rgba(177,98,134,0.3); }
.badge-aqua     { background: rgba(104,157,106,0.2); color: var(--aqua-bright);   border: 1px solid rgba(104,157,106,0.3); }
.badge-blue     { background: rgba(69,133,136,0.2);  color: var(--blue-bright);   border: 1px solid rgba(69,133,136,0.3); }

/* Provider badges */
.badge-github    { background: rgba(36,41,47,0.8);  color: #e6edf3; border: 1px solid #30363d; }
.badge-gitlab    { background: rgba(252,109,38,0.2);color: #fc6d26; border: 1px solid rgba(252,109,38,0.3); }
.badge-bitbucket { background: rgba(0,82,204,0.2);  color: #2684ff; border: 1px solid rgba(0,82,204,0.3); }
.badge-azure     { background: rgba(0,120,212,0.2); color: #0078d4; border: 1px solid rgba(0,120,212,0.3); }
.badge-jenkins   { background: rgba(249,166,40,0.2);color: #f9a628; border: 1px solid rgba(249,166,40,0.3); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: 'Fira Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
}
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--orange), #bf4b05);
  color: white;
  border-color: var(--orange);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--orange-bright), var(--orange));
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(214,93,14,0.35);
}

.btn-secondary {
  background: var(--bg-1);
  color: var(--fg-2);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-2); color: var(--fg); }

.btn-danger {
  background: rgba(204,36,29,0.15);
  color: var(--red-bright);
  border-color: rgba(204,36,29,0.3);
}
.btn-danger:hover {
  background: rgba(204,36,29,0.25);
  color: var(--red-bright);
}

.btn-success {
  background: rgba(152,151,26,0.15);
  color: var(--green-bright);
  border-color: rgba(152,151,26,0.3);
}
.btn-success:hover { background: rgba(152,151,26,0.25); }

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

.btn-xs { padding: 3px 8px; font-size: 0.72rem; white-space: nowrap; }
.btn-xs svg { width: 11px; height: 11px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
  background: var(--bg-1);
  color: var(--fg-3);
  border-color: var(--border-light);
}
.btn-icon:hover { background: var(--bg-2); color: var(--fg); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red-bright); margin-left: 2px; }

.form-control {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-family: 'Fira Sans', sans-serif;
  font-size: 0.875rem;
  transition: all var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(69,133,136,0.15);
}
.form-control::placeholder { color: var(--fg-4); }
.form-control:disabled { opacity: 0.6; cursor: not-allowed; }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control    { cursor: pointer; }

.form-hint { font-size: 0.75rem; color: var(--fg-4); margin-top: 4px; }
.form-error { font-size: 0.75rem; color: var(--red-bright); margin-top: 4px; }

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

/* Toggle */
.toggle-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle {
  position: relative;
  width: 40px; height: 22px;
  display: inline-block;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: 22px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: var(--fg);
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab-link {
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-4);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-link:hover { color: var(--fg); border-bottom-color: var(--border); }
.tab-link.active { color: var(--orange-bright); border-bottom-color: var(--orange); }

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

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
  height: 6px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.progress-bar.critical { background: var(--red-bright); }
.progress-bar.high     { background: var(--orange-bright); }
.progress-bar.success  { background: var(--green-bright); }
.progress-bar.blue     { background: var(--blue-bright); }
.progress-bar.gradient {
  background: linear-gradient(90deg, var(--red-bright), var(--yellow-bright), var(--green-bright));
}

/* ============================================================
   CODE BLOCKS
   ============================================================ */
.code-block {
  background: var(--bg-hard);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  color: var(--fg-1);
  overflow-x: auto;
  line-height: 1.6;
}

.code-line { display: block; }
.code-line.highlight {
  background: rgba(204,36,29,0.2);
  border-left: 3px solid var(--red-bright);
  margin: 0 -16px;
  padding: 0 16px;
}

.code-highlight-good {
  background: rgba(152,151,26,0.2);
  border-left: 3px solid var(--green-bright);
  margin: 0 -16px;
  padding: 0 16px;
}

/* ============================================================
   NOTIFICATION DRAWER
   ============================================================ */
.notif-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.notif-overlay.show { opacity: 1; pointer-events: all; }

.notif-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  z-index: 160;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.notif-drawer.show { transform: translateX(0); }

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

.notif-drawer-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.notif-drawer-body { flex: 1; overflow-y: auto; }

.notif-item {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.notif-item:hover  { background: var(--bg-1); }
.notif-item.unread { background: rgba(69,133,136,0.05); }

.notif-dot-type {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.notif-dot-type.critical { background: var(--red-bright); }
.notif-dot-type.warning  { background: var(--yellow-bright); }
.notif-dot-type.info     { background: var(--blue-bright); }
.notif-dot-type.success  { background: var(--green-bright); }

.notif-content { flex: 1; }
.notif-title   { font-size: 0.85rem; font-weight: 600; color: var(--fg); }
.notif-body    { font-size: 0.78rem; color: var(--fg-3); margin-top: 2px; }
.notif-time    { font-size: 0.7rem; color: var(--fg-4); margin-top: 4px; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash-messages {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 400px;
}

.flash {
  padding: 13px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
  border: 1px solid;
  backdrop-filter: blur(0);
  min-width: 280px;
}
.flash svg { width: 16px; height: 16px; flex-shrink: 0; }

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

.flash-success { background: #2d3a1e; color: var(--green-bright); border-color: rgba(152,151,26,0.5); }
.flash-error   { background: #3a1e1e; color: var(--red-bright);   border-color: rgba(204,36,29,0.5); }
.flash-info    { background: #1e2d3a; color: var(--blue-bright);  border-color: rgba(69,133,136,0.5); }
.flash-warning { background: #3a2e1a; color: var(--yellow-bright);border-color: rgba(215,153,33,0.5); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg-hard);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-image:
    radial-gradient(ellipse 600px 400px at 60% 30%, rgba(214,93,14,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 20% 80%, rgba(69,133,136,0.07) 0%, transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}

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

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--orange), var(--red-bright));
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--glow-orange);
}
.login-logo svg { width: 28px; height: 28px; fill: white; }

.login-app-name { font-size: 1.5rem; font-weight: 700; }
.login-tagline  { font-size: 0.78rem; color: var(--fg-4); margin-top: 4px; }

.login-body   { padding: 28px 32px 20px; }
.login-footer { padding: 16px 32px; background: var(--bg-1); text-align: center; font-size: 0.78rem; color: var(--fg-4); }

/* ============================================================
   FILTER SIDEBAR (for findings, etc.)
   ============================================================ */
.filter-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.filter-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.filter-main { flex: 1; min-width: 0; }

.filter-group { margin-bottom: 18px; }
.filter-group-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--fg-4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.83rem;
  color: var(--fg-2);
}
.filter-option:hover { background: var(--bg-1); color: var(--fg); }
.filter-option input[type="checkbox"] { accent-color: var(--orange); }
.filter-count {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--fg-4);
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
}

/* ============================================================
   WIZARD
   ============================================================ */
.wizard {
  max-width: 800px;
  margin: 0 auto;
}

.wizard-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.wizard-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--fg-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: all var(--transition);
}
.wizard-step.active .wizard-step-num {
  background: var(--orange);
  color: white;
  box-shadow: var(--glow-orange);
}
.wizard-step.done .wizard-step-num {
  background: var(--green);
  color: white;
}

.wizard-step-label {
  font-size: 0.78rem;
  color: var(--fg-4);
  white-space: nowrap;
}
.wizard-step.active .wizard-step-label { color: var(--fg); font-weight: 600; }

.wizard-step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

/* ============================================================
   ATTACK PATH DIAGRAM
   ============================================================ */
.attack-path-diagram {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 24px;
  overflow-x: auto;
}

.ap-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 110px;
}

.ap-node-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid;
  position: relative;
}
.ap-node-circle.source { background: rgba(104,157,106,0.2); border-color: var(--aqua); }
.ap-node-circle.processing { background: rgba(215,153,33,0.2); border-color: var(--yellow); }
.ap-node-circle.sink   { background: rgba(204,36,29,0.2); border-color: var(--red-bright); }
.ap-node-circle svg    { width: 20px; height: 20px; }

.ap-node-label {
  font-size: 0.72rem;
  color: var(--fg-2);
  text-align: center;
  max-width: 110px;
  line-height: 1.3;
}

.ap-arrow {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--red-bright);
  font-size: 1.5rem;
  position: relative;
}
.ap-arrow::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--yellow), var(--red-bright));
}
.ap-arrow-head {
  position: relative;
  z-index: 1;
  color: var(--red-bright);
}

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  min-width: 100px;
  text-align: center;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.72rem; color: var(--fg-4); font-weight: 500; text-transform: uppercase; }

/* ============================================================
   ZELSCODE SCORE RING
   ============================================================ */
.score-ring {
  position: relative;
  width: 80px; height: 80px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.score-ring svg { position: absolute; top: 0; left: 0; transform: rotate(-90deg); }
.score-ring-value { font-size: 1.2rem; font-weight: 700; z-index: 1; }
.score-ring.high    .score-ring-value { color: var(--green-bright); }
.score-ring.medium  .score-ring-value { color: var(--yellow-bright); }
.score-ring.low     .score-ring-value { color: var(--red-bright); }

/* ============================================================
   RISK HEATMAP
   ============================================================ */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}
.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition);
  color: white;
}
.heatmap-cell:hover { transform: scale(1.1); }
.heatmap-cell.risk-0 { background: rgba(152,151,26,0.2); color: var(--green-bright); }
.heatmap-cell.risk-1 { background: rgba(152,151,26,0.4); }
.heatmap-cell.risk-2 { background: rgba(215,153,33,0.5); color: var(--bg-hard); }
.heatmap-cell.risk-3 { background: rgba(214,93,14,0.6); }
.heatmap-cell.risk-4 { background: rgba(204,36,29,0.7); }
.heatmap-cell.risk-5 { background: var(--red-bright); }

/* ============================================================
   AINA PANEL
   ============================================================ */
.aina-panel {
  background: linear-gradient(135deg, rgba(177,98,134,0.1), rgba(69,133,136,0.1));
  border: 1px solid rgba(177,98,134,0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.aina-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.aina-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--purple), var(--blue));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(177,98,134,0.4);
}
.aina-icon svg { width: 16px; height: 16px; }

.aina-badge {
  background: linear-gradient(135deg, var(--purple), var(--blue));
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.aina-title { font-size: 0.9rem; font-weight: 600; }
.aina-demo-badge {
  background: rgba(215,153,33,0.2);
  color: var(--yellow-bright);
  border: 1px solid rgba(215,153,33,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px 0;
}

.chat-message {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.chat-avatar.user   { background: var(--blue); }
.chat-avatar.aina   { background: linear-gradient(135deg, var(--purple), var(--blue)); }

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.6;
}
.chat-bubble.user {
  background: var(--bg-2);
  color: var(--fg);
  margin-left: auto;
}
.chat-bubble.aina {
  background: rgba(177,98,134,0.15);
  border: 1px solid rgba(177,98,134,0.2);
  color: var(--fg-1);
}
.chat-bubble.aina p:last-child { margin-bottom: 0; }
.chat-bubble.aina ul, .chat-bubble.aina ol { color: var(--fg-2); }
.chat-code-block {
  background: rgba(29,32,33,0.85);
  border: 1px solid rgba(80,73,69,0.6);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0;
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  color: var(--fg-2);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.55;
}

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

.text-muted  { color: var(--fg-4); }
.text-sm     { font-size: 0.8rem; }
.text-xs     { font-size: 0.72rem; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-red    { color: var(--red-bright); }
.text-green  { color: var(--green-bright); }
.text-yellow { color: var(--yellow-bright); }
.text-blue   { color: var(--blue-bright); }
.text-orange { color: var(--orange-bright); }
.text-purple { color: var(--purple-bright); }
.text-aqua   { color: var(--aqua-bright); }

.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.flex-gap-sm { gap: 8px; }
.flex-gap    { gap: 14px; }
.flex-gap-lg { gap: 24px; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

.mb-0  { margin-bottom: 0; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.p-0  { padding: 0; }
.fw-6 { font-weight: 600; }
.fw-7 { font-weight: 700; }

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

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--fg-4);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3  { color: var(--fg-2); margin-bottom: 8px; }

.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-hard);
  color: var(--fg);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  border: 1px solid var(--border);
  z-index: 999;
}
.tooltip:hover::after { opacity: 1; }

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--bg-3);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* KEV badge */
.kev-badge {
  background: linear-gradient(135deg, var(--red-bright), var(--orange));
  color: white;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

/* Module chip */
.module-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--fg-3);
}
.module-chip.active {
  background: rgba(214,93,14,0.15);
  border-color: rgba(214,93,14,0.3);
  color: var(--orange-bright);
}

/* Integration card */
.integration-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--transition);
}
.integration-card:hover { border-color: var(--border); box-shadow: 0 4px 16px var(--shadow); }
.integration-logo { font-size: 2rem; }
.integration-name { font-size: 0.95rem; font-weight: 600; }
.integration-desc { font-size: 0.78rem; color: var(--fg-3); }

/* Dashboard date filter */
.date-filter {
  display: flex;
  gap: 4px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}
.date-filter-btn {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--fg-3);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  transition: all var(--transition);
}
.date-filter-btn.active {
  background: var(--bg-3);
  color: var(--fg);
}
.date-filter-btn:hover { color: var(--fg); }

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); width: 260px; }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; }
  .main-content { margin-left: 0; }
  .page-container { padding: 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filter-layout { flex-direction: column; }
  .filter-sidebar { width: 100%; }
}
