/* ==========================================================================
   Calculadora de Rentabilidade — usa as variáveis e componentes de styles.css
   ========================================================================== */

/* ---------- Cabeçalho ---------- */
.calc-hero { background: var(--ivory); padding: calc(var(--header-h) + 48px) 0 48px; border-bottom: 1px solid var(--line); }
.calc-hero__title { font-size: clamp(2.2rem, 7vw, 3.8rem); margin-bottom: 14px; }
.calc-hero__sub { font-size: 1.1rem; color: var(--muted); margin-bottom: 36px; }
.calc-rules { display: grid; gap: 12px; }
.calc-rules li { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 4px; }
.calc-rules strong { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); }
.calc-rules span { font-size: 14.5px; line-height: 1.55; color: var(--text); }
@media (min-width: 768px) { .calc-rules { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .calc-hero { padding: calc(var(--header-h) + 72px) 0 64px; } }

/* ---------- Layout ---------- */
.calc-layout { display: grid; gap: 48px; padding-top: 48px; padding-bottom: 72px; }
@media (min-width: 1024px) {
  .calc-layout { grid-template-columns: minmax(0, 1.45fr) minmax(340px, 1fr); gap: 56px; padding-top: 64px; padding-bottom: 96px; align-items: start; }
  .calc-side {
    position: sticky; top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--gold-line) transparent; padding-right: 4px;
  }
}

.calc-step { margin-bottom: 52px; }
.calc-step:last-child { margin-bottom: 0; }
.calc-step__num { font-size: 11.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 8px; }
.calc-step__num--light { color: var(--gold); }
.calc-step__title { font-family: var(--serif); font-weight: 400; font-size: clamp(1.4rem, 3.6vw, 1.75rem); line-height: 1.25; margin-bottom: 22px; }
.calc-step__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 20px; }
.calc-step__actions { display: flex; gap: 18px; margin-bottom: 24px; }

.calc-link {
  background: none; border: 0; padding: 2px 0; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--gold-line); transition: border-color .3s, color .3s;
}
.calc-link:hover { border-color: currentColor; }
.calc-link--light { color: var(--gold); }

/* ---------- Etapa 1: períodos ---------- */
.calc-periods { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; }
.calc-period { position: relative; cursor: pointer; }
.calc-period input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.calc-period span {
  display: grid; gap: 4px; padding: 16px 14px; border: 1px solid #d8d3c7; border-radius: var(--radius); background: var(--white);
  text-align: center; transition: border-color .3s, background-color .3s, box-shadow .3s, color .3s;
}
.calc-period strong { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; color: var(--ink); line-height: 1.1; }
.calc-period small { font-size: 13.5px; color: var(--muted); }
.calc-period input:hover + span { border-color: var(--navy-900); }
.calc-period input:checked + span { background: var(--navy-900); border-color: var(--navy-900); box-shadow: 0 14px 30px -18px rgba(17, 28, 46, .7); }
.calc-period input:checked + span strong { color: var(--white); }
.calc-period input:checked + span small { color: var(--gold); }
.calc-period input:focus-visible + span { outline: 2px solid var(--gold-ink); outline-offset: 3px; }

/* ---------- Modo ---------- */
.calc-mode { border: 0; padding: 4px; margin: 0 0 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--ivory); border-radius: calc(var(--radius) + 2px); }
.calc-mode__opt { position: relative; cursor: pointer; }
.calc-mode__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.calc-mode__opt span { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius); transition: background-color .3s, box-shadow .3s; height: 100%; }
.calc-mode__opt strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.calc-mode__opt small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.calc-mode__opt input:checked + span { background: var(--white); box-shadow: 0 6px 18px -10px rgba(17, 28, 46, .35); }
.calc-mode__opt input:focus-visible + span { outline: 2px solid var(--gold-ink); outline-offset: 2px; }

/* ---------- Catálogo ---------- */
.calc-catalog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.calc-catalog__tools { padding: 16px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.calc-search { position: relative; }
.calc-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.calc-search input {
  width: 100%; min-height: 48px; padding: 12px 14px 12px 42px; border: 1px solid #d8d3c7; border-radius: var(--radius);
  background: var(--paper); font-size: 16px; color: var(--ink);
}
.calc-search input:focus { outline: none; border-color: var(--navy-900); background: var(--white); box-shadow: 0 0 0 3px rgba(17, 28, 46, .08); }
.calc-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.calc-tabs::-webkit-scrollbar { display: none; }
.calc-tab {
  flex: none; min-height: 38px; padding: 8px 14px; border: 1px solid #d8d3c7; border-radius: 40px; background: var(--white);
  font-size: 13px; color: var(--ink); cursor: pointer; transition: all .3s var(--ease);
}
.calc-tab:hover { border-color: var(--navy-900); }
.calc-tab[aria-pressed='true'] { background: var(--navy-900); border-color: var(--navy-900); color: var(--white); }

.calc-catalog__list { max-height: 520px; overflow-y: auto; overscroll-behavior: contain; }
.calc-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); transition: background-color .3s; }
.calc-item:last-child { border-bottom: 0; }
.calc-item:hover { background: var(--paper); }
.calc-item.is-added { background: #f6f3ea; }
.calc-item__info { display: grid; gap: 2px; min-width: 0; }
.calc-item__cat { font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-ink); }
.calc-item__name { font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.calc-item__meta { font-size: 13px; color: var(--muted); }
.calc-item__add { display: flex; gap: 6px; align-items: center; }
.calc-item__qty {
  width: 56px; min-height: 42px; padding: 8px; text-align: center; border: 1px solid #d8d3c7; border-radius: var(--radius);
  font-size: 16px; color: var(--ink); background: var(--paper);
}
.calc-item__qty:focus { outline: none; border-color: var(--navy-900); background: var(--white); }
.calc-item__qty[aria-invalid='true'] { border-color: var(--error); }
.calc-item__btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 14px; border: 1px solid var(--navy-900); border-radius: var(--radius);
  background: var(--navy-900); color: var(--white); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  transition: background-color .3s, color .3s;
}
.calc-item__btn svg { width: 15px; height: 15px; }
.calc-item__btn:hover { background: var(--navy-700); }
.calc-item.is-added .calc-item__btn { background: transparent; color: var(--ink); border-color: var(--gold-line); }
.calc-item .calc-field__error { grid-column: 1 / -1; margin: 0; }
.calc-catalog__empty { padding: 24px 16px; color: var(--muted); font-size: 14px; margin: 0; }
@media (max-width: 479px) {
  .calc-item { grid-template-columns: 1fr; }
  .calc-item__add { justify-content: flex-start; }
}

/* ---------- Etapa 3: linhas ---------- */
.calc-lines { display: grid; gap: 14px; }
.calc-line { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 20px; transition: box-shadow .6s var(--ease), border-color .6s; }
.calc-line.is-flash { animation: calcFlash 1.4s var(--ease); }
@keyframes calcFlash { 0% { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(220, 198, 156, .45); } 100% { border-color: var(--line); box-shadow: none; } }
.calc-line__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.calc-line__name { font-family: var(--sans); font-size: 16px; font-weight: 600; line-height: 1.35; margin-top: 2px; }
.calc-line__remove {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%;
  background: var(--white); color: var(--muted); cursor: pointer; transition: color .3s, border-color .3s, background-color .3s;
}
.calc-line__remove svg { width: 18px; height: 18px; }
.calc-line__remove:hover { color: var(--error); border-color: var(--error); background: #fdf7f6; }
.calc-line__fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.calc-field { display: grid; gap: 6px; align-content: start; }
.calc-field > label { font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.calc-stepper, .calc-money { display: flex; align-items: stretch; border: 1px solid #d8d3c7; border-radius: var(--radius); background: var(--paper); overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.calc-stepper:focus-within, .calc-money:focus-within { border-color: var(--navy-900); background: var(--white); box-shadow: 0 0 0 3px rgba(17, 28, 46, .08); }
.calc-field.has-error .calc-stepper, .calc-field.has-error .calc-money { border-color: var(--error); background: #fdf7f6; }
.calc-stepper button { flex: none; width: 42px; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.calc-stepper button:hover { background: rgba(17, 28, 46, .06); }
.calc-stepper button svg { width: 16px; height: 16px; }
.calc-stepper input, .calc-money input { width: 100%; min-width: 0; min-height: 46px; border: 0; background: transparent; font-size: 16px; color: var(--ink); text-align: center; padding: 8px 4px; }
.calc-money span { display: grid; place-items: center; padding-left: 12px; font-size: 14px; color: var(--muted); }
.calc-money input { text-align: left; padding-left: 6px; }
.calc-stepper input:focus, .calc-money input:focus { outline: none; }
.calc-field__hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.calc-field__hint .calc-link { font-size: 12.5px; margin-left: 4px; }
.calc-field__error { margin: 0; font-size: 12.5px; color: var(--error); }
.calc-field__error:empty { display: none; }
.calc-line__stats { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.calc-line__stats dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); line-height: 1.35; }
.calc-line__stats dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--ink); }
@media (max-width: 479px) {
  .calc-line { padding: 16px; }
  .calc-line__fields { grid-template-columns: 1fr; }
}

.calc-empty { border: 1px dashed var(--gold-line); border-radius: var(--radius); padding: 32px 20px; text-align: center; background: var(--white); }
.calc-empty p { margin: 0 0 4px; font-family: var(--serif); font-size: 1.2rem; color: var(--ink); }
.calc-empty small { font-size: 14px; color: var(--muted); }

.calc-note { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.55; color: var(--muted); margin: 0; }
.calc-note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--gold-ink); }
.calc-note--example { background: #fbf6ec; border: 1px solid var(--gold-line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; color: var(--ink); }
.calc-note--warn { margin: 24px 0; color: var(--error); }

/* ---------- Resultado ---------- */
.calc-result { background: var(--navy-900); color: rgba(255, 255, 255, .78); border-radius: var(--radius); padding: 26px 22px; }
.calc-result__title { font-family: var(--serif); font-weight: 400; color: var(--white); font-size: 1.6rem; }
.calc-result__period { font-size: 13px; color: rgba(255, 255, 255, .6); margin: 4px 0 20px; }
.calc-kpis { display: grid; grid-template-columns: 1fr; gap: 10px; }
.calc-kpi { border: 1px solid rgba(220, 198, 156, .28); border-radius: var(--radius); padding: 16px; background: rgba(255, 255, 255, .03); }
.calc-kpi__label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: 6px; }
.calc-kpi__value { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(1.7rem, 6vw, 2.1rem); line-height: 1.1; color: var(--white); font-variant-numeric: tabular-nums; word-break: break-word; }
.calc-kpi__value.is-negative { color: #f0b6ad; }
.calc-kpi__hint { display: block; margin-top: 4px; font-size: 12px; color: rgba(255, 255, 255, .55); }
@media (min-width: 420px) and (max-width: 1023px) { .calc-kpis { grid-template-columns: 1fr 1fr; } }
.calc-stats { margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.calc-stats div { padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, .1); }
.calc-stats dt { font-size: 12px; color: rgba(255, 255, 255, .6); }
.calc-stats dd { margin: 2px 0 0; font-size: 15.5px; font-weight: 600; color: var(--white); font-variant-numeric: tabular-nums; }
.calc-invalid { margin: 14px 0 0; font-size: 13px; color: #f0b6ad; }

.calc-billing { margin-top: 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.calc-billing h3 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin-bottom: 10px; }
.calc-billing__list { margin: 0; }
.calc-billing__list div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.calc-billing__list dt { color: var(--muted); }
.calc-billing__list dd { margin: 0; font-weight: 600; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.calc-billing__list .is-credit dd { color: var(--success); }
.calc-billing__list .is-total { border-bottom: 0; padding-top: 12px; }
.calc-billing__list .is-total dt, .calc-billing__list .is-total dd { color: var(--ink); font-weight: 600; font-size: 15px; }
.calc-rule { margin: 12px 0 16px; padding: 12px 14px; background: var(--ivory); border-radius: var(--radius); font-size: 13.5px; line-height: 1.55; color: var(--text); }
.calc-flow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
.calc-flow li { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 2px; }
.calc-flow span { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-ink); }
.calc-flow strong { font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.calc-flow small { font-size: 12px; line-height: 1.4; color: var(--muted); }

/* ---------- Transparência ---------- */
.calc-trust { display: grid; gap: 16px; padding-bottom: 72px; }
.calc-trust__item { background: var(--ivory); border-radius: var(--radius); padding: 24px; }
.calc-trust__item h2 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; margin-bottom: 10px; }
.calc-trust__item p { font-size: 14.5px; line-height: 1.7; color: var(--text); }
.calc-trust__small { font-size: 13px !important; color: var(--muted) !important; }
@media (min-width: 900px) { .calc-trust { grid-template-columns: 1fr 1fr; padding-bottom: 96px; } .calc-trust__item { padding: 32px; } }

/* ---------- CTA WhatsApp ---------- */
.calc-cta h2 { font-size: clamp(2rem, 6vw, 3.4rem); }
.calc-msg { max-width: 640px; margin: 0 auto 28px; text-align: left; display: grid; gap: 8px; }
.calc-msg label { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.calc-msg label span { font-weight: 400; letter-spacing: 0; text-transform: none; color: rgba(255, 255, 255, .6); }
.calc-msg textarea {
  width: 100%; min-height: 200px; padding: 14px 16px; border: 1px solid rgba(255, 255, 255, .2); border-radius: var(--radius);
  background: rgba(255, 255, 255, .05); color: var(--white); font-size: 15px; line-height: 1.6; resize: vertical;
}
.calc-msg textarea:focus { outline: none; border-color: var(--gold); }
.calc-msg .calc-link { justify-self: start; }
.calc-cta__small { font-size: 13px !important; margin: 24px auto 0 !important; max-width: 36em; color: rgba(255, 255, 255, .55); }

/* ---------- Barra fixa (celular) ---------- */
.calc-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--navy-900); border-top: 1px solid rgba(220, 198, 156, .3);
  box-shadow: 0 -10px 30px -16px rgba(0, 0, 0, .5);
}
.calc-bar[hidden] { display: none; }
.calc-bar span { display: block; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.calc-bar strong { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; color: var(--white); font-variant-numeric: tabular-nums; }
.calc-bar .btn { min-height: 44px; padding: 10px 16px; font-size: 11.5px; }
.page-calc.has-calc-bar .wa-float { bottom: 84px; }
.page-calc.has-calc-bar .site-footer { padding-bottom: 150px; }
@media (min-width: 1024px) { .calc-bar { display: none !important; } }
@media (max-width: 599px) {
  .calc-periods { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .calc-period span { padding: 12px 6px; }
  .calc-period strong { font-size: 1.1rem; white-space: nowrap; }
  .calc-period small { font-size: 12.5px; white-space: nowrap; }
}
