/* ==========================================================================
   ESSID Lab — Calculadora de Preço de Venda & Margem Real
   ========================================================================== */
:root {
  --bg: #101118;
  --navy: #2b2d3f;
  --surface: #161824;
  --surface-2: #1d2030;
  --text: #fefefe;
  --text-muted: #b5b7c7;
  --text-subtle: #8d8fa3;
  --accent: #f9a431;
  --accent-2: #ffd000;
  --accent-soft: rgba(249, 164, 49, 0.14);
  --cyan: #00b4e6;
  --magenta: #ff2d9b;
  --green: #10b981;
  --font-sans: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
::selection { background: var(--accent); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(43, 45, 63, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 45, 63, 0.25) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 10%, black 22%, transparent 80%);
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  width: 780px;
  height: 440px;
  background: radial-gradient(circle, rgba(249, 164, 49, 0.15), rgba(43, 45, 63, 0.12) 50%, transparent 72%);
  filter: blur(42px);
  pointer-events: none;
  z-index: 0;
}

.container { position: relative; z-index: 1; width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }

.topbar {
  border-bottom: 1px solid var(--navy);
  background: rgba(16, 17, 24, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { height: 32px; width: auto; display: block; }
.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(249, 164, 49, 0.34);
  padding: 3px 9px;
  border-radius: 999px;
}
.nav { display: flex; align-items: center; gap: 16px; font-size: 0.84rem; font-weight: 600; }
.nav a { color: var(--text-muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }

.main-content { padding-top: 36px; padding-bottom: 64px; }
.hero { text-align: center; max-width: 760px; margin: 0 auto 28px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--navy);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.hero h1 { font-size: clamp(1.8rem, 3.8vw, 2.65rem); line-height: 1.15; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 12px; }
.text-gradient { background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-subtitle { color: var(--text-muted); font-size: 0.95rem; max-width: 620px; margin: 0 auto 20px; }

.presets-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.preset-btn {
  appearance: none;
  border: 1px solid var(--navy);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.preset-btn:hover { color: var(--text); border-color: rgba(249, 164, 49, 0.45); }
.preset-btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.calc-grid { display: grid; grid-template-columns: 1.02fr 0.98fr; gap: 22px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--navy); border-radius: 18px; padding: 24px; }
.card-head { margin-bottom: 16px; }
.card-head h2 { font-size: 1rem; font-weight: 700; margin-bottom: 3px; }
.card-head p { font-size: 0.82rem; color: var(--text-muted); }
.card h3 { font-size: 0.96rem; font-weight: 700; margin-bottom: 14px; }
.divider { border: none; border-top: 1px solid var(--navy); margin: 22px 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.76rem; font-weight: 600; color: var(--text-muted); }
.field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--navy);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.field input:focus { border-color: var(--accent); outline: none; }

.sliders-stack { display: flex; flex-direction: column; gap: 16px; }
.slider-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.slider-top label { font-size: 0.84rem; font-weight: 600; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--navy);
  padding: 3px 9px;
  border-radius: 8px;
}
.chip-accent { color: var(--accent); background: var(--accent-soft); border-color: rgba(249, 164, 49, 0.35); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--navy);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--accent);
}

.compare-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  background: var(--surface-2);
  border: 1px solid var(--navy);
}
.compare-result.bad { border-color: rgba(255, 45, 155, 0.45); background: rgba(255, 45, 155, 0.1); color: #ffd4eb; }
.compare-result.good { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.1); color: #d1fae5; }

.results-col { display: flex; flex-direction: column; gap: 18px; }
.hero-result {
  background: linear-gradient(155deg, #1b1d2c 0%, #151621 58%, #221a14 100%);
  border-color: rgba(249, 164, 49, 0.35);
}
.eyebrow { display: block; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-subtle); margin-bottom: 4px; }
.big-price { font-family: var(--font-mono); font-size: clamp(2.1rem, 4vw, 2.85rem); font-weight: 700; line-height: 1.1; color: var(--text); }
.sub-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 0.86rem; color: var(--text-muted); }
.sub-metrics strong { font-family: var(--font-mono); color: var(--accent); }

.alert-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 9px;
  background: rgba(255, 45, 155, 0.14);
  border: 1px solid rgba(255, 45, 155, 0.45);
  color: #ffd4eb;
  font-size: 0.8rem;
}

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.kpi {
  background: rgba(16, 17, 24, 0.55);
  border: 1px solid var(--navy);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.kpi-accent { background: rgba(249, 164, 49, 0.1); border-color: rgba(249, 164, 49, 0.35); }
.kpi span { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.kpi strong { font-family: var(--font-mono); font-size: 1.15rem; }
.kpi-accent strong { color: var(--accent); }
.kpi small { font-size: 0.72rem; color: var(--text-subtle); }

.stacked-bar {
  display: flex;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  margin-bottom: 16px;
}
.stacked-seg { height: 100%; transition: width 0.25s ease; }

.legend-list { display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.82rem; }
.legend-left { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-val { font-family: var(--font-mono); font-weight: 700; color: var(--text); }

.scenarios-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.scenario-card {
  background: var(--surface-2);
  border: 1px solid var(--navy);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.scenario-card.featured { border-color: rgba(249, 164, 49, 0.45); background: rgba(249, 164, 49, 0.08); }
.scenario-card span { display: block; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-subtle); margin-bottom: 4px; }
.scenario-card strong { display: block; font-family: var(--font-mono); font-size: 1rem; color: var(--text); }
.scenario-card small { display: block; font-size: 0.72rem; color: var(--accent); margin-top: 3px; font-family: var(--font-mono); }

.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.16s ease;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { background: #ffba52; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--navy); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.footer { border-top: 1px solid var(--navy); padding: 22px 0; font-size: 0.82rem; color: var(--text-subtle); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.footer-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-logo { height: 28px; width: auto; display: block; }
.footer-links { display: flex; align-items: center; gap: 10px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 920px) { .calc-grid { grid-template-columns: 1fr; } }
@media (max-width: 580px) {
  .form-grid, .kpi-grid, .scenarios-grid, .actions-row { grid-template-columns: 1fr; }
  .nav { gap: 10px; font-size: 0.78rem; }
}
