:root {
  --navy: var(--blue-900);
  --blue: var(--blue-700);
  --surface: var(--white);
  --success: #176b4d;
  --danger: #a32835;
  --navy-deep: var(--blue-900);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.tool-site-header { min-height: 76px; }

.prototype-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  color: var(--blue-900);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font-size: .82rem;
  font-weight: 850;
}

main { padding: 46px 0 72px; }

.intro { max-width: 830px; margin-bottom: 28px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-700);
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2 { color: var(--navy); line-height: 1.1; }
h1 { margin: 0; max-width: 850px; font-family: inherit; font-size: clamp(38px, 5vw, 64px); font-weight: 900; }
h2 { margin: 0; font-family: inherit; font-size: 2rem; font-weight: 850; }
.intro > p:not(.eyebrow) { max-width: 680px; color: var(--muted); font-size: 18px; }

.data-status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 20px;
  padding-left: 14px;
  border-left: 3px solid var(--gold);
}

.data-status span { color: var(--muted); }
.data-status a { color: var(--blue); font-weight: 700; }

.calculator {
  display: grid;
  grid-template-columns: minmax(380px, .82fr) minmax(0, 1.18fr);
  min-height: 520px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calculator-form, .result, .result-placeholder { padding: 34px; }
.calculator-form { display: flex; flex-direction: column; gap: 22px; }
.panel-heading { display: flex; gap: 12px; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel-heading > span, .result-kicker > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  color: #fff;
  background: var(--gold);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
}
.panel-heading strong { display: block; color: var(--navy); }
.panel-heading small { display: block; color: var(--muted); }
.result { background: var(--navy); color: #fff; }
.result-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #d9e5ee;
  background: var(--navy-deep);
  overflow: hidden;
}
.result-placeholder__mark { position: absolute; right: 24px; top: -44px; color: rgba(255,255,255,.055); font: 900 260px/1 Inter, "Segoe UI", Arial, sans-serif; }
.result-placeholder .eyebrow { position: relative; color: #efc45e; }
.result-placeholder h2 { position: relative; max-width: 430px; color: #fff; font-size: 34px; }
.result-placeholder p:not(.eyebrow) { position: relative; max-width: 430px; }
.placeholder-lines { position: relative; display: grid; gap: 10px; max-width: 390px; margin-top: 28px; }
.placeholder-lines span { height: 5px; background: rgba(255,255,255,.12); }
.placeholder-lines span:nth-child(2) { width: 78%; }
.placeholder-lines span:nth-child(3) { width: 56%; }

.field { display: grid; gap: 8px; }
.field label { color: var(--navy); font-size: 14px; font-weight: 800; }
.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b7c5d4;
  border-radius: 8px;
}
.field input:focus { outline: 3px solid rgba(23, 79, 122, .16); border-color: var(--blue); }

.period-field { margin: 0; padding: 0; border: 0; }
.period-field legend { margin-bottom: 8px; color: var(--navy); font-size: 14px; font-weight: 800; }
.period-field small { display: block; margin-top: 8px; color: var(--muted); }
.period-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.period-options label { min-width: 0; }
.period-options input { position: absolute; opacity: 0; pointer-events: none; }
.period-options span {
  display: grid;
  min-height: 46px;
  place-items: center;
  color: var(--navy);
  background: #fff;
  border: 1px solid #b7c5d4;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
}
.period-options input:checked + span { color: #fff; background: var(--navy); border-color: var(--navy); }
.period-options input:focus-visible + span { outline: 3px solid rgba(23, 79, 122, .2); }

.amount-input, .rate-input { display: flex; align-items: center; border: 1px solid #b7c5d4; border-radius: 8px; overflow: hidden; }
.amount-input span, .rate-input span { padding: 0 14px; color: var(--navy); font-size: 19px; font-weight: 800; }
.amount-input input, .rate-input input { border: 0; border-left: 1px solid var(--line); border-radius: 0; }
.rate-input input { border-left: 0; border-right: 1px solid var(--line); }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.button { min-height: 50px; padding: 0 22px; border-radius: 8px; border: 1px solid var(--navy); font-weight: 850; cursor: pointer; }
.button--primary { color: #fff; background: var(--navy); }
.button--secondary { color: var(--navy); background: #fff; }
.button--light { color: var(--navy); background: #fff; border-color: #fff; }
.button--whatsapp { color: #fff; background: #19754b; border-color: #19754b; text-decoration: none; }
.button:hover { filter: brightness(.96); }
.form-message { min-height: 24px; margin: 0; color: var(--danger); font-weight: 700; }

.result-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.result-kicker p { margin: 0; color: #efc45e; font-size: 12px; font-weight: 800; }
.result-main { padding-bottom: 24px; border-bottom: 1px solid rgba(255,255,255,.22); }
.result-main span { display: block; color: #cddce8; font-size: 14px; }
.result-main strong { display: block; margin-top: 2px; font-family: inherit; font-size: clamp(38px, 6vw, 56px); font-weight: 900; line-height: 1.05; }
.result-highlight { display: grid; grid-template-columns: .65fr 1.35fr; gap: 1px; margin: 24px 0 0; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.18); border-radius: 8px 8px 0 0; overflow: hidden; }
.result-highlight > div { min-width: 0; padding: 16px; background: rgba(255,255,255,.07); }
.result-highlight span { display: block; color: #cddce8; font-size: 12px; }
.adjustment-highlight strong { display: block; margin-top: 4px; color: #fff; font-size: 28px; }
.formula-box strong { display: block; margin-top: 7px; color: #fff; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.result-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 1px 0 24px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.18); border-top: 0; border-radius: 0 0 8px 8px; overflow: hidden; }
.result-metrics div { padding: 13px 16px; background: rgba(255,255,255,.045); }
.result-metrics dt { color: #cddce8; font-size: 13px; }
.result-metrics dd { margin: 2px 0 0; font-size: 19px; font-weight: 800; }
.breakdown { padding-top: 22px; border-top: 1px solid rgba(255,255,255,.22); }
.breakdown h2 { color: #fff; font-family: inherit; font-size: 17px; }
.breakdown ol { margin: 14px 0 0; padding: 0; list-style: none; }
.breakdown li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.result-note { color: #cddce8; font-size: 12px; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.share-actions .button { display: grid; place-items: center; text-align: center; }

.method {
  display: grid;
  grid-template-columns: minmax(260px, .75fr) 1fr;
  gap: 44px;
  align-items: start;
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}
.method > p { margin: 0; color: var(--muted); }

.maintenance { margin-top: 30px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.maintenance summary { padding: 18px 20px; color: var(--navy); font-weight: 800; cursor: pointer; }
.maintenance__body { padding: 0 20px 24px; border-top: 1px solid var(--line); }
.maintenance__body > p { color: var(--muted); }
.maintenance form { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 14px; }
.maintenance-message { min-height: 22px; color: var(--success); font-weight: 700; }
.ipc-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { position: sticky; top: 0; color: var(--navy); background: #f7f9fb; }
td:last-child, th:last-child { text-align: right; }

[hidden] { display: none !important; }

@media (max-width: 760px) {
  main { width: min(100% - 28px, 1180px); }
  main { padding-top: 34px; }
  h1 { font-size: 39px; }
  .calculator { grid-template-columns: 1fr; }
  .calculator-form, .result, .result-placeholder { padding: 24px 20px; }
  .result-placeholder { min-height: 400px; }
  .result-highlight { grid-template-columns: 1fr; }
  .method { grid-template-columns: 1fr; gap: 16px; }
  .maintenance form { grid-template-columns: 1fr; }
  .period-options { grid-template-columns: repeat(5, minmax(52px, 1fr)); }
  .share-actions { grid-template-columns: 1fr; }
}

@media (max-width: 1060px) {
  .tool-site-header { grid-template-columns: auto auto; }
  .tool-site-header .tool-nav { display: none; }
  .tool-site-header .header-actions { display: flex; justify-self: end; }
  .tool-site-header .header-action { display: inline-flex; }
}

@media (max-width: 520px) {
  .tool-site-header .prototype-badge { display: none; }
  .tool-site-header .header-action { min-height: 40px; padding: 0 12px; font-size: .86rem; }
}

@media (max-width: 390px) {
  .period-options { grid-template-columns: repeat(3, 1fr); }
}
