/* ============================================================
   ZelSOAR — Application Stylesheet
   Theme: Gruvbox Dark
   ============================================================ */

/* ============================================================
   1. CSS Custom Properties (Gruvbox Dark Palette)
   ============================================================ */
:root {
  --bg: #282828;
  --bg-soft: #32302f;
  --bg-hard: #1d2021;
  --bg-1: #3c3836;
  --bg-dark: #1d2021;
  --bg-card: #32302f;
  --bg-input: #3c3836;
  --fg: #ebdbb2;
  --fg-muted: #a89984;
  --border: #3c3836;
  --border-light: #504945;
  --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;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 60px;
  --topnav-height: 64px;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --transition: 0.2s ease;
  --sidebar-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'Fira Sans', 'Inter', 'Segoe UI', 'Helvetica Neue', Arial,
               'Noto Sans', 'Liberation Sans', sans-serif,
               'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a:hover {
  color: var(--fg);
  text-decoration: none;
}

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

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
}

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

p {
  margin-bottom: 0.75rem;
}

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

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

code, pre, kbd, samp, .monospace {
  font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', 'Consolas',
               'Monaco', 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 0.875em;
}

/* ============================================================
   3. Scrollbar Styling
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) var(--bg-dark);
}

/* ============================================================
   4. Layout: Sidebar + Top Nav + Main
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  margin-top: var(--topnav-height);
  transition: margin-left var(--sidebar-transition);
  min-width: 0;
}

body.sidebar-collapsed .main-wrapper {
  margin-left: var(--sidebar-collapsed-width);
}

/* ============================================================
   5. Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  transition: width var(--sidebar-transition);
  will-change: width;
}

body.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

/* Sidebar Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  height: var(--topnav-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--aqua) 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--bg-dark);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition), width var(--sidebar-transition);
}

.sidebar-logo-text strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sidebar-logo-text span {
  font-size: 0.65rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

body.sidebar-collapsed .sidebar-logo-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Sidebar Nav Scroll Area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0 1rem;
}

/* Sidebar Section Labels */
.sidebar-section-label {
  padding: 0.9rem 1.1rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
  user-select: none;
}

body.sidebar-collapsed .sidebar-section-label {
  opacity: 0;
}

.sidebar-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.5rem 0.75rem;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

body.sidebar-collapsed .sidebar-separator {
  margin: 0.5rem auto;
  width: 36px;
}

/* Sidebar Nav Items */
.sidebar-item {
  position: relative;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin: 1px 0.5rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
  cursor: pointer;
}

.sidebar-link:hover {
  background: var(--bg-input);
  color: var(--fg);
}

.sidebar-link.active {
  background: rgba(69, 133, 136, 0.2);
  color: var(--blue-bright);
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  background: var(--blue-bright);
  border-radius: 0 2px 2px 0;
  margin-left: -0.5rem;
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Colored sidebar icons */
.sidebar-link[data-color="red"] .sidebar-icon     { color: var(--red-bright); }
.sidebar-link[data-color="green"] .sidebar-icon   { color: var(--green-bright); }
.sidebar-link[data-color="yellow"] .sidebar-icon  { color: var(--yellow-bright); }
.sidebar-link[data-color="blue"] .sidebar-icon    { color: var(--blue-bright); }
.sidebar-link[data-color="purple"] .sidebar-icon  { color: var(--purple-bright); }
.sidebar-link[data-color="aqua"] .sidebar-icon    { color: var(--aqua-bright); }
.sidebar-link[data-color="orange"] .sidebar-icon  { color: var(--orange-bright); }

.sidebar-link-text {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  overflow: hidden;
  opacity: 1;
  transition: opacity var(--sidebar-transition);
}

body.sidebar-collapsed .sidebar-link-text {
  opacity: 0;
  width: 0;
}

/* Submenu chevron */
.sidebar-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform var(--transition), opacity var(--sidebar-transition);
  opacity: 1;
}

body.sidebar-collapsed .sidebar-chevron {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

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

/* Submenu */
.sidebar-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.sidebar-item.open > .sidebar-submenu {
  max-height: 500px;
}

body.sidebar-collapsed .sidebar-submenu {
  display: none;
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem 0.4rem 2.75rem;
  font-size: 0.825rem;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin: 1px 0.5rem;
  transition: background var(--transition), color var(--transition);
}

.sidebar-sublink:hover {
  background: var(--bg-input);
  color: var(--fg);
}

.sidebar-sublink.active {
  color: var(--blue-bright);
}

.sidebar-sublink::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.5;
}

.sidebar-sublink.active::before {
  opacity: 1;
}

/* Sidebar Collapse Toggle */
.sidebar-toggle {
  flex-shrink: 0;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

body.sidebar-collapsed .sidebar-toggle {
  justify-content: center;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.sidebar-toggle-btn:hover {
  color: var(--fg);
  background: var(--border-light);
}

.sidebar-toggle-btn svg {
  width: 14px;
  height: 14px;
  transition: transform var(--sidebar-transition);
}

body.sidebar-collapsed .sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

/* Sidebar tooltip on collapsed (title attr) */
body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0.55rem;
}

body.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 0;
}

/* ============================================================
   6. Top Navigation
   ============================================================ */
.topnav {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topnav-height);
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 150;
  transition: left var(--sidebar-transition);
}

body.sidebar-collapsed .topnav {
  left: var(--sidebar-collapsed-width);
}

/* Breadcrumbs in topnav */
.topnav-breadcrumbs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  padding: 0 0.4rem;
  color: var(--fg-muted);
  opacity: 0.5;
}

.breadcrumb-item a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color var(--transition);
}

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

.breadcrumb-item.active {
  color: var(--fg);
}

/* Topnav spacer */
.topnav-spacer {
  flex: 1;
}

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

.topnav-search-input {
  width: 100%;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  padding: 0 1rem 0 2.5rem;
  color: var(--fg);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.topnav-search-input::placeholder {
  color: var(--fg-muted);
  opacity: 0.7;
}

.topnav-search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(69, 133, 136, 0.2);
}

.topnav-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

/* Global Search Dropdown */
.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  display: none;
}

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

.search-dropdown-section {
  padding: 0.5rem 0;
}

.search-dropdown-label {
  padding: 0.35rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: var(--fg);
}

.search-result-item:hover {
  background: var(--bg-input);
}

.search-result-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

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

.search-result-title {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.search-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

/* Topnav Actions */
.topnav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topnav-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.topnav-btn:hover {
  background: var(--bg-input);
  color: var(--fg);
}

.topnav-btn svg {
  width: 18px;
  height: 18px;
}

/* Notification badge */
.notif-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 16px;
  height: 16px;
  background: var(--red-bright);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-badge:empty,
.notif-badge[data-count="0"] {
  display: none;
}

/* Profile dropdown */
.topnav-profile {
  position: relative;
}

.topnav-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.5rem;
  border-radius: 20px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--fg);
  transition: background var(--transition), border-color var(--transition);
}

.topnav-profile-btn:hover {
  background: var(--bg-input);
  border-color: var(--border-light);
}

.topnav-profile-info {
  text-align: left;
  line-height: 1.2;
}

.topnav-profile-name {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--fg);
}

.topnav-profile-role {
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.topnav-profile-caret {
  width: 12px;
  height: 12px;
  color: var(--fg-muted);
  transition: transform var(--transition);
}

.topnav-profile.open .topnav-profile-caret {
  transform: rotate(180deg);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  overflow: hidden;
  display: none;
}

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

.profile-dropdown-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.profile-dropdown-name {
  font-size: 0.875rem;
  font-weight: 600;
}

.profile-dropdown-email {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.profile-dropdown-menu {
  padding: 0.4rem 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.profile-dropdown-item:hover {
  background: var(--bg-input);
  color: var(--fg);
}

.profile-dropdown-item svg {
  width: 15px;
  height: 15px;
}

.profile-dropdown-item.danger {
  color: var(--red-bright);
}

.profile-dropdown-item.danger:hover {
  background: rgba(204, 36, 29, 0.15);
}

.profile-dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}

/* ============================================================
   7. Main Content Area
   ============================================================ */
.main-content {
  padding: 1.75rem 2rem;
  min-height: calc(100vh - var(--topnav-height));
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.page-header-left {}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.2rem;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--fg-muted);
  margin: 0;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ============================================================
   8. Avatar
   ============================================================ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 2px solid var(--border-light);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  flex-shrink: 0;
  overflow: hidden;
  user-select: none;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  font-size: 1.25rem;
}

.avatar-xl {
  width: 64px;
  height: 64px;
  font-size: 1.75rem;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-emoji {
  font-style: normal;
  line-height: 1;
}

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

/* ============================================================
   9. Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

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

.card-title-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.card-subtitle {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin: 0;
  margin-top: 0.15rem;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.card-body {
  padding: 1.25rem;
}

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

/* Card padding variants */
.card-body-sm { padding: 0.75rem; }
.card-body-lg { padding: 1.75rem; }
.card-body-none { padding: 0; }

/* Colored left border variants */
.card-red    { border-left: 4px solid var(--red-bright); }
.card-green  { border-left: 4px solid var(--green-bright); }
.card-yellow { border-left: 4px solid var(--yellow-bright); }
.card-blue   { border-left: 4px solid var(--blue-bright); }
.card-purple { border-left: 4px solid var(--purple-bright); }
.card-aqua   { border-left: 4px solid var(--aqua-bright); }
.card-orange { border-left: 4px solid var(--orange-bright); }

/* KPI / Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.stat-card-value {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  color: var(--fg);
  margin-bottom: 0.5rem;
  letter-spacing: -1px;
}

.stat-card-trend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.trend-up   { color: var(--green-bright); }
.trend-down { color: var(--red-bright); }
.trend-flat { color: var(--fg-muted); }

.stat-card-trend svg {
  width: 14px;
  height: 14px;
}

.stat-card-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  opacity: 0.8;
}

.stat-card-icon-red    { background: rgba(251, 73, 52, 0.15); color: var(--red-bright); }
.stat-card-icon-green  { background: rgba(184, 187, 38, 0.15); color: var(--green-bright); }
.stat-card-icon-blue   { background: rgba(131, 165, 152, 0.15); color: var(--blue-bright); }
.stat-card-icon-yellow { background: rgba(250, 189, 47, 0.15); color: var(--yellow-bright); }
.stat-card-icon-orange { background: rgba(254, 128, 25, 0.15); color: var(--orange-bright); }
.stat-card-icon-purple { background: rgba(211, 134, 155, 0.15); color: var(--purple-bright); }
.stat-card-icon-aqua   { background: rgba(142, 192, 124, 0.15); color: var(--aqua-bright); }

/* Grid for stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

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

/* ============================================================
   10. Tables
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table,
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table thead {
  background: var(--bg-dark);
}

.table thead th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--fg-muted);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.table thead th.sortable {
  cursor: pointer;
  transition: color var(--transition);
}

.table thead th.sortable:hover {
  color: var(--fg);
}

.table thead th.sortable::after {
  content: ' ⇅';
  opacity: 0.4;
  font-size: 0.7rem;
}

.table thead th.sort-asc::after {
  content: ' ↑';
  opacity: 1;
  color: var(--blue-bright);
}

.table thead th.sort-desc::after {
  content: ' ↓';
  opacity: 1;
  color: var(--blue-bright);
}

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

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

.table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.1);
}

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

.table tbody td {
  padding: 0.75rem 1rem;
  color: var(--fg);
  vertical-align: middle;
}

.table tbody td.muted {
  color: var(--fg-muted);
  font-size: 0.825rem;
}

.table tbody td.mono {
  font-family: 'Fira Code', monospace;
  font-size: 0.825rem;
}

/* Table within card (no double border) */
.card .table-wrapper {
  border: none;
  border-radius: 0;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--fg-muted);
  flex: 1;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--fg-muted);
  font-size: 0.825rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.page-btn:hover {
  background: var(--bg-input);
  color: var(--fg);
  border-color: var(--fg-muted);
}

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

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

/* ============================================================
   11. Badges / Pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* Severity */
.severity-critical {
  background: rgba(251, 73, 52, 0.2);
  color: var(--red-bright);
  border: 1px solid rgba(251, 73, 52, 0.35);
}

.severity-high {
  background: rgba(254, 128, 25, 0.2);
  color: var(--orange-bright);
  border: 1px solid rgba(254, 128, 25, 0.35);
}

.severity-medium {
  background: rgba(250, 189, 47, 0.2);
  color: var(--yellow-bright);
  border: 1px solid rgba(250, 189, 47, 0.35);
}

.severity-low {
  background: rgba(184, 187, 38, 0.2);
  color: var(--green-bright);
  border: 1px solid rgba(184, 187, 38, 0.35);
}

.severity-info {
  background: rgba(131, 165, 152, 0.2);
  color: var(--blue-bright);
  border: 1px solid rgba(131, 165, 152, 0.35);
}

/* Status badges */
.status-open {
  background: rgba(251, 73, 52, 0.15);
  color: var(--red-bright);
  border: 1px solid rgba(251, 73, 52, 0.3);
}

.status-investigating {
  background: rgba(250, 189, 47, 0.15);
  color: var(--yellow-bright);
  border: 1px solid rgba(250, 189, 47, 0.3);
}

.status-contained {
  background: rgba(254, 128, 25, 0.15);
  color: var(--orange-bright);
  border: 1px solid rgba(254, 128, 25, 0.3);
}

.status-resolved {
  background: rgba(184, 187, 38, 0.15);
  color: var(--green-bright);
  border: 1px solid rgba(184, 187, 38, 0.3);
}

.status-pending {
  background: rgba(131, 165, 152, 0.15);
  color: var(--blue-bright);
  border: 1px solid rgba(131, 165, 152, 0.3);
}

.status-approved {
  background: rgba(142, 192, 124, 0.15);
  color: var(--aqua-bright);
  border: 1px solid rgba(142, 192, 124, 0.3);
}

.status-rejected {
  background: rgba(211, 134, 155, 0.15);
  color: var(--purple-bright);
  border: 1px solid rgba(211, 134, 155, 0.3);
}

/* Generic colored badges */
.badge-red    { background: rgba(251,73,52,.15);   color: var(--red-bright);    border: 1px solid rgba(251,73,52,.3); }
.badge-green  { background: rgba(184,187,38,.15);  color: var(--green-bright);  border: 1px solid rgba(184,187,38,.3); }
.badge-yellow { background: rgba(250,189,47,.15);  color: var(--yellow-bright); border: 1px solid rgba(250,189,47,.3); }
.badge-blue   { background: rgba(131,165,152,.15); color: var(--blue-bright);   border: 1px solid rgba(131,165,152,.3); }
.badge-purple { background: rgba(211,134,155,.15); color: var(--purple-bright); border: 1px solid rgba(211,134,155,.3); }
.badge-aqua   { background: rgba(142,192,124,.15); color: var(--aqua-bright);   border: 1px solid rgba(142,192,124,.3); }
.badge-orange { background: rgba(254,128,25,.15);  color: var(--orange-bright); border: 1px solid rgba(254,128,25,.3); }
.badge-muted  { background: rgba(168,153,132,.15); color: var(--fg-muted);      border: 1px solid rgba(168,153,132,.3); }

/* Badge sizes */
.badge-sm { font-size: 0.65rem; padding: 0.1rem 0.45rem; }
.badge-lg { font-size: 0.82rem; padding: 0.3rem 0.8rem; border-radius: var(--radius-sm); }

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

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

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* Primary */
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn-primary:hover {
  background: var(--blue-bright);
  border-color: var(--blue-bright);
  color: var(--bg-dark);
}

/* Danger */
.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-danger:hover {
  background: var(--red-bright);
  border-color: var(--red-bright);
}

/* Success */
.btn-success {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.btn-success:hover {
  background: var(--green-bright);
  border-color: var(--green-bright);
  color: var(--bg-dark);
}

/* Warning */
.btn-warning {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--bg-dark);
}
.btn-warning:hover {
  background: var(--yellow-bright);
  border-color: var(--yellow-bright);
}

/* Secondary */
.btn-secondary {
  background: var(--bg-input);
  border-color: var(--border-light);
  color: var(--fg-muted);
}
.btn-secondary:hover {
  background: var(--border-light);
  color: var(--fg);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  border-color: var(--border-light);
  color: var(--fg-muted);
}
.btn-ghost:hover {
  background: var(--bg-input);
  color: var(--fg);
}

/* Outline variants */
.btn-outline-blue {
  background: transparent;
  border-color: var(--blue);
  color: var(--blue-bright);
}
.btn-outline-blue:hover {
  background: rgba(69, 133, 136, 0.15);
}

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

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

/* Sizes */
.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}
.btn-sm svg { width: 13px; height: 13px; }

.btn-lg {
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  border-radius: var(--radius);
}
.btn-lg svg { width: 18px; height: 18px; }

/* Icon-only button */
.btn-icon {
  padding: 0.4rem;
  width: 34px;
  height: 34px;
}
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 0.25rem; }
.btn-icon.btn-lg { width: 44px; height: 44px; padding: 0.6rem; }

/* Button group */
.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border-radius: 0;
}

.btn-group .btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.btn-group .btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.btn-group .btn:not(:last-child) {
  border-right-width: 0;
}

.btn-group .btn:not(:first-child):not(:last-child) {
  border-radius: 0;
}

/* ============================================================
   13. Forms
   ============================================================ */
.form-group {
  margin-bottom: 1.1rem;
}

.form-label {
  display: block;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.form-label .required {
  color: var(--red-bright);
  margin-left: 0.2rem;
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.5rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

.form-control::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

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

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Validation states */
.form-control.is-valid {
  border-color: var(--green-bright);
}
.form-control.is-valid:focus {
  box-shadow: 0 0 0 2px rgba(184, 187, 38, 0.2);
}

.form-control.is-invalid {
  border-color: var(--red-bright);
}
.form-control.is-invalid:focus {
  box-shadow: 0 0 0 2px rgba(251, 73, 52, 0.2);
}

.form-valid-feedback {
  font-size: 0.78rem;
  color: var(--green-bright);
  margin-top: 0.3rem;
}

.form-invalid-feedback {
  font-size: 0.78rem;
  color: var(--red-bright);
  margin-top: 0.3rem;
}

.form-help {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 0.3rem;
}

/* Select */
select.form-control {
  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 0.75rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* Textarea */
textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

/* Form sizes */
.form-control-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
}

.form-control-lg {
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}

/* Search input */
.input-search {
  position: relative;
}

.input-search .form-control {
  padding-left: 2.25rem;
}

.input-search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  width: 14px;
  height: 14px;
  pointer-events: none;
}

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

.input-group-text {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  color: var(--fg-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

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

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

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

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

/* Checkbox and radio */
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.form-check-input {
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-light);
  border-radius: 3px;
  appearance: none;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input:checked {
  background: var(--blue);
  border-color: var(--blue);
}

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

.form-check-input[type="radio"]:checked::after {
  top: 3px;
  left: 3px;
  width: 6px;
  height: 6px;
  background: #fff;
  border: none;
  border-radius: 50%;
  transform: none;
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--fg);
  cursor: pointer;
  user-select: none;
}

/* Toggle switch */
.form-switch {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.form-switch-input {
  display: none;
}

.form-switch-track {
  width: 38px;
  height: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  position: relative;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.form-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--fg-muted);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}

.form-switch-input:checked + .form-switch-track {
  background: var(--blue);
  border-color: var(--blue);
}

.form-switch-input:checked + .form-switch-track::after {
  transform: translateX(18px);
  background: #fff;
}

.form-switch-label {
  font-size: 0.875rem;
  color: var(--fg);
  user-select: none;
}

/* Character counter */
.char-counter {
  font-size: 0.75rem;
  color: var(--fg-muted);
  text-align: right;
  margin-top: 0.25rem;
}

.char-counter.near-limit { color: var(--yellow-bright); }
.char-counter.at-limit   { color: var(--red-bright); }

/* Password toggle */
.input-password {
  position: relative;
}

.input-password .form-control {
  padding-right: 2.5rem;
}

.input-password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color var(--transition);
}

.input-password-toggle:hover {
  color: var(--fg);
}

/* ============================================================
   14. Modal Dialogs
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 32, 33, 0.85);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(-16px) scale(0.98);
  transition: transform 0.2s ease;
  overflow: hidden;
}

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

.modal-sm { max-width: 400px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

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

.modal-close svg {
  width: 16px;
  height: 16px;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ============================================================
   15. Notification Drawer
   ============================================================ */
.notif-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 32, 33, 0.6);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  z-index: 850;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

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

.notif-drawer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notif-drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.notif-drawer-close:hover {
  background: var(--bg-input);
  color: var(--fg);
}

.notif-drawer-close svg { width: 15px; height: 15px; }

/* Notification filter tabs */
.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 0.5rem;
}

.notif-tab {
  padding: 0.6rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.notif-tab:hover { color: var(--fg); }
.notif-tab.active {
  color: var(--blue-bright);
  border-bottom-color: var(--blue-bright);
}

/* Notification list */
.notif-list {
  flex: 1;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}

.notif-item:hover {
  background: var(--bg-input);
}

.notif-item.unread {
  background: rgba(69, 133, 136, 0.05);
}

.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--blue-bright);
  border-radius: 0 2px 2px 0;
}

.notif-item-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.notif-item-icon-red    { background: rgba(251,73,52,.15);   color: var(--red-bright); }
.notif-item-icon-green  { background: rgba(184,187,38,.15);  color: var(--green-bright); }
.notif-item-icon-yellow { background: rgba(250,189,47,.15);  color: var(--yellow-bright); }
.notif-item-icon-blue   { background: rgba(131,165,152,.15); color: var(--blue-bright); }
.notif-item-icon-orange { background: rgba(254,128,25,.15);  color: var(--orange-bright); }

.notif-item-meta { flex: 1; min-width: 0; }

.notif-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 0.15rem;
  line-height: 1.3;
}

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

.notif-item-body {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-bottom: 0.3rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-item-time {
  font-size: 0.72rem;
  color: var(--fg-muted);
  opacity: 0.7;
}

.notif-drawer-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  text-align: center;
}

/* ============================================================
   16. ZelC Terminal
   ============================================================ */
.terminal-container {
  background: #0f1010;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 480px;
  font-family: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', 'Consolas', monospace;
}

.terminal-titlebar {
  background: var(--bg-dark);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.terminal-dots {
  display: flex;
  gap: 0.4rem;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot-red    { background: #ff5f57; }
.terminal-dot-yellow { background: #febc2e; }
.terminal-dot-green  { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--fg-muted);
  letter-spacing: 0.5px;
}

.terminal-status {
  font-size: 0.7rem;
  color: var(--aqua-bright);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.terminal-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--aqua-bright);
  animation: terminal-pulse 2s infinite;
}

@keyframes terminal-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  color: #b8bb26;
  font-size: 0.85rem;
  line-height: 1.6;
}

.terminal-output::-webkit-scrollbar {
  width: 4px;
}

.terminal-output::-webkit-scrollbar-track {
  background: transparent;
}

.terminal-output::-webkit-scrollbar-thumb {
  background: var(--border-light);
}

.terminal-line {
  display: block;
  margin-bottom: 0.15rem;
}

.terminal-line-prompt {
  color: var(--aqua-bright);
  font-weight: 600;
}

.terminal-line-cmd {
  color: #ebdbb2;
}

.terminal-line-output {
  color: #b8bb26;
}

.terminal-line-error {
  color: var(--red-bright);
}

.terminal-line-info {
  color: var(--blue-bright);
}

.terminal-line-success {
  color: var(--green-bright);
}

.terminal-line-warn {
  color: var(--yellow-bright);
}

.terminal-line-muted {
  color: var(--fg-muted);
}

.terminal-input-area {
  display: flex;
  align-items: center;
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--border);
  background: #0c0d0d;
  flex-shrink: 0;
  gap: 0.5rem;
}

.terminal-prompt-label {
  color: var(--aqua-bright);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
}

.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ebdbb2;
  font-size: 0.85rem;
  font-family: inherit;
  caret-color: var(--green-bright);
}

.terminal-input::placeholder {
  color: var(--fg-muted);
  opacity: 0.4;
}

.terminal-clear-btn {
  font-size: 0.7rem;
  color: var(--fg-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition);
  padding: 0;
}

.terminal-clear-btn:hover {
  color: var(--red-bright);
}

/* ============================================================
   17. Charts
   ============================================================ */
.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  display: block;
}

.chart-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.chart-filter-btn {
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
}

.chart-filter-btn:hover {
  background: var(--bg-input);
  color: var(--fg);
}

.chart-filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 0;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

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

/* ============================================================
   18. Alert/Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  top: calc(var(--topnav-height) + 1rem);
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: 360px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.hide {
  transform: translateX(calc(100% + 1.5rem));
  opacity: 0;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

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

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.1rem;
}

.toast-message {
  font-size: 0.8rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

.toast-close {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color var(--transition);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-close:hover { color: var(--fg); }
.toast-close svg { width: 13px; height: 13px; }

/* Toast variants */
.toast-success { border-left: 3px solid var(--green-bright); }
.toast-success .toast-icon { color: var(--green-bright); }

.toast-error { border-left: 3px solid var(--red-bright); }
.toast-error .toast-icon { color: var(--red-bright); }

.toast-warning { border-left: 3px solid var(--yellow-bright); }
.toast-warning .toast-icon { color: var(--yellow-bright); }

.toast-info { border-left: 3px solid var(--blue-bright); }
.toast-info .toast-icon { color: var(--blue-bright); }

/* Flash/alert messages in page */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert-success {
  background: rgba(184, 187, 38, 0.1);
  border-color: rgba(184, 187, 38, 0.3);
  color: var(--green-bright);
}

.alert-danger {
  background: rgba(251, 73, 52, 0.1);
  border-color: rgba(251, 73, 52, 0.3);
  color: var(--red-bright);
}

.alert-warning {
  background: rgba(250, 189, 47, 0.1);
  border-color: rgba(250, 189, 47, 0.3);
  color: var(--yellow-bright);
}

.alert-info {
  background: rgba(131, 165, 152, 0.1);
  border-color: rgba(131, 165, 152, 0.3);
  color: var(--blue-bright);
}

.alert-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  color: currentColor;
  opacity: 0.6;
  cursor: pointer;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  transition: opacity var(--transition);
}

.alert-dismiss:hover { opacity: 1; }

/* ============================================================
   19. Loading Spinner
   ============================================================ */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-top-color: var(--blue-bright);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

.spinner-green  { border-top-color: var(--green-bright); }
.spinner-red    { border-top-color: var(--red-bright); }
.spinner-yellow { border-top-color: var(--yellow-bright); }
.spinner-white  { border-color: rgba(255,255,255,0.3); border-top-color: #fff; }

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

/* Loading overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(40, 40, 40, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: inherit;
}

/* ============================================================
   20. Progress Bars
   ============================================================ */
.progress {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-sm { height: 4px; }
.progress-lg { height: 10px; border-radius: 5px; }

.progress-bar {
  height: 100%;
  border-radius: inherit;
  transition: width 0.5s ease;
  background: var(--blue);
}

.progress-bar-blue   { background: var(--blue); }
.progress-bar-green  { background: var(--green-bright); }
.progress-bar-red    { background: var(--red-bright); }
.progress-bar-yellow { background: var(--yellow-bright); }
.progress-bar-orange { background: var(--orange-bright); }
.progress-bar-purple { background: var(--purple-bright); }
.progress-bar-aqua   { background: var(--aqua-bright); }

.progress-bar-striped {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.08) 0px,
    rgba(255,255,255,0.08) 6px,
    transparent 6px,
    transparent 12px
  );
}

.progress-bar-animated {
  animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
  from { background-position: 0 0; }
  to   { background-position: 24px 0; }
}

/* ============================================================
   21. Tabs
   ============================================================ */
.tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 0;
  overflow-x: auto;
}

.tab {
  padding: 0.7rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--transition), border-color var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

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

.tab.active {
  color: var(--blue-bright);
  border-bottom-color: var(--blue-bright);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--bg-input);
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--fg-muted);
}

.tab.active .tab-badge {
  background: rgba(69, 133, 136, 0.25);
  color: var(--blue-bright);
}

/* Tab panel */
.tab-panel {
  display: none;
  padding: 1.25rem 0;
}

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

/* Tabs inside a card */
.card-tabs {
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   22. Timeline
   ============================================================ */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.375rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--border-light);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

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

.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: 0.3rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timeline-dot-blue   { border-color: var(--blue-bright); background: rgba(69,133,136,0.2); }
.timeline-dot-green  { border-color: var(--green-bright); background: rgba(184,187,38,0.2); }
.timeline-dot-red    { border-color: var(--red-bright); background: rgba(251,73,52,0.2); }
.timeline-dot-yellow { border-color: var(--yellow-bright); background: rgba(250,189,47,0.2); }
.timeline-dot-orange { border-color: var(--orange-bright); background: rgba(254,128,25,0.2); }
.timeline-dot-purple { border-color: var(--purple-bright); background: rgba(211,134,155,0.2); }

.timeline-time {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-bottom: 0.2rem;
}

.timeline-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.25rem;
}

.timeline-body {
  font-size: 0.825rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* ============================================================
   23. Empty State
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--fg-muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.4rem;
}

.empty-state-body {
  font-size: 0.875rem;
  color: var(--fg-muted);
  max-width: 360px;
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

/* ============================================================
   24. Login Page
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(69, 133, 136, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(177, 98, 134, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  justify-content: center;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--aqua) 100%);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--bg-dark);
}

.login-logo-text strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.login-logo-text span {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.login-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-footer {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--fg-muted);
}

/* ============================================================
   25. ATT&CK Map Grid
   ============================================================ */
.attack-map {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.attack-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 140px;
  gap: 0.5rem;
  min-width: max-content;
}

.attack-tactic {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.attack-tactic-header {
  background: rgba(69, 133, 136, 0.2);
  border: 1px solid rgba(69, 133, 136, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--blue-bright);
  text-align: center;
}

.attack-technique {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.72rem;
  color: var(--fg-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  line-height: 1.3;
}

.attack-technique:hover {
  background: var(--border-light);
  color: var(--fg);
}

.attack-technique.covered {
  background: rgba(184, 187, 38, 0.1);
  border-color: rgba(184, 187, 38, 0.3);
  color: var(--green-bright);
}

.attack-technique.partial {
  background: rgba(250, 189, 47, 0.1);
  border-color: rgba(250, 189, 47, 0.3);
  color: var(--yellow-bright);
}

.attack-technique.gap {
  background: rgba(251, 73, 52, 0.08);
  border-color: rgba(251, 73, 52, 0.25);
  color: var(--red-bright);
}

/* ============================================================
   26. Playbook Builder
   ============================================================ */
.playbook-canvas {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 500px;
  padding: 2rem;
  position: relative;
  overflow: auto;
}

.playbook-steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.playbook-step {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  width: 280px;
  position: relative;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.playbook-step:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(69, 133, 136, 0.15);
}

.playbook-step.active {
  border-color: var(--blue-bright);
}

.playbook-step-connector {
  width: 2px;
  height: 32px;
  background: var(--border-light);
  margin: 0 auto;
  position: relative;
}

.playbook-step-connector::after {
  content: '▼';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: var(--fg-muted);
}

.playbook-step-type {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.3rem;
}

.playbook-step-type-trigger  { color: var(--orange-bright); }
.playbook-step-type-action   { color: var(--blue-bright); }
.playbook-step-type-condition { color: var(--yellow-bright); }
.playbook-step-type-notify   { color: var(--purple-bright); }
.playbook-step-type-end      { color: var(--green-bright); }

.playbook-step-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.2rem;
}

.playbook-step-meta {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.playbook-step-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: none;
  gap: 0.2rem;
}

.playbook-step:hover .playbook-step-actions {
  display: flex;
}

.playbook-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-input);
  border: 1px dashed var(--border-light);
  color: var(--fg-muted);
  cursor: pointer;
  margin: 0 auto;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  font-size: 1.1rem;
  line-height: 1;
}

.playbook-add-btn:hover {
  background: rgba(69, 133, 136, 0.15);
  border-color: var(--blue);
  color: var(--blue-bright);
}

/* ============================================================
   27. Autonomy Level Selector (L0–L5)
   ============================================================ */
.autonomy-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.autonomy-card {
  background: var(--bg-input);
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.autonomy-card:hover {
  border-color: var(--blue);
  background: rgba(69, 133, 136, 0.08);
}

.autonomy-card.active {
  border-color: var(--blue-bright);
  background: rgba(69, 133, 136, 0.15);
  box-shadow: 0 0 0 3px rgba(69, 133, 136, 0.2);
}

.autonomy-level {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--blue-bright);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.autonomy-name {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  margin-bottom: 0.4rem;
}

.autonomy-desc {
  font-size: 0.7rem;
  color: var(--fg-muted);
  line-height: 1.35;
}

/* ============================================================
   28. Tooltip
   ============================================================ */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
}

.tooltip-wrapper .tooltip-text {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  color: var(--fg);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.tooltip-wrapper:hover .tooltip-text {
  opacity: 1;
}

/* Simple data-tooltip attribute tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  color: var(--fg);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 1000;
  box-shadow: var(--shadow);
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ============================================================
   29. Copy to Clipboard
   ============================================================ */
.copy-wrapper {
  position: relative;
  display: inline-flex;
}

.copy-tooltip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.copy-tooltip.show {
  opacity: 1;
}

/* ============================================================
   30. Sidebar Collapsed Tooltips (native title-based in JS)
   ============================================================ */
body.sidebar-collapsed .sidebar-link:hover .sidebar-link-text {
  display: none;
}

/* ============================================================
   31. Utility / Helper Classes
   ============================================================ */
/* Flex */
.d-flex        { display: flex; }
.d-inline-flex { display: inline-flex; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.align-center  { align-items: center; }
.align-start   { align-items: flex-start; }
.align-end     { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-1        { flex: 1; }
.gap-1         { gap: 0.25rem; }
.gap-2         { gap: 0.5rem; }
.gap-3         { gap: 0.75rem; }
.gap-4         { gap: 1rem; }
.gap-5         { gap: 1.25rem; }

/* Grid */
.grid          { display: grid; }
.grid-2        { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3        { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4        { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* Spacing */
.m-0   { margin: 0; }
.mb-1  { margin-bottom: 0.25rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-3  { margin-bottom: 0.75rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-5  { margin-bottom: 1.25rem; }
.mb-6  { margin-bottom: 1.5rem; }
.mt-1  { margin-top: 0.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-3  { margin-top: 0.75rem; }
.mt-4  { margin-top: 1rem; }
.mt-5  { margin-top: 1.25rem; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }

.p-0  { padding: 0; }
.p-2  { padding: 0.5rem; }
.p-3  { padding: 0.75rem; }
.p-4  { padding: 1rem; }
.p-5  { padding: 1.25rem; }
.p-6  { padding: 1.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }

/* Typography */
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.72rem; }
.text-lg      { font-size: 1.1rem; }
.text-xl      { font-size: 1.3rem; }
.text-muted   { color: var(--fg-muted); }
.text-fg      { color: var(--fg); }
.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-purple  { color: var(--purple-bright); }
.text-aqua    { color: var(--aqua-bright); }
.text-orange  { color: var(--orange-bright); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-bold    { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono    { font-family: 'Fira Code', monospace; }
.uppercase    { text-transform: uppercase; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Display */
.d-none        { display: none; }
.d-block       { display: block; }
.d-inline      { display: inline; }
.d-inline-block { display: inline-block; }
.invisible     { visibility: hidden; }
.opacity-50    { opacity: 0.5; }
.opacity-70    { opacity: 0.7; }

/* Sizing */
.w-full       { width: 100%; }
.h-full       { height: 100%; }
.min-w-0      { min-width: 0; }

/* Borders */
.border       { border: 1px solid var(--border); }
.border-top   { border-top: 1px solid var(--border); }
.border-b     { border-bottom: 1px solid var(--border); }
.rounded      { border-radius: var(--radius); }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 9999px; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }

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

/* Colors */
.bg-card  { background: var(--bg-card); }
.bg-dark  { background: var(--bg-dark); }
.bg-input { background: var(--bg-input); }

/* Separator */
.sep {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

/* ============================================================
   32. Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .stats-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .autonomy-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .topnav-search { flex: 0 0 220px; }
  .main-content  { padding: 1.25rem; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--sidebar-transition), width var(--sidebar-transition);
    width: var(--sidebar-width) !important;
  }

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

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

  .topnav {
    left: 0 !important;
  }

  .topnav-search {
    display: none;
  }

  .topnav-profile-info {
    display: none;
  }

  .main-content {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

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

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

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

  .notif-drawer {
    width: 100%;
  }

  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius);
  }
}

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

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

  .btn-group {
    flex-wrap: wrap;
  }

  .login-card {
    padding: 1.5rem;
  }
}

/* ============================================================
   33. Print
   ============================================================ */
@media print {
  .sidebar,
  .topnav,
  .topnav-actions,
  .notif-drawer,
  .toast-container {
    display: none !important;
  }

  .main-wrapper {
    margin: 0 !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    border: 1px solid #ccc;
    box-shadow: none;
  }
}

/* ============================================================
   34. Animations / Transitions
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

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

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

.anim-fade-in     { animation: fadeIn 0.25s ease both; }
.anim-slide-right { animation: slideInRight 0.25s ease both; }
.anim-slide-down  { animation: slideInDown 0.2s ease both; }
.anim-pulse       { animation: pulse 2s ease infinite; }

/* ============================================================
   35. Code / Pre blocks
   ============================================================ */
pre {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--green-bright);
}

code {
  background: var(--bg-input);
  border-radius: 3px;
  padding: 0.1em 0.35em;
  font-size: 0.85em;
  color: var(--orange-bright);
}

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

/* ============================================================
   36. Dividers and Separators
   ============================================================ */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--fg-muted);
  font-size: 0.78rem;
  margin: 1rem 0;
}

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

/* ============================================================
   37. Miscellaneous Components
   ============================================================ */

/* Key-value list */
.kv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.875rem;
}

.kv-key {
  color: var(--fg-muted);
  white-space: nowrap;
  font-weight: 500;
}

.kv-value {
  color: var(--fg);
  word-break: break-word;
}

/* Risk score indicator */
.risk-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 700;
  border: 2px solid;
}

.risk-critical { background: rgba(251,73,52,.15);   border-color: var(--red-bright);    color: var(--red-bright); }
.risk-high     { background: rgba(254,128,25,.15);  border-color: var(--orange-bright); color: var(--orange-bright); }
.risk-medium   { background: rgba(250,189,47,.15);  border-color: var(--yellow-bright); color: var(--yellow-bright); }
.risk-low      { background: rgba(184,187,38,.15);  border-color: var(--green-bright);  color: var(--green-bright); }

/* IOC tag chip */
.ioc-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: 'Fira Code', monospace;
  color: var(--fg-muted);
  cursor: default;
}

.ioc-tag:hover {
  border-color: var(--blue);
  color: var(--blue-bright);
}

/* Connection status dot */
.conn-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.conn-dot-online  { background: var(--green-bright); box-shadow: 0 0 5px var(--green-bright); }
.conn-dot-offline { background: var(--red-bright); }
.conn-dot-warn    { background: var(--yellow-bright); }
.conn-dot-idle    { background: var(--fg-muted); }

/* Focus ring for accessibility */
*:focus-visible {
  outline: 2px solid var(--blue-bright);
  outline-offset: 2px;
}
