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

:root {
  --navy-950: #04080F;
  --navy-900: #080E1A;
  --navy-800: #0C1524;
  --navy-700: #111B33;
  --navy-600: #162241;
  --navy-500: #1A2A4A;
  --navy-400: #1E3355;
  --navy-300: #2A4070;
  --navy-200: #3D5A8A;

  --bg:             var(--navy-900);
  --bg-card:        var(--navy-700);
  --bg-elevated:    var(--navy-500);
  --border:         var(--navy-400);
  --border-subtle:  rgba(30, 51, 85, 0.5);
  --border-light:   var(--navy-300);

  --text:           #F0F4FF;
  --text-secondary: #8899BB;
  --text-muted:     #556688;
  --text-dimmed:    #3A4F70;

  --accent:         #00D4FF;
  --accent-dim:     rgba(0, 212, 255, 0.07);
  --accent-mid:     rgba(0, 212, 255, 0.14);
  --accent-border:  rgba(0, 212, 255, 0.22);
  --accent-glow:    rgba(0, 212, 255, 0.35);

  --violet:         #8B5CF6;
  --violet-dim:     rgba(139, 92, 246, 0.07);

  --green:          #10B981;
  --green-dim:      rgba(16, 185, 129, 0.07);
  --green-border:   rgba(16, 185, 129, 0.22);

  --amber:          #F59E0B;
  --amber-dim:      rgba(245, 158, 11, 0.07);
  --amber-border:   rgba(245, 158, 11, 0.22);

  --grad-brand:     linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
  --grad-text:      linear-gradient(135deg, #F0F4FF 30%, var(--accent) 100%);

  --max-w:          1100px;
  --radius:         16px;
  --radius-sm:      10px;
  --radius-xs:      8px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:      0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.5);
  --shadow-glow:    0 0 40px rgba(0, 212, 255, 0.18);

  --ease-out:       cubic-bezier(0.4, 0, 0.2, 1);
  --transition:     all 0.3s var(--ease-out);
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: var(--bg); }
a { text-decoration: none; color: inherit; }

/* ─── SCROLL PROGRESS ─────────────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--grad-brand);
  z-index: 500;
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ─── NAV ──────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 18px 24px;
  transition: var(--transition);
}
.nav.scrolled {
  background: rgba(8, 14, 26, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 24px;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--grad-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  letter-spacing: 0.1px;
}
.nav-links a:hover { color: var(--text); }

/* ─── HERO ─────────────────────────────────────────────── */
.hero {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 130px 24px 60px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-bg::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  top: -200px; left: -200px;
  background: radial-gradient(ellipse, rgba(0, 212, 255, 0.05) 0%, transparent 65%);
  animation: blob-float 9s ease-in-out infinite alternate;
}
.hero-bg::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  bottom: -150px; right: -150px;
  background: radial-gradient(ellipse, rgba(139, 92, 246, 0.05) 0%, transparent 65%);
  animation: blob-float 12s ease-in-out infinite alternate-reverse;
}
@keyframes blob-float {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 30px) scale(1.12); }
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(42, 64, 112, 0.5) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
  opacity: 0.45;
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 840px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px 7px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-bottom: 36px;
  font-family: 'JetBrains Mono', monospace;
  cursor: default;
  box-shadow: inset 0 0 20px var(--accent-dim);
}
.hero-badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: dot-pulse 1.8s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.65); }
}
.hero-title {
  font-size: clamp(2.2rem, 5.5vw, 4rem);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.08;
  margin-bottom: 28px;
}
.hero-title .grad {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.78;
  font-weight: 400;
}

/* ─── BUTTONS ─────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 30px;
  border-radius: var(--radius-xs);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  background: var(--accent);
  color: var(--navy-900);
  box-shadow: 0 0 28px var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 0 44px var(--accent-glow);
  transform: translateY(-2px);
}

/* ─── UPLOAD SECTION ──────────────────────────────────── */
.upload-section {
  padding: 40px 24px 80px;
}
.upload-inner {
  max-width: 600px;
  margin: 0 auto;
}
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 32px;
  text-align: center;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  background: var(--bg-card);
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 40px var(--accent-dim);
}
.upload-zone.has-file {
  border-color: var(--accent);
  border-style: solid;
}
.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-icon {
  color: var(--text-muted);
  margin-bottom: 20px;
  transition: var(--transition);
}
.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
  color: var(--accent);
}
.upload-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.upload-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.upload-btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--navy-900);
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  pointer-events: none;
}
.upload-btn:hover {
  box-shadow: 0 0 24px var(--accent-glow);
}
.upload-hint {
  font-size: 11px;
  color: var(--text-dimmed);
  margin-top: 20px;
  font-family: 'JetBrains Mono', monospace;
}

/* ─── LOADING ───────────────────────────────────────────── */
.upload-loading {
  text-align: center;
  padding: 60px 32px;
}
.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 24px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-text {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.loading-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ─── ERROR ────────────────────────────────────────────── */
.upload-error {
  text-align: center;
  padding: 60px 32px;
}
.error-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #EF4444;
  margin: 0 auto 20px;
}
.error-text {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ─── DASHBOARD ───────────────────────────────────────── */
.dashboard {
  padding: 20px 24px 100px;
}
.dashboard-inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 36px;
  gap: 20px;
  flex-wrap: wrap;
}
.dash-supplier {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.dash-title {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.2;
}
.dash-badge {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── TOTAL CARD ──────────────────────────────────────── */
.total-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 44px;
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.total-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--grad-brand);
  opacity: 0.6;
}
.total-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.total-amount {
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -3px;
  line-height: 1;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}
.total-meta {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 8px;
}
.total-dot { color: var(--border); }

/* ─── KPI GRID ─────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 36px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px 24px;
  transition: var(--transition);
}
.kpi-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 16px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  line-height: 1;
}
.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.3;
}

/* ─── SECTION LABEL ───────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', monospace;
}

/* ─── COST BREAKDOWN ──────────────────────────────────── */
.cost-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px;
  margin-bottom: 36px;
}
.cost-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  margin-bottom: 28px;
  overflow: hidden;
}
.cost-bar-fill {
  height: 100%;
  background: var(--grad-brand);
  border-radius: 999px;
  transition: width 1.2s var(--ease-out);
}
.cost-items { display: flex; flex-direction: column; gap: 14px; }
.cost-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.cost-item-name {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.cost-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cost-item-amount {
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* ─── CONTRACT GRID ───────────────────────────────────── */
.contract-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}
.contract-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 20px;
}
.contract-label {
  font-size: 10px;
  color: var(--text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 6px;
  font-family: 'JetBrains Mono', monospace;
}
.contract-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* ─── HISTÓRICO ───────────────────────────────────────── */
.historico-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 28px;
  margin-bottom: 36px;
}
.historico-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 200px;
  padding-top: 20px;
}
.historico-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.historico-bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  background: var(--grad-brand);
  opacity: 0.7;
  transition: height 1s var(--ease-out);
  min-height: 4px;
  cursor: pointer;
  position: relative;
}
.historico-bar:hover {
  opacity: 1;
  box-shadow: 0 0 16px var(--accent-glow);
}
.historico-bar-value {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.historico-bar-label {
  font-size: 10px;
  color: var(--text-dimmed);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── RAW DATA ────────────────────────────────────────── */
.raw-details {
  margin-bottom: 36px;
}
.raw-summary {
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 12px 0;
  font-family: 'JetBrains Mono', monospace;
  transition: var(--transition);
}
.raw-summary:hover { color: var(--accent); }
.raw-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  margin-top: 8px;
}

/* ─── DASHBOARD ACTIONS ───────────────────────────────── */
.dash-actions {
  text-align: center;
  padding-top: 20px;
}

/* ─── FOOTER ──────────────────────────────────────────── */
.footer {
  padding: 36px 24px;
  border-top: 1px solid var(--border);
  background: var(--navy-800);
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}
.footer-legal { display: flex; gap: 20px; }
.footer-legal a {
  font-size: 12px;
  color: var(--text-dimmed);
  transition: var(--transition);
}
.footer-legal a:hover { color: var(--accent); }

/* ─── REVEAL ──────────────────────────────────────────── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .hero { min-height: 70vh; padding: 110px 20px 40px; }
  .hero-title { font-size: 2rem; letter-spacing: -1.5px; }
  .upload-zone { padding: 40px 24px; }
  .total-card { padding: 32px 24px; }
  .contract-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .hero { padding: 100px 20px 30px; }
  .hero-title { font-size: 1.8rem; }
  .kpi-grid { grid-template-columns: 1fr; }
  .contract-grid { grid-template-columns: 1fr; }
  .dash-header { flex-direction: column; }
  .footer-inner { flex-direction: column; text-align: center; }
}
