/**
 * Kusicair Estimation Form - Styles
 *
 * Design inspire des maquettes fournies par le client :
 *   - Modal creme (fdf7f1) sur fond flou
 *   - Cards blanches avec bordure orange au survol/selection
 *   - Badge subvention cyan
 *   - Barre de progression ETAPE 1..4 avec chevrons orange
 *   - Boutons Precedent / Suivant (fleche)
 *   - Ecran resultat avec total orange mis en valeur
 *
 * Couleurs Kusicair :
 *   --k-orange      #e87722
 *   --k-orange-dark #c96216
 *   --k-cyan        #1ab0bd
 *   --k-cream       #fdf7f1
 *   --k-text        #2b2b2b
 *   --k-muted       #8a8a8a
 *   --k-border      #e6e0d8
 */

/* =========================================================================
   Reset / variables
   ========================================================================= */
.kusicair-estimation,
.kusicair-estimation * {
  box-sizing: border-box;
}

.kusicair-estimation {
  --k-orange: #ff5500;
  --k-orange-dark: #c96216;
  --k-orange-soft: rgba(232, 119, 34, 0.08);
  --k-cyan: #1ab0bd;
  --k-cream: #fffaf7;
  --k-white: #ffffff;
  --k-text: #2b2b2b;
  --k-muted: #8a8a8a;
  --k-border: #e6e0d8;
  --k-border-soft: #f0ebe4;
  --k-error: #c0362c;
  --k-error-bg: #fdecea;
  --k-radius: 12px;
  --k-radius-sm: 8px;
  --k-shadow: 0 12px 40px rgba(20, 20, 20, 0.1);

  position: relative;
  max-width: 720px;
  margin: 2rem auto;
  padding: 2.5rem 2.5rem 2rem;
  background: var(--k-cream);
  border-radius: var(--k-radius);
  box-shadow: var(--k-shadow);
  font-family: 'Montserrat', sans-serif;
  color: var(--k-text);
  line-height: 1.5;
}

[x-cloak] {
  display: none !important;
}

/* =========================================================================
   Barre de progression
   ========================================================================= */
.k-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.k-progress-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  margin: 0;
  padding: 0;
  flex: 1;
}

.k-progress-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #c9c2b8;
  text-transform: uppercase;
}

.k-progress-item.is-current {
  color: var(--k-orange);
}
.k-progress-item.is-done {
  color: var(--k-text);
}

.k-progress-sep {
  color: #d5cec3;
  font-weight: 400;
  margin-left: 0.25rem;
}

.k-progress-item.is-current + .k-progress-item .k-progress-sep,
.k-progress-item.is-done .k-progress-sep {
  color: var(--k-orange);
}

.k-close {
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: #aaa;
  padding: 0 0.25rem;
  transition: color 0.15s;
}
.k-close:hover {
  color: var(--k-text);
}

/* =========================================================================
   Etapes / questions
   ========================================================================= */
.k-step {
  border: none;
  padding: 0;
  margin: 0 0 1rem 0;
  min-width: 0;
}

.k-question {
  font-size: 1.35rem;
  font-weight: 400;
  color: #111111;
  margin: 0 0 1.75rem 0;
  padding: 0;
  line-height: 1.35;
}

.k-sublabel {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--k-text);
  margin: 0 0 0.6rem 0;
}

/* =========================================================================
   Etape contact : intro + grille 2x2 + labels flottants + icones a droite
   ========================================================================= */
.k-contact-intro {
  font-size: 1.08rem;
  font-weight: 400;
  color: #111111;
  margin: 0 0 1.5rem 0;
  padding: 0;
  line-height: 1.5;
  max-width: 100%;
}

.k-contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: start;
  width: 100%;
}

.k-float-field {
  position: relative;
  width: 100%;
  min-width: 0;
}

.k-float-input.k-input {
  width: 100%;
  min-height: 3.35rem;
  padding: 1.1rem 2.85rem 0.4rem 1rem;
  margin: 0;
}

.k-float-input.k-input::placeholder {
  color: transparent;
}

.k-float-label {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--k-muted);
  pointer-events: none;
  transition:
    top 0.2s ease,
    transform 0.2s ease,
    color 0.2s ease,
    font-size 0.2s ease;
  transform-origin: left top;
  line-height: 1.2;
}

/* :placeholder-shown sur <select> est incomplet selon les navigateurs : on ne
   l applique qu aux <input>, sinon le label « Secteur » reste fige en haut. */
.k-float-field:focus-within .k-float-label,
.k-float-field.is-filled .k-float-label,
input.k-float-input:not(:placeholder-shown) + .k-float-label {
  top: 0.42rem;
  font-size: 0.78rem;
  transform: translateY(0);
  color: var(--k-muted);
  font-weight: 600;
}

input.k-float-input.k-input:-webkit-autofill + .k-float-label {
  top: 0.42rem;
  font-size: 0.78rem;
  transform: translateY(0);
  color: var(--k-muted);
  font-weight: 600;
}

.k-input-suffix-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--k-orange);
}

.k-input-suffix-icon svg {
  display: block;
}

.k-input-suffix-icon--chevron {
  color: #5c5c5c;
}

select.k-float-input.k-float-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
  padding-right: 2.65rem;
  cursor: pointer;
}

/* =========================================================================
   Grille de cards (type installation, sous-type, habitation)
   ========================================================================= */
.k-grid {
  display: grid;
  gap: 1rem;
}
.k-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* Habitation : en page (inline), meme rythme 2 colonnes que l installation.
   En popup (elargi), 3 cartes par ligne (6 options => 2 lignes). */
.k-grid-habitation {
  grid-template-columns: repeat(2, 1fr);
}
.kusicair-estimation--popup .k-grid-habitation {
  grid-template-columns: repeat(3, 1fr);
}

.k-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.75rem 1rem 1.25rem;
  min-height: 165px;
  background: var(--k-white);
  border: 2px solid transparent;
  border-radius: var(--k-radius-sm);
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    transform 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.k-card:hover {
  border-color: var(--k-orange);
}

.k-card.is-selected {
  border-color: var(--k-orange);
  box-shadow: 0 4px 14px rgba(232, 119, 34, 0.18);
}

/* On masque le radio natif et on affiche un radio custom via ::before */
.k-card input[type='radio'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.k-card-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--k-text);
  padding-left: 1.75rem;
}

.k-card-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid #d5cec3;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--k-white);
  transition:
    border-color 0.15s,
    background 0.15s;
}

.k-card-label::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--k-orange);
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s;
}

.k-card.is-selected .k-card-label::before {
  border-color: var(--k-orange);
}
.k-card.is-selected .k-card-label::after {
  transform: translateY(-50%) scale(1);
}

/* Card simple (liste compacte sans visuel) — optionnel si reutilise ailleurs */
.k-card-simple {
  min-height: 70px;
  flex-direction: row;
  justify-content: flex-start;
  padding: 1rem 1.25rem;
}
.k-card-simple .k-card-img {
  display: none;
}

/* Image / icone placeholder. Remplacables plus tard par de vraies images.
   Chaque variante a sa propre silhouette en SVG (data URI) pour eviter
   le 404 tant que le client n a pas fourni ses visuels. */
.k-card-img {
  display: block;
  width: 150px;
  height: 150px;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* Placeholder generique (petit carre discret). Les selecteurs specifiques
   ci-dessous remplacent ce fond si on a une icone dediee. */
.k-card-img[data-type],
.k-card-img[data-sub],
.k-card-img[data-habitation] {
  opacity: 0.85;
}

/* Images des cards - fichiers deposes dans assets/cards/ (webp).
   URLs relatives au fichier CSS, donc resolues vers
   <theme>/estimation-form/assets/cards/<nom>.webp. */

/* Step 1 : types d installation */
.k-card-img[data-type='climatisation'] {
  background-image: url('cards/climatisation.webp');
}
.k-card-img[data-type='thermopompe'] {
  background-image: url('cards/thermopompe.webp');
}
.k-card-img[data-type='ventilation'] {
  background-image: url('cards/ventilation.webp');
}
.k-card-img[data-type='aspirateur'] {
  background-image: url('cards/aspirateur.webp');
}

/* Step 2 : sous-types */
.k-card-img[data-sub='centrale'] {
  background-image: url('cards/centrale.webp');
}
.k-card-img[data-sub='murale'] {
  background-image: url('cards/murale.webp');
}
.k-card-img[data-sub='mural'] {
  background-image: url('cards/mural.webp');
}
.k-card-img[data-sub='multi_zone'] {
  background-image: url('cards/multi_zone.webp');
}
.k-card-img[data-sub='p_tac'] {
  background-image: url('cards/p_tac.webp');
}
.k-card-img[data-sub='echangeur_air'] {
  background-image: url('cards/echangeur_air.webp');
}
.k-card-img[data-sub='extracteur_sdb'] {
  background-image: url('cards/extracteur_sdb.webp');
}
.k-card-img[data-sub='hotte_cuisine'] {
  background-image: url('cards/hotte_cuisine.webp');
}
.k-card-img[data-sub='secheuse'] {
  background-image: url('cards/secheuse.webp');
}
.k-card-img[data-sub='central'] {
  background-image: url('cards/central.webp');
}

/* Etape habitation : memes assets que les autres cards (dossier assets/cards/).
   Valeurs = opt.value dans estimation-form.js (HABITATION_OPTIONS).
   Remplacez les url() par vos fichiers (chemins relatifs a ce fichier CSS). */
.k-card-img[data-habitation='condo'] {
  background-image: url('cards/condo.webp');
}
.k-card-img[data-habitation='ville'] {
  background-image: url('cards/maison_ville_jumele.webp');
}
.k-card-img[data-habitation='cottage'] {
  background-image: url('cards/cottage.webp');
}
.k-card-img[data-habitation='bungalow'] {
  background-image: url('cards/bungalow.webp');
}
.k-card-img[data-habitation='triplex'] {
  background-image: url('cards/triplex.webp');
}
.k-card-img[data-habitation='multiplex'] {
  background-image: url('cards/multiplex.webp');
}

/* =========================================================================
   Badge subvention
   ========================================================================= */
.k-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--k-cyan);
  color: #fff;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.k-card-label .k-badge,
.k-pill .k-badge {
  position: static;
  margin-left: 0.4rem;
}

/* =========================================================================
   Pills (radio boutons horizontaux)
   ========================================================================= */
.k-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.k-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem 0.75rem 2.5rem;
  background: var(--k-white);
  border: 2px solid transparent;
  border-radius: var(--k-radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--k-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.k-pill:hover {
  border-color: var(--k-orange);
}
.k-pill.is-selected {
  border-color: var(--k-orange);
}

.k-pill input[type='radio'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.k-pill::before {
  content: '';
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid #d5cec3;
  border-radius: 50%;
  background: var(--k-white);
  transform: translateY(-50%);
  transition: border-color 0.15s;
}

.k-pill::after {
  content: '';
  position: absolute;
  left: calc(0.9rem + 5px);
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--k-orange);
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s;
}

.k-pill.is-selected::before {
  border-color: var(--k-orange);
}
.k-pill.is-selected::after {
  transform: translateY(-50%) scale(1);
}

/* =========================================================================
   Checkboxes group
   ========================================================================= */
.k-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.k-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem 0.75rem 2.5rem;
  background: var(--k-white);
  border: 2px solid transparent;
  border-radius: var(--k-radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--k-text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s;
}
.k-check:hover {
  border-color: var(--k-orange);
}
.k-check.is-selected {
  border-color: var(--k-orange);
}

.k-check input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.k-check::before {
  content: '';
  position: absolute;
  left: 0.9rem;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid #d5cec3;
  border-radius: 4px;
  background: var(--k-white);
  transform: translateY(-50%);
  transition:
    border-color 0.15s,
    background 0.15s;
}

.k-check.is-selected::before {
  border-color: var(--k-orange);
  background: var(--k-orange);
}

.k-check.is-selected::after {
  content: '';
  position: absolute;
  left: 1.3rem;
  top: calc(50% - 1px);
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-50%) rotate(45deg);
}

/* =========================================================================
   Champs texte / number / select
   ========================================================================= */
.k-field,
.k-subfield {
  margin-bottom: 1.5rem;
}
.k-field:last-child,
.k-subfield:last-child {
  margin-bottom: 0;
}

.k-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--k-white);
  border: 1.5px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  color: var(--k-text);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.k-input:focus {
  outline: none;
  border-color: var(--k-orange);
  box-shadow: 0 0 0 3px var(--k-orange-soft);
}
.k-input::placeholder {
  color: #b5b0a7;
}
.k-input-narrow {
  max-width: 120px;
}
select.k-input {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23888'><path d='M4 6l4 4 4-4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.25rem;
}

/* =========================================================================
   Superficies (2 colonnes : label + champ avec chevrons, style maquette)
   ========================================================================= */
.k-superficies-wrap {
  margin-top: 1rem;
}

/* Multicolonne : remplissage haut-bas dans la 1re colonne, puis la 2e (comme la maquette). */
.k-superficies--grid {
  column-count: 2;
  column-gap: 1rem;
  column-fill: balance;
}

.k-superficie-row {
  display: grid;
  grid-template-columns: 1fr minmax(96px, 120px);
  gap: 0.5rem;
  align-items: stretch;
  min-width: 0;
  break-inside: avoid;
  margin-bottom: 0.75rem;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}

.k-superficie-label-cell {
  display: flex;
  align-items: center;
  padding: 0.65rem 0.85rem;
  background: var(--k-white);
  border: 1.5px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  font-size: 0.92rem;
  color: var(--k-text);
  line-height: 1.35;
  min-height: 2.75rem;
}

.k-superficie-field {
  display: flex;
  align-items: stretch;
  background: var(--k-white);
  border: 1.5px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  overflow: hidden;
  min-height: 2.75rem;
}

.k-superficie-input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0.5rem 0.35rem 0.5rem 0.65rem;
  border: none !important;
  border-radius: 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--k-text);
  text-align: center;
  background: transparent;
  box-shadow: none;
  transition: box-shadow 0.15s;
  -moz-appearance: textfield;
  appearance: textfield;
}

.k-superficie-input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--k-orange-soft);
}

.k-superficie-input::-webkit-outer-spin-button,
.k-superficie-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.k-superficie-spin {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 2rem;
  background: #fff;
}

.k-superficie-spin-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  min-height: 0;
  border: none;
  background: #fff;
  cursor: pointer;
  color: #6e6a63;
  transition:
    background 0.12s,
    color 0.12s;
  line-height: 0;
}

.k-superficie-spin-btn:hover {
  background: var(--k-orange-soft);
  color: var(--k-orange);
}

.k-superficie-spin-btn:focus {
  outline: none;
}

.k-superficie-spin-btn:focus-visible {
  box-shadow: inset 0 0 0 2px var(--k-orange);
  z-index: 1;
}

.k-superficie-spin-up {
  border-bottom: none;
}

.k-superficie-chevron {
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid currentColor;
}

.k-superficie-spin-down .k-superficie-chevron {
  transform: rotate(180deg);
}

.k-unit {
  color: var(--k-muted);
  font-size: 0.9rem;
}
.k-total-superficie {
  margin-top: 1.25rem;
  padding: 0.75rem 1rem;
  background: var(--k-white);
  border-radius: var(--k-radius-sm);
  color: var(--k-text);
  border: 1px dashed var(--k-border);
}

.kusicair-estimation .k-superficie-spin-btn:focus {
  background: none !important;
}

.kusicair-estimation .k-superficie-spin-btn:hover {
  background: none !important;
}

.kusicair-estimation .k-superficie-spin-btn:hover span {
  border-left: 5px solid transparent !important;
  border-right: 5px solid transparent !important;
  border-bottom: 6px solid #6e6a63 !important;
}

.kusicair-estimation .k-superficie-spin-btn:focus span {
  border-left: 5px solid transparent !important;
  border-right: 5px solid transparent !important;
  border-bottom: 6px solid #6e6a63 !important;
}

/* =========================================================================
   Uploads (maquette : hint italique + zone blanche + bouton cyan)
   ========================================================================= */
.k-file-block:last-of-type {
  margin-bottom: 0;
}

.k-file-hint {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--k-text);
  line-height: 1.4;
}

.k-file-hint em {
  font-style: italic;
}

.k-file-control {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 4.25rem;
  margin: 0;
  padding: 0;
  background: var(--k-white);
  border: 1.5px solid var(--k-border);
  border-radius: var(--k-radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.k-file-control:hover {
  border-color: #d0c8bc;
}

.k-file-control:focus-within {
  outline: none;
  border-color: var(--k-orange);
  box-shadow: 0 0 0 3px var(--k-orange-soft);
}

.k-file-native {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.k-file-control-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  pointer-events: none;
}

.k-file-control-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--k-text);
  line-height: 1.3;
}

.k-file-control-meta {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  color: var(--k-muted);
  line-height: 1.3;
}

.k-file-control-action {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18%;
  min-width: 3.25rem;
  max-width: 5.5rem;
  background: var(--k-cyan);
  color: #fff;
  pointer-events: none;
  transition: background 0.15s;
}

.k-file-control:hover .k-file-control-action {
  background: #159aa6;
}

.k-file-control-icon {
  display: block;
  flex-shrink: 0;
}

.k-file-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.k-file-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--k-white);
  border-radius: var(--k-radius-sm);
  font-size: 0.9rem;
  border: 1px solid var(--k-border);
}
.k-file-list li span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.k-file-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--k-error);
  font-size: 1.1rem;
  line-height: 1;
}

button.k-file-remove {
  color: #000;
}

button.k-file-remove:hover {
  background: transparent;
  color: #e87722;
}

/* =========================================================================
   Aides, erreurs, honeypot
   ========================================================================= */
.k-help {
  color: var(--k-muted);
  font-size: 0.85rem;
  margin-top: 0.6rem;
}

.k-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--k-radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}
.k-inline-error {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--k-error);
  font-weight: 600;
}

.k-alert-error {
  background: var(--k-error-bg);
  color: var(--k-error);
  border: 1px solid rgba(192, 54, 44, 0.25);
}

.k-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* =========================================================================
   Navigation (Precedent / Suivant / Envoyer)
   ========================================================================= */
.k-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
}

.k-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.75rem;
  background: transparent;
  border: none;
  border-radius: var(--k-radius-sm);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s,
    opacity 0.15s;
}
.k-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.k-btn-primary {
  background: linear-gradient(90deg, #e43900 0%, #ff671b 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(228, 57, 0, 0.25);
}
.k-btn-primary:hover:not(:disabled) {
  background: linear-gradient(90deg, #d13300 0%, #e85a10 100%);
  box-shadow: 0 6px 16px rgba(228, 57, 0, 0.35);
}
.k-btn-ghost {
  color: var(--k-text);
}
.k-btn-ghost:hover:not(:disabled) {
  color: var(--k-orange);
  background: transparent !important;
}

.k-btn-ghost:hover {
  background: transparent;
  color: #000;
}

.k-btn:focus {
  background: linear-gradient(90deg, #e43900 0%, #ff671b 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(228, 57, 0, 0.25) !important;
}
.k-btn-ghost:focus {
  background: transparent !important;
  color: #000 !important;
  box-shadow: none !important;
}

/* =========================================================================
   Ecran resultat (maquette : lignes detail + total orange + bandeau cyan + 2 colonnes)
   ========================================================================= */
.k-result {
  padding: 1rem 0 0;
}

.k-result-summary {
  margin-bottom: 1.5rem;
}

.k-result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.35rem 0 0.85rem;
}

.k-result-row-text {
  min-width: 0;
  flex: 1;
}

.k-result-row-title {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--k-text);
  line-height: 1.3;
}

.k-result-row-note {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--k-muted);
  line-height: 1.35;
}

.k-result-row-amount {
  flex-shrink: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--k-text);
  white-space: nowrap;
  line-height: 1.2;
}

.k-result-summary-rule {
  height: 1px;
  background: var(--k-orange);
  margin: 0.15rem 0 0.35rem;
  opacity: 0.85;
}

.k-result-total-wrap {
  position: relative;
  margin: 0 0 3rem;
}

.k-result-total {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.35rem 1.5rem 2rem;
  background: var(--k-orange);
  color: #fff;
  border-radius: var(--k-radius-sm);
  box-shadow: 0 6px 20px rgba(232, 119, 34, 0.22);
}

.k-result-total-label strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 700;
}

.k-result-total-label small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  opacity: 0.95;
}

.k-result-total-value {
  text-align: right;
}

.k-result-total-value small {
  display: block;
  font-size: 0.78rem;
  opacity: 0.95;
  margin-bottom: 0.15rem;
}

.k-result-total-value strong {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
}

.k-result-banner {
  position: relative;
  width: fit-content;
  z-index: 2;
  margin: -1.2rem auto 0;
  padding: 0.7rem 1rem;
  background: var(--k-cyan);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.35;
  text-align: center;
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(26, 176, 189, 0.35);
}

.k-result-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 4.25rem;
  margin-bottom: 1rem;
}

.k-result-footer-col {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.k-result-footer-icon {
  display: flex;
  color: var(--k-orange);
  line-height: 0;
}

.k-result-footer-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--k-text);
  line-height: 1.45;
}

.k-cta {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--k-white);
  border-radius: var(--k-radius-sm);
  border: 1.5px solid var(--k-orange);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--k-orange);
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    background 0.15s;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.k-cta-result {
  margin-top: auto;
}

.k-cta:hover {
  border-color: var(--k-orange-dark);
  box-shadow: 0 4px 12px rgba(232, 119, 34, 0.18);
  background: #fffdfb;
}

.k-cta-arrow {
  font-weight: 700;
}

.k-cta-outline {
  border-color: var(--k-border);
}

.k-result-footer-icon-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

a.k-cta.k-cta-result {
  background: none;
}

a.k-cta.k-cta-result:hover {
  background: #ff5500;
  color: white;
}

a.k-cta.k-cta-result {
  width: fit-content;
}

/* =========================================================================
   Animations Alpine x-transition (legers)
   ========================================================================= */
.k-step,
.k-result {
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 640px) {
  .kusicair-estimation {
    padding: 1.5rem 1.25rem 1.25rem;
    margin: 1rem;
    max-width: none;
  }
  .k-grid-2 {
    grid-template-columns: 1fr;
  }
  .k-grid-habitation {
    grid-template-columns: 1fr;
  }
  .kusicair-estimation--popup .k-grid-habitation {
    grid-template-columns: 1fr;
  }
  .k-card {
    min-height: 140px;
    padding: 1.25rem 0.75rem 1rem;
  }
  .k-question {
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
  }
  .k-result-total {
    flex-direction: column;
    text-align: center;
  }
  .k-result-total-value {
    text-align: center;
  }
  .k-result-footer {
    grid-template-columns: 1fr;
  }
  .k-result-row {
    flex-wrap: wrap;
  }
  .k-result-row-amount {
    width: 100%;
    text-align: right;
    margin-top: 0.25rem;
  }
  .k-nav {
    gap: 0.75rem;
  }
  .k-btn {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
  }
  .k-superficies--grid {
    column-count: 1;
  }
  .k-contact-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   Mode popup : element <dialog> natif
   =========================================================================
   Le formulaire conserve ses styles habituels ; on ne style que le wrapper
   <dialog> et son backdrop. Comportement natif du <dialog> :
     - focus trap automatique
     - ESC ferme le modal
     - scroll de la page bloque pendant l ouverture
*/
.kusicair-dialog {
  /* Reset du style par defaut des navigateurs (bordure, padding). */
  border: 0;
  padding: 0;
  background: transparent;
  /* Plus large que le formulaire inline : permet une grille 3 colonnes pour l habitation. */
  max-width: min(980px, 96vw);
  width: 100%;
  max-height: 90vh;
  border-radius: 16px;
  /* Une seule ombre portee sur le dialog : le bloc .kusicair-estimation a la sienne
     en mode inline uniquement ; en popup il est sans ombre pour eviter la superposition. */

  overflow: hidden;
  /* Evite un leger depassement quand l enfant a height: min(..., vh). */
  box-sizing: border-box;
}

.kusicair-dialog[open] {
  /* Animation d entree */
  animation: kusicair-dialog-in 0.22s ease-out;
}

.kusicair-dialog::backdrop {
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: kusicair-backdrop-in 0.22s ease-out;
}

@keyframes kusicair-dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes kusicair-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* En popup : hauteur = contenu (jusqu a max 90vh). Scroll uniquement dans .k-popup-scroll
   quand le total depasse la fenetre. flex 0 1 auto sur la zone centrale evite qu elle
   s etire en hauteur fictive ; scrollbar-gutter: stable limite le clignotement a l apparition
   de la scrollbar. */
.kusicair-estimation--popup {
  /* Depasse le max-width 720px du bloc .kusicair-estimation pour accueillir 3 colonnes. */
  max-width: min(960px, 100%);
  width: 100%;
  margin: 0;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: none;
}

.kusicair-estimation--popup .k-progress {
  flex-shrink: 0;
}

.kusicair-estimation--popup .k-alert {
  flex-shrink: 0;
}

/* Etapes + ecran resultat : hauteur suivant le contenu ; si le bloc depasse, scroll ici. */
.kusicair-estimation--popup .k-popup-scroll {
  flex: 0 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

/* Pendant la transition d etape, le JS anime explicitement la height de
   .k-popup-scroll (de l ancienne vers la nouvelle hauteur naturelle) en
   parallele du fondu Alpine. On masque la scrollbar et on empeche tout
   tearing pendant que les deux fieldsets coexistent. */
.kusicair-estimation--popup.is-transitioning .k-popup-scroll {
  overflow-y: hidden;
}

.kusicair-estimation--popup .k-nav {
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--k-border-soft);
  background: var(--k-cream);
}

/* Petit ecran : le modal occupe tout l espace visible pour un usage mobile confortable. */
@media (max-width: 600px) {
  .kusicair-dialog {
    max-width: 100vw;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .kusicair-estimation--popup {
    height: 100%;
    max-height: none;
    min-height: 0;
    border-radius: 0;
  }

  /* Plein ecran : la zone centrale occupe l espace entre entete et navigation. */
  .kusicair-estimation--popup .k-popup-scroll {
    flex: 1 1 auto;
  }
}

button.k-close:focus {
  background: none !important;
  color: #000;
}

button.k-close:hover {
  background: none !important;
  color: #ff5500;
}

button.k-close {
  color: #000;
}

@media all and (max-width: 450px) {
  .k-progress-item {
    font-size: 0.6rem;
  }
}
