/* ── Chakra Petch Font (offline) ── */
@font-face { font-family: 'Chakra Petch'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/chakra-petch-300.ttf') format('truetype'); }
@font-face { font-family: 'Chakra Petch'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/chakra-petch-500.ttf') format('truetype'); }
@font-face { font-family: 'Chakra Petch'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/chakra-petch-600.ttf') format('truetype'); }
@font-face { font-family: 'Chakra Petch'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/chakra-petch-700.ttf') format('truetype'); }

:root {
  /* ── Light Picocrypt Theme — green/white/gray ── */
  --bg-primary: #ffffff;
  --bg-secondary: #f2f4f1;
  --bg-card: #f2f4f1;
  --bg-input: #f8faf7;
  --border: #cdd5cb;
  --border-light: #cdd5cb;
  --text-primary: #252927;
  --text-secondary: #4e5a4c;
  --text-muted: #8a9487;
  --accent: #4d8b2e;
  --accent-hover: #2e5218;
  --accent-text: #ffffff;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --orange: #f97316;
  --radius: 16px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 72px;
  --topbar-h: 64px;
  --font: 'Chakra Petch', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  /* Sidebar palette */
  --sidebar-bg: #e8ece6;
  --sidebar-hover: rgba(77,139,46,0.1);
  --sidebar-active: #4d8b2e;
  --sidebar-text: #4e5a4c;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #cdd5cb;
}

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

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: #252927; text-decoration: none; }
a:hover { color: #4d8b2e; }

/* ── Custom Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cdd5cb; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8a9487; }

/* ══════════════════════════════════════════════
   LAYOUT
   ══════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--sidebar-bg);
  width: var(--sidebar-w);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #ffffff;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}
.sidebar-logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.sidebar-version {
  font-size: 11px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-logo-text { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 20px 10px 16px; }

/* Sidebar collapse toggle */
.sidebar-toggle {
  position: absolute;
  right: -14px;
  top: 76px;
  width: 28px;
  height: 28px;
  background: #f2f4f1;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  box-shadow: var(--shadow);
  font-size: 14px;
  color: #4e5a4c;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
}
.sidebar-toggle:hover {
  background: #cdd5cb;
  color: #252927;
}

/* Sidebar search */
.nav-search-box {
  padding: 0 8px 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar.collapsed .nav-search-box { display: none; }
.nav-search-box input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 12.5px;
  border: 1px solid #cdd5cb;
  border-radius: 8px;
  background: #f8faf7;
  color: #4e5a4c;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.nav-search-box input:focus {
  border-color: rgba(77,139,46,0.4);
  background: #f2f4f1;
}
.nav-search-box input::placeholder {
  color: var(--sidebar-text);
}
.nav-search-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #4d8b2e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-search-btn:hover { background: #2e5218; }

/* ── Navigation ── */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 8px;
  flex: 1;
}

.nav-group { margin-bottom: 4px; }
.nav-group-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  padding: 8px 12px 4px;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .nav-group-label { text-align: center; font-size: 0; height: 8px; padding: 4px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e8e8e8;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(77,139,46,0.15), rgba(46,82,24,0.1));
  color: #38bdf8;
  border-left: 3px solid #4d8b2e;
}
.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
}
.sidebar.collapsed .nav-item span:not(.nav-icon) { display: none; }

/* Sidebar bottom sections */
#user-display {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  color: #fff;
  font-size: 12px;
}
.sidebar.collapsed #user-display { padding: 8px; text-align: center; }
.sidebar.collapsed #user-display .user-name { display: none; }
.sidebar.collapsed #user-display .user-role { display: none; }

.sidebar-bottom-section {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-bottom-section .conn-label { display: none; }
.sidebar.collapsed .sidebar-bottom-section select { display: none; }

/* ── Top Bar ── */
.top-bar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}
.top-bar-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.top-bar-search {
  position: relative;
}
.top-bar-search input {
  width: 220px;
  padding: 9px 14px 9px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.top-bar-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77,139,46,0.25);
}
.top-bar-search input::placeholder { color: var(--text-muted); }
.top-bar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.top-bar-date {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.top-bar-notif {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  font-size: 16px;
  color: #4e5a4c;
  transition: background 0.15s;
  padding: 0;
}
.top-bar-notif:hover { background: #cdd5cb; }
.top-bar-notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: var(--red);
  border-radius: 50%;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  width: calc(100vw - var(--sidebar-w));
  overflow-x: hidden;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 28px 36px;
}
.sidebar.collapsed ~ .main-content,
body.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-w);
  width: calc(100vw - var(--sidebar-collapsed-w));
}
.main-content-inner {
  padding: 0 36px 36px;
  flex: 1;
}

/* ══════════════════════════════════════════════
   GLOBAL SEARCH OVERLAY (Ctrl+K)
   ══════════════════════════════════════════════ */
.global-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37,41,39,0.85);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding-top: 15vh;
}
.global-search-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-height: 480px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.global-search-dialog input {
  padding: 16px 20px;
  font-size: 16px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font);
}
.global-search-dialog input::placeholder { color: var(--text-muted); }
.global-search-results {
  overflow-y: auto;
  flex: 1;
  max-height: 350px;
}
.global-search-results .search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.global-search-results .search-item:hover,
.global-search-results .search-item.active {
  background: var(--bg-input);
  color: var(--text-primary);
}
.global-search-results .search-item .search-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.global-search-results .search-item .search-label { flex: 1; }
.global-search-results .search-item .search-group {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.global-search-results .search-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.search-section-label {
  padding: 6px 20px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
.search-section-label:first-child { border-top: none; margin-top: 0; }
.global-search-hint {
  display: flex;
  gap: 16px;
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}
.global-search-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #f8faf7;
  font-family: var(--font-mono);
  font-size: 10px;
  margin-right: 4px;
}

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */
button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, #4d8b2e, #2e5218);
  color: #fff;
  box-shadow: 0 4px 14px rgba(77,139,46,0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, #2563eb, #1e40af); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary {
  background: var(--bg-card);
  color: #4d8b2e;
  border: 1px solid #cdd5cb;
}
.btn-secondary:hover { background: var(--bg-input); border-color: #4d8b2e; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--yellow); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ══════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════ */
input, select, textarea {
  font-family: var(--font);
  background: #f8faf7;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(77,139,46,0.15);
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 3px;
  accent-color: var(--accent, #4d8b2e);
  vertical-align: middle;
}
textarea { font-family: var(--font-mono); resize: vertical; min-height: 200px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════
   CARDS
   ══════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 0;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.card-header h2, .card-header h3 { font-size: 16px; font-weight: 600; }

/* ── Page Header ── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }

/* ══════════════════════════════════════════════
   GRID
   ══════════════════════════════════════════════ */
.grid { display: grid; gap: 20px; width: 100%; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 1400px) {
  .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main-content { margin-left: 0 !important; width: 100% !important; }
  .main-content-inner { padding: 0 16px 16px; }
}

/* ══════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════ */
table { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: auto; }
thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 16px; padding-right: 8px; width: 36px; text-align: center; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-primary); }
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  line-height: 1.5;
}
tbody tr:hover { background: rgba(77,139,46,0.05); }
tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-green { background: rgba(34,197,94,0.12); color: #22c55e; }
.badge-red { background: rgba(239,68,68,0.12); color: #ef4444; }
.badge-yellow { background: rgba(245,158,11,0.12); color: #f59e0b; }
.badge-blue { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.badge-gray { background: rgba(138,148,135,0.15); color: #4e5a4c; }
.badge-orange { background: rgba(249,115,22,0.12); color: #f97316; }

/* ══════════════════════════════════════════════
   STATS
   ══════════════════════════════════════════════ */
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ══════════════════════════════════════════════
   TERMINAL
   ══════════════════════════════════════════════ */
.terminal {
  background: #060810;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: #4ade80;
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.terminal .text-green { color: #4ade80; }
.terminal .text-red { color: #f87171; }
.terminal .text-yellow { color: #fbbf24; }

/* ══════════════════════════════════════════════
   MODAL
   ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(37,41,39,0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h2 { font-size: 18px; margin-bottom: 20px; }

/* ══════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 16px;
  background: none;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 13px;
}
.tab.active {
  color: #4d8b2e;
  border-bottom-color: #4d8b2e;
  font-weight: 600;
}
.tab:hover { color: var(--text-primary); }

/* ══════════════════════════════════════════════
   FORM LAYOUT
   ══════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { margin-bottom: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.span-2 { grid-column: span 2; }

/* ══════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-secondary); }
.error-msg {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--red);
  font-size: 13px;
  margin-bottom: 16px;
}
.success-msg {
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--green);
  font-size: 13px;
  margin-bottom: 16px;
}
.mt-16 { margin-top: 20px; }
.mb-16 { margin-bottom: 24px; }
.text-mono { font-family: var(--font-mono); font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.inline-flex { display: inline-flex; align-items: center; gap: 8px; }

/* ══════════════════════════════════════════════
   LOGGING
   ══════════════════════════════════════════════ */
#log-content table tbody tr td:first-child { white-space: nowrap; }
#log-content .terminal { max-height: calc(100vh - 280px); }

/* ══════════════════════════════════════════════
   TOPOLOGY
   ══════════════════════════════════════════════ */
.topo-container { display: flex; gap: 24px; min-height: calc(100vh - 140px); }
.topo-tree { flex: 1; min-width: 0; }
.topo-detail { width: 360px; flex-shrink: 0; }

.topo-node {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.topo-node:hover { border-color: var(--text-primary); box-shadow: var(--shadow-md); }
.topo-node.selected { border-color: var(--text-primary); box-shadow: 0 0 0 1px var(--text-primary); }
.topo-node-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.topo-node-info { flex: 1; min-width: 0; }
.topo-node-name { font-weight: 600; font-size: 14px; }
.topo-node-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.topo-children { margin-left: 28px; padding-left: 20px; border-left: 2px solid var(--border); }
.topo-section { margin-bottom: 20px; }
.topo-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}
.topo-detail-section { margin-bottom: 16px; }
.topo-detail-section h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
.topo-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  margin: 2px 2px 2px 0;
}

/* ══════════════════════════════════════════════
   CONSOLE AUTOCOMPLETE
   ══════════════════════════════════════════════ */
.autocomplete {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 10;
}
.autocomplete.show { display: block; }
.autocomplete-item {
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
}
.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--bg-input);
}

/* ══════════════════════════════════════════════
   KPI CARDS
   ══════════════════════════════════════════════ */
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  border-color: var(--text-muted);
}
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #4d8b2e;
  border-radius: 0 4px 4px 0;
}
.kpi-card--green::before { background: var(--green); }
.kpi-card--yellow::before { background: var(--yellow); }
.kpi-card--orange::before { background: var(--orange); }
.kpi-card--red::before { background: var(--red); }
.kpi-card--blue::before { background: #4d8b2e; }
.kpi-card--gray::before { background: #9ca3af; }

.kpi-value { font-size: 32px; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 6px; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ══════════════════════════════════════════════
   CHARTS
   ══════════════════════════════════════════════ */
.chart-container { padding: 16px 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); }
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Expiry timeline bars */
.expiry-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  position: relative;
}
.expiry-bar {
  flex: 1;
  min-width: 16px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: opacity 0.2s;
}
.expiry-bar:hover { opacity: 0.85; }
.expiry-bar-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}
.expiry-bar-count {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── Quick Actions ── */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-actions button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s;
}
.quick-actions button:hover {
  border-color: var(--accent);
  background: rgba(77,139,46,0.08);
}

/* ── Quick Action Buttons (link-styled) ── */
.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.quick-action-btn:hover {
  border-color: var(--accent);
  background: rgba(77,139,46,0.08);
}
.quick-action-icon { font-size: 16px; }

/* ── KPI Secondary Row (dashboard status row) ── */
.kpi-secondary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 24px;
}
.kpi-secondary-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}
.kpi-secondary-item:hover { box-shadow: var(--shadow); }
.kpi-secondary-item .kpi-sec-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Horizontal Bar Charts (dashboard analytics) ── */
.horizontal-bar {
  display: block;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
}
.horizontal-bar--link { cursor: pointer; }
.horizontal-bar--link:hover .horizontal-bar-fill { opacity: 0.8; }
.horizontal-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}
.hb-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.horizontal-bar-track {
  width: 100%;
  height: 10px;
  background: var(--bg-input);
  border-radius: 5px;
  overflow: hidden;
}
.horizontal-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

/* ── Vertical Bar Charts (dashboard analytics) ── */
.vertical-bars {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 140px;
  padding-top: 20px;
}
.vertical-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.vertical-bar-item--link { cursor: pointer; }
.vertical-bar-item--link:hover .vertical-bar-stick { opacity: 0.8; }
.vertical-bar-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.vertical-bar-stick {
  width: 100%;
  max-width: 44px;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease, opacity 0.2s;
}
.vertical-bar-name {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

/* ── Grade Ribbon Pills (compliance) ── */
.grade-pill {
  width: 28px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-input);
  color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s;
}
.grade-pill.active-A { background: rgba(34,197,94,0.12); color: #22c55e; }
.grade-pill.active-B { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.grade-pill.active-C { background: rgba(245,158,11,0.12); color: #f59e0b; }
.grade-pill.active-D { background: rgba(249,115,22,0.12); color: #f97316; }
.grade-pill.active-E { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Expiry status ── */
.expiry-countdown { font-weight: 600; }
.urgent { color: var(--red); }
.warning { color: var(--orange); }
.ok { color: var(--yellow); }
.alg-badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}
.alg-key { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.alg-hash { background: rgba(34,197,94,0.12); color: #22c55e; }

/* Source badges */
.source-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  background: rgba(138,148,135,0.15); color: #4e5a4c;
}
.source-picocrypt-ui { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.source-bulk-enrollment { background: rgba(245,158,11,0.12); color: #f59e0b; }
.source-workflow { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.source-servicenow { background: rgba(14,165,233,0.12); color: #0ea5e9; }
.source-api { background: rgba(34,197,94,0.12); color: #22c55e; }
.source-self-service { background: rgba(236,72,153,0.12); color: #ec4899; }
.source-acme, .source-est, .source-cmp, .source-scep { background: rgba(34,197,94,0.1); color: #22c55e; }
.source-discovery { background: rgba(249,115,22,0.12); color: #f97316; }
.source-nhi-scan { background: rgba(239,68,68,0.12); color: #ef4444; }
.source-cert-scanner { background: rgba(239,68,68,0.12); color: #ef4444; }
.source-pqc-migration { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.source-pre-existing { background: rgba(138,148,135,0.15); color: #4e5a4c; }

/* Destination badges */
.dest-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  background: rgba(14,165,233,0.1); color: #38bdf8;
  border: 1px solid rgba(14,165,233,0.2);
}
.dest-servicenow-cmdb { background: rgba(14,165,233,0.1); color: #0ea5e9; border-color: rgba(14,165,233,0.25); }
.dest-ldap { background: rgba(245,158,11,0.1); color: #f59e0b; border-color: rgba(245,158,11,0.25); }
.dest-webhook { background: rgba(139,92,246,0.1); color: #8b5cf6; border-color: rgba(139,92,246,0.25); }

/* Integration hub cards */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.integration-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}
.integration-card:hover { border-color: var(--text-muted); color: inherit; }
.integration-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.integration-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-xs);
}
.integration-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.integration-card-info { font-size: 12px; }

/* Integration list view */
.integration-list-table { width: 100%; border-collapse: collapse; }
.integration-list-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 8px 12px; border-bottom: 2px solid var(--border); }
.integration-list-table td { padding: 12px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.integration-list-table tr[data-href] { cursor: pointer; }
.integration-list-table tr[data-href]:hover td { background: var(--bg-tertiary, #f0f0eb); }
.integration-list-table .integ-icon { font-size: 18px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.integration-list-table .integ-name { font-weight: 600; font-size: 14px; }
.integration-list-table .integ-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.integration-category-row td { background: var(--bg-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; padding: 6px 12px; }
.integ-test-result { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-left: 8px; }
.integ-test-ok { color: var(--success); }
.integ-test-fail { color: var(--danger); }

/* Integration detail preview table */
.preview-table { width: 100%; font-size: 13px; }
.preview-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.preview-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-light); }

/* Activity feed */
.activity-feed { list-style: none; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  line-height: 1.5;
}
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
}
.activity-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; margin-left: auto; }

/* ── Search bar ── */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; }
.search-bar::before {
  content: '\2315';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* ── Filter row ── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}
.filter-row select,
.filter-row input {
  width: auto;
  min-width: 120px;
}

/* ── Bulk actions bar ── */
.bulk-actions-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  background: rgba(37,41,39,0.98);
  border-top: 2px solid #4d8b2e;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  z-index: 200;
  animation: slideUp 0.2s;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.3);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ── Bulk action bar ── */
.bulk-bar {
  position: sticky;
  bottom: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sidebar-bg, #1a1a1a);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  margin-top: 12px;
  animation: slideUp 0.15s ease;
}
.bulk-bar .bulk-count {
  font-size: 13px;
  font-weight: 600;
  margin-right: 4px;
  color: rgba(255,255,255,0.85);
  flex: 1;
}
.bulk-bar .btn-sm { font-size: 12px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  font-size: 13px;
}
.pagination-info { color: var(--text-secondary); }

/* ── Crypto grades ── */
.grade { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 700; font-size: 12px; }
.grade-A { background: rgba(34,197,94,0.12); color: #22c55e; }
.grade-B { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.grade-C { background: rgba(245,158,11,0.12); color: #f59e0b; }
.grade-D { background: rgba(249,115,22,0.12); color: #f97316; }
.grade-E { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Loading skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input), #cdd5cb, var(--bg-input));
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-card { height: 80px; }

/* ── Button hover ── (no transform — avoids layout thrash on pages with many buttons) */

/* ── Table row highlights ── */
tbody tr { border-left: 3px solid transparent; transition: border-color 0.15s; }
tbody tr:hover { border-left-color: #4d8b2e; }

/* ── Certificate details ── */
.cert-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .cert-detail-grid { grid-template-columns: 1fr; } }
.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-secondary);
}
.copy-btn:hover { background: var(--bg-input); color: var(--text-primary); }

/* ── Keyboard shortcuts ── */
.shortcuts-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; }
.shortcut-key {
  display: inline-block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Responsive topology ── */
@media (max-width: 1000px) {
  .topo-container { flex-direction: column; }
  .topo-detail { width: 100%; }
}

/* ══════════════════════════════════════════════
   PERFORMANCE PANEL
   ══════════════════════════════════════════════ */
.perf-progress {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-input);
  overflow: hidden;
}
.perf-progress-fill {
  height: 100%;
  background: #4d8b2e;
  border-radius: 4px;
  transition: width 0.3s;
}
.perf-progress-fill.has-errors {
  background: linear-gradient(90deg, var(--green), var(--red));
}
.perf-kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.perf-kpi {
  text-align: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}
.perf-kpi-label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); }
.perf-kpi-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.perf-kpi-val.green { color: var(--green); }
.perf-kpi-val.red { color: var(--red); }
.perf-kpi-val.blue { color: #4d8b2e; }
.perf-log-wrap { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perf-status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.perf-status-line .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.btn-cancel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-cancel:hover { border-color: var(--red); color: var(--red); }

/* ══════════════════════════════════════════════
   CHATBOT
   ══════════════════════════════════════════════ */
#chat-messages::-webkit-scrollbar { width: 4px; }
#chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#chat-messages code { font-family: var(--font-mono); }
#chat-messages strong { color: var(--text-primary); font-weight: 600; }
#chat-messages table { font-size: 12px; margin: 8px 0; }
#chat-input { font-size: 14px; padding: 10px 14px; }
.typing-indicator { color: var(--text-muted); font-style: italic; animation: pulse 1.5s infinite; }

/* ══════════════════════════════════════════════
   DASHBOARD TOOLBAR
   ══════════════════════════════════════════════ */
.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 28px;
  padding-top: 8px;
}
.dashboard-toolbar h1 { font-size: 24px; font-weight: 700; }
.dashboard-toolbar-actions { display: flex; gap: 8px; align-items: center; }
.dashboard-toolbar .toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: background 0.15s, border-color 0.15s;
}
.dashboard-toolbar .toolbar-btn:hover {
  border-color: #4d8b2e;
  color: var(--text-primary);
}
.dashboard-toolbar .toolbar-btn.active {
  background: #4d8b2e;
  color: #fff;
  border-color: #4d8b2e;
}

/* ══════════════════════════════════════════════
   KPI SUMMARY CARDS (Dashboard)
   ══════════════════════════════════════════════ */
.kpi-summary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 4px; }
@media (max-width: 1000px) { .kpi-summary-row { grid-template-columns: 1fr; } }
.kpi-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
}
.kpi-summary-card:hover { border-color: var(--text-muted); color: inherit; }
.kpi-summary-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #4d8b2e;
  border-radius: 0 4px 4px 0;
}
.kpi-summary-card--green::before { background: var(--green); }
.kpi-summary-card--orange::before { background: var(--orange); }
.kpi-summary-card--yellow::before { background: var(--yellow); }
.kpi-summary-card--red::before { background: var(--red); }
.kpi-summary-value { font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 12px; }
.kpi-summary-label { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; font-weight: 600; margin-top: 10px; letter-spacing: 0.5px; }
.kpi-summary-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ── KPI Trends ── */
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
}
.kpi-trend--up { background: rgba(34,197,94,0.12); color: #22c55e; }
.kpi-trend--down { background: rgba(239,68,68,0.12); color: #ef4444; }
.kpi-trend--neutral { background: rgba(138,148,135,0.15); color: #4e5a4c; }

/* ── New Streamlined Dashboard KPIs ── */
.dash-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1200px) { .dash-kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .dash-kpi-row { grid-template-columns: 1fr; } }
.dash-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s;
}
.dash-kpi:hover { border-color: var(--text-muted); color: inherit; }
.dash-kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 8px; }
.dash-kpi-value { font-size: 32px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.dash-kpi-value--primary { color: #4742c2; }
.dash-kpi-value--green { color: var(--green); }
.dash-kpi-value--coral { color: #fa7963; }
.dash-kpi-footer { font-size: 12px; color: var(--text-muted); margin-top: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Dashboard Chart Area ── */
.dash-chart-area { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 1200px) { .dash-chart-area { grid-template-columns: 1fr; } }

/* ── Trends Row (two graphs squeezed side by side) ── */
.dash-trends-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 1000px) { .dash-trends-row { grid-template-columns: 1fr; } }

/* ── Trend Area Graphs ── */
.trend-chart { position: relative; }
.trend-chart-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.trend-chart-total { font-size: 18px; font-weight: 700; color: var(--text-primary); }
.trend-chart-period { font-size: 12px; color: var(--text-muted); }
.trend-graph-svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-axis-label { font-size: 9px; fill: var(--text-muted); font-family: var(--font-mono, monospace); }
/* Clickable hit areas */
.trend-hit { cursor: pointer; text-decoration: none; }
.trend-hit .trend-dot { opacity: 0; transition: opacity 0.15s; }
.trend-hit .trend-val { opacity: 0; font-size: 8px; font-weight: 700; fill: var(--text-primary); transition: opacity 0.15s; pointer-events: none; }
.trend-hit .trend-hit-rect { transition: fill 0.1s; }
.trend-hit:hover .trend-dot { opacity: 1; }
.trend-hit:hover .trend-val { opacity: 1; }
.trend-hit:hover .trend-hit-rect { fill: rgba(77,139,46, 0.06); }
.trend-hit:hover .trend-axis-label { fill: var(--text-primary); font-weight: 600; }

/* ── Donut Charts ── */
.donut-chart-wrap { display: flex; align-items: center; gap: 24px; justify-content: center; flex-wrap: wrap; }
.donut-chart-svg { display: block; flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-label { color: var(--text-secondary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend-count { font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }

/* ── KPI Secondary Row ── */
.kpi-sec-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.kpi-sec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: background 0.2s, border-color 0.2s;
}
.kpi-sec-item:hover { box-shadow: var(--shadow); }
.kpi-sec-value { font-size: 18px; font-weight: 700; }

/* ══════════════════════════════════════════════
   ANALYTICS CARDS
   ══════════════════════════════════════════════ */
.analytics-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 24px; }
.analytics-row--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1200px) { .analytics-row--3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1000px) { .analytics-row { grid-template-columns: 1fr; } .analytics-row--3 { grid-template-columns: 1fr; } }
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.analytics-card h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}

/* ── Horizontal bar charts ── */
.hbar-item { margin-bottom: 10px; }
.hbar-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--text-secondary); }
.hbar-label .count { font-weight: 600; color: var(--text-primary); }
.hbar-track { width: 100%; height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }

/* ── Vertical bar charts ── */
.vbar-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.vbar-item { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.vbar-stick { width: 100%; max-width: 40px; border-radius: 3px 3px 0 0; transition: height 0.3s; }
.vbar-label { font-size: 9px; color: var(--text-muted); white-space: nowrap; }
.vbar-item:hover .vbar-stick { background: rgba(77,139,46,0.5) !important; }

/* Filter banner */
.filter-banner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid #4d8b2e;
  padding: 8px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════════
   COMPLIANCE CARDS
   ══════════════════════════════════════════════ */
.compliance-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
@media (max-width: 1200px) { .compliance-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .compliance-row { grid-template-columns: 1fr; } }
.compliance-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.compliance-card:hover {
  border-color: #4d8b2e;
}
.compliance-card h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  min-height: 28px;
  font-weight: 600;
  line-height: 1.4;
}

/* ── Gauge charts ── */
.gauge-chart { position: relative; display: inline-block; }
.gauge-chart-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  font-weight: 700;
}

/* ── Grade ribbons ── */
.grade-ribbon { display: flex; gap: 6px; margin-top: 4px; }
.grade-ribbon-pill {
  width: 26px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-input);
  color: var(--text-muted);
}
.grade-ribbon-pill.active-A { background: rgba(34,197,94,0.12); color: #22c55e; }
.grade-ribbon-pill.active-B { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.grade-ribbon-pill.active-C { background: rgba(245,158,11,0.12); color: #f59e0b; }
.grade-ribbon-pill.active-D { background: rgba(249,115,22,0.12); color: #f97316; }
.grade-ribbon-pill.active-E { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── Coming soon placeholder ── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
}
.coming-soon-icon { font-size: 48px; opacity: 0.5; margin-bottom: 16px; }
.coming-soon h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.coming-soon p { font-size: 14px; color: var(--text-muted); max-width: 400px; }

/* ══════════════════════════════════════════════
   NOTIFICATION CHANNELS
   ══════════════════════════════════════════════ */
.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.channel-badge { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.channel-badge.email { background: rgba(34,197,94,0.12); color: #22c55e; }
.channel-badge.webhook { background: rgba(245,158,11,0.12); color: #f59e0b; }
.channel-badge.slack { background: rgba(139,92,246,0.12); color: #8b5cf6; }

/* ── Request status badges ── */
.req-pending { color: var(--yellow); }
.req-approved { color: var(--green); }
.req-rejected { color: var(--red); }
.req-completed { color: #4d8b2e; }

/* ── Policy severity ── */
.severity-warn { color: var(--yellow); }
.severity-block { color: var(--red); }

/* ── Compliance detail ── */
.compliance-detail { padding: 24px; text-align: center; }
.compliance-detail-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
@media (max-width: 1200px) { .compliance-detail-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .compliance-detail-row { grid-template-columns: 1fr; } }
.compliance-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.compliance-detail-card:hover { border-color: #4d8b2e; }

/* ── Import dropzone ── */
.import-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
  color: var(--text-muted);
}
.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: #4d8b2e;
  background: rgba(77,139,46,0.05);
}

/* ── Toggle switch ── */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Scan progress ── */
.scan-progress {
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.scan-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: #4d8b2e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-stats, .scan-items {
  padding: 6px 10px;
  background: var(--bg-input);
  border-radius: var(--radius-xs);
  font-size: 12px;
}

/* ══════════════════════════════════════════════
   SCANNER LAYOUT
   ══════════════════════════════════════════════ */
.scanner-layout { display: flex; gap: 0; position: relative; }
.scanner-main { flex: 1; min-width: 0; transition: margin-right 0.2s; }
.scanner-detail-pane {
  width: 400px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  max-height: calc(100vh - 80px);
  position: sticky;
  top: 80px;
}
@media (max-width: 1200px) {
  .scanner-layout { flex-direction: column; }
  .scanner-detail-pane { width: 100%; border-left: none; border-top: 1px solid var(--border); max-height: none; position: static; }
}
.scanner-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.scanner-detail-body { padding: 12px 16px; }
.scanner-detail-section { margin-bottom: 16px; }
.scanner-detail-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
tbody tr.selected-row { outline: 2px solid #4d8b2e; outline-offset: -2px; }

/* ── Compliance detail grid ── */
.compliance-detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1200px) { .compliance-detail-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .compliance-detail-grid { grid-template-columns: 1fr; } }

/* ── KPI row ── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-row .card { text-align: center; }
.kpi-row .kpi-value { font-size: 28px; }
.kpi-row .kpi-label { font-size: 12px; }
@media (max-width: 900px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

/* ── Responsive overrides ── */
@media (max-width: 1400px) {
  .analytics-row { grid-template-columns: repeat(2, 1fr); }
  .compliance-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1000px) {
  .kpi-summary-row { grid-template-columns: 1fr; }
  .analytics-row { grid-template-columns: 1fr; }
  .compliance-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .kpi-sec-row { flex-direction: column; }
  .compliance-row { grid-template-columns: 1fr; }
  .kpi-summary-value { font-size: 32px; }
  .kpi-sec-value { font-size: 16px; }
}

/* ── Auto-Renewal ── */
.match-indicator { font-size: 11px; color: #4d8b2e; font-style: italic; }

/* ── Deployment target types ── */
.target-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.target-type.ssh { background: rgba(34,197,94,0.12); color: #22c55e; }
.target-type.api { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.target-type.azure-kv { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.target-type.file { background: rgba(245,158,11,0.12); color: #f59e0b; }

.deploy-success { color: var(--green); }
.deploy-failed { color: var(--red); }
.deploy-pending { color: var(--yellow); }

/* ══════════════════════════════════════════════
   TOASTS
   ══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: slideUp 0.3s;
  z-index: 2000;
  max-width: 400px;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ── Signer type badges ── */
.signer-type {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.signer-type.pkcs12 { background: rgba(34,197,94,0.12); color: #22c55e; }
.signer-type.pkcs11 { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.signer-type.emulator { background: rgba(245,158,11,0.12); color: #f59e0b; }

/* ══════════════════════════════════════════════
   WORKFLOW COMPONENTS
   ══════════════════════════════════════════════ */
.wf-steps { display: flex; gap: 0; flex-wrap: wrap; }
.wf-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.wf-step.approved { border-color: var(--green); background: rgba(34,197,94,0.1); color: #22c55e; }
.wf-step.rejected { border-color: var(--red); background: rgba(239,68,68,0.1); color: #ef4444; }
.wf-step.pending { color: var(--text-muted); }
.wf-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: #4d8b2e;
  color: #fff;
  flex-shrink: 0;
}
.wf-step-arrow { font-size: 18px; color: var(--text-muted); padding: 0 8px; }
.wf-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* ── Event Chain Timeline ─────────────────────────────────────── */
.event-chain-timeline { padding: 12px 16px; position: relative; }
.event-chain-timeline::before { content: ''; position: absolute; left: 26px; top: 20px; bottom: 20px; width: 2px; background: var(--border); }
.event-chain-item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.event-chain-item:first-child { padding-top: 0; }
.event-chain-item:last-child { padding-bottom: 0; }
.event-chain-future { opacity: 0.5; }
.event-chain-dot { width: 20px; min-width: 20px; text-align: center; font-size: 14px; line-height: 20px; z-index: 1; background: var(--bg-card); }
.event-chain-content { flex: 1; min-width: 0; }
.event-chain-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.event-chain-label { font-weight: 600; font-size: 13px; }
.event-chain-ts { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.event-chain-detail { font-size: 12px; color: var(--text-secondary); margin-top: 2px; word-break: break-word; }
.event-chain-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; font-size: 11px; color: var(--text-muted); }
.event-chain-meta a { color: var(--green); text-decoration: none; }
.event-chain-meta a:hover { text-decoration: underline; }
.event-chain-txn { font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; background: var(--bg-tertiary); border-radius: 3px; }

.wf-history { font-size: 13px; line-height: 1.8; }
.wf-diagram { display: flex; flex-wrap: wrap; gap: 10px; }
.wf-diagram-node {
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  min-width: 130px;
  text-align: center;
}
.wf-diagram-node.initial { border: 2px solid var(--text-primary); }
.wf-diagram-node.final { border: 2px dashed var(--text-muted); opacity: 0.7; }
.wf-diagram-events {
  font-size: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.wf-diagram-events span {
  background: rgba(77,139,46,0.15);
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ══════════════════════════════════════════════
   ADCS WIZARD
   ══════════════════════════════════════════════ */
.wizard-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  overflow-x: auto;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  min-width: 120px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: default;
  opacity: 0.5;
  white-space: nowrap;
}
.wizard-step:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.wizard-step:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.wizard-step + .wizard-step { border-left: none; }
.wizard-step.active {
  opacity: 1;
  border-color: #4d8b2e;
  background: rgba(77,139,46,0.1);
  z-index: 1;
}
.wizard-step.completed {
  opacity: 1;
  border-color: var(--green);
  background: rgba(34,197,94,0.1);
  cursor: pointer;
}
.wizard-step.skipped {
  opacity: 0.7;
  border-color: var(--border);
  background: var(--bg-card);
}
.wizard-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--text-muted);
  color: #fff;
}
.wizard-step.active .wizard-step-num { background: #4d8b2e; }
.wizard-step.completed .wizard-step-num { background: var(--green); }
.wizard-step-label { line-height: 1.2; }
.wizard-step-label small { display: block; font-size: 10px; font-weight: 400; color: var(--text-muted); }
.wizard-content { min-height: 400px; }
.wizard-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}
.wizard-footer .btn + .btn { margin-left: 8px; }
.wizard-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}
.wizard-progress-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width 0.3s;
}
.wizard-log {
  max-height: 300px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 12px;
}
.wizard-log-entry { padding: 2px 0; }
.wizard-log-entry.success { color: var(--green); }
.wizard-log-entry.error { color: var(--red); }
.wizard-log-entry.info { color: var(--text-secondary); }
.wizard-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: var(--bg-primary);
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card .login-logo { font-size: 28px; font-weight: 700; color: var(--text-primary); text-align: center; margin-bottom: 4px; }
.login-card .login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 32px;
}

/* ══════════════════════════════════════════════
   CERTIFICATE GRADING
   ══════════════════════════════════════════════ */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}
.grade-badge.A { background: rgba(34,197,94,0.12); color: #22c55e; }
.grade-badge.B { background: rgba(77,139,46,0.12); color: #4d8b2e; }
.grade-badge.C { background: rgba(245,158,11,0.12); color: #f59e0b; }
.grade-badge.D { background: rgba(249,115,22,0.12); color: #f97316; }
.grade-badge.F { background: rgba(239,68,68,0.12); color: #ef4444; }
.tag-card:hover { box-shadow: var(--shadow); }
.policy-card { transition: border-color 0.15s; }
.policy-card:hover { border-color: var(--text-primary); }
.policy-default { border-color: #22c55e; }
.grade-detail td { background: var(--bg-input); }

/* ══════════════════════════════════════════════
   FLOATING CHATBOT BUTTON
   ══════════════════════════════════════════════ */
.fab-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4d8b2e, #2e5218);
  color: #fff;
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(77,139,46,0.4);
  z-index: 1000;
  transition: background 0.2s, border-color 0.2s;
}
.fab-chatbot:hover { background: linear-gradient(135deg, #2563eb, #1e40af); transform: scale(1.08); }

/* ── Hidden nav group ── */
.nav-group-hidden .nav-group-label { display: none; }

/* When sidebar is hidden (login page) */
.sidebar[style*="display: none"] ~ .main-content,
.sidebar[style*="display:none"] ~ .main-content {
  margin-left: 0 !important;
  width: 100% !important;
}

/* ══════════════════════════════════════════════
   SETTINGS SUB-NAVIGATION
   ══════════════════════════════════════════════ */
.settings-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.settings-subnav .tab {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  border-bottom: none;
}
.settings-subnav .tab:hover { background: var(--bg-input); }
.settings-subnav .tab.active {
  background: #4d8b2e;
  color: #fff;
  font-weight: 600;
  border-bottom: none;
}

/* ══════════════════════════════════════════════
   USER AVATAR (sidebar bottom)
   ══════════════════════════════════════════════ */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-name { color: #fff; font-size: 13px; font-weight: 500; }
.user-role { color: var(--sidebar-text); font-size: 11px; }

/* ══════════════════════════════════════════════
   PERIOD TOGGLE (charts)
   ══════════════════════════════════════════════ */
.period-toggle {
  display: inline-flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.period-toggle button {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  transition: background 0.15s, border-color 0.15s;
}
.period-toggle button:hover { color: var(--text-primary); transform: none; }
.period-toggle button.active {
  background: #4d8b2e;
  color: #fff;
  box-shadow: var(--shadow);
  transform: none;
}

/* ── ServiceNow Enrollment Table ── */
#snow-enroll-table td { padding: 6px 4px; vertical-align: middle; }
#snow-enroll-table input,
#snow-enroll-table select { font-size: 12px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-primary); }
#snow-enroll-table .se-remove { padding: 2px 8px; font-size: 14px; line-height: 1; }
#snow-enroll-table tbody tr:last-child td { border-bottom: none; }

/* ── License Page ── */
#license-upload-form input[type="file"] { padding: 8px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg-primary); cursor: pointer; }
#license-upload-form input[type="file"]:hover { border-color: var(--accent); }
.license-feature-locked { position: relative; }
.license-feature-locked::after { content: 'Requires upgrade'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(37,41,39,0.85); color: #4e5a4c; font-weight: 600; font-size: 13px; border-radius: var(--radius); pointer-events: none; }
