:root {
  --primary: #6C5CE7;
  --primary-dim: rgba(108,92,231,0.15);
  --secondary: #A29BFE;
  --accent: #00CEC9;
  --accent-dim: rgba(0,206,201,0.15);
  --bg: #0B0E11;
  --bg-card: rgba(11,14,17,0.85);
  --bg-input: rgba(8,10,14,0.9);
  --border: rgba(108,92,231,0.12);
  --border-hover: rgba(108,92,231,0.25);
  --text: #E2E8F0;
  --text-dim: #94A3B8;
  --text-muted: #64748B;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --transition: 250ms ease;
  --glass: rgba(11,14,17,0.65);
  --glass-border: rgba(108,92,231,0.08);
  --danger: #EF4444;
  --warning: #F59E0B;
  --success: #10B981;
}

*, *::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;
  background-image:
    radial-gradient(ellipse at 15% 0%, rgba(108,92,231,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 100%, rgba(0,206,201,0.05) 0%, transparent 50%);
}
.app { max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; min-height: 100vh; }

.header { padding: 20px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.header-left { display: flex; align-items: center; gap: 14px; }
.logo { 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); }
.header h1 { font-size: 1.3rem; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { font-size: 0.75rem; color: var(--text-dim); }

.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: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #5B4BD5; transform: translateY(-1px); }
.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); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.main { flex: 1; padding: 20px 0; }

/* Upload Zone */
.upload-zone { display: flex; align-items: center; justify-content: center; min-height: 300px; border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer; transition: all var(--transition); }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--primary); background: var(--primary-dim); }
.upload-content { text-align: center; padding: 40px; }
.upload-content h2 { font-size: 1.1rem; margin-top: 16px; }
.upload-content p { color: var(--text-dim); font-size: 0.85rem; margin-top: 8px; }
.upload-note { font-size: 0.72rem !important; color: var(--text-muted) !important; margin-top: 16px !important; }

/* Dashboard */
.hidden { display: none !important; }
.summary-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-label { font-size: 0.72rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 1.4rem; font-weight: 700; font-family: var(--mono); color: var(--accent); }

.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.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; animation: fadeIn 0.3s ease; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-header h2 { font-size: 0.88rem; font-weight: 600; }
.panel-body { padding: 16px; flex: 1; overflow-y: auto; max-height: 500px; }

/* Treemap */
.treemap { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.treemap-cell { border-radius: 6px; display: flex; align-items: center; justify-content: center; padding: 8px; font-size: 0.7rem; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4); cursor: default; transition: all 150ms ease; min-height: 40px; position: relative; overflow: hidden; }
.treemap-cell:hover { transform: scale(1.03); z-index: 2; }
.treemap-cell .cell-name { font-size: 0.65rem; }
.treemap-cell .cell-size { font-family: var(--mono); font-size: 0.6rem; opacity: 0.8; }

/* Section List */
.section-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.82rem; }
.section-row:last-child { border-bottom: none; }
.section-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-dot { width: 10px; height: 10px; border-radius: 3px; }
.section-size { font-family: var(--mono); color: var(--accent); }
.section-pct { font-size: 0.72rem; color: var(--text-muted); margin-left: 8px; }
.section-bar { width: 60px; height: 6px; background: var(--bg-input); border-radius: 3px; overflow: hidden; margin-left: 8px; }
.section-bar-fill { height: 100%; border-radius: 3px; }

/* Tree List */
.sub-title { font-size: 0.78rem; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.tree-list { font-size: 0.8rem; }
.tree-item { padding: 4px 0 4px 16px; border-left: 2px solid var(--border); margin-left: 4px; }
.tree-item .item-module { color: var(--secondary); font-weight: 600; }
.tree-item .item-name { color: var(--text); font-family: var(--mono); font-size: 0.78rem; }
.tree-item .item-type { color: var(--text-muted); font-size: 0.72rem; }
.empty-state { color: var(--text-muted); font-size: 0.82rem; text-align: center; padding: 16px; }

/* Function List */
.func-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.func-row:last-child { border-bottom: none; }
.func-name { font-family: var(--mono); font-size: 0.78rem; }
.func-size-bar { flex: 1; max-width: 120px; height: 6px; background: var(--bg-input); border-radius: 3px; margin: 0 10px; overflow: hidden; }
.func-size-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 3px; }
.func-size { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); }

/* Suggestions */
.suggestions-list { list-style: none; }
.suggestions-list li { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 0.82rem; display: flex; align-items: flex-start; gap: 8px; }
.suggestion-icon { font-size: 1rem; flex-shrink: 0; }
.suggestion-text strong { color: var(--accent); }

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

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

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

@media (max-width: 900px) { .summary-bar { grid-template-columns: repeat(3, 1fr); } .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .app { padding: 0 12px; } .summary-bar { grid-template-columns: repeat(2, 1fr); } .header h1 { font-size: 1.1rem; } }
