/* ============================================================
   ZelZero-Trust — Enterprise Zero Trust Security Platform
   CSS Design System — Gruvbox Dark Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fira+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ============================================================
   1. CSS CUSTOM PROPERTIES — GRUVBOX DARK PALETTE
   ============================================================ */

:root {
  /* Background tones */
  --bg:        #282828;
  --bg2:       #3c3836;
  --bg3:       #504945;
  --bg4:       #665c54;

  /* Foreground tones */
  --fg:        #ebdbb2;
  --fg2:       #d5c4a1;
  --fg3:       #bdae93;
  --fg4:       #a89984;

  /* Red */
  --red:       #cc241d;
  --red-br:    #fb4934;

  /* Green */
  --green:     #98971a;
  --green-br:  #b8bb26;

  /* Yellow */
  --yellow:    #d79921;
  --yellow-br: #fabd2f;

  /* Blue */
  --blue:      #458588;
  --blue-br:   #83a598;

  /* Purple */
  --purple:    #b16286;
  --purple-br: #d3869b;

  /* Aqua */
  --aqua:      #689d6a;
  --aqua-br:   #8ec07c;

  /* Orange */
  --orange:    #d65d0e;
  --orange-br: #fe8019;

  /* Shadows */
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.45);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.55);

  /* Radii */
  --radius-sm:  4px;
  --radius:     6px;
  --radius-md:  8px;
  --radius-lg:  10px;
  --radius-xl:  12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition:      0.15s ease;
  --transition-md:   0.2s ease;
  --transition-lg:   0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-sans: 'Fira Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ============================================================
   2. GLOBAL RESET + BASE
   ============================================================ */

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

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

a {
  color: var(--blue-br);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover { color: var(--blue); }

ul, ol { list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button { cursor: pointer; border: none; background: none; }

::selection {
  background: rgba(215, 153, 33, 0.35);
  color: var(--yellow-br);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--fg);
}

p { color: var(--fg2); }

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

/* ============================================================
   3. CUSTOM SCROLLBAR
   ============================================================ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg4); }
::-webkit-scrollbar-corner { background: var(--bg); }

/* ============================================================
   4. LAYOUT — APP SHELL
   ============================================================ */

.app-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ============================================================
   5. SIDEBAR
   ============================================================ */

.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--bg3);
  transition: width var(--transition-lg), min-width var(--transition-lg);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

/* Logo / Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--bg3);
  min-height: 60px;
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--red) 0%, var(--orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(204,36,29,0.4);
}

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

.sidebar-brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sidebar-brand-version {
  font-size: 10px;
  font-weight: 600;
  color: var(--fg4);
  background: var(--bg3);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  display: inline-block;
  margin-top: 3px;
  width: fit-content;
  letter-spacing: 0.5px;
}

.sidebar.collapsed .sidebar-brand-text { display: none; }

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

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 16px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-lg), max-height var(--transition-lg);
}

.sidebar.collapsed .sidebar-section-title {
  opacity: 0;
  height: 4px;
  padding: 2px 0;
  pointer-events: none;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  color: var(--fg3);
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
  user-select: none;
}

.nav-link:hover {
  background: var(--bg3);
  color: var(--fg);
  border-left-color: rgba(204,36,29,0.5);
}

.nav-link.active {
  background: rgba(80,73,69,0.8);
  color: var(--fg);
  border-left-color: var(--red);
  font-weight: 600;
}

.nav-link.active .nav-icon { color: var(--red-br); }

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: color var(--transition);
}

.nav-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-lg), width var(--transition-lg);
}

.sidebar.collapsed .nav-text { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-arrow { opacity: 0; width: 0; overflow: hidden; }

.nav-arrow {
  font-size: 10px;
  color: var(--fg4);
  transition: transform 0.25s, opacity var(--transition-lg);
  flex-shrink: 0;
}

.nav-item.open > .nav-link .nav-arrow { transform: rotate(90deg); }

/* Submenu */
.nav-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(0,0,0,0.15);
}

.nav-item.open > .nav-submenu { max-height: 700px; }

.nav-submenu .nav-link {
  padding-left: 48px;
  font-size: 12.5px;
  color: var(--fg4);
  border-left-color: transparent;
}

.nav-submenu .nav-link:hover {
  color: var(--fg);
  background: rgba(80,73,69,0.5);
  border-left-color: var(--bg4);
}

.nav-submenu .nav-link.active {
  color: var(--blue-br);
  background: rgba(69,133,136,0.1);
  border-left-color: var(--blue);
}

/* Collapsed sidebar tooltips */
.sidebar.collapsed .nav-link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 0 10px 21px;
  border-left: none;
  gap: 0;
}

.nav-tooltip {
  position: absolute;
  left: 68px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg3);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 999;
  border: 1px solid var(--bg4);
  box-shadow: var(--shadow-md);
}

.nav-tooltip::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--bg4);
  border-left: none;
}

.sidebar.collapsed .nav-link:hover .nav-tooltip { opacity: 1; }

/* Sidebar badge */
.nav-badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-submenu { max-height: 0 !important; overflow: hidden; }

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

.sidebar-collapse-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  color: var(--fg4);
  font-size: 12px;
  border-radius: var(--radius);
  transition: all var(--transition);
  justify-content: center;
}

.sidebar-collapse-btn:hover {
  background: var(--bg3);
  color: var(--fg);
}

.sidebar.collapsed .sidebar-collapse-btn .collapse-text { display: none; }

/* ============================================================
   6. MAIN CONTENT
   ============================================================ */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ============================================================
   7. TOPNAV
   ============================================================ */

.topnav {
  height: 60px;
  background: var(--bg2);
  border-bottom: 1px solid var(--bg3);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.topnav-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg4);
  white-space: nowrap;
}

.topnav-breadcrumb .bc-item { color: var(--fg3); transition: color var(--transition); }
.topnav-breadcrumb .bc-item:hover { color: var(--fg); }
.topnav-breadcrumb .bc-item.active { color: var(--fg); font-weight: 600; }
.topnav-breadcrumb .bc-sep { color: var(--bg4); font-size: 11px; }

/* Global search */
.topnav-search {
  flex: 0 1 380px;
  position: relative;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--fg4);
  font-size: 13px;
  pointer-events: none;
  transition: color var(--transition);
}

.search-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--bg4);
  border-radius: var(--radius-full);
  padding: 7px 40px 7px 36px;
  font-size: 13px;
  color: var(--fg);
  transition: all var(--transition);
  outline: none;
}

.search-input::placeholder { color: var(--fg4); }

.search-input:focus {
  border-color: var(--blue);
  background: var(--bg2);
  box-shadow: 0 0 0 3px rgba(69,133,136,0.15);
  width: 100%;
}

.search-input:focus + .search-icon,
.search-input-wrap:focus-within .search-icon { color: var(--blue-br); }

.search-shortcut {
  position: absolute;
  right: 10px;
  background: var(--bg4);
  color: var(--fg4);
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  pointer-events: none;
  font-family: var(--font-mono);
}

/* Topnav right */
.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg3);
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg3);
  color: var(--fg);
}

.notif-bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg2);
  line-height: 1;
}

.topnav-divider {
  width: 1px;
  height: 24px;
  background: var(--bg3);
  margin: 0 4px;
}

/* Profile button */
.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.profile-btn:hover { background: var(--bg3); }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(69,133,136,0.3);
}

.profile-info { display: flex; flex-direction: column; }
.profile-name { font-size: 13px; font-weight: 600; color: var(--fg); line-height: 1.2; }
.profile-role { font-size: 11px; color: var(--fg4); }

/* ============================================================
   8. PAGE CONTENT
   ============================================================ */

.page-content {
  flex: 1;
  padding: 28px;
  background: var(--bg);
}

/* ============================================================
   9. PAGE ELEMENTS
   ============================================================ */

.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-header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--fg3);
  margin-top: 4px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg4);
  margin-bottom: 8px;
}

.breadcrumb-sep { color: var(--bg4); }
.breadcrumb a:hover { color: var(--fg); }

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg3);
}

.sticky-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 20;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg3);
  margin-bottom: 20px;
}

/* ============================================================
   10. CARDS
   ============================================================ */

.card {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg3);
  padding: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--bg4);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
}

.card-subtitle {
  font-size: 12px;
  color: var(--fg4);
  margin-top: 2px;
}

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

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

/* ============================================================
   11. STAT CARDS
   ============================================================ */

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  cursor: default;
  transition: all var(--transition-md);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-color, var(--blue));
  opacity: 0.7;
}

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

.stat-card-left { flex: 1; min-width: 0; }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
}

.stat-trend.up { color: var(--green-br); }
.stat-trend.down { color: var(--red-br); }
.stat-trend.neutral { color: var(--fg4); }

.stat-trend-label { color: var(--fg4); font-weight: 400; }

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  opacity: 0.9;
}

/* Stat color variants */
.stat-red   { --accent-color: var(--red-br); }
.stat-red .stat-icon-wrap   { background: rgba(204,36,29,0.2); color: var(--red-br); }
.stat-red .stat-value       { color: var(--red-br); }

.stat-green { --accent-color: var(--green-br); }
.stat-green .stat-icon-wrap { background: rgba(152,151,26,0.2); color: var(--green-br); }
.stat-green .stat-value     { color: var(--green-br); }

.stat-blue  { --accent-color: var(--blue-br); }
.stat-blue .stat-icon-wrap  { background: rgba(69,133,136,0.2); color: var(--blue-br); }
.stat-blue .stat-value      { color: var(--blue-br); }

.stat-yellow { --accent-color: var(--yellow-br); }
.stat-yellow .stat-icon-wrap { background: rgba(215,153,33,0.2); color: var(--yellow-br); }
.stat-yellow .stat-value     { color: var(--yellow-br); }

.stat-purple { --accent-color: var(--purple-br); }
.stat-purple .stat-icon-wrap { background: rgba(177,98,134,0.2); color: var(--purple-br); }
.stat-purple .stat-value     { color: var(--purple-br); }

.stat-orange { --accent-color: var(--orange-br); }
.stat-orange .stat-icon-wrap { background: rgba(214,93,14,0.2); color: var(--orange-br); }
.stat-orange .stat-value     { color: var(--orange-br); }

.stat-aqua  { --accent-color: var(--aqua-br); }
.stat-aqua .stat-icon-wrap  { background: rgba(104,157,106,0.2); color: var(--aqua-br); }
.stat-aqua .stat-value      { color: var(--aqua-br); }

/* ============================================================
   12. BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  font-family: var(--font-sans);
}

.btn:disabled, .btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary   { background: var(--red); color: #fff; border-color: var(--red); }
.btn-primary:hover { background: var(--red-br); border-color: var(--red-br); box-shadow: 0 0 12px rgba(251,73,52,0.3); }

.btn-secondary { background: var(--bg3); color: var(--fg); border-color: var(--bg4); }
.btn-secondary:hover { background: var(--bg4); color: var(--fg); }

.btn-success   { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover { background: var(--green-br); border-color: var(--green-br); }

.btn-warning   { background: var(--yellow); color: var(--bg); border-color: var(--yellow); }
.btn-warning:hover { background: var(--yellow-br); border-color: var(--yellow-br); }

.btn-danger    { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: var(--red-br); border-color: var(--red-br); }

.btn-info      { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-info:hover { background: var(--blue-br); border-color: var(--blue-br); color: var(--bg); }

.btn-ghost     { background: transparent; color: var(--fg); border-color: var(--bg3); }
.btn-ghost:hover { background: var(--bg3); border-color: var(--bg4); }

.btn-outline-primary { background: transparent; color: var(--red); border-color: var(--red); }
.btn-outline-primary:hover { background: rgba(204,36,29,0.1); }

.btn-outline-blue { background: transparent; color: var(--blue-br); border-color: var(--blue); }
.btn-outline-blue:hover { background: rgba(69,133,136,0.1); }

.btn-sm  { padding: 5px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; }

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
}

.btn-icon-sm { width: 28px; height: 28px; border-radius: var(--radius-sm); }

.btn-icon-lg {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
}

/* Loading spinner on button */
.btn.loading { pointer-events: none; }
.btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============================================================
   13. BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-red,    .badge-danger   { background: rgba(204,36,29,0.2);  color: var(--red-br);    border: 1px solid rgba(204,36,29,0.4); }
.badge-green,  .badge-success  { background: rgba(152,151,26,0.2); color: var(--green-br);  border: 1px solid rgba(152,151,26,0.4); }
.badge-yellow, .badge-warning  { background: rgba(215,153,33,0.2); color: var(--yellow-br); border: 1px solid rgba(215,153,33,0.4); }
.badge-blue,   .badge-info     { background: rgba(69,133,136,0.2); color: var(--blue-br);   border: 1px solid rgba(69,133,136,0.4); }
.badge-purple  { background: rgba(177,98,134,0.2); color: var(--purple-br); border: 1px solid rgba(177,98,134,0.4); }
.badge-orange  { background: rgba(214,93,14,0.2);  color: var(--orange-br); border: 1px solid rgba(214,93,14,0.4); }
.badge-aqua    { background: rgba(104,157,106,0.2);color: var(--aqua-br);   border: 1px solid rgba(104,157,106,0.4); }
.badge-gray, .badge-muted { background: var(--bg3); color: var(--fg3); border: 1px solid var(--bg4); }

/* ============================================================
   14. RISK BADGES
   ============================================================ */

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.risk-critical { background: rgba(251,73,52,0.2);  color: #fb4934;          border: 1px solid rgba(251,73,52,0.4); }
.risk-high     { background: rgba(254,128,25,0.2); color: var(--orange-br); border: 1px solid rgba(214,93,14,0.4); }
.risk-medium   { background: rgba(250,189,47,0.2); color: var(--yellow-br); border: 1px solid rgba(215,153,33,0.4); }
.risk-low      { background: rgba(184,187,38,0.2); color: var(--green-br);  border: 1px solid rgba(152,151,26,0.4); }
.risk-none     { background: var(--bg3);           color: var(--fg4);       border: 1px solid var(--bg4); }

/* ============================================================
   15. STATUS DOTS & PILLS
   ============================================================ */

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

.status-dot-green  { background: var(--green-br);  box-shadow: 0 0 6px rgba(184,187,38,0.5); }
.status-dot-red    { background: var(--red-br);    box-shadow: 0 0 6px rgba(251,73,52,0.5); }
.status-dot-yellow { background: var(--yellow-br); box-shadow: 0 0 6px rgba(250,189,47,0.5); }
.status-dot-blue   { background: var(--blue-br);   box-shadow: 0 0 6px rgba(131,165,152,0.4); }
.status-dot-orange { background: var(--orange-br); box-shadow: 0 0 6px rgba(254,128,25,0.4); }
.status-dot-gray   { background: var(--fg4); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.status-pill-online  { background: rgba(184,187,38,0.15); color: var(--green-br);  border: 1px solid rgba(184,187,38,0.3); }
.status-pill-offline { background: rgba(251,73,52,0.15);  color: var(--red-br);    border: 1px solid rgba(251,73,52,0.3); }
.status-pill-pending { background: rgba(250,189,47,0.15); color: var(--yellow-br); border: 1px solid rgba(250,189,47,0.3); }
.status-pill-unknown { background: var(--bg3);            color: var(--fg4);       border: 1px solid var(--bg4); }

/* ============================================================
   16. TABLES
   ============================================================ */

.table-responsive { overflow-x: auto; border-radius: var(--radius-lg); }

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

.data-table th {
  background: var(--bg3);
  color: var(--fg2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 2px solid var(--bg4);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th:first-child { border-radius: var(--radius-md) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius-md) 0 0; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg3);
  color: var(--fg);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(80,73,69,0.4); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--transition-fast); }

.data-table td.text-muted { color: var(--fg4); }
.data-table td.text-mono  { font-family: var(--font-mono); font-size: 12px; }

.table-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--blue-br); }
.sortable.asc::after  { content: ' ↑'; color: var(--blue-br); }
.sortable.desc::after { content: ' ↓'; color: var(--blue-br); }

.scroll-table-container {
  overflow: auto;
  max-height: 500px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--bg3);
}

.scroll-table-container .data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

/* ============================================================
   17. FORMS
   ============================================================ */

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg2);
  margin-bottom: 6px;
}

.form-label .required { color: var(--red-br); margin-left: 3px; }

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--bg4);
  color: var(--fg);
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(69,133,136,0.2);
}

.form-control::placeholder { color: var(--fg4); }

.form-control:read-only {
  background: var(--bg2);
  color: var(--fg3);
  cursor: default;
}

.form-control.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(204,36,29,0.15);
}

.form-control.is-valid {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(152,151,26,0.15);
}

.form-hint {
  font-size: 12px;
  color: var(--fg4);
  margin-top: 4px;
  display: block;
}

.form-error {
  font-size: 12px;
  color: var(--red-br);
  margin-top: 4px;
  display: block;
}

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

.form-section { margin-bottom: 32px; }

.form-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bg3);
}

select.form-control {
  cursor: pointer;
  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='%23a89984' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select.form-control option {
  background: var(--bg2);
  color: var(--fg);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 8px;
}

.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.form-check-label {
  font-size: 13px;
  color: var(--fg2);
  cursor: pointer;
}

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

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

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

.input-group-addon {
  background: var(--bg3);
  border: 1px solid var(--bg4);
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--fg4);
  font-size: 13px;
  white-space: nowrap;
}

/* ============================================================
   18. TOGGLE SWITCH
   ============================================================ */

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg4);
  border-radius: 24px;
  transition: background 0.3s;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input:checked + .toggle-slider { background: var(--green); }
input:checked + .toggle-slider::before { transform: translateX(20px); }
input:disabled + .toggle-slider { opacity: 0.4; cursor: not-allowed; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-label-text {
  font-size: 13px;
  color: var(--fg2);
}

/* ============================================================
   19. TABS
   ============================================================ */

.tabs { }

.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--bg3);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-list::-webkit-scrollbar { height: 0; }

.tab-item {
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg4);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.tab-item.active {
  color: var(--blue-br);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

/* Pill tabs variant */
.tab-list.tab-pills {
  border-bottom: none;
  gap: 4px;
  background: var(--bg2);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.tab-list.tab-pills .tab-item {
  border: none;
  border-radius: var(--radius);
  margin-bottom: 0;
  padding: 7px 14px;
}

.tab-list.tab-pills .tab-item.active {
  background: var(--bg3);
  color: var(--fg);
  border: none;
}

/* ============================================================
   20. MODALS
   ============================================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalPop 0.22s cubic-bezier(.22,.68,0,1.2) both;
}

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

.modal-sm  { max-width: 420px; }
.modal-lg  { max-width: 800px; }
.modal-xl  { max-width: 1100px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--bg3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

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

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg4);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg3); color: var(--fg); }

.modal-body { padding: 24px; }

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

/* ============================================================
   21. DRAWERS
   ============================================================ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-md);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.drawer {
  position: fixed;
  top: 0;
  right: -520px;
  width: 480px;
  height: 100vh;
  background: var(--bg2);
  border-left: 1px solid var(--bg3);
  z-index: 901;
  transition: right var(--transition-lg);
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}

.drawer.open { right: 0; }

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--bg3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
  flex-shrink: 0;
}

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

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

/* ============================================================
   22. NOTIFICATION PANEL
   ============================================================ */

.notification-panel { width: 400px; }

.notif-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--bg3);
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
  align-items: flex-start;
}

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

.notif-item:hover {
  background: rgba(80,73,69,0.3);
  margin: 0 -24px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
}

.notif-item.unread .notif-title { font-weight: 600; }

.notif-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 15px;
}

.notif-icon-red    { background: rgba(204,36,29,0.2);  color: var(--red-br); }
.notif-icon-yellow { background: rgba(215,153,33,0.2); color: var(--yellow-br); }
.notif-icon-blue   { background: rgba(69,133,136,0.2); color: var(--blue-br); }
.notif-icon-green  { background: rgba(152,151,26,0.2); color: var(--green-br); }

.notif-content { flex: 1; min-width: 0; }
.notif-title   { font-size: 13px; font-weight: 500; color: var(--fg); line-height: 1.3; }
.notif-desc    { font-size: 12px; color: var(--fg3); margin-top: 2px; line-height: 1.4; }
.notif-time    { font-size: 11px; color: var(--fg4); margin-top: 4px; }

.notif-badge {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-br);
  flex-shrink: 0;
  margin-top: 5px;
}

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

/* ============================================================
   23. DROPDOWN MENUS
   ============================================================ */

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-md);
  min-width: 200px;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: all var(--transition);
  overflow: hidden;
}

.dropdown-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

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

.dropdown-header {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dropdown-item {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition-fast);
  text-decoration: none;
}

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

.dropdown-item-icon { color: var(--fg3); font-size: 14px; flex-shrink: 0; }
.dropdown-item .badge { margin-left: auto; }

.dropdown-divider { height: 1px; background: var(--bg3); margin: 4px 0; }

/* ============================================================
   24. CHARTS
   ============================================================ */

.chart-container { position: relative; }
.chart-container canvas { max-width: 100%; }

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

.chart-title-wrap { }
.chart-title    { font-size: 14px; font-weight: 600; color: var(--fg); }
.chart-subtitle { font-size: 12px; color: var(--fg4); margin-top: 2px; }

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg3);
  cursor: pointer;
  transition: color var(--transition);
}

.legend-item:hover { color: var(--fg); }

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

.legend-line {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.donut-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.radar-chart-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Time range buttons */
.time-range-group {
  display: flex;
  gap: 2px;
  background: var(--bg3);
  padding: 3px;
  border-radius: var(--radius);
}

.time-range-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
}

.time-range-btn:hover { color: var(--fg); background: var(--bg4); }
.time-range-btn.active { background: var(--bg2); color: var(--fg); box-shadow: var(--shadow-sm); }

/* ============================================================
   25. GRID LAYOUTS
   ============================================================ */

.content-grid { display: grid; gap: 20px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(4, 1fr); }
.grid-5 { display: grid; gap: 16px; grid-template-columns: repeat(5, 1fr); }
.grid-auto { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.grid-cols-3-1 { grid-template-columns: 3fr 1fr; }
.grid-cols-2-1 { grid-template-columns: 2fr 1fr; }
.grid-cols-1-2 { grid-template-columns: 1fr 2fr; }

/* ============================================================
   26. HEALTH / PROGRESS BARS
   ============================================================ */

.health-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}

.health-bar-fill.green  { background: var(--green-br); }
.health-bar-fill.yellow { background: var(--yellow-br); }
.health-bar-fill.red    { background: var(--red-br); }
.health-bar-fill.blue   { background: var(--blue-br); }
.health-bar-fill.orange { background: var(--orange-br); }

.progress-bar {
  height: 8px;
  background: var(--bg3);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue-br) 100%);
  transition: width 0.6s ease;
}

/* ============================================================
   27. ALERT BOXES
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.alert-icon { flex-shrink: 0; margin-top: 1px; font-size: 15px; }

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

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

/* ============================================================
   28. CODE BLOCKS
   ============================================================ */

.code-block {
  background: var(--bg);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--aqua-br);
  overflow-x: auto;
  line-height: 1.6;
  position: relative;
}

.code-block pre { margin: 0; white-space: pre-wrap; word-break: break-all; }

.inline-code {
  background: var(--bg3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--yellow-br);
}

/* ============================================================
   29. EMPTY STATES
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
  display: block;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg2);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--fg4);
  max-width: 400px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

/* ============================================================
   30. WIZARD STEPS
   ============================================================ */

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

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

.wizard-step-head {
  display: flex;
  align-items: center;
  width: 100%;
}

.wizard-step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--bg4);
  color: var(--fg4);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  z-index: 1;
}

.wizard-step.active .wizard-step-circle {
  background: var(--blue);
  border-color: var(--blue);
  color: white;
  box-shadow: 0 0 12px rgba(69,133,136,0.4);
}

.wizard-step.done .wizard-step-circle {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.wizard-step-label {
  font-size: 11px;
  color: var(--fg4);
  margin-top: 6px;
  text-align: center;
  font-weight: 500;
  white-space: nowrap;
}

.wizard-step.active .wizard-step-label { color: var(--blue-br); }
.wizard-step.done  .wizard-step-label  { color: var(--green-br); }

.wizard-step-line {
  flex: 1;
  height: 2px;
  background: var(--bg3);
  margin: 0 4px;
  margin-bottom: 18px;
  transition: background var(--transition);
}

.wizard-step.done .wizard-step-line { background: var(--green); }

/* ============================================================
   31. CONNECTOR / APP CARDS
   ============================================================ */

.app-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition-md);
  cursor: pointer;
  position: relative;
}

.app-card:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.app-card.selected { border-color: var(--blue); background: rgba(69,133,136,0.05); }
.app-card.selected::after {
  content: '✓';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  background: var(--green);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.app-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.app-card-type {
  font-size: 12px;
  color: var(--fg3);
  margin-top: 4px;
}

.app-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Connector health card */
.connector-health-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: all var(--transition);
}

.connector-health-card:hover { border-color: var(--bg4); }

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

.connector-name { font-size: 14px; font-weight: 600; color: var(--fg); }
.connector-type { font-size: 11px; color: var(--fg4); margin-top: 2px; }

.connector-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.connector-metric-label { font-size: 10px; color: var(--fg4); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.5px; }
.connector-metric-value { font-size: 14px; font-weight: 600; color: var(--fg); }

/* Device card */
.device-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition-md);
  cursor: pointer;
}

.device-card:hover {
  border-color: var(--bg4);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

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

.device-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.device-name { font-size: 13px; font-weight: 600; color: var(--fg); }
.device-os   { font-size: 11px; color: var(--fg4); margin-top: 2px; }

/* ============================================================
   32. RISK SCORE WIDGET
   ============================================================ */

.risk-score {
  display: flex;
  align-items: center;
  gap: 12px;
}

.risk-score-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.risk-score.critical .risk-score-value { color: var(--red-br); }
.risk-score.high     .risk-score-value { color: var(--orange-br); }
.risk-score.medium   .risk-score-value { color: var(--yellow-br); }
.risk-score.low      .risk-score-value { color: var(--green-br); }

.risk-score-label { font-size: 12px; color: var(--fg4); margin-top: 4px; }
.risk-score-trend { font-size: 12px; }

/* ============================================================
   33. GEO MAP
   ============================================================ */

.geo-map {
  background: var(--bg3);
  border-radius: var(--radius-md);
  min-height: 300px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--bg4);
}

.map-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(40,40,40,0.8) 0%, rgba(60,56,54,0.6) 100%);
}

.map-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.map-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.3;
  animation: pulse 2s infinite;
}

/* ============================================================
   34. LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(69,133,136,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(204,36,29,0.06) 0%, transparent 50%);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-2xl);
  width: 100%;
  max-width: 440px;
  padding: 48px;
  box-shadow: var(--shadow-xl);
}

.login-logo { text-align: center; margin-bottom: 36px; }

.login-logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--bg3);
  border-radius: var(--radius-xl);
  border: 1px solid var(--bg4);
}

.login-logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--red) 0%, var(--orange) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(204,36,29,0.4);
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--fg4);
  text-align: center;
  margin-bottom: 32px;
}

.quick-login-btn {
  width: 100%;
  text-align: center;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--fg4);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg3);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--fg4);
}

/* ============================================================
   35. METRIC ROW
   ============================================================ */

.metric-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.metric-item { flex: 1; min-width: 120px; }
.metric-label { font-size: 11px; color: var(--fg4); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.metric-value { font-size: 1.4rem; font-weight: 700; color: var(--fg); }
.metric-sub   { font-size: 11px; color: var(--fg4); margin-top: 3px; }

/* ============================================================
   36. SPARKLINE
   ============================================================ */

.sparkline {
  display: inline-block;
  min-width: 80px;
  height: 32px;
  position: relative;
}

.sparkline canvas, .sparkline svg {
  width: 100% !important;
  height: 100% !important;
}

/* ============================================================
   37. PILL / CHIP FILTERS
   ============================================================ */

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--fg3);
  background: var(--bg3);
  border: 1px solid var(--bg4);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.pill:hover { color: var(--fg); border-color: var(--fg4); }

.pill.active {
  background: rgba(69,133,136,0.15);
  color: var(--blue-br);
  border-color: var(--blue);
}

.pill .pill-count {
  background: var(--bg4);
  color: var(--fg4);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

.pill.active .pill-count {
  background: rgba(69,133,136,0.25);
  color: var(--blue-br);
}

/* ============================================================
   38. TIMELINE
   ============================================================ */

.timeline { position: relative; }

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--bg3);
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 0 0 24px 0;
  position: relative;
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--bg4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  z-index: 1;
  margin-top: 2px;
}

.timeline-dot.green  { background: rgba(152,151,26,0.2);  border-color: var(--green);  color: var(--green-br); }
.timeline-dot.red    { background: rgba(204,36,29,0.2);   border-color: var(--red);    color: var(--red-br); }
.timeline-dot.yellow { background: rgba(215,153,33,0.2);  border-color: var(--yellow); color: var(--yellow-br); }
.timeline-dot.blue   { background: rgba(69,133,136,0.2);  border-color: var(--blue);   color: var(--blue-br); }

.timeline-content { flex: 1; }
.timeline-header  { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.timeline-title   { font-size: 13px; font-weight: 600; color: var(--fg); }
.timeline-time    { font-size: 11px; color: var(--fg4); white-space: nowrap; }
.timeline-desc    { font-size: 12px; color: var(--fg3); margin-top: 4px; line-height: 1.5; }

/* ============================================================
   39. INFO GRID / KEY-VALUE
   ============================================================ */

.info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
}

.kv-row {
  display: contents;
}

.kv-row > :first-child {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid var(--bg3);
  white-space: nowrap;
}

.kv-row > :last-child {
  font-size: 13px;
  color: var(--fg);
  padding: 8px 0;
  border-bottom: 1px solid var(--bg3);
  word-break: break-all;
}

.kv-row:last-child > * { border-bottom: none; }

/* ============================================================
   40. TAGS
   ============================================================ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg3);
  color: var(--fg3);
  border: 1px solid var(--bg4);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}

.tag .tag-remove {
  cursor: pointer;
  color: var(--fg4);
  font-size: 12px;
  line-height: 1;
  margin-left: 2px;
  transition: color var(--transition);
}

.tag .tag-remove:hover { color: var(--red-br); }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* ============================================================
   41. COPY BUTTON
   ============================================================ */

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 500;
  color: var(--fg4);
  background: var(--bg3);
  border: 1px solid var(--bg4);
  cursor: pointer;
  transition: all var(--transition);
}

.copy-btn:hover { color: var(--fg); border-color: var(--fg4); }

.copy-btn.copied {
  color: var(--green-br);
  border-color: var(--green);
  background: rgba(152,151,26,0.1);
}

/* ============================================================
   42. SPLIT VIEW
   ============================================================ */

.split-view {
  display: flex;
  gap: 0;
  height: 100%;
  overflow: hidden;
}

.split-main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.sidebar-detail {
  width: 360px;
  min-width: 360px;
  background: var(--bg2);
  border-left: 1px solid var(--bg3);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--bg3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg2);
  z-index: 1;
}

.sidebar-detail-body { padding: 20px; }

/* ============================================================
   43. POLICY BUILDER
   ============================================================ */

.policy-builder {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.rule-block {
  background: var(--bg3);
  border: 1px solid var(--bg4);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  transition: border-color var(--transition);
}

.rule-block:hover { border-color: var(--blue); }

.rule-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.rule-block-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

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

.condition-row .form-control { flex: 1; min-width: 120px; }

.condition-connector {
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-br);
  background: rgba(177,98,134,0.15);
  border: 1px solid rgba(177,98,134,0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.policy-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  margin-top: 12px;
}

.policy-action.allow { background: rgba(152,151,26,0.15); color: var(--green-br); border: 1px solid rgba(152,151,26,0.3); }
.policy-action.deny  { background: rgba(204,36,29,0.15);  color: var(--red-br);   border: 1px solid rgba(204,36,29,0.3); }
.policy-action.mfa   { background: rgba(215,153,33,0.15); color: var(--yellow-br);border: 1px solid rgba(215,153,33,0.3); }

/* ============================================================
   44. AI / AINA CHAT
   ============================================================ */

.ai-message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 88%;
}

.ai-message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.ai-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  margin-top: 2px;
}

.ai-message.assistant .ai-message-avatar {
  background: linear-gradient(135deg, var(--blue) 0%, var(--aqua) 100%);
  box-shadow: 0 0 10px rgba(69,133,136,0.3);
}

.ai-message.user .ai-message-avatar {
  background: linear-gradient(135deg, var(--purple) 0%, var(--blue) 100%);
}

.ai-message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg);
  max-width: 100%;
}

.ai-message.assistant .ai-message-bubble {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-top-left-radius: var(--radius-sm);
}

.ai-message.user .ai-message-bubble {
  background: rgba(69,133,136,0.2);
  border: 1px solid rgba(69,133,136,0.35);
  border-top-right-radius: var(--radius-sm);
}

.ai-message-time {
  font-size: 10px;
  color: var(--fg4);
  margin-top: 4px;
  text-align: right;
}

.ai-message.assistant .ai-message-time { text-align: left; }

.ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-radius: var(--radius-xl);
  border-top-left-radius: var(--radius-sm);
  width: fit-content;
}

.ai-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue-br);
  animation: pulse 1.2s infinite;
}

.ai-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0.4s; }

.aina-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, rgba(69,133,136,0.2) 0%, rgba(104,157,106,0.2) 100%);
  border: 1px solid rgba(69,133,136,0.4);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-br);
  letter-spacing: 0.5px;
}

.aina-badge::before {
  content: '⬡';
  font-size: 10px;
  color: var(--aqua-br);
}

.futuristic-panel {
  background: linear-gradient(135deg, rgba(69,133,136,0.08) 0%, rgba(104,157,106,0.05) 100%);
  border: 1px solid rgba(69,133,136,0.25);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.futuristic-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--aqua) 50%, var(--blue) 100%);
  opacity: 0.7;
}

.futuristic-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(69,133,136,0.08) 0%, transparent 70%);
  pointer-events: none;
}

/* Chat input area */
.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--bg3);
  background: var(--bg2);
}

.chat-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--bg4);
  border-radius: var(--radius-full);
  padding: 10px 16px;
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.chat-input:focus { border-color: var(--blue); }
.chat-input::placeholder { color: var(--fg4); }

/* ============================================================
   45. GLOBAL SEARCH RESULTS
   ============================================================ */

.search-results-overlay {
  position: fixed;
  top: 60px;
  left: 260px;
  right: 0;
  z-index: 800;
  background: rgba(0,0,0,0.45);
  transition: left var(--transition-lg);
}

.sidebar.collapsed ~ .main-content .search-results-overlay { left: 60px; }

.search-results-panel {
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-top: none;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.search-section-header {
  padding: 8px 20px;
  font-size: 10px;
  font-weight: 700;
  color: var(--fg4);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--bg3);
  position: sticky;
  top: 0;
}

.search-result-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.search-result-item:hover, .search-result-item.focused {
  background: var(--bg3);
}

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

.search-result-content { flex: 1; min-width: 0; }
.search-result-title { font-size: 13px; font-weight: 500; color: var(--fg); }
.search-result-title mark { background: rgba(250,189,47,0.25); color: var(--yellow-br); border-radius: 2px; padding: 0 2px; }
.search-result-path { font-size: 11px; color: var(--fg4); margin-top: 1px; }
.search-result-type { font-size: 11px; color: var(--fg4); flex-shrink: 0; }

.search-no-results {
  padding: 32px 20px;
  text-align: center;
  color: var(--fg4);
  font-size: 13px;
}

/* ============================================================
   46. TOASTS
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg2);
  border: 1px solid var(--bg3);
  border-left: 3px solid var(--blue);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideInRight 0.3s ease, fadeIn 0.3s ease;
  position: relative;
}

.toast.dismissing {
  animation: fadeOut 0.3s ease forwards;
}

.toast-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.toast-content { flex: 1; }
.toast-title   { font-size: 13px; font-weight: 600; color: var(--fg); }
.toast-message { font-size: 12px; color: var(--fg3); margin-top: 2px; }
.toast-close   { color: var(--fg4); cursor: pointer; font-size: 16px; flex-shrink: 0; transition: color var(--transition); }
.toast-close:hover { color: var(--fg); }

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

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

/* ============================================================
   47. HEATMAP GRID
   ============================================================ */

.heatmap-grid {
  display: grid;
  gap: 3px;
}

.heatmap-cell {
  border-radius: 3px;
  cursor: pointer;
  transition: opacity var(--transition);
}

.heatmap-cell:hover { opacity: 0.8; }
.heatmap-cell[data-level="0"] { background: var(--bg3); }
.heatmap-cell[data-level="1"] { background: rgba(104,157,106,0.3); }
.heatmap-cell[data-level="2"] { background: rgba(104,157,106,0.5); }
.heatmap-cell[data-level="3"] { background: rgba(142,192,124,0.7); }
.heatmap-cell[data-level="4"] { background: var(--aqua-br); }

/* ============================================================
   48. PROGRESS RING (SVG circular)
   ============================================================ */

.progress-ring { position: relative; display: inline-flex; align-items: center; justify-content: center; }

.progress-ring-svg { transform: rotate(-90deg); }

.progress-ring-track { fill: none; stroke: var(--bg3); }
.progress-ring-fill  { fill: none; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }

.progress-ring-label {
  position: absolute;
  text-align: center;
}

.progress-ring-value { font-size: 1.1rem; font-weight: 700; color: var(--fg); }
.progress-ring-sub   { font-size: 10px; color: var(--fg4); }

/* ============================================================
   49. DEPENDENCY MAP
   ============================================================ */

.dep-map-container {
  background: var(--bg3);
  border-radius: var(--radius-md);
  border: 1px solid var(--bg4);
  overflow: hidden;
  position: relative;
  cursor: grab;
}

.dep-map-container:active { cursor: grabbing; }

.dep-map-container svg { width: 100%; height: 100%; }

/* ============================================================
   50. POLICY SIMULATOR
   ============================================================ */

.policy-sim-result {
  padding: 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 20px;
}

.policy-sim-result.allow  { background: rgba(152,151,26,0.1);  border: 1px solid rgba(152,151,26,0.3); }
.policy-sim-result.deny   { background: rgba(204,36,29,0.1);   border: 1px solid rgba(204,36,29,0.3); }
.policy-sim-result.mfa    { background: rgba(215,153,33,0.1);  border: 1px solid rgba(215,153,33,0.3); }

.policy-sim-icon { font-size: 32px; flex-shrink: 0; }
.policy-sim-title { font-size: 18px; font-weight: 700; }
.policy-sim-desc  { font-size: 13px; color: var(--fg3); margin-top: 4px; }
.policy-sim-rules { margin-top: 12px; }
.policy-sim-rule-item { font-size: 12px; color: var(--fg4); padding: 3px 0; display: flex; align-items: center; gap: 6px; }

/* ============================================================
   51. MISC UTILITY CLASSES
   ============================================================ */

/* Spacing */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }

/* Flex helpers */
.d-flex        { display: flex; }
.flex-1        { flex: 1; }
.align-center  { align-items: center; }
.align-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-wrap     { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }

/* Text */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--fg4); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-lg     { font-size: 16px; }
.text-fg     { color: var(--fg); }
.text-fg2    { color: var(--fg2); }
.text-fg3    { color: var(--fg3); }
.text-red    { color: var(--red-br); }
.text-green  { color: var(--green-br); }
.text-yellow { color: var(--yellow-br); }
.text-blue   { color: var(--blue-br); }
.text-purple { color: var(--purple-br); }
.text-orange { color: var(--orange-br); }
.text-aqua   { color: var(--aqua-br); }
.fw-bold     { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium   { font-weight: 500; }
.font-mono   { font-family: var(--font-mono); }

/* Display */
.d-none      { display: none !important; }
.d-block     { display: block; }
.d-inline    { display: inline; }
.d-inline-flex { display: inline-flex; }
.d-grid      { display: grid; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Border */
.border-top    { border-top: 1px solid var(--bg3); }
.border-bottom { border-bottom: 1px solid var(--bg3); }

/* Background */
.bg-card { background: var(--bg2); }
.bg-main { background: var(--bg); }
.bg-panel { background: var(--bg3); }

/* Radius */
.rounded    { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

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

/* Shadow */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Separator dot */
.sep-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--fg4); display: inline-block; vertical-align: middle; }

/* Number value display */
.num-display {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--fg2);
}

/* ============================================================
   52. ANIMATIONS
   ============================================================ */

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

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

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

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

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

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes countUp {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(69,133,136,0.3); }
  50%       { box-shadow: 0 0 16px rgba(69,133,136,0.6); }
}

.fade-in          { animation: fadeIn 0.3s ease forwards; }
.slide-in-right   { animation: slideInRight 0.3s ease forwards; }
.slide-in-left    { animation: slideInLeft 0.3s ease forwards; }
.animate-pulse    { animation: pulse 2s infinite; }
.spin             { animation: spin 1s linear infinite; }
.glow-pulse       { animation: glow-pulse 2s ease infinite; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius);
}

.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 60%; }
.skeleton-circle { border-radius: 50%; }

/* ============================================================
   53. RESPONSIVE BREAKPOINTS
   ============================================================ */

@media (max-width: 1400px) {
  .grid-5 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-3-1, .grid-cols-2-1 { grid-template-columns: 1fr; }
  .topnav-search { flex: 0 1 280px; }
  .sidebar-detail { width: 300px; min-width: 300px; }
}

@media (max-width: 900px) {
  .grid-3    { grid-template-columns: repeat(2, 1fr); }
  .grid-4    { grid-template-columns: repeat(2, 1fr); }
  .grid-5    { grid-template-columns: repeat(2, 1fr); }
  .form-row  { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .profile-info { display: none; }
  .sidebar-detail { display: none; }
  .split-view { display: block; }
}

@media (max-width: 768px) {
  .search-results-overlay { left: 0; }
  .drawer { width: 100%; right: -100%; }
  .notification-panel { width: 100%; }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 200; height: 100vh; }
  .sidebar.mobile-open { display: flex; width: 260px; }
  .page-content { padding: 16px; }
  .topnav { padding: 0 16px; }
  .topnav-search { display: none; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.8rem; }
  .login-card { padding: 32px 24px; }
  .modal { max-width: 100%; width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-header-right { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   54. MOBILE OVERLAY (sidebar backdrop)
   ============================================================ */

.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
}

@media (max-width: 600px) {
  .mobile-overlay.active { display: block; }
}

/* ============================================================
   55. PRINT STYLES
   ============================================================ */

@media print {
  .sidebar, .topnav, .page-header-right { display: none !important; }
  .main-content { margin: 0; }
  .page-content { padding: 0; overflow: visible; }
  .card { break-inside: avoid; }
  body { background: white; color: black; }
}
