:root {
  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --ink-muted: #475569;
  --line: #dbe4ee;
  --brand-navy: #03254f;
  --brand-yellow: #fcd728;
  --good: #059669;
  --bad: #dc2626;
  --warning-bg: #fff8db;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fcfcfc;
  color: var(--ink);
  font-family: Barlow, sans-serif;
}

.hero-bg {
  position: absolute;
  inset: 0 0 auto 0;
  height: 600px;
  pointer-events: none;
  opacity: 0.4;
  overflow: hidden;
  z-index: 0;
  mix-blend-mode: multiply;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 16px 18px 56px;
}

.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 32px 0 16px;
}

.brand-icon {
  width: 90px;
  height: auto;
}

.brand-title {
  margin: 0;
  margin-top: 12px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--brand-navy);
  text-align: center;
}

.hero-section {
  text-align: center;
  margin: 0 auto 10px;
  max-width: 860px;
  padding: 40px 24px;
}

.hero-pill {
  display: inline-block;
  margin: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(252, 215, 40, 0.2);
  color: var(--brand-navy);
  border: 1px solid rgba(252, 215, 40, 0.45);
}

.hero-section h2 {
  margin: 12px 0 8px;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
  color: var(--ink);
}

.hero-section p {
  margin: 0 auto;
  max-width: 720px;
  color: var(--ink-muted);
  font-size: 18px;
}

.static-help {
  position: relative;
  z-index: 2;
}

.static-before-after {
  padding-top: 0;
}

.calculator-shell {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-width: 72rem;
  margin: 0 auto;
  padding: 8px 24px 24px;
}

.calculator-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.calculator-header h3 {
  margin: 0;
  font-size: 30px;
  color: var(--ink);
}

.calculator-header p {
  margin: 3px 0 0;
  color: var(--ink-muted);
}

.currency-switch,
.timeframe-switch,
.charge-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-switch,
.timeframe-switch {
  padding: 4px;
  border-radius: 10px;
  background: #eef3f8;
}

.currency-switch button,
.timeframe-switch button,
.charge-presets button,
.action-row button,
.cta,
#resetBtn,
#shareBtn,
#exportBtn {
  appearance: none;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink-muted);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 140ms ease;
}

.currency-switch button.is-active,
.timeframe-switch button.is-active {
  background: #fff;
  color: var(--brand-navy);
  box-shadow: 0 2px 8px rgba(3, 37, 79, 0.15);
}

.charge-presets button {
  border-color: #f0dca0;
  background: #fffef9;
  color: var(--brand-navy);
}

.charge-presets button.is-active {
  background: #f9b21c;
  color: #fff;
  border-color: #f9b21c;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.panel,
.summary-panel,
.summary-hero {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.panel h4,
.summary-panel h5 {
  margin: 0 0 12px;
  color: var(--ink);
}

.panel h4 {
  font-size: 19px;
}

.panel label,
.summary-panel label {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}

.panel input[type="number"],
.summary-panel input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.panel input[type="range"] {
  width: 100%;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.range-row output {
  min-width: 52px;
  text-align: right;
  color: var(--brand-navy);
  font-weight: 700;
}

.toggle-row,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  margin-top: 8px;
}

.note-box {
  margin-top: 10px;
  background: #f6f9fd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  color: var(--ink-muted);
  font-size: 13px;
}

.note-box p {
  margin: 4px 0;
}

.hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.panel-accent {
  background: #f6f9fe;
}

.panel-warning {
  background: var(--warning-bg);
}

.summary {
  display: grid;
  gap: 12px;
}

.summary-hero {
  background: linear-gradient(145deg, #062d61 0%, #03254f 74%);
  color: #e6eef8;
  border: none;
}

.summary-hero h4 {
  margin: 0;
  color: #d7e5f7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-hero .net {
  margin: 8px 0 0;
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.summary-hero .period {
  margin: 2px 0 0;
  color: #93afcf;
  font-weight: 600;
}

.summary-hero .tiny {
  margin: 10px 0 0;
  font-size: 11px;
  color: #8ea9c6;
}

.summary-stats {
  margin-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-stats span {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9db4cf;
}

.summary-stats strong {
  font-size: 28px;
  color: #fff;
}

.summary-panel dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.summary-panel dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.summary-panel dt {
  color: var(--ink-muted);
  font-size: 13px;
}

.summary-panel dd {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  font-feature-settings: "tnum";
}

.summary-panel .total {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.panel-kicker {
  margin: -2px 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--ink-muted);
}

.glance-bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f4f7fb;
  display: flex;
}

.glance-seg {
  height: 100%;
  min-width: 0;
}

.glance-cost {
  background: #334155;
}

.glance-revenue {
  background: var(--brand-yellow);
}

.glance-time {
  background: #10b981;
}

.glance-other {
  background: #14b8a6;
}

.glance-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.glance-grid div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.glance-grid span {
  display: block;
  color: var(--ink);
  font-weight: 700;
}

.glance-grid small {
  display: block;
  margin-top: 2px;
  color: var(--ink-muted);
  font-size: 11px;
}

.hosting-box {
  margin-top: 10px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
  padding: 10px;
}

.hosting-box h6 {
  margin: 0 0 6px;
  color: #1d4ed8;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.hosting-line,
.hosting-formula,
.hosting-equivalent,
.hosting-note {
  margin: 5px 0;
}

.hosting-line {
  color: var(--ink);
  font-size: 13px;
}

.hosting-formula,
.hosting-equivalent {
  color: #334155;
  font-size: 12px;
}

.hosting-note {
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
}

.summary-panel-profit {
  border-color: #fde68a;
  background: #fffbeb;
}

.direct-box {
  margin-top: 8px;
  border-top: 1px solid #f5e2a4;
  padding-top: 8px;
}

.summary-panel.meta {
  background: #f8fafc;
}

.action-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

#resetBtn {
  border-color: var(--line);
  color: var(--ink-muted);
}

#shareBtn {
  background: var(--brand-navy);
  color: #fff;
}

#exportBtn {
  border-color: var(--brand-navy);
  color: var(--brand-navy);
}

#shareBtn.flash {
  background: var(--good);
}

.closing-note {
  margin: 32px auto 0;
  max-width: 800px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 18px;
}

.closing-note h3 {
  margin: 0 0 8px;
  font-size: 30px;
}

.closing-note p {
  margin: 0;
  color: var(--ink-muted);
}

.cta {
  margin-top: 14px;
  display: inline-block;
  background: var(--brand-navy);
  color: #fff;
  text-decoration: none;
}

.page-footer {
  margin-top: 14px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 12px;
}

@media (min-width: 980px) {
  .calculator-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .calculator-grid > .panel:nth-child(1),
  .calculator-grid > .panel:nth-child(2),
  .calculator-grid > .panel:nth-child(3),
  .calculator-grid > .panel:nth-child(4),
  .calculator-grid > .panel:nth-child(5) {
    grid-column: span 7;
  }

  .summary {
    grid-column: 8 / span 5;
    grid-row: 1 / span 5;
    position: sticky;
    top: 12px;
    align-self: start;
  }
}

@media (max-width: 640px) {
  .brand-icon {
    width: 76px;
  }

  .brand-title {
    font-size: 1.1rem;
  }

  .calculator-shell {
    padding: 8px 12px 12px;
  }

  .calculator-header h3 {
    font-size: 24px;
  }

  .summary-hero .net {
    font-size: 38px;
  }

  .summary-stats strong {
    font-size: 22px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }
}
