:root {
  --primary: #6C5CE7;
  --primary-dim: rgba(108, 92, 231, 0.15);
  --primary-glow: rgba(108, 92, 231, 0.3);
  --secondary: #A29BFE;
  --accent: #FD79A8;
  --accent-dim: rgba(253, 121, 168, 0.15);
  --bg: #1A0D2E;
  --bg-card: rgba(30, 18, 52, 0.85);
  --bg-card-hover: rgba(40, 25, 65, 0.9);
  --bg-input: rgba(20, 12, 38, 0.6);
  --surface: #241546;
  --border: rgba(162, 155, 254, 0.12);
  --border-hover: rgba(162, 155, 254, 0.25);
  --text: #E8E4F0;
  --text-dim: #9B8FC2;
  --text-muted: #6B5F8A;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --transition: 250ms ease;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
  --glass: rgba(30, 18, 52, 0.65);
  --glass-border: rgba(162, 155, 254, 0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  min-height: 100vh; line-height: 1.6; overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(108,92,231,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(253,121,168,0.05) 0%, transparent 60%);
}

.app-container { max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; min-height: 100vh; }
.app-header { padding: 20px 0; border-bottom: 1px solid var(--border); }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.logo-group { display: flex; align-items: center; gap: 14px; }
.logo-icon { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--primary-dim); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.app-header h1 { font-size: 1.35rem; font-weight: 700; background: linear-gradient(135deg, var(--secondary), var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; line-height: 1.2; }
.subtitle { font-size: 0.75rem; color: var(--text-dim); font-weight: 500; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius-sm); border: none; font-family: var(--font); font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #7C6FF0); color: #fff; box-shadow: 0 2px 12px rgba(108,92,231,0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(108,92,231,0.45); }
.btn-secondary { background: var(--primary-dim); color: var(--secondary); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--primary-glow); border-color: var(--border-hover); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--primary-dim); border-color: var(--border-hover); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; }

.upload-section { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 0; gap: 20px; animation: fadeIn 0.5s ease; }
.drop-zone { width: 100%; max-width: 560px; padding: 50px 32px; border: 2px dashed var(--border-hover); border-radius: var(--radius); text-align: center; cursor: pointer; transition: all var(--transition); background: var(--glass); backdrop-filter: blur(12px); }
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--primary); background: var(--primary-dim); transform: translateY(-2px); box-shadow: var(--shadow-md), 0 0 40px var(--primary-glow); }
.drop-zone:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.drop-zone-icon { margin-bottom: 16px; opacity: 0.7; }
.drop-zone-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 6px; }
.drop-zone-sub { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 20px; }
.sample-actions { display: flex; gap: 10px; }
.hidden { display: none !important; }

.dashboard { flex: 1; display: flex; flex-direction: column; gap: 20px; padding: 24px 0; animation: fadeIn 0.4s ease; }
.stats-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-card { background: var(--glass); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; transition: all var(--transition); }
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--secondary); line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-group { position: relative; flex: 1; min-width: 200px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input { width: 100%; padding: 10px 14px 10px 40px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font); font-size: 0.85rem; transition: all var(--transition); outline: none; }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-dim); }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--text-dim); font-family: var(--font); font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: all var(--transition); }
.chip:hover { border-color: var(--border-hover); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1; }
.panel { background: var(--glass); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-header h2 { font-size: 0.9rem; font-weight: 600; }
.panel-body { padding: 16px 18px; overflow-y: auto; flex: 1; max-height: 400px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 0.72rem; font-weight: 700; background: var(--primary-dim); color: var(--secondary); }
.badge-accent { background: var(--accent-dim); color: var(--accent); }
.right-panels { display: flex; flex-direction: column; gap: 16px; }

.tree-root { list-style: none; }
.tree-root ul { list-style: none; padding-left: 20px; }
.tree-item { position: relative; animation: slideIn 0.2s ease both; }
.tree-label { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--radius-xs); cursor: pointer; transition: all var(--transition); font-size: 0.84rem; user-select: none; }
.tree-label:hover { background: var(--primary-dim); }
.tree-label.selected { background: var(--primary-dim); border-left: 3px solid var(--primary); }
.tree-toggle { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); transition: transform var(--transition); }
.tree-toggle.expanded { transform: rotate(90deg); }
.tree-toggle.leaf { visibility: hidden; }
.tree-name { font-weight: 500; }
.tree-version { font-size: 0.75rem; color: var(--text-muted); }
.tree-type-badge { font-size: 0.68rem; padding: 1px 6px; border-radius: 4px; background: var(--primary-dim); color: var(--secondary); font-weight: 600; text-transform: uppercase; }

.license-chart { display: flex; height: 28px; border-radius: 14px; overflow: hidden; margin-bottom: 14px; background: var(--bg-input); }
.license-bar { height: 100%; transition: width 0.5s ease; }
.license-bar:hover { opacity: 0.85; }
.license-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-dim); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-count { color: var(--text-muted); font-size: 0.72rem; }

.detail-content { font-size: 0.84rem; line-height: 1.7; }
.detail-row { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-key { font-weight: 600; color: var(--text-dim); min-width: 100px; flex-shrink: 0; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-value { color: var(--text); word-break: break-word; }
.detail-value a { color: var(--secondary); text-decoration: none; }
.detail-value a:hover { text-decoration: underline; }

.vuln-list { display: flex; flex-direction: column; gap: 10px; }
.vuln-card { padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-card); transition: all var(--transition); }
.vuln-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.vuln-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.vuln-id { font-weight: 600; font-size: 0.84rem; }
.vuln-severity { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.vuln-severity.critical { background: rgba(255,71,87,0.2); color: #FF4757; }
.vuln-severity.high { background: rgba(255,159,67,0.2); color: #FF9F43; }
.vuln-severity.medium { background: rgba(255,234,100,0.2); color: #FCEA64; }
.vuln-severity.low { background: rgba(46,213,115,0.2); color: #2ED573; }
.vuln-severity.unknown { background: rgba(162,155,254,0.15); color: var(--secondary); }
.vuln-desc { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 4px; }
.vuln-affects { font-size: 0.74rem; color: var(--text-muted); }

.empty-msg { color: var(--text-muted); font-size: 0.84rem; text-align: center; padding: 20px 0; }
.app-footer { padding: 20px 0; text-align: center; font-size: 0.75rem; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: auto; }

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

.panel-body::-webkit-scrollbar { width: 6px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }

@media (max-width: 1024px) { .content-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .app-container { padding: 0 16px; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .header-content { flex-wrap: wrap; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-group { min-width: unset; }
  .drop-zone { padding: 36px 20px; }
}
@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 1.25rem; }
  .sample-actions { flex-direction: column; }
  .app-header h1 { font-size: 1.15rem; }
}
