/* =========================================================
   CALCULATEUR TPI — CSS DÉDIÉ
   ========================================================= */

/* ── Hero ── */
.tpi-hero {
  background: linear-gradient(135deg, #0d2140 0%, #1a3560 55%, #1f3d6a 100%);
  padding: 88px 0 108px;
  position: relative;
  overflow: hidden;
}

.tpi-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 78% 22%, rgba(201, 154, 85, 0.13), transparent 28%),
    linear-gradient(180deg, rgba(7, 18, 30, 0.08) 0%, rgba(7, 18, 30, 0.28) 100%);
  pointer-events: none;
}

.tpi-hero > .container { position: relative; z-index: 1; }

.tpi-hero .hero-kicker {
  display: block;
  color: rgba(201, 154, 85, 0.9);
  opacity: 1;
  margin-bottom: 20px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.78rem;
}

.tpi-hero h1 {
  color: #ffffff;
  max-width: 840px;
  margin: 0 0 22px;
  font-size: clamp(2.6rem, 4.4vw, 4.8rem);
  line-height: 1.0;
  letter-spacing: -0.05em;
}

.tpi-hero .hero-text {
  color: rgba(255, 255, 255, 0.84);
  max-width: 740px;
  font-size: 1.08rem;
  line-height: 1.72;
  margin: 0;
}

/* ── Shell & Page ── */
.tpi-tool-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.section-tpi-tool-page {
  background: linear-gradient(180deg, #f9f5ee 0%, #f3ead9 100%);
}

.tpi-tool-box {
  background: linear-gradient(180deg, #ffffff 0%, #fbf8f3 100%);
  border: 1px solid rgba(23, 40, 58, 0.08);
  border-radius: 32px;
  padding: 44px;
  box-shadow: 0 24px 52px rgba(9, 27, 49, 0.08);
}

/* ── Formulaire ── */
.tpi-tool-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tpi-section-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #a77b3d;
  margin-top: 28px;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 154, 85, 0.2);
}

.tpi-section-label:first-child {
  margin-top: 0;
}

.tpi-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-bottom: 4px;
}

.tpi-tool-form .form-field label {
  font-weight: 700;
  color: #0f2743;
  font-size: 0.97rem;
}

.tpi-tool-form .form-field small {
  color: #6b7480;
  font-size: 0.82rem;
  line-height: 1.45;
}

.tpi-tool-form select,
.tpi-tool-form input[type="number"] {
  width: 100%;
  min-height: 64px;
  padding: 0 20px;
  border-radius: 18px;
  border: 1px solid rgba(23, 40, 58, 0.12);
  background: #fff;
  font-size: 15px;
  color: #17283a;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tpi-tool-form select:focus,
.tpi-tool-form input:focus {
  outline: none;
  border-color: rgba(201, 154, 85, 0.7);
  box-shadow: 0 0 0 4px rgba(201, 154, 85, 0.12);
}

.tpi-coeff-link {
  color: #a77b3d;
  font-weight: 600;
  text-decoration: none;
}

.tpi-coeff-link:hover { text-decoration: underline; }

[data-tpi-coeff-suggestion] {
  color: #a77b3d;
  font-style: italic;
}

.tpi-tool-actions {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

/* ── Exonération banner ── */
.tpi-exoneration-banner {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: linear-gradient(180deg, #edf9f0 0%, #e0f4e6 100%);
  border: 1px solid rgba(54, 115, 78, 0.22);
  border-radius: 20px;
  padding: 22px 26px;
  margin-top: 32px;
}

.tpi-exoneration-banner.is-hidden { display: none; }

.tpi-exo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #3e7f58;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.tpi-exoneration-banner strong {
  display: block;
  color: #1e5c38;
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.tpi-exoneration-banner p {
  margin: 0;
  color: #2d6b3e;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ── Lecture résultats ── */
.tpi-tool-reading {
  margin-top: 38px;
  padding-top: 36px;
  border-top: 1px solid rgba(23, 40, 58, 0.08);
}

.tpi-reading-intro {
  margin-bottom: 24px;
}

.tpi-reading-intro h3 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 2.2vw, 2.1rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: #091b31;
}

.tpi-reading-intro p {
  margin: 0;
  color: #425263;
  font-size: 1rem;
}

/* ── Summary grid ── */
.tpi-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.tpi-results-grid .result-card {
  background: linear-gradient(180deg, #fff 0%, #faf6ef 100%);
  border: 1px solid rgba(23, 40, 58, 0.08);
  border-radius: 20px;
  padding: 22px 20px;
  box-shadow: 0 8px 24px rgba(9, 27, 49, 0.04);
}

.tpi-card-main {
  border-color: rgba(201, 154, 85, 0.3) !important;
  background: linear-gradient(180deg, #fffdf8 0%, #f9f1e4 100%) !important;
}

.result-value-md {
  font-size: 1.5rem !important;
}

/* ── Détail breakdown ── */
.tpi-detail-breakdown {
  background: linear-gradient(180deg, #f8f4ed 0%, #f2e9d8 100%);
  border: 1px solid rgba(201, 154, 85, 0.15);
  border-radius: 22px;
  padding: 28px 30px;
  margin-bottom: 22px;
}

.tpi-detail-breakdown h4 {
  margin: 0 0 20px;
  font-size: 1.05rem;
  color: #0f2743;
  font-weight: 700;
}

.tpi-breakdown-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tpi-breakdown-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.96rem;
  color: #2a3f55;
}

.tpi-breakdown-line span {
  color: #5c6e7e;
  flex: 1;
}

.tpi-breakdown-line strong {
  font-weight: 700;
  color: #0f2743;
  text-align: right;
  white-space: nowrap;
}

.tpi-breakdown-subtotal {
  padding-top: 8px;
  border-top: 1px solid rgba(23, 40, 58, 0.1);
  font-weight: 600;
}

.tpi-breakdown-subtotal span,
.tpi-breakdown-subtotal strong {
  color: #0f2743;
}

.tpi-breakdown-total {
  padding-top: 10px;
  border-top: 2px solid rgba(23, 40, 58, 0.14);
  font-weight: 700;
}

.tpi-breakdown-tpi {
  margin-top: 4px;
  padding: 12px 16px;
  background: rgba(201, 154, 85, 0.1);
  border-radius: 12px;
  font-weight: 700;
}

.tpi-breakdown-tpi strong {
  color: #7a5020;
}

/* ── RP check ── */
.tpi-rp-check {
  background: linear-gradient(180deg, #fef8e8 0%, #fdf2d8 100%);
  border: 1px solid rgba(201, 154, 85, 0.24);
  border-radius: 14px;
  padding: 14px 18px;
}

.tpi-rp-check p {
  margin: 0;
  font-size: 0.9rem;
  color: #6b4a1e;
  line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 1100px) {
  .tpi-results-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .tpi-tool-box { padding: 26px; border-radius: 22px; }
  .tpi-tool-grid { grid-template-columns: 1fr; gap: 16px; }
  .tpi-results-grid { grid-template-columns: 1fr; }
  .tpi-detail-breakdown { padding: 20px 18px; }
}
