:root{
  --ast-bg: #f6f7fb;
  --ast-card: #ffffff;
  --ast-text: #111827;
  --ast-muted: rgba(17,24,39,.65);
  --ast-border: rgba(17,24,39,.10);

  --ast-blue: #1677ff;
  --ast-blue-2: #0b5fff;
  --ast-blue-soft: rgba(22,119,255,.14);

  --ast-radius: 16px;
  --ast-radius-sm: 12px;

  --ast-shadow: 0 14px 40px rgba(0,0,0,.10);
  --ast-shadow-soft: 0 8px 22px rgba(0,0,0,.08);
}

.ast-immo-agent{
  max-width: 1040px;
  margin: 0 auto;
  padding: 18px;
  border-radius: var(--ast-radius);
  background: radial-gradient(1200px 500px at 0% 0%, rgba(22,119,255,.12), transparent 60%),
              radial-gradient(900px 400px at 100% 0%, rgba(22,119,255,.10), transparent 55%),
              var(--ast-bg);
  color: var(--ast-text);
}

.ast-hero{
  display:flex;
  justify-content:space-between;
  gap: 14px;
  padding: 16px;
  border-radius: var(--ast-radius);
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(255,255,255,.5);
  box-shadow: var(--ast-shadow-soft);
  backdrop-filter: blur(10px);
}

.ast-kicker{
  font-weight: 800;
  color: rgba(0,0,0,.55);
  margin-bottom: 6px;
}

.ast-title{
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.4px;
}
.ast-title span{
  color: var(--ast-blue);
  font-weight: 900;
}
.ast-subtitle{
  margin: 6px 0 0 0;
  color: var(--ast-muted);
}

.ast-tabs{
  display:flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.ast-tab{
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.80);
  color: var(--ast-text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}
.ast-tab.active{
  background: linear-gradient(180deg, var(--ast-blue), var(--ast-blue-2));
  color: #fff;
  border-color: rgba(0,0,0,.0);
}
.ast-ready{
  margin-left: 8px;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(34,197,94,.16);
  color: rgba(22,163,74,.95);
}

.ast-quota-card{
  min-width: 210px;
  background: rgba(255,255,255,.85);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,.08);
  text-align: right;
}
.ast-quota-big{ font-size: 20px; font-weight: 900; }
.ast-quota-small{ margin-top: 4px; color: var(--ast-muted); font-weight: 700; }

.ast-tab-content{ display:none; margin-top: 14px; }
.ast-tab-content.active{ display:block; }

.ast-card{
  background: var(--ast-card);
  border: 1px solid var(--ast-border);
  border-radius: var(--ast-radius);
  box-shadow: var(--ast-shadow-soft);
  padding: 14px;
  margin: 12px 0;
}
.ast-card-title{
  font-weight: 900;
  margin-bottom: 10px;
}
.ast-muted{ color: var(--ast-muted); font-weight: 650; }

.ast-field label{
  display:block;
  font-weight: 850;
  margin: 0 0 8px 0;
}
.ast-immo-agent input,
.ast-immo-agent select,
.ast-immo-agent textarea{
  width: 100%;
  padding: 12px 12px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: var(--ast-radius-sm);
  background: #fff;
  color: var(--ast-text);
  outline: none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.ast-immo-agent input:focus,
.ast-immo-agent select:focus,
.ast-immo-agent textarea:focus{
  border-color: rgba(22,119,255,.55);
  box-shadow: 0 0 0 4px rgba(22,119,255,.16);
}
.ast-immo-agent textarea{ min-height: 90px; resize: vertical; }

.ast-grid-3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ast-grid-2{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.ast-actions{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  margin-top: 12px;
}

.ast-btn{
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  color: var(--ast-text);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
  transition: transform .06s ease, box-shadow .15s ease;
  font-weight: 900;
}
.ast-btn:hover{ transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,.10); }
.ast-btn:active{ transform: translateY(0); }
.ast-btn:disabled{ opacity:.55; cursor:not-allowed; transform:none; box-shadow:none; }

.ast-primary{
  background: linear-gradient(180deg, var(--ast-blue), var(--ast-blue-2));
  color: #fff;
  border-color: rgba(0,0,0,0);
  box-shadow: 0 14px 28px rgba(22,119,255,.25);
}
.ast-ghost{
  background: rgba(255,255,255,.85);
}

.ast-output{
  margin-top: 14px;
  background: var(--ast-card);
  border: 1px solid var(--ast-border);
  border-radius: var(--ast-radius);
  box-shadow: var(--ast-shadow-soft);
  padding: 14px;
}
.ast-output-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  margin-bottom: 10px;
}
.ast-output-tools{ display:flex; gap: 10px; }
.ast-result{
  height: 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}
.ast-note{ margin: 10px 0 0 0; font-size: 13px; color: var(--ast-muted); font-weight: 650; }

/* ======= THEMES CHECKBOXES : en colonnes ======= */
.ast-themes{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.ast-theme{
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,.85);
}
.ast-theme-title{
  font-weight: 950;
  margin-bottom: 10px;
  color: rgba(0,0,0,.82);
}
.ast-chips{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
}
.ast-chip{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
  cursor:pointer;
  user-select:none;
  transition: transform .06s ease, box-shadow .15s ease, border-color .15s ease;
}
.ast-chip input{
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ast-blue);
}
.ast-chip:hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0,0,0,.10);
  border-color: rgba(22,119,255,.30);
}
.ast-chip span{ font-weight: 850; color: var(--ast-text); }

/* Fiche preview */
#ast-flyer-preview .ast-print-area{
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.10);
  background: #fff;
}
.ast-bottom-actions{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* DPE/GES SVG */
.ast-energy-wrap{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px;
}
.ast-energy-item{
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);
}
.ast-energy-title{
  font-weight: 950;
  margin-bottom: 6px;
  color: rgba(0,0,0,.80);
}
.ast-energy-svg{ width: 390px; max-width: 100%; height: auto; }

/* Impression : on imprime uniquement la fiche */
@media print{
  body * { visibility: hidden !important; }
  #ast-flyer-preview, #ast-flyer-preview * { visibility: visible !important; }
  #ast-flyer-preview { position: absolute; left: 0; top: 0; width: 100%; }
}

/* Mobile */
@media (max-width: 860px){
  .ast-grid-3{ grid-template-columns: 1fr; }
  .ast-grid-2{ grid-template-columns: 1fr; }
  .ast-themes{ grid-template-columns: 1fr; }
  .ast-hero{ flex-direction: column; }
  .ast-quota-card{ text-align:left; width:100%; }
}

/* =========================
   FICHE COMMERCIALE - PHOTOS (AUTO LAYOUT)
   ========================= */

/* IMPORTANT : images propres */
.ast-flyer img{
  max-width: 100%;
  height: auto;
  display:block;
}

/* Bloc photo */
.ast-flyer .ast-photo{
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.10);
  background: #f3f4f6;
}

/* Image : réglage global (sera override en bas en "contain") */
.ast-flyer .ast-photo img,
.ast-flyer .ast-hero img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Classic/Premium main photo ratio */
.ast-flyer .ast-photo-main{
  aspect-ratio: 16 / 10;
}

/* Thumbs: ratio homogène */
.ast-flyer .ast-photo-thumb{
  aspect-ratio: 4 / 3;
}

/* Grille thumbs */
.ast-flyer .ast-thumbs{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

/* Banner: hero */
.ast-flyer.ast-tpl-banner .ast-hero{
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.10);
  background: #f3f4f6;
  aspect-ratio: 16 / 9;
}

/* Mobile */
@media (max-width: 720px){
  .ast-flyer .ast-thumbs{ grid-template-columns: repeat(2, 1fr); }
}

/* Print: évite les coupures moches */
@media print{
  .ast-flyer{
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .ast-flyer .ast-photo,
  .ast-flyer .ast-hero{
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ===== Barème DPE / GES (A→G) ===== */
.ast-energy-scales{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  margin-top:14px;
}

.ast-scale{
  flex:1 1 220px;
}

.ast-scale-label{
  font-weight:800;
  margin-bottom:6px;
}

.ast-scale-bar{
  display:flex;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(0,0,0,.10);
  background:#fff;
}

.ast-scale-cell{
  flex:1;
  text-align:center;
  font-weight:900;
  padding:10px 0;
  font-size:16px;
  line-height:1;
  color:rgba(0,0,0,.65);
  position:relative;
}

/* mobile */
@media (max-width: 720px){
  .ast-energy-scales{gap:10px;}
  .ast-scale-cell{padding:9px 0; font-size:15px;}
}

/* ========== Astrarius — style pro (AJOUT, ne change pas la charte) ========== */

.ast-flyer{
  color: var(--ast-text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  line-height: 1.35;
  box-sizing: border-box;

  /* ✅ marge sécurité (anti texte coupé, surtout en print) */
  padding: 16px 18px;
}

.ast-flyer *{ box-sizing: border-box; }

.ast-flyer b, .ast-flyer strong{ font-weight: 900; }

.ast-title-colored{
  color: var(--ast-blue);
  font-weight: 950;
}

.ast-desc-pro{
  font-size: 14.5px;
  line-height: 1.55;
  font-weight: 650;
  color: rgba(17,24,39,.92);
}

.ast-contact-pro{
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--ast-border);
}

.ast-contact-pro .ast-agent{
  font-weight: 950;
}
.ast-contact-pro .ast-phone{
  font-weight: 850;
  color: rgba(0,0,0,.75);
}

/* séparateurs propres */
.ast-flyer hr{
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ast-border), transparent);
  margin: 14px 0;
}

/* titres de section + petit trait */
.ast-flyer .f-h,
.ast-flyer .ast-dpe-title,
.ast-flyer .ast-scale-label{
  font-weight: 950;
  color: var(--ast-blue);
  margin-bottom: 6px;
}
.ast-flyer .f-h::after,
.ast-flyer .ast-dpe-title::after,
.ast-flyer .ast-scale-label::after{
  content:"";
  display:block;
  height: 3px;
  width: 44px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--ast-blue);
  opacity: .25;
}

/* ✅ PHOTOS : on voit la photo entière */
.ast-flyer .ast-photo img,
.ast-flyer .ast-hero img{
  object-fit: contain !important;
  background: #f3f4f6;
}

/* ✅ Evite que le contenu touche les bords en print */
@media print{
  #ast-flyer-preview{
    padding: 12mm;
  }
  #ast-flyer-preview .ast-print-area{
    border: none;
  }
}

/* =========================
   ✅ TEMPLATE 4 : A4 LANDSCAPE
   ========================= */
.ast-tpl-landscape .ast-land-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ast-tpl-landscape .ast-land-right .ast-price{
  font-size: 26px;
}

.ast-tpl-landscape .ast-land-grid{
  display:grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
}

.ast-tpl-landscape .ast-land-main{
  aspect-ratio: 16 / 10;
}

@media (max-width: 860px){
  .ast-tpl-landscape .ast-land-grid{
    grid-template-columns: 1fr;
  }
}
/* /* =========================================
   A4 PAYSAGE – PREVIEW MODE (tes classes)
   ========================================= */

.ast-flyer.ast-tpl-landscape{
  width: 100%;
  max-width: 1120px;
  aspect-ratio: 297 / 210;
  margin: 0 auto;
  padding: 32px;
  box-sizing: border-box;
}

@media print{
  .ast-flyer.ast-tpl-landscape{
    width: 297mm;
    height: 210mm;
    aspect-ratio: auto;
    padding: 20mm;
  }
}
/* =========================================================
   A4 PAYSAGE (template ast-tpl-landscape) - FORCER L’APERÇU + PRINT
   (AJOUT UNIQUEMENT, ne modifie rien d’autre)
   ========================================================= */

/* Aperçu écran : on simule une feuille A4 paysage centrée */
#ast-flyer-preview .ast-print-area{
  padding: 14px;                  /* évite texte coupé sur les bords */
  box-sizing: border-box;
}

#ast-flyer-preview .ast-flyer.ast-tpl-landscape{
  /* ratio A4 paysage = 297/210 ≈ 1.414 */
  width: 100%;
  max-width: 1100px;              /* taille “feuille” sur écran */
  aspect-ratio: 297 / 210;
  margin: 10px auto;
  box-sizing: border-box;
  overflow: hidden;
  background: #fff;
}

/* Si ton layout landscape utilise une grille interne, elle doit prendre toute la hauteur */
#ast-flyer-preview .ast-flyer.ast-tpl-landscape *{
  box-sizing: border-box;
}

/* PRINT : on force A4 paysage + marges (Chrome/Edge OK, Safari iOS parfois ignore @page) */
@media print{
  @page{
    size: A4 landscape;
    margin: 12mm;
  }

  /* On imprime proprement sur une “feuille” */
  #ast-flyer-preview .ast-flyer.ast-tpl-landscape{
    width: 297mm !important;
    height: 210mm !important;
    max-width: none !important;
    aspect-ratio: auto !important;
    margin: 0 !important;
    overflow: hidden !important;
  }
}