/* public/css/estimator.css — Contract at Risk Estimator styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: #0a0f0d;
  color: #e8ede9;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }
:root {
  --accent: #38bdf8;
  --accent-dim: rgba(56,189,248,0.12);
  --green: #34d399;
  --amber: #fbbf24;
  --orange: #f97316;
  --red: #ef4444;
  --bg: #0a0f0d;
  --surface: #141c18;
  --surface2: rgba(20,28,24,0.7);
  --border: #1e2a38;
  --muted: #5a6e60;
  --sub: #8fa396;
}

.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,15,13,0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; font-weight: 700; color: #e8ede9; gap: .4rem; }
.nav-brand img { height: 30px; }
.nav-links { display: flex; gap: .5rem; }
.nav-link { font-size: .82rem; color: var(--sub); padding: .4rem .75rem; border-radius: 7px; transition: all .18s; }
.nav-link:hover { color: #e8ede9; background: rgba(255,255,255,0.05); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }

.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 2.5rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -120px; left: 50%; transform: translateX(-50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, rgba(56,189,248,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem 1rem;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 100px;
  font-size: .72rem; font-weight: 700; letter-spacing: .12em; color: #f87171;
  margin-bottom: 1.5rem; text-transform: uppercase;
}
.badge svg { width: 12px; height: 12px; }
.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700; line-height: 1.15; margin-bottom: 1rem;
  background: linear-gradient(135deg, #e8ede9 0%, #38bdf8 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { font-size: 1rem; color: var(--sub); max-width: 500px; margin: 0 auto 2rem; line-height: 1.65; }
.trust-row { display: flex; justify-content: center; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.trust-item { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: .35rem; }
.trust-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.main-wrap {
  max-width: 1060px; margin: 0 auto; padding: 0 1.5rem 5rem;
  display: grid; grid-template-columns: 1fr 380px; gap: 1.5rem; align-items: start;
}
@media (max-width: 780px) { .main-wrap { grid-template-columns: 1fr; } }

.form-card {
  background: rgba(20,28,24,0.85); border: 1px solid var(--border);
  border-radius: 18px; padding: 2.25rem; backdrop-filter: blur(12px);
  position: relative; overflow: hidden;
}
.form-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 18px 18px 0 0;
}
.form-section { margin-bottom: 2rem; }
.form-section:last-child { margin-bottom: 0; }
.section-label { font-size: .72rem; font-weight: 700; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; margin-bottom: .6rem; }
.section-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.05rem; font-weight: 600; color: #e8ede9; margin-bottom: 1rem; }

.buyer-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: .75rem;
  align-items: start; padding: 1rem 0; border-bottom: 1px solid var(--border);
}
.buyer-row:first-child { padding-top: 0; }
.buyer-row:last-child { border-bottom: none; padding-bottom: 0; }
.buyer-num { grid-column: 1/-1; font-size: .7rem; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .5rem; }

.field-group { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .75rem; color: var(--sub); font-weight: 500; }
.field-input {
  width: 100%; padding: .7rem 1rem;
  background: rgba(30,42,56,0.45);
  border: 1px solid var(--border); border-radius: 9px;
  color: #e8ede9; font-size: .9rem; transition: border-color .18s;
}
.field-input:focus { outline: none; border-color: var(--accent); }
.field-input::placeholder { color: var(--muted); }
.field-input.mono { font-family: 'JetBrains Mono', monospace; }

.currency-wrap { position: relative; }
.currency-wrap .field-input { padding-left: 1.75rem; }
.currency-prefix { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-family: 'JetBrains Mono', monospace; font-size: .85rem; }

select.field-input { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6e60' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px; padding-right: 2.5rem; }

.total-revenue-box {
  background: rgba(56,189,248,0.06); border: 1px solid rgba(56,189,248,0.2);
  border-radius: 12px; padding: 1.25rem 1.5rem;
  display: grid; grid-template-columns: 1fr 180px; gap: 1rem; align-items: end;
}

.radio-group { display: flex; gap: .6rem; flex-wrap: wrap; }
.radio-btn {
  display: flex; align-items: center; gap: .5rem;
  padding: .65rem 1.1rem;
  background: rgba(30,42,56,0.4); border: 1px solid var(--border); border-radius: 8px;
  color: #94a3b8; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all .18s;
}
.radio-btn:hover { border-color: rgba(56,189,248,0.35); color: #e8ede9; }
.radio-btn.selected { border-color: var(--accent); background: rgba(56,189,248,0.12); color: var(--accent); }
.radio-btn input { display: none; }
.radio-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; position: relative; flex-shrink: 0; }
.radio-btn.selected .radio-dot::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }

.btn-calculate {
  width: 100%; padding: .95rem 2rem;
  background: linear-gradient(135deg, var(--accent), var(--green));
  border: none; border-radius: 11px;
  color: #0a0f0d; font-size: 1rem; font-weight: 700;
  font-family: 'Space Grotesk', sans-serif;
  transition: opacity .18s, transform .18s;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  margin-top: .5rem;
}
.btn-calculate:hover { opacity: .92; transform: translateY(-1px); }
.btn-calculate:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-calculate svg { width: 18px; height: 18px; }

.loading-overlay {
  display: none; position: absolute; inset: 0;
  background: rgba(10,15,13,0.88); border-radius: 18px;
  align-items: center; justify-content: center; flex-direction: column; gap: 1rem; z-index: 5;
}
.loading-overlay.show { display: flex; }
.spinner { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-family: 'JetBrains Mono', monospace; font-size: .85rem; color: var(--accent); }

.err-msg { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); border-radius: 8px; padding: .75rem 1rem; font-size: .82rem; color: #f87171; margin-top: .75rem; display: none; }
.err-msg.show { display: block; }

.results-panel { display: none; }
.results-panel.visible { display: block; animation: slideIn .4s cubic-bezier(0.4, 0, 0.2, 1); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

.results-placeholder {
  background: rgba(20,28,24,0.5); border: 1px dashed rgba(30,42,56,0.7);
  border-radius: 18px; padding: 2.5rem 1.5rem;
  text-align: center; color: var(--muted); font-size: .85rem; line-height: 1.6;
}
.results-placeholder svg { width: 40px; height: 40px; margin: 0 auto .75rem; opacity: .4; }

.result-card {
  background: rgba(20,28,24,0.85); border: 1px solid var(--border);
  border-radius: 18px; padding: 1.75rem; backdrop-filter: blur(12px);
  position: sticky; top: 80px;
}
.result-top { text-align: center; margin-bottom: 1.5rem; }
.result-eyebrow { font-size: .7rem; font-weight: 700; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; margin-bottom: .5rem; }
.result-at-risk-label { font-size: .75rem; color: var(--sub); margin-bottom: .25rem; }
.result-at-risk-amt { font-family: 'JetBrains Mono', monospace; font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1; margin-bottom: .35rem; }
.result-revenue-label { font-size: .75rem; color: var(--sub); }
.result-revenue-amt { font-family: 'JetBrains Mono', monospace; font-size: 1.05rem; color: var(--muted); }

.tier-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1.1rem; border-radius: 100px; font-size: .85rem; font-weight: 700; margin-top: .5rem; }

.pct-bar-wrap { margin: 1.25rem 0 .75rem; }
.pct-bar-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.pct-bar-fill { height: 100%; border-radius: 4px; transition: width 1.2s cubic-bezier(0.4,0,0.2,1); }
.pct-bar-labels { display: flex; justify-content: space-between; margin-top: .3rem; font-size: .68rem; color: var(--muted); }

.buyer-breakdown { margin-top: 1.5rem; }
.buyer-breakdown-title { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; }
.buyer-item { display: flex; align-items: center; justify-content: space-between; padding: .75rem 0; border-bottom: 1px solid var(--border); gap: .5rem; }
.buyer-item:last-child { border-bottom: none; }
.buyer-info { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.buyer-num-badge { width: 20px; height: 20px; border-radius: 5px; background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.2); display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; color: var(--accent); flex-shrink: 0; }
.buyer-name { font-size: .82rem; color: #e8ede9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buyer-rev { font-size: .72rem; color: var(--muted); }
.buyer-risk { font-family: 'JetBrains Mono', monospace; font-size: .82rem; font-weight: 600; text-align: right; flex-shrink: 0; }

.email-gate { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.email-gate-title { font-size: .82rem; font-weight: 600; color: #e8ede9; margin-bottom: .4rem; }
.email-gate-sub { font-size: .78rem; color: var(--muted); margin-bottom: .85rem; line-height: 1.5; }
.email-input {
  width: 100%; padding: .7rem 1rem;
  background: rgba(30,42,56,0.45); border: 1px solid var(--border); border-radius: 9px;
  color: #e8ede9; font-size: .875rem; transition: border-color .18s; margin-bottom: .6rem;
}
.email-input:focus { outline: none; border-color: var(--accent); }
.email-input::placeholder { color: var(--muted); }
.btn-download {
  width: 100%; padding: .75rem 1rem;
  background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.3); border-radius: 9px;
  color: var(--accent); font-size: .875rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: .5rem; transition: all .18s;
}
.btn-download:hover { background: rgba(56,189,248,0.18); border-color: rgba(56,189,248,0.5); }
.btn-download svg { width: 15px; height: 15px; }
.gate-confirmation { font-size: .82rem; color: var(--green); font-weight: 500; text-align: center; margin-top: .6rem; display: none; }
.gate-confirmation.show { display: block; }

footer { border-top: 1px solid var(--border); padding: 2rem 1.5rem; text-align: center; }
.footer-inner { max-width: 1100px; margin: 0 auto; }
.footer-links { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; margin-bottom: .75rem; }
.footer-links a { font-size: .78rem; color: var(--muted); }
.footer-links a:hover { color: var(--sub); }
.footer-copy { font-size: .72rem; color: var(--muted); }