/* Finanzierungsrechner (seit 11.11.2026) - Farben wie die Website (head.php :root) */

.fr-knopf {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 10px 14px;
    background: transparent;
    color: #fff;
    border: 1.5px solid var(--gold, #c8a84e);
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.fr-knopf:hover, .fr-knopf:focus-visible { background: var(--gold, #c8a84e); color: var(--blau, #1a3a5c); }
.fr-knopf:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

html.fr-offen { overflow: hidden; }

.fr-dialog {
    width: min(1100px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #f5f7fa;
    color: #333;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.45;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    overflow: auto;
}
.fr-dialog::backdrop { background: rgba(10, 25, 40, 0.6); }
.fr-dialog *, .fr-dialog *::before, .fr-dialog *::after { box-sizing: border-box; }
.fr-innen { min-height: 100%; }

.fr-kopf {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 24px;
    background: var(--blau, #1a3a5c);
    color: #fff;
    border-bottom: 3px solid var(--gold, #c8a84e);
}
.fr-kopf h2 { margin: 0; font-size: 1.35rem; font-weight: 700; color: #fff; }
.fr-unterzeile { margin: 2px 0 0; font-size: 0.85rem; opacity: 0.8; }
.fr-schliessen {
    flex: none;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}
.fr-schliessen:hover, .fr-schliessen:focus-visible { background: rgba(255, 255, 255, 0.15); }
.fr-schliessen:focus-visible { outline: 3px solid var(--gold, #c8a84e); outline-offset: 2px; }

.fr-raster {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    padding: 20px 24px 24px;
}

.fr-angaben, .fr-ergebnis {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    min-width: 0;
}
.fr-angaben fieldset { border: 0; margin: 0 0 18px; padding: 0 0 14px; border-bottom: 1px solid #e4e8ee; min-width: 0; }
.fr-angaben fieldset:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.fr-angaben legend {
    padding: 0;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blau, #1a3a5c);
}
.fr-optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: #4a5a6a; }

/* Haushaltsnetto steht zuerst und faellt auf: ohne Eingabe keine Rechnung (Nutzer 11.11.2026) */
.fr-angaben fieldset.fr-zuerst {
    padding: 12px 14px 8px;
    margin-bottom: 18px;
    border: 0;
    border-left: 4px solid var(--gold, #c8a84e);
    border-radius: 8px;
    background: #fbf6e6;
}
.fr-angaben fieldset.fr-zuerst legend { float: left; width: 100%; }
.fr-angaben fieldset.fr-zuerst .fr-zwei { clear: both; }

.fr-zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.fr-feld { min-width: 0; }
.fr-feld label { display: block; font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; color: #333; }
.fr-eingabe { position: relative; }
.fr-eingabe input, .fr-eingabe select {
    width: 100%;
    min-height: 44px;
    padding: 9px 34px 9px 12px;
    border: 1.5px solid #c9d1db;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font: inherit;
    font-size: 1rem;
}
.fr-eingabe select { padding-right: 12px; }
.fr-eingabe input:focus, .fr-eingabe select:focus {
    outline: none;
    border-color: var(--gold, #c8a84e);
    box-shadow: 0 0 0 3px rgba(200, 168, 78, 0.3);
}
.fr-eingabe input[aria-invalid="true"] { border-color: #b3261e; }
.fr-einheit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #4a5a6a;
    pointer-events: none;
}
.fr-hinweis { margin: 4px 0 0; min-height: 1em; font-size: 0.8rem; color: #4a5a6a; }
.fr-hinweis:empty { min-height: 0; }
.fr-hinweis.fr-warnung { color: #8a4b00; font-weight: 600; }
.fr-hinweis.fr-warnung::before { content: "⚠ "; }
.fr-fehler { margin: 2px 0 6px; font-size: 0.8rem; color: #b3261e; font-weight: 600; }
.fr-fehler:empty { margin: 0; }
.fr-zinsquelle { margin-top: 8px; }

.fr-meldungen:empty { display: none; }
.fr-meldung { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; border-left: 4px solid; }
.fr-meldung-warnung { background: #fff6e5; border-color: #c77700; color: #5c3600; }
.fr-meldung-info { background: #eaf2fb; border-color: #2f6fb0; color: #1a3a5c; }
.fr-meldung-fehler { background: #f3f4f6; border-color: #8a96a3; color: #333; }

.fr-rate {
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 10px;
    background: var(--blau, #1a3a5c);
    color: #fff;
}
.fr-rate-titel { margin: 0; font-size: 0.85rem; opacity: 0.85; }
.fr-rate-wert { margin: 2px 0 4px; font-size: 2.2rem; font-weight: 800; line-height: 1.1; color: #fff; }
.fr-rate-zins { margin: 0; font-size: 0.85rem; line-height: 1.4; opacity: 0.9; }

.fr-tabelle { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 0.92rem; }
.fr-tabelle caption {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blau, #1a3a5c);
    padding-bottom: 6px;
}
.fr-tabelle th, .fr-tabelle td { padding: 6px 0; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.fr-tabelle th { text-align: left; font-weight: 400; padding-right: 12px; }
.fr-tabelle td { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fr-tabelle .fr-stark th, .fr-tabelle .fr-stark td { font-weight: 700; color: var(--blau, #1a3a5c); }

/* Belastungsquote am angezeigten Wert: gruen bis 33,0 % (Nutzer 12.11.2026), orange > 33 %,
   rot > 40 % (Nutzer 11.11.2026). Helle Flaechen, dunkle Schrift (Kontrast); die Marke
   "bis 33 %"/"ueber 33 %"/"ueber 40 %" steht als Text daneben. */
.fr-tabelle tr.fr-stufe-gruen th, .fr-tabelle tr.fr-stufe-gruen td { background: #e3f3e6; font-weight: 700; }
.fr-tabelle tr.fr-stufe-orange th, .fr-tabelle tr.fr-stufe-orange td { background: #fff1dc; font-weight: 700; }
.fr-tabelle tr.fr-stufe-rot th, .fr-tabelle tr.fr-stufe-rot td { background: #fde4e2; font-weight: 700; }
.fr-tabelle tr.fr-stufe-gruen th { box-shadow: inset 4px 0 0 #2e7d32; padding-left: 10px; }
.fr-tabelle tr.fr-stufe-orange th { box-shadow: inset 4px 0 0 #c77700; padding-left: 10px; }
.fr-tabelle tr.fr-stufe-rot th { box-shadow: inset 4px 0 0 #b3261e; padding-left: 10px; }
.fr-tabelle tr.fr-stufe-gruen td, .fr-tabelle tr.fr-stufe-orange td, .fr-tabelle tr.fr-stufe-rot td { padding-right: 8px; }
.fr-marke:empty { display: none; }
.fr-marke {
    display: inline-block;
    margin-left: 6px;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.fr-stufe-gruen .fr-marke { background: #c3e6cb; color: #14532d; }
.fr-stufe-orange .fr-marke { background: #ffd9a8; color: #5c3600; }
.fr-stufe-rot .fr-marke { background: #f9c5c0; color: #7a1710; }

.fr-knoepfe { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 14px; }
.fr-knopf-haupt, .fr-knopf-neben {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.fr-knopf-haupt { background: var(--gold, #c8a84e); border: 1.5px solid var(--gold, #c8a84e); color: var(--blau, #1a3a5c); }
.fr-knopf-haupt:hover { background: var(--gold-hell, #dfc06a); }
.fr-knopf-neben { background: #fff; border: 1.5px solid #c9d1db; color: var(--blau, #1a3a5c); }
.fr-knopf-neben:hover { border-color: var(--blau, #1a3a5c); }
.fr-knopf-haupt:focus-visible, .fr-knopf-neben:focus-visible { outline: 3px solid var(--blau, #1a3a5c); outline-offset: 2px; }

.fr-klein { margin: 0 0 6px; font-size: 0.78rem; color: #4a5a6a; }

/* Handy: feste Leiste mit der Rate (nur bei einspaltiger Darstellung) */
.fr-leiste { display: none; }
.fr-nurdruck { display: none; }
.fr-unsichtbar {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (max-width: 860px) {
    .fr-raster { grid-template-columns: 1fr; }
    .fr-leiste {
        position: sticky;
        bottom: 0;
        z-index: 2;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        justify-content: center;
        gap: 4px 10px;
        width: 100%;
        min-height: 48px;
        padding: 10px 16px;
        border: 0;
        border-top: 3px solid var(--gold, #c8a84e);
        background: var(--blau, #1a3a5c);
        color: #fff;
        font: inherit;
        font-size: 0.95rem;
        cursor: pointer;
    }
    .fr-leiste strong { font-size: 1.2rem; }
    .fr-leiste span { font-size: 0.85rem; opacity: 0.85; }
    .fr-leiste:focus-visible { outline: 3px solid var(--gold, #c8a84e); outline-offset: -3px; }
}
@media (max-width: 600px) {
    .fr-dialog {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }
    .fr-kopf { padding: 14px 16px; }
    .fr-raster { padding: 14px 16px 20px; gap: 14px; }
    .fr-angaben, .fr-ergebnis { padding: 16px; }
    .fr-zwei { grid-template-columns: 1fr; }
    .fr-rate-wert { font-size: 1.9rem; }
}

/* Druck: nur das Fenster, ohne Schatten und Bedienelemente (Hinweis Gemini:
   ein fixiertes <dialog> wird sonst nach Seite 1 abgeschnitten). */
@media print {
    html.fr-offen, html.fr-offen body { overflow: visible !important; height: auto !important; background: #fff !important; }
    html.fr-offen body > *:not(.fr-dialog) { display: none !important; }
    .fr-dialog[open] {
        position: static !important;
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        max-height: none !important;
        height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #fff !important;
    }
    .fr-dialog::backdrop { display: none; }
    .fr-kopf { position: static; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fr-schliessen, .fr-knoepfe, .fr-leiste { display: none !important; }
    html.fr-offen { font-size: 11px !important; }   /* rem-Angaben im Fenster schrumpfen mit */
    .fr-raster { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 14px; padding: 10px 0 0; }
    .fr-angaben, .fr-ergebnis { box-shadow: none; padding: 0; }
    .fr-zwei { grid-template-columns: 1fr 1fr; }
    .fr-angaben fieldset { margin-bottom: 8px; padding-bottom: 6px; }
    .fr-rate-wert { font-size: 1.7rem; }
    .fr-tabelle th, .fr-tabelle td { padding: 3px 0; }
    .fr-rate { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .fr-eingabe input, .fr-eingabe select { min-height: 0; padding: 4px 26px 4px 6px; border-width: 1px; }
    .fr-hinweis:not(.fr-zinsquelle):not(.fr-warnung) { display: none; }
    .fr-nurdruck { display: block; }
    .fr-tabelle { break-inside: avoid; }
    .fr-stufe-gruen th, .fr-stufe-gruen td,
    .fr-stufe-orange th, .fr-stufe-orange td, .fr-stufe-rot th, .fr-stufe-rot td, .fr-marke {
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
}
