/* Overlay + Modal (Desktop) */
.ersparnis-modal-overlay {
  position: fixed; inset: 0; z-index: 10000; background: rgba(0,0,0,.7);
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 2rem 1rem;
}
.ersparnis-modal {
  background: #fff; border-radius: 12px; padding: 3.25rem 1.25rem 1.25rem; max-width: 920px; width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,.35); position: relative;
}
@media (max-width: 819px){ .ersparnis-modal-overlay { display: none; } }

/* Farb-Variablen (Brand) */
:root{
  --ersp-primary:     #007acc;
  --ersp-primary-hov: #0067c2;
  --ersp-primary-act: #005fb0;
  --ersp-ghost-bg:    #eef2f7;
  --ersp-ghost-bd:    #d6dee9;
  --ersp-ghost-hbg:   #e3edf9;
  --ersp-ghost-hbd:   #c6d6f2;
  --ersp-ghost-ic:    #3b3f45;
  --ersp-ghost-ich:   #004aad;
  --ersp-focus:       #c6dafc;
  --ersp-shadow:      rgba(0,0,0,.12);
}

/* Close-Button (Ghost) */
.ersparnis-close{
  position: absolute; top: 14px; right: 16px; width: 34px; height: 34px;
  display:inline-flex; align-items:center; justify-content:center;
  background: var(--ersp-ghost-bg); border: 1px solid var(--ersp-ghost-bd); border-radius: 50%;
  color: var(--ersp-ghost-ic); font-size: 16px; line-height: 1; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; z-index: 2;
}
.ersparnis-close:hover{ background: var(--ersp-ghost-hbg); border-color: var(--ersp-ghost-hbd); color: var(--ersp-ghost-ich); box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.ersparnis-close:active{ transform: translateY(1px); }
.ersparnis-close:focus-visible{ outline: 2px solid var(--ersp-focus); outline-offset: 2px; }

/* ERSPARNISRECHNER – Grundlayout */
#ersparnisrechner.er-box{
  max-width: 820px; margin: 0 auto; padding: 20px;
  background:#fff; border:1px solid #e8e8e8; border-radius:16px; box-shadow: 0 4px 18px rgba(0,0,0,.06);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
#ersparnisrechner h2{ margin:0 0 12px 0; }
#ersparnisrechner h3{ margin:8px 0 8px; }

#ersparnisrechner .er-grid{ display:grid; gap:12px; grid-template-columns: repeat(3, minmax(0,1fr)); }
#ersparnisrechner label{ display:block; font-size:.95rem; margin-bottom:6px; }
#ersparnisrechner input, #ersparnisrechner select{
  width:100%; box-sizing:border-box; padding:10px 12px; border:1px solid #dcdcdc; border-radius:10px; font-size:1rem; background:#fff;
}
#ersparnisrechner hr{ border:none; border-top:1px solid #efefef; margin:16px 0; }
#ersparnisrechner .ergebnis-text{
  font-size:1.1rem; background:#f7fafc; border:1px solid #e6edf3; border-radius:12px; padding:14px; margin-top:8px;
}
#ersparnisrechner .er-actions{ margin-top:8px; }
#ersparnisrechner .er-disclaimer{ margin-top:8px; font-size:.9rem; color:#666; }
@media (max-width: 820px){ #ersparnisrechner .er-grid{ grid-template-columns: 1fr; } }

/* Berechnen-Button (Primary) */
#ersparnisrechner #btnCalc{
  display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:0 18px; line-height:1;
  font-weight:700; letter-spacing:.02em; color:#fff !important; background:var(--ersp-primary);
  border:0; border-radius:10px; cursor:pointer; box-shadow:0 1px 2px var(--ersp-shadow);
  transition: background .15s ease, transform .05s ease, box-shadow .15s ease;
}
#ersparnisrechner #btnCalc:hover{ background:var(--ersp-primary-hov); box-shadow:0 2px 6px rgba(0,0,0,.14); }
#ersparnisrechner #btnCalc:active{ background:var(--ersp-primary-act); transform:translateY(1px); box-shadow:0 1px 2px rgba(0,0,0,.10); }
#ersparnisrechner #btnCalc:focus-visible{ outline:2px solid var(--ersp-focus); outline-offset:2px; }

/* Kontaktseite: CTA-Fläche */
#kontakt-scope .switcher-cta { display: none; }
#kontakt-scope #mode-offer:checked ~ .switcher .switcher-cta { display: flex; }
#kontakt-scope #mode-simple:checked ~ .switcher .switcher-cta { display: none; }
#kontakt-scope #cta-ersparnis, #kontakt-scope #cta-ersparnis:visited{
  width:auto; max-width:none; min-height:44px; padding:.5em 1em; font-weight:700;
}

/* Modal-Steuerung/Reset */
.ersparnis-modal-overlay[hidden] { display: none !important; }
html.no-scroll, body.no-scroll { overflow: hidden; }

/* sicheres Farbschema im Modal */
.ersparnis-modal,
.ersparnis-modal :is(h1,h2,h3,label,p,span,a,strong,em) { color:#1f2937; }
.ersparnis-modal a:hover { text-decoration: underline; }

/* Form Neutralisierung im Modal */
.ersparnis-modal input,
.ersparnis-modal select,
.ersparnis-modal textarea {
  width:100%;
  background:#fff;
  color:#111;
  border:1px solid #e5e7eb;
  border-radius:8px;
  padding:.7rem .9rem;
  outline:none;
}
.ersparnis-modal input::placeholder { color:#9ca3af; }
.ersparnis-modal hr { border:0; border-top:1px solid #eee; margin:16px 0; }

/* Dialog-Sizing (falls global was reingrätscht) */
.ersparnis-modal { max-width: 1080px; }

/* Fallback für [hidden] */
[hidden] { display: none !important; }
