@import url('https://fonts.googleapis.com/css2?family=Urbanist:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-surface: #18181b;
  --bg-elevated: #27272a;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --accent: #14b8a6;
  --accent-dim: rgba(20, 184, 166, 0.12);
  --accent-warm: #f59e0b;
  --positive: #22c55e;
  --negative: #ef4444;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #52525b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Urbanist', sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  min-height: 100vh;
}

/* Grain overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.02;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* Nav */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-link {
  position: relative;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-link:hover { color: var(--text-muted); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

/* Glass card */
.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.25s ease;
}
.glass-card:hover { border-color: var(--border-hover); }
.glass-card-glow:hover {
  box-shadow: 0 0 0 1px rgba(20,184,166,0.15), 0 4px 24px -4px rgba(20,184,166,0.08);
}

/* Upload zone */
.upload-zone {
  border: 2px dashed var(--text-dim);
  border-radius: 16px;
  transition: all 0.3s ease;
  cursor: pointer;
  background: var(--bg-surface);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-zone.drag-over { transform: scale(1.005); }

.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.progress-track {
  height: 4px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.target-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  width: 60px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  transition: border-color 0.2s;
}
.target-input:focus { outline: none; border-color: var(--accent); }

.action-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.action-badge.comprar { background: rgba(34,197,94,0.1); color: var(--positive); }
.action-badge.vender { background: rgba(239,68,68,0.1); color: var(--negative); }
.action-badge.ok { background: rgba(161,161,170,0.08); color: var(--text-dim); }

.chart-container {
  position: relative;
  height: 260px;
  width: 260px;
  margin: 0 auto;
}

/* Dropdown */
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hover);
  border-radius: 8px;
  padding: 4px;
  min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 50;
}
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Urbanist', sans-serif;
  transition: all 0.15s;
}
.dropdown-item:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.dropdown-item.danger { color: var(--negative); }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

section[id] { scroll-margin-top: 72px; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.5s ease forwards; }
.stagger > * { animation: fadeUp 0.4s ease forwards; opacity: 0; }
.stagger > *:nth-child(1) { animation-delay: 0.04s; }
.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.16s; }
.stagger > *:nth-child(5) { animation-delay: 0.20s; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.loading-pulse { animation: pulse 1.5s ease-in-out infinite; }

/* Table */
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th {
  text-align: inherit;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.detail-table td {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr:hover td { background: rgba(255,255,255,0.02); }

.rent-positive { color: var(--positive); }
.rent-negative { color: var(--negative); }

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
}
