  :root {
    --bg-deepest: #08080e;
    --bg-deep: #0e0e16;
    --bg-surface: #141420;
    --bg-elevated: #1a1a2a;
    --bg-rail: #0a0a12;
    --bg-panel: #12121e;
    --bg-overlay: rgba(6, 6, 10, 0.75);
    --border-subtle: #1e1e30;
    --border-default: #2a2a40;
    --border-accent: #3d351a;
    --border-strong: #4a4a60;
    --text-primary: #e4e4ec;
    --text-secondary: #9090a4;
    --text-muted: #5c5c70;
    --accent: #c8960c;
    --accent-dim: #8a6a10;
    --accent-glow: rgba(200, 150, 12, 0.12);
    --accent-strong: rgba(200, 150, 12, 0.25);
    --success: #4ade80;
    --success-dim: rgba(74, 222, 128, 0.15);
    --warning: #d4a017;
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.12);
    --info: #60a5fa;
    --info-dim: rgba(96, 165, 250, 0.12);
    --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', system-ui, sans-serif;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  }

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

  html { height:100%; }

  body {
    font-family: var(--font-sans);
    background: var(--bg-deepest);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  .auth-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 8, 14, 0.86);
    backdrop-filter: blur(8px);
    z-index: 1000;
  }

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

  .auth-card {
    width: min(420px, calc(100vw - 32px));
    padding: 28px;
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }

  .auth-card h2 {
    color: var(--accent);
    font-size: 20px;
    margin-bottom: 10px;
  }

  .auth-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 18px;
  }

  .auth-card input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
  }

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

  .auth-error {
    min-height: 18px;
    margin-top: 10px;
    color: var(--danger);
    font-size: 12px;
  }

  .auth-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
  }

  /* ══════════════════════════════════════
     Sidebar Shell (Cortex pattern)
     ══════════════════════════════════════ */
  #sidebar-shell {
    position: relative;
    width: 64px;
    min-width: 64px;
    height: 100vh;
    z-index: 40;
  }

  #sidebar-rail {
    width: 64px;
    min-width: 64px;
    height: 100vh;
    background: var(--bg-rail);
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    position: relative;
    z-index: 42;
    padding: 12px 0;
    border-right: 1px solid var(--border-subtle);
  }

  .sidebar-project-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    padding: 0 12px;
    scrollbar-width: none;
  }

  .sidebar-project-list::-webkit-scrollbar { display: none; }

  .sidebar-project {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 4px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    flex-shrink: 0;
    outline: none;
    position: relative;
  }

  .sidebar-project:hover,
  .sidebar-project:focus-visible {
    background: rgba(255,255,255,0.04);
  }

  .sidebar-project.is-active {
    border: 2px solid var(--border-strong);
    padding: 3px;
    background: rgba(255,255,255,0.03);
  }

  .sidebar-project:active { transform: scale(0.94); }

  .sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    user-select: none;
    letter-spacing: 0.3px;
  }

  /* Tooltip on hover */
  .sidebar-tooltip {
    display: none;
    position: absolute;
    left: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 50;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    font-weight: 500;
  }

  .sidebar-project:hover .sidebar-tooltip { display: block; }

  /* New project button */
  .sidebar-new {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: transparent;
    border: 1px dashed var(--border-default);
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-top: 6px;
  }

  .sidebar-new:hover {
    border-color: var(--accent-dim);
    color: var(--accent);
    background: var(--accent-glow);
  }

  /* ══════════════════════════════════════
     Main Area
     ══════════════════════════════════════ */
  #main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
  }

  /* ---- Topbar ---- */
  #topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: linear-gradient(180deg, #151522 0%, #11111c 100%);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
    position: relative;
    box-shadow: 0 1px 0 rgba(255,255,255,0.015);
    flex-shrink: 0;
  }

  #topbar h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--accent);
    white-space: nowrap;
    margin-right: 6px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #topbar h1::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow), 0 0 20px var(--accent-glow);
  }

  #current-project-name {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
  }

  /* ---- Buttons ---- */
  .btn {
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 12.5px;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.2px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
  }

  .btn-refresh {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
  }

  .btn-refresh:hover {
    background: #222238;
    color: var(--text-primary);
    border-color: #3a3a50;
  }

  .btn-delete {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #2a1a1c;
  }

  .btn-delete:hover {
    background: rgba(239,68,68,0.08);
    border-color: rgba(239,68,68,0.3);
    color: var(--danger);
  }

  /* ---- Stats ---- */
  #stats {
    display: flex;
    gap: 16px;
    margin-left: auto;
    font-size: 12.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }

  .stat {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono);
  }

  .stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
  }

  /* ---- Graph container ---- */
  #cy {
    flex: 1;
    background: var(--bg-deep);
    min-height: 0;
  }

  /* ---- Box selection overlay ---- */
  #sel-box {
    position: fixed;
    border: 1.5px dashed rgba(200, 150, 12, 0.8);
    background: rgba(200, 150, 12, 0.08);
    pointer-events: none;
    display: none;
    z-index: 100;
  }

  /* ---- Empty state ---- */
  #empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 5;
    display: none;
  }

  #empty-state h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
  }

  #empty-state p {
    font-size: 13px;
    line-height: 1.8;
  }

  #empty-state kbd {
    background: var(--bg-elevated);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-default);
    font-family: var(--font-mono);
    font-size: 12px;
  }

  /* ---- Modal ---- */
  .modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    justify-content: center;
    align-items: center;
  }

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

  .modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    border: 1px solid var(--border-default);
    width: 360px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.02);
    position: relative;
  }

  .modal h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 18px;
    color: var(--text-primary);
    letter-spacing: 0.3px;
  }

  .modal input {
    width: 100%;
    padding: 9px 13px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13.5px;
    font-family: var(--font-sans);
    margin-bottom: 18px;
    transition: border-color var(--transition), box-shadow var(--transition);
  }

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

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

  .modal .btn-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
  }

  /* ── Analysis Modal ─────────────────────────────────────── */
  .analysis-modal {
    width: min(880px, 92vw);
    max-height: 88vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: analysisIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  @keyframes analysisIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
  }

  /* header bar */
  .analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 10px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    min-height: 42px;
  }

  .analysis-header h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .analysis-header h2 svg { flex-shrink: 0; }

.analysis-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
}

.analysis-actions > * {
  box-sizing: border-box;
}

  .analysis-actions .btn { font-size: 12px; padding: 6px 14px; border-radius: var(--radius-sm); }

/* Daily report actions — unified purple theme */

.dr-date-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  align-self: center;
  height: 30px;
  width: 132px;
  overflow: hidden;
  background: var(--bg-deep);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}
input.dr-date-input {
  width: 102px !important;
  height: 28px;
  padding: 0 8px;
  background: transparent;
  border: 0;
  color: var(--text-primary);
  border-radius: 0;
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 28px;
  box-sizing: border-box;
  display: block;
  appearance: none;
  -webkit-appearance: none;
}
input.dr-date-input::-webkit-datetime-edit { padding: 0; }
input.dr-date-input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
/* Hide native browser date decorations — we expose a single visible trigger button. */
input.dr-date-input::-webkit-calendar-picker-indicator {
  opacity: 0;
  display: none;
}
.dr-date-input::-webkit-inner-spin-button,
.dr-date-input::-webkit-clear-button {
  display: none;
}
.dr-date-trigger {
  position: static;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border-default);
  background: rgba(124,58,237,0.08);
  color: #a78bfa;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0.85;
  flex-shrink: 0;
  box-sizing: border-box;
  line-height: 1;
  margin: 0;
}
.dr-date-trigger svg {
  display: block;
  width: 14px;
  height: 14px;
}
.dr-date-trigger:hover {
  background: rgba(124,58,237,0.16);
  color: #c4b5fd;
  opacity: 1;
}

.dr-btn {
  background: rgba(124,58,237,0.12);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.2);
  font-size: 12px;
  padding: 0 12px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-sizing: border-box;
  line-height: 1;
  margin: 0;
}
.dr-btn:hover { background: rgba(124,58,237,0.22); border-color: rgba(124,58,237,0.35); color: #c4b5fd; }

.dr-btn-close {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 16px;
  padding: 0 8px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  line-height: 1;
  flex-shrink: 0;
}
.dr-btn-close:hover { background: rgba(239,68,68,0.15); color: #ef4444; }

  /* scrollable body */
  .analysis-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px 24px;
    overscroll-behavior: contain;
  }

  .analysis-body::-webkit-scrollbar { width: 5px; }
  .analysis-body::-webkit-scrollbar-track { background: transparent; }
  .analysis-body::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

  /* ── markdown content inside analysis-body ───────── */
  .analysis-body { color: var(--text-secondary); font-size: 13px; line-height: 1.75; word-break: break-word; }
  .analysis-body h1 { font-size: 18px; margin: 24px 0 12px; color: var(--text-primary); font-weight: 700; letter-spacing: 0.2px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 8px; }
  .analysis-body h2 { font-size: 15px; margin: 20px 0 8px; color: var(--text-primary); font-weight: 600; letter-spacing: 0.1px; }
  .analysis-body h3 { font-size: 14px; margin: 18px 0 6px; color: var(--text-primary); font-weight: 600; }
  .analysis-body h4 { font-size: 13px; margin: 16px 0 4px; color: var(--text-primary); font-weight: 600; }
  .analysis-body p { margin: 0 0 12px 0; }
  .analysis-body p:last-child { margin-bottom: 0; }
  .analysis-body strong { color: var(--text-primary); }
  .analysis-body em { font-style: italic; color: var(--text-secondary); }
  .analysis-body code {
    background: rgba(255,255,255,0.06);
    padding: 2px 7px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.05);
  }
  .analysis-body pre {
    background: var(--bg-deep);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    border: 1px solid var(--border-subtle);
    margin: 12px 0;
  }
  .analysis-body pre code { background: transparent; padding: 0; border: none; font-size: inherit; }
  .analysis-body pre code.hljs { background: transparent; padding: 0; border: none; font-size: inherit; }
  .analysis-body ul, .analysis-body ol { padding-left: 20px; margin: 8px 0; }
  .analysis-body li { margin: 4px 0; }
  .analysis-body a { color: var(--accent); text-decoration: none; }
  .analysis-body a:hover { text-decoration: underline; }
  .analysis-body blockquote {
    border-left: 2px solid var(--accent-dim);
    padding: 4px 0 4px 14px;
    color: var(--text-muted);
    margin: 12px 0;
    font-style: italic;
  }
  .analysis-body hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 20px 0;
  }
  .analysis-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 12px;
  }
  .analysis-body th {
    background: var(--bg-deep);
    color: var(--text-primary);
    font-weight: 600;
    padding: 8px 12px;
    text-align: left;
    border: 1px solid var(--border-subtle);
  }
  .analysis-body td {
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
  }
  .analysis-body img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }

  /* ── stat cards ─────────────────────────────────────── */
  .analysis-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
  }

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

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

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .stat-icon svg { width: 18px; height: 18px; }

  .stat-icon.paths  { background: rgba(200,150,12,0.12); color: var(--accent); }
  .stat-icon.vulns  { background: var(--danger-dim);      color: var(--danger); }
  .stat-icon.dead   { background: rgba(92,92,112,0.18);   color: var(--text-muted); }
  .stat-icon.cross  { background: rgba(245,158,11,0.12);  color: #f59e0b; }
  .stat-icon.suggest { background: var(--info-dim);        color: var(--info); }

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

  .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }

  /* ── collapsible section card ───────────────────────── */
  .analysis-section {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color var(--transition);
  }

  .analysis-section:hover { border-color: var(--border-default); }

  .section-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: none;
    border: none;
    padding: 14px 16px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    text-align: left;
    letter-spacing: 0.3px;
    transition: background var(--transition);
  }

  .section-toggle:hover { background: rgba(255,255,255,0.02); }

  .section-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
  }

  .analysis-section.collapsed .section-chevron { transform: rotate(-90deg); }

  .section-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .section-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 10px;
    font-family: var(--font-mono);
  }

  .section-body {
    padding: 0 16px 14px;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    max-height: 2000px;
    opacity: 1;
  }

  .analysis-section.collapsed .section-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
  }

  .section-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.5;
  }

  /* ── attack path flow ──────────────────────────────── */
  .path-flow {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 10px 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
    line-height: 1;
  }

  .path-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
  }

  .path-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-deepest);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
  }

  .path-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
  }

  .path-arrow {
    display: inline-flex;
    align-items: center;
    margin: 0 8px;
    color: var(--accent-dim);
    flex-shrink: 0;
  }

  .path-arrow svg { width: 16px; height: 16px; }

  .path-edge-label {
    font-size: 10.5px;
    color: var(--text-muted);
    font-style: italic;
    margin: 0 2px;
  }

  /* ── list items (vulns, dead ends, next steps) ─────── */
  .analysis-item {
    padding: 10px 14px;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 13px;
    border-left: 3px solid var(--accent-dim);
    border-top: 1px solid transparent;
    transition: border-color var(--transition), background var(--transition);
  }

  .analysis-item:last-child { margin-bottom: 0; }

  .analysis-item:hover { background: var(--bg-elevated); }

  .analysis-item.vuln { border-left-color: var(--danger); }
  .analysis-item.dead { border-left-color: var(--text-muted); }
  .analysis-item.next { border-left-color: var(--info); }

  .analysis-item .item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
  }

  .analysis-item .label {
    font-weight: 500;
    color: var(--text-primary);
  }

  .analysis-item .type-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .analysis-item .hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 6px;
    line-height: 1.5;
  }

  .analysis-item .breadcrumbs {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
  }

  .breadcrumbs .crumb-sep { color: var(--border-default); font-size: 10px; }

  /* ── AI badge ────────────────────────────────────────── */
  .ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    color: var(--info);
    background: var(--info-dim);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
  }

  .ai-badge svg { width: 10px; height: 10px; }

  .analysis-item.ai-suggestion {
    border-left-color: var(--info);
    border-top-color: rgba(96,165,250,0.08);
    box-shadow: 0 0 12px rgba(96,165,250,0.04);
  }

  /* ── cross connection cards ──────────────────────────── */
  .cross-card {
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px dashed rgba(245,158,11,0.25);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background var(--transition), border-color var(--transition);
  }

  .cross-card:last-child { margin-bottom: 0; }

  .cross-card:hover {
    background: var(--bg-elevated);
    border-color: rgba(245,158,11,0.4);
  }

  .cross-node {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 4px 10px;
    background: rgba(245,158,11,0.08);
    border-radius: var(--radius-sm);
    white-space: nowrap;
  }

  .cross-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--warning);
    flex-shrink: 0;
  }

  .cross-link svg { width: 18px; height: 18px; }

  .cross-reason {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
    font-style: italic;
    text-align: right;
    max-width: 240px;
  }

  /* ── skeleton / loading ──────────────────────────────── */
  .analysis-skeleton {
    padding: 4px 0;
  }

  .skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--border-subtle) 25%, var(--border-default) 50%, var(--border-subtle) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
    margin-bottom: 10px;
  }

  .skeleton-line:nth-child(1) { width: 60%; height: 14px; }
  .skeleton-line:nth-child(2) { width: 100%; }
  .skeleton-line:nth-child(3) { width: 85%; }
  .skeleton-line:nth-child(4) { width: 45%; }
  .skeleton-line:nth-child(5) { width: 92%; }
  .skeleton-line:nth-child(6) { width: 70%; }

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

  /* ── empty state ─────────────────────────────────────── */
  .analysis-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
  }

  .analysis-empty svg {
    width: 56px;
    height: 56px;
    color: var(--border-default);
    margin-bottom: 16px;
  }

  .analysis-empty .empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
  }

  .analysis-empty .empty-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 320px;
  }

  /* ── keep toolbar btn-analysis ─────────────────────── */
  .btn-analysis {
    background: linear-gradient(135deg, #0d9488 0%, #0ea5a9 50%, #0d9488 100%);
    color: #0a0a0e;
    font-weight: 600;
    border: 1px solid rgba(14, 165, 169, 0.3);
    margin-left: auto;
  }

  .btn-analysis:hover { background: linear-gradient(135deg, #0ea5a9 0%, #14b8a6 50%, #0ea5a9 100%); }

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

  #zoom-ctrl {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
    background: var(--bg-deep);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    padding: 2px;
  }

  .btn-zoom {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xsm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
  }

  .btn-zoom:hover { background: var(--bg-hover); color: var(--text-primary); }

  .btn-export {
    background: linear-gradient(135deg, #b8860b 0%, #c8960c 50%, #b8860b 100%);
    color: #0a0a0e;
    font-weight: 600;
    font-size: 11.5px;
    border: 1px solid rgba(200, 150, 12, 0.3);
    padding: 5px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    margin-left: 4px;
  }

  .btn-export:hover { background: linear-gradient(135deg, #c8960c 0%, #d4a017 50%, #c8960c 100%); }

  .btn-new {
    background: linear-gradient(135deg, #b8860b 0%, #c8960c 50%, #b8860b 100%);
    color: #0a0a0e;
    font-weight: 600;
    border: 1px solid rgba(200, 150, 12, 0.3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.06);
  }

  .btn-new:hover {
    background: linear-gradient(135deg, #c8960c 0%, #d4a017 50%, #c8960c 100%);
    box-shadow: 0 2px 8px var(--accent-glow), 0 0 16px rgba(200,150,12,0.08);
    transform: translateY(-1px);
  }

  .btn-new:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  }

  /* ---- Node detail panel (card) ---- */
  #node-panel {
    position: fixed;
    top: 56px;
    right: 16px;
    bottom: 16px;
    width: 400px;
    max-width: calc(100vw - 96px);
    background: rgba(11, 11, 20, 0.94);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.03), 0 8px 40px rgba(0,0,0,0.6), 0 2px 12px rgba(0,0,0,0.4);
    z-index: 50;
    transform: translateX(calc(100% + 24px));
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.25s ease;
    opacity: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: none;
  }
  #node-panel.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* ── Panel header area ── */
  .np-head {
    padding: 20px 24px 0;
    flex-shrink: 0;
  }

  .np-head-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }

  .np-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }

  .np-type-pill {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: var(--font-mono);
    color: var(--accent);
    background: rgba(200,150,12,0.1);
    padding: 3px 10px;
    border-radius: 4px;
    white-space: nowrap;
    border: 1px solid rgba(200,150,12,0.15);
  }

  .np-evidence-pill {
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: var(--font-mono);
    white-space: nowrap;
    border: 1px solid transparent;
  }
  .np-evidence-pill.confirmed  { color: #4ade80; background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.18); }
  .np-evidence-pill.unverified { color: #d4a017; background: rgba(200,150,12,0.1); border-color: rgba(200,150,12,0.18); }
  .np-evidence-pill.hypothesis { color: #a78bfa; background: rgba(167,139,250,0.1); border-color: rgba(167,139,250,0.18); }

  .np-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
    line-height: 1;
  }
  .np-close:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: var(--text-primary);
  }
  .np-close:active { transform: scale(0.92); }

  .np-title-area {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .np-status-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    margin-top: 2px;
  }
  .np-status-icon.success  { color: #4ade80; background: rgba(74,222,128,0.1); }
  .np-status-icon.failed   { color: #f87171; background: rgba(248,113,113,0.1); }
  .np-status-icon.none     { display: none; }

  .np-title {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    word-break: break-word;
    letter-spacing: 0.1px;
  }

  .np-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* ── Divider ── */
  .np-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0 24px;
    flex-shrink: 0;
    opacity: 0.6;
  }

  /* ── Content body ── */
  .np-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 24px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
  }
  .np-body::-webkit-scrollbar { width: 4px; }
  .np-body::-webkit-scrollbar-track { background: transparent; }
  .np-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
  .np-body::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

  .np-body:empty::after {
    content: '暂无详细描述';
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
  }

  .np-content {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.75;
    word-break: break-word;
  }
  .np-content p { margin: 0 0 12px 0; }
  .np-content p:last-child { margin-bottom: 0; }
  .np-content code {
    background: rgba(255,255,255,0.06);
    padding: 2px 7px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 12px;
    border: 1px solid rgba(255,255,255,0.05);
  }
  .np-content pre {
    background: var(--bg-deep);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    border: 1px solid var(--border-subtle);
    margin: 12px 0;
  }
  .np-content pre code.hljs {
    background: transparent;
    padding: 0;
    border: none;
    font-size: inherit;
  }
  .np-content ul, .np-content ol { padding-left: 20px; margin: 8px 0; }
  .np-content li { margin: 4px 0; }
  .np-content a { color: var(--accent); text-decoration: none; }
  .np-content a:hover { text-decoration: underline; }
  .np-content h2 { font-size: 15px; margin: 20px 0 8px; color: var(--text-primary); font-weight: 600; letter-spacing: 0.1px; }
  .np-content h3 { font-size: 14px; margin: 18px 0 6px; color: var(--text-primary); font-weight: 600; }
  .np-content strong { color: var(--text-primary); }
  .np-content blockquote {
    border-left: 2px solid var(--accent-dim);
    padding: 4px 0 4px 14px;
    color: var(--text-muted);
    margin: 12px 0;
    font-style: italic;
  }
  .np-content hr {
    border: none;
    height: 1px;
    background: var(--border-subtle);
    margin: 16px 0;
  }
  .np-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin: 12px 0;
  }
  .np-content th {
    text-align: left;
    padding: 6px 10px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
  .np-content td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-secondary);
  }

  .np-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 20px;
    min-height: 160px;
  }
  .np-empty-icon { font-size: 32px; margin-bottom: 12px; opacity: 0.6; }
  .np-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 6px;
  }
  .np-empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
  }
  .np-empty-hint code {
    background: rgba(255,255,255,0.06);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    border: 1px solid rgba(255,255,255,0.05);
  }

  /* ── Meta footer ── */
  .np-title-input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    padding: 4px 8px;
    font-family: var(--font-sans);
  }

  .np-content-edit {
    width: 100%;
    min-height: 180px;
    background: var(--bg-deep);
    border: 1px solid var(--accent-dim);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    padding: 10px;
    font-family: var(--font-mono);
    resize: vertical;
    line-height: 1.5;
  }

  .np-edit-fields { margin-bottom: 10px; }

  .np-field-row {
    display: flex;
    align-items: center;
    gap: 6px 16px;
    flex-wrap: wrap;
  }

  .np-field-row label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
  }

  .np-field-row select {
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 11.5px;
    padding: 3px 6px;
    font-family: var(--font-sans);
    cursor: pointer;
  }

  .np-field-row select:focus { border-color: var(--accent-dim); outline: none; }

  .np-screenshots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
  }

  .np-screenshots:empty { display: none; }

  .np-shot {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    object-fit: cover;
    cursor: pointer;
    transition: border-color var(--transition);
  }

  .np-shot:hover { border-color: var(--accent-dim); }

  .np-upload-zone {
    margin-top: 10px;
    padding: 14px;
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    user-select: none;
  }

  .np-upload-zone:hover, .np-upload-zone.drag-over {
    border-color: var(--accent-dim);
    background: var(--bg-hover);
  }

  .np-edit-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
  }

  .np-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11.5px;
    color: var(--text-muted);
    overflow: hidden;
    white-space: nowrap;
  }

  .np-footer:empty { display: none; }

  .np-tag {
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 4px 10px;
    border-radius: 5px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.15s;
  }

  #np-tags { display: flex; gap: 6px; align-items: center; }
  .np-tag.verdict-success { color: #4ade80; background: rgba(74,222,128,0.08); border-color: rgba(74,222,128,0.14); }
  .np-tag.verdict-failed  { color: #f87171; background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.14); }

  /* ---- Toast ---- */
  #toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(8px);
    pointer-events: none;
    z-index: 200;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    font-weight: 500;
  }

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

  /* ---- Legend (collapsible) ---- */
  #legend {
    position: fixed;
    bottom: 20px;
    left: 84px;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    gap: 0;
  }

  #legend-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
    line-height: 1;
  }

  #legend-toggle:hover {
    color: var(--text-primary);
    border-color: var(--accent-dim);
    background: rgba(200,150,12,0.08);
  }

  #legend-toggle.open {
    color: var(--accent);
    border-color: var(--accent-dim);
  }

  #legend-body {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 11.5px;
    user-select: none;
    box-shadow: var(--shadow-md);
    margin-left: 8px;
  }

  #legend-body.visible { display: flex; }

  .legend-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-secondary);
  }
  .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
  }
  .legend-dot.vuln      { background: #d44c4c; }
  .legend-dot.process   { background: #0ea5a9; }
  .legend-dot.dead      { background: #5c5c6e; }
  .legend-dot.objective { background: #5c9cd4; }
  .legend-dot.user_info { background: #8a6cd4; }
  .legend-dot.neutral   { background: #3a3a4c; }

  .ctx-menu {
    position: fixed;
    z-index: 200;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 4px;
    min-width: 120px;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255,255,255,0.03);
  }

  .ctx-item {
    padding: 6px 12px;
    font-size: 12.5px;
    color: var(--text-secondary);
    border-radius: var(--radius-xsm);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    user-select: none;
  }

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

  .ctx-item.danger { color: #d44c4c; }

  .ctx-item.danger:hover { background: rgba(212, 76, 76, 0.12); }

  /* ══════════════════════════════════════
     Sidebar Tool Buttons
     ══════════════════════════════════════ */
  .sidebar-separator {
    width: 24px;
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 0;
    flex-shrink: 0;
  }

  .sidebar-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 4px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
    flex-shrink: 0;
    outline: none;
    font-size: 16px;
    color: var(--text-muted);
    position: relative;
  }
  .sidebar-tool-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
  }
  .sidebar-tool-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
  }
  .sidebar-tool-btn:active:not(:disabled) { transform: scale(0.94); }

  .sidebar-tool-btn .sidebar-tooltip {
    display: none;
    position: absolute;
    left: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 50;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    font-weight: 500;
  }
  .sidebar-tool-btn:hover .sidebar-tooltip { display: block; }

  /* ══════════════════════════════════════
     Credentials Panel
     ══════════════════════════════════════ */
  #credentials-panel {
    position: fixed;
    top: 56px;
    right: 16px;
    bottom: 16px;
    width: 420px;
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    z-index: 50;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    transform: translateX(460px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
  }
  #credentials-panel.open {
    transform: translateX(0);
  }

  .cred-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }

  .cred-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .cred-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
  }
  .cred-close:hover { color: var(--text-primary); }

  .cred-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
  }
  .cred-body::-webkit-scrollbar { width: 4px; }
  .cred-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 4px; }

  .cred-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
  }
  .cred-empty-icon { font-size: 32px; margin-bottom: 8px; }
  .cred-empty-title { font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

  .cred-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: border-color 0.15s, background 0.15s;
  }
  .cred-card:hover {
    border-color: var(--border-default);
    background: var(--bg-elevated);
  }

  .cred-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .cred-card-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cred-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
  }
  .cred-badge.password { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.2); }
  .cred-badge.api_key { background: rgba(96,165,250,0.12); color: #60a5fa; border: 1px solid rgba(96,165,250,0.2); }
  .cred-badge.token { background: rgba(168,85,247,0.12); color: #a855f7; border: 1px solid rgba(168,85,247,0.2); }
  .cred-badge.hash { background: rgba(234,179,8,0.12); color: #eab308; border: 1px solid rgba(234,179,8,0.2); }
  .cred-badge.key { background: rgba(34,197,94,0.12); color: #22c55e; border: 1px solid rgba(34,197,94,0.2); }
  .cred-badge.other { background: rgba(148,163,184,0.12); color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }

  .cred-status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
  }
  .cred-status-badge.active { background: rgba(74,222,128,0.12); color: #4ade80; }
  .cred-status-badge.expired { background: rgba(239,68,68,0.12); color: #ef4444; }
  .cred-status-badge.unknown { background: rgba(148,163,184,0.08); color: #94a3b8; }

  .cred-secret-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
  }
  .cred-secret {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-deep);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cred-eye-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
  }
  .cred-eye-btn:hover { color: var(--text-primary); }

  .cred-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .cred-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
  }
  .cred-card-actions button {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s;
  }
  .cred-card-actions button:hover {
    border-color: var(--accent-dim);
    color: var(--text-primary);
  }
  .cred-card-actions .cred-delete-btn:hover {
    border-color: rgba(239,68,68,0.3);
    color: #ef4444;
    background: rgba(239,68,68,0.06);
  }

  .cred-form {
    padding: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
  }
  .cred-form h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
  }
  .cred-form-row {
    margin-bottom: 10px;
  }
  .cred-form-row label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
  }
  .cred-form-row input,
  .cred-form-row select,
  .cred-form-row textarea {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    padding: 7px 10px;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color 0.15s;
  }
  .cred-form-row textarea {
    resize: vertical;
    min-height: 60px;
    font-family: var(--font-mono);
  }
  .cred-form-row input:focus,
  .cred-form-row select:focus,
  .cred-form-row textarea:focus {
    border-color: var(--accent-dim);
  }
  .cred-form-row select option { background: var(--bg-deep); }
  .cred-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
  }

  /* ══════════════════════════════════════
     Timeline View
     ══════════════════════════════════════ */
  .view-toggle {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-left: 4px;
  }
  .view-toggle-btn {
    padding: 5px 12px;
    font-size: 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
    white-space: nowrap;
  }
  .view-toggle-btn:hover { color: var(--text-secondary); }
  .view-toggle-btn.active {
    background: var(--accent);
    color: var(--bg-deepest);
    font-weight: 600;
  }

  #timeline-view {
    display: none;
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    padding: 20px 32px;
    background: var(--bg-deepest);
    z-index: 12;
  }
  #timeline-view.visible { display: block; }

  .timeline-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 13px;
  }
  .timeline-empty-icon { font-size: 36px; margin-bottom: 10px; }
  .timeline-empty-title { font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }

  .timeline-container {
    position: relative;
    padding-left: 32px;
  }
  .timeline-line {
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-default);
  }
  .timeline-item {
    position: relative;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.15s;
  }
  .timeline-item:hover { transform: translateX(4px); }
  .timeline-dot {
    position: absolute;
    left: -27px;
    top: 16px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border-default);
    background: var(--bg-deepest);
    z-index: 1;
  }
  .timeline-dot.vuln { border-color: #d44c4c; background: rgba(212,76,76,0.2); }
  .timeline-dot.process { border-color: #0ea5a9; background: rgba(14,165,169,0.2); }
  .timeline-dot.objective { border-color: #5c9cd4; background: rgba(92,156,212,0.2); }
  .timeline-dot.dead { border-color: #5c5c6e; background: rgba(92,92,110,0.2); }
  .timeline-dot.user_info { border-color: #8a6cd4; background: rgba(138,108,212,0.2); }
  .timeline-dot.neutral { border-color: #3a3a4c; background: rgba(58,58,76,0.2); }

  .timeline-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    transition: border-color 0.15s;
  }
  .timeline-card:hover { border-color: var(--border-default); }
  .timeline-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }
  .timeline-type-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
  }
  .timeline-type-icon.vuln { background: rgba(212,76,76,0.15); color: #d44c4c; }
  .timeline-type-icon.process { background: rgba(14,165,169,0.15); color: #0ea5a9; }
  .timeline-type-icon.objective { background: rgba(92,156,212,0.15); color: #5c9cd4; }
  .timeline-type-icon.neutral { background: rgba(58,58,76,0.15); color: #6a6a7c; }
  .timeline-type-icon.dead { background: rgba(92,92,110,0.15); color: #5c5c6e; }
  .timeline-type-icon.user_info { background: rgba(138,108,212,0.15); color: #8a6cd4; }

  .timeline-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .timeline-time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
  }
  .timeline-edge-label {
    font-size: 11px;
    color: var(--accent-dim);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .timeline-type-label {
    font-size: 11px;
    color: var(--text-muted);
  }

  /* ══════════════════════════════════════
     Search
     ══════════════════════════════════════ */
  #search-dropdown {
    position: fixed;
    top: 56px;
    right: 16px;
    width: 380px;
    max-height: 480px;
    background: var(--bg-panel);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    display: none;
    flex-direction: column;
    overflow: hidden;
  }
  #search-dropdown.open { display: flex; }

  .search-input-wrap {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  .search-input-wrap input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 12px;
    font-family: var(--font-sans);
    outline: none;
  }
  .search-input-wrap input:focus { border-color: var(--accent-dim); }
  .search-input-wrap input::placeholder { color: var(--text-muted); }
  .search-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
  }
  .search-close-btn:hover { color: var(--text-primary); }

  .search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.06) transparent;
  }
  .search-results::-webkit-scrollbar { width: 4px; }
  .search-results::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 4px; }

  .search-empty {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    font-size: 12px;
  }
  .search-result-item {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
  }
  .search-result-item:hover { background: var(--bg-elevated); }
  .search-result-project {
    font-size: 10px;
    color: var(--accent-dim);
    font-weight: 500;
    margin-bottom: 2px;
  }
  .search-result-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
  }
  .search-result-context {
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .search-result-context mark {
    background: rgba(200,150,12,0.25);
    color: var(--accent);
    padding: 0 2px;
    border-radius: 2px;
  }

  /* ══════════════════════════════════════
     Evidence Attachments
     ══════════════════════════════════════ */
  .node-evidence-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
  }
  .evidence-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .evidence-file-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .evidence-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s;
  }
  .evidence-file-item:hover { border-color: var(--border-default); }
  .evidence-file-icon { font-size: 14px; flex-shrink: 0; }
  .evidence-file-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }
  .evidence-file-name:hover { color: var(--accent); }
  .evidence-file-size {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
  }
  .evidence-file-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
  }
  .evidence-file-item:hover .evidence-file-delete { opacity: 1; }
  .evidence-file-delete:hover { color: #ef4444; }
  .evidence-upload-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
  }
  .evidence-upload-btn {
    font-size: 11px;
    padding: 5px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font-sans);
  }
  .evidence-upload-btn:hover {
    border-color: var(--accent-dim);
    color: var(--text-primary);
  }
  .evidence-empty {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
  }

  /* ══════════════════════════════════════
     Import Modal
     ══════════════════════════════════════ */
  #import-modal .modal {
    max-width: 640px;
  }
  .import-textarea {
    width: 100%;
    min-height: 180px;
    background: var(--bg-deep);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 12px;
    resize: vertical;
    outline: none;
    margin: 12px 0;
  }
  .import-textarea:focus { border-color: var(--accent-dim); }
  .import-textarea::placeholder { color: var(--text-muted); }

  .import-preview {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 12px 0;
    display: none;
  }
  .import-preview.visible { display: block; }
  .import-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
  }
  .import-preview-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
  }
  .import-preview-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
  }
  .import-preview-stat .num {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
  }
  .import-result {
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 12px;
    display: none;
    color: var(--text-secondary);
    line-height: 1.6;
  }
  .import-result.visible { display: block; }
  .import-result.success { border-color: rgba(74,222,128,0.3); }
  .import-result.error { border-color: rgba(239,68,68,0.3); }

/* ══════════════════════════════════════
   Project Manager Modal
   ══════════════════════════════════════ */
.manager-modal-inner {
  width: min(800px, 94vw);
  max-height: 80vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.manager-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.manager-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.manager-count {
  font-size: 12px;
  color: var(--text-muted);
}
.manager-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.manager-close-btn:hover { color: var(--text-primary); }

.manager-table-wrap {
  overflow-y: auto;
  flex: 1;
  padding: 4px 24px;
}
.manager-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.manager-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.manager-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  white-space: nowrap;
  user-select: none;
}
.manager-table th.sortable {
  cursor: pointer;
  color: var(--text-secondary);
}
.manager-table th.sortable:hover {
  color: var(--text-primary);
}
.manager-table th.sortable .sort-arrow {
  opacity: 0;
  margin-left: 2px;
  font-size: 9px;
}
.manager-table th.sortable.active .sort-arrow { opacity: 1; }
.manager-table th.sortable.active { color: var(--accent); }

.manager-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}
.manager-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}
.manager-table tbody tr:hover { background: var(--bg-hover); }
.manager-table tbody tr.selected { background: rgba(90,130,200,0.08); }
.manager-table tbody tr td:first-child {
  padding-left: 8px;
  width: 32px;
}
.manager-table .manager-name {
  color: var(--text-primary);
  font-weight: 500;
}
.manager-table .manager-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.manager-table .manager-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
}
.manager-table .manager-num.empty { color: var(--text-muted); font-weight: 400; }
.manager-table .manager-actions {
  display: flex;
  gap: 6px;
}
.manager-table .manager-act-btn {
  background: none;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  padding: 3px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.manager-table .manager-act-btn:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary);
}
.manager-table .manager-act-btn.delete:hover {
  border-color: rgba(239,68,68,0.4);
  color: #ef4444;
}

.manager-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  font-size: 13px;
}
.manager-empty kbd {
  background: var(--bg-deep);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.manager-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.manager-selected-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* ════════════ Batch Project Management ════════════ */
.sidebar-project { position: relative; }

/* Click-to-select: no checkboxes, just a left border highlight */
.manage-mode .sidebar-project {
  cursor: pointer;
  padding-left: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.sidebar-project.is-selected {
  border-left: 3px solid var(--accent) !important;
  background: rgba(200, 150, 12, 0.08);
}

.batch-action-bar {
  display: none;
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--bg-deepest);
  border-top: 1px solid var(--border-default);
  padding: 8px 6px;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}
.manage-mode .batch-action-bar { display: flex; }

.batch-btn {
  width: 100%;
  padding: 5px 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  color: var(--text-primary);
  transition: var(--transition);
}
.batch-btn-delete { background: rgba(239,68,68,0.15); }
.batch-btn-delete:hover { background: rgba(239,68,68,0.35); }
.batch-btn-cancel { background: rgba(90,90,108,0.2); }
.batch-btn-cancel:hover { background: rgba(90,90,108,0.4); }
