/* =========================================================
   Oasis Scan — Main Stylesheet
   ========================================================= */

/* --- Variables --- */
:root {
  --bg-base:       #08090e;
  --bg-panel:      #0f1117;
  --bg-card:       #161822;
  --bg-hover:      #1c1f2e;

  --border:        #1e2235;
  --border-accent: #2a3050;

  --text-primary:  #e2e8f0;
  --text-secondary:#8892a4;
  --text-muted:    #4a5568;

  --accent:        #00d4ff;
  --accent-dim:    #005f72;
  --accent-glow:   rgba(0, 212, 255, 0.12);

  --sev-critical:  #ff3860;
  --sev-high:      #ff6b35;
  --sev-medium:    #f5a623;
  --sev-low:       #27c93f;
  --sev-info:      #4a9eff;

  --font-mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --font-sans:     'Inter', 'Segoe UI', system-ui, sans-serif;

  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;

  --sidebar-w:     240px;
  --topbar-h:      56px;

  --transition:    150ms ease;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

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

ul { list-style: none; }

/* =========================================================
   Layout
   ========================================================= */

/* --- Sidebar --- */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

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

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #0055aa);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.sidebar-logo .logo-text span {
  color: var(--accent);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 20px 20px 6px;
}

.sidebar-nav {
  padding: 4px 10px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--accent-dim);
}

.nav-item .nav-icon { font-size: 15px; width: 18px; text-align: center; }

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--sev-critical);
  color: #fff;
}

.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

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

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email-small,
.user-provider {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* --- Top Bar --- */
#topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 99;
  gap: 16px;
}

.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.topbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sev-low);
  box-shadow: 0 0 6px var(--sev-low);
  animation: pulse 2s infinite;
}

.status-dot.idle { background: var(--text-muted); box-shadow: none; animation: none; }
.status-dot.scanning { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.status-dot.error { background: var(--sev-critical); box-shadow: 0 0 6px var(--sev-critical); }

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

/* --- Main Content --- */
#main {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  padding: 28px 28px 48px;
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover { background: #33ddff; border-color: #33ddff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-accent);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: transparent;
  color: var(--sev-critical);
  border-color: var(--sev-critical);
}
.btn-danger:hover { background: rgba(255,56,96,0.1); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

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

/* =========================================================
   Cards & Panels
   ========================================================= */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .icon { color: var(--accent); }

.panel-body {
  padding: 20px;
}

.panel-body.no-pad { padding: 0; }

/* --- Stat Cards Row --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--border-accent); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.stat-card-jump { cursor: pointer; }

/* --- Page section spacing (panels stack with consistent gap) --- */
.page-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Overview two-column row --- */
.overview-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .overview-row { grid-template-columns: 1fr; }
}

/* Security posture summary */
.posture-summary {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 4px 0 16px;
}
.posture-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--bg-hover);
  border: 1px solid var(--border-accent);
}
.posture-summary.posture-ok   .posture-icon { color: var(--sev-low);      border-color: var(--sev-low); }
.posture-summary.posture-warn .posture-icon { color: var(--sev-critical); border-color: var(--sev-critical); }
.posture-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.posture-sub   { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

/* Severity breakdown strip */
.sev-breakdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.sev-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.sev-dot.crit { background: var(--sev-critical); }
.sev-dot.high { background: var(--sev-high); }
.sev-dot.med  { background: var(--sev-medium); }
.sev-dot.low  { background: var(--sev-low); }
.sev-n   { font-size: 20px; font-weight: 800; font-family: var(--font-mono); line-height: 1.1; }
.sev-cap { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

/* Top vulnerabilities preview rows */
.ov-cve-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border);
}
.ov-cve-row:last-child { border-bottom: none; }
.ov-cve-row .cvss-score {
  flex-shrink: 0;
  min-width: 34px;
  text-align: center;
  font-weight: 800;
}
.ov-cve-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.ov-cve-main .cve-id { font-size: 12px; }
.ov-cve-pkg {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   Severity Badges
   ========================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-critical { background: rgba(255,56,96,0.15);  color: var(--sev-critical); border: 1px solid rgba(255,56,96,0.3); }
.badge-high     { background: rgba(255,107,53,0.15); color: var(--sev-high);     border: 1px solid rgba(255,107,53,0.3); }
.badge-medium   { background: rgba(245,166,35,0.15); color: var(--sev-medium);   border: 1px solid rgba(245,166,35,0.3); }
.badge-low      { background: rgba(39,201,63,0.15);  color: var(--sev-low);      border: 1px solid rgba(39,201,63,0.3); }
.badge-info     { background: rgba(74,158,255,0.15); color: var(--sev-info);     border: 1px solid rgba(74,158,255,0.3); }

/* =========================================================
   Section: System Overview
   ========================================================= */

#section-overview .spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.spec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.spec-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-accent);
}

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

.spec-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.spec-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-detail {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Progress bar for resource usage */
.usage-bar {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 99px;
  margin-top: 6px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.usage-fill.warn  { background: var(--sev-medium); }
.usage-fill.crit  { background: var(--sev-critical); }

/* =========================================================
   Section: Integrity
   ========================================================= */

.integrity-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-panel);
}

.integrity-banner-ok   { border-color: rgba(39,201,63,0.35);  background: rgba(39,201,63,0.06); }
.integrity-banner-warn { border-color: rgba(245,166,35,0.4);  background: rgba(245,166,35,0.06); }

.integrity-banner-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-hover);
}

.integrity-banner-ok   .integrity-banner-icon { color: var(--sev-low); }
.integrity-banner-warn .integrity-banner-icon { color: var(--sev-medium); }

.integrity-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.integrity-banner-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* =========================================================
   Section: CVE Results
   ========================================================= */

#section-cves .filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-accent);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  transition: all var(--transition);
}

.filter-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.filter-chip.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent-dim); }
.filter-chip.critical.active { background: rgba(255,56,96,0.15); color: var(--sev-critical); border-color: rgba(255,56,96,0.3); }
.filter-chip.high.active    { background: rgba(255,107,53,0.15); color: var(--sev-high);     border-color: rgba(255,107,53,0.3); }
.filter-chip.medium.active  { background: rgba(245,166,35,0.15); color: var(--sev-medium);   border-color: rgba(245,166,35,0.3); }
.filter-chip.low.active     { background: rgba(39,201,63,0.15);  color: var(--sev-low);      border-color: rgba(39,201,63,0.3); }

/* CVE Table */
.cve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cve-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cve-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

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

.cve-table tr:hover td {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.cve-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.cve-desc {
  max-width: 380px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cvss-score {
  font-family: var(--font-mono);
  font-weight: 700;
}

.cvss-critical { color: var(--sev-critical); }
.cvss-high     { color: var(--sev-high); }
.cvss-medium   { color: var(--sev-medium); }
.cvss-low      { color: var(--sev-low); }

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

/* Empty state */
.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }

/* =========================================================
   Section: AI Patch Advisor
   ========================================================= */

#section-advisor {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.advisor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 480px;
  gap: 0;
}

/* Chat / output pane */
.advisor-chat {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 340px;
  max-height: 480px;
}

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

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.msg.system .msg-avatar { background: var(--accent-glow); border: 1px solid var(--accent-dim); }
.msg.user   .msg-avatar { background: var(--bg-hover); border: 1px solid var(--border-accent); }

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

.msg-role {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.msg-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.msg.system .msg-text { color: var(--text-primary); }

.msg-text code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  color: var(--accent);
}

.msg-text pre {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  overflow-x: auto;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s infinite;
}

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

@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  resize: none;
  min-height: 38px;
  max-height: 120px;
  transition: border-color var(--transition);
  line-height: 1.4;
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-input::placeholder { color: var(--text-muted); }

/* Advisor sidebar — CVE context list */
.advisor-sidebar {
  display: flex;
  flex-direction: column;
}

.advisor-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.advisor-cve-list {
  flex: 1;
  overflow-y: auto;
  max-height: 440px;
}

.advisor-cve-item {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.advisor-cve-item:hover { background: var(--bg-hover); }

.advisor-cve-item.selected {
  background: var(--accent-glow);
  border-left: 2px solid var(--accent);
}

.advisor-cve-id {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.advisor-cve-pkg {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* =========================================================
   Section: Devices
   ========================================================= */

.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}

.device-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition);
}

.device-card:hover { border-color: var(--border-accent); }

.device-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-icon {
  width: 40px;
  height: 40px;
  background: var(--bg-hover);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.device-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.device-os {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.device-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.device-stat {
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
}

/* CPU strings are long ("Intel(R) Core(TM) i7-…"); give it the full row
   and let the value wrap to two lines instead of truncating. */
.device-stat-cpu {
  grid-column: 1 / -1;
}

.device-stat-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.device-stat-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Allow long values (CPU model) to wrap up to two lines rather than clip. */
.device-stat-value-wrap {
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.device-card-critical { border-color: rgba(255,56,96,0.35); }
.device-card-high     { border-color: rgba(255,107,53,0.35); }

.device-vuln-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 22px;
}

.device-clean {
  font-size: 10px;
  color: var(--sev-low);
}

.device-no-cve-data {
  font-size: 10px;
  color: var(--text-muted);
}

.device-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.device-kernel {
  font-size: 10px;
  color: var(--accent);
  font-family: var(--font-mono);
}

.device-last-scan {
  font-size: 10px;
  color: var(--text-muted);
}

/* =========================================================
   Section: Applications
   ========================================================= */

#section-apps .app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color var(--transition);
}

.app-card:hover { border-color: var(--border-accent); }

.app-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid var(--border-accent);
}

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

.app-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-version {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.app-vuln-flag {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sev-critical);
  flex-shrink: 0;
  box-shadow: 0 0 5px var(--sev-critical);
}

/* =========================================================
   Scan Progress Overlay
   ========================================================= */

#scan-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,9,14,0.85);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none; /* toggled by JS */
}

.scan-modal {
  background: var(--bg-panel);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  text-align: center;
  min-width: 340px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}

.scan-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-accent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.scan-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.scan-step {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* =========================================================
   Device Detail Modal (slide-over from right)
   ========================================================= */

.device-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 500;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.device-modal-panel {
  width: min(680px, 100vw);
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInRight 180ms ease;
}

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

.device-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
}

.device-modal-hostname {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.device-modal-os {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.device-modal-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-specs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  flex-shrink: 0;
}

.modal-spec {
  background: var(--bg-panel);
  padding: 12px 18px;
}

.modal-spec-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.modal-spec-value {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-all;
}

.modal-cve-summary {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-base);
  flex-shrink: 0;
}

.modal-cve-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.modal-cve-num {
  font-size: 26px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1;
}

.modal-cve-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.modal-section {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-section:last-child {
  border-bottom: none;
}

.modal-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.modal-cve-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.modal-cve-table th {
  text-align: left;
  padding: 5px 8px;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.modal-cve-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.modal-cve-table tr:last-child td { border-bottom: none; }

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.modal-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.modal-meta-value {
  font-size: 13px;
  color: var(--text-primary);
}

/* =========================================================
   CVE Detail Rows
   ========================================================= */

.cve-expand-btn {
  white-space: nowrap;
}

.cve-detail-row {
  background: var(--bg-hover);
}

.cve-detail-cell {
  padding: 0 !important;
}

.cve-detail-body {
  padding: 14px 20px 16px;
  border-left: 3px solid var(--border-accent);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cve-detail-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0;
}

.cve-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
}

.cve-detail-meta code {
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.cve-detail-meta .text-ok {
  color: var(--sev-low);
}

.cve-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================================================
   Topology / Attack Map
   ========================================================= */

.topo-canvas {
  width: 100%;
  height: 520px;
  background: var(--bg-base);
  position: relative;
}

.topo-node-info {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 8px 20px;
  background: var(--bg-base);
  border-top: 1px solid var(--border);
  min-height: 34px;
  line-height: 1.5;
  display: none;
}

.topo-legend-inline {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.topo-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
}
.topo-dot.crit { background: var(--sev-critical); }
.topo-dot.high { background: var(--sev-high); }
.topo-dot.ok   { background: var(--sev-low); }
.topo-dot.unk  { background: var(--text-muted); }

.topo-line-sample {
  display: inline-block;
  width: 22px;
  height: 2px;
  vertical-align: middle;
  margin-right: 3px;
  border-radius: 1px;
}
.topo-line-sample.attack { background: var(--sev-critical); }
.topo-line-sample.pivot  { background: var(--sev-high); }

.attack-steps {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.attack-step {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--border-accent);
}

/* =========================================================
   Scrollbars
   ========================================================= */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #3a4060; }

/* =========================================================
   Utility
   ========================================================= */

.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }
.mono          { font-family: var(--font-mono); }

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

.hidden { display: none !important; }

.tooltip-wrap { position: relative; }
.tooltip-wrap:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  z-index: 300;
}
