/* Aufwandsrechner. Farben und Fussleiste wie ralfwbalz.ch und offerte.ralfwbalz.ch. */
:root {
  --navy: #1B2A4A;
  --navy-dark: #111E35;
  --blue: #3B82F6;
  --blue-hover: #2563EB;
  --cyan: #0891b2;
  --white: #FFFFFF;
  --bg: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-400: #94A3B8;
  --gray-600: #475569;
  --text: #1F2937;
  --gut: #166534;
  --gut-bg: #DCFCE7;
  --fehler: #991B1B;
  --fehler-bg: #FEE2E2;
  --radius: 8px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.07);
  --shadow: 0 4px 24px rgba(0,0,0,.10);
  --transition: .2s ease;
}
* { box-sizing: border-box; }
/* Das Attribut hidden gewinnt immer, auch gegen display-Angaben weiter unten. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--blue-hover); }
h1 { color: var(--navy); font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.2; margin: 0 0 12px; }
h2 { color: var(--navy); font-size: 1.05rem; margin: 0 0 12px; }
.lead { color: var(--gray-600); font-size: 1.05rem; margin: 0; max-width: 62ch; }
.klein { font-size: .82rem; color: var(--gray-600); margin: 10px 0 0; }
.icon { width: 34px; height: 34px; color: var(--cyan); flex-shrink: 0; }

/* Kopf */
.kopf {
  background: var(--white);
  box-shadow: var(--shadow-sm);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.kopf-marke { display: flex; align-items: center; gap: 10px; color: var(--navy);
              font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.kopf-links { display: flex; gap: 20px; font-size: .95rem; }
.kopf-links a { color: var(--gray-600); text-decoration: none; font-weight: 600; }
.kopf-links a:hover { color: var(--blue-hover); }

.haupt { width: 100%; max-width: 1100px; margin: 0 auto; padding: 32px 16px 56px; flex: 1 0 auto; }
.einstieg { margin-bottom: 28px; }
.zurueck { margin: 0 0 16px; font-size: .92rem; }
.hinweis { color: var(--gray-600); font-size: .9rem; margin-top: 28px; }

/* Startseite: Karten */
.karten { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px;
          grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.karte { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 20px;
         background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
         color: inherit; text-decoration: none;
         transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition); }
.karte:hover, .karte:focus-visible { border-color: var(--blue); box-shadow: var(--shadow); transform: translateY(-2px); }
.karte-titel { font-weight: 700; color: var(--navy); line-height: 1.3; }
.karte-kurz { font-size: .9rem; color: var(--gray-600); }

/* Rechner */
.rechner-kopf { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 24px; }
.rechner-kopf .icon { width: 44px; height: 44px; margin-top: 4px; }
.rechner { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.gruppe { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius);
          padding: 20px; margin-bottom: 16px; }
.frage { padding: 12px 0; border-top: 1px solid var(--gray-200); }
.gruppe > .frage:first-of-type { border-top: 0; padding-top: 0; }
.frage:last-child { padding-bottom: 0; }
.frage-text { font-weight: 600; color: var(--navy); display: block; padding: 0; }
.frage-zeile { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.frage-hilfe { margin: 6px 0 0; font-size: .86rem; color: var(--gray-600); }
.frage-grund { margin: 6px 0 0; font-size: .86rem; color: var(--cyan); font-weight: 600; }

.schalter { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.schalter input { appearance: none; -webkit-appearance: none; width: 42px; height: 24px; flex-shrink: 0;
                  border-radius: 12px; background: var(--gray-400); position: relative; margin: 0;
                  cursor: pointer; transition: background var(--transition); }
.schalter input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
                         border-radius: 50%; background: var(--white); transition: transform var(--transition); }
.schalter input:checked { background: var(--blue); }
.schalter input:checked::after { transform: translateX(18px); }
.schalter input:disabled { background: var(--cyan); cursor: default; }
.schalter input:focus-visible, .wahl-reihe input:focus-visible + label,
input[type=range]:focus-visible, select:focus-visible, .knopf:focus-visible {
  outline: 2px solid var(--navy); outline-offset: 2px; }
.schalter-text { font-weight: 600; color: var(--navy); }

input[type=range] { width: 100%; margin: 10px 0 0; accent-color: var(--blue); }
.regler-wert { font-weight: 700; color: var(--blue-hover); white-space: nowrap; }
.regler-skala { display: flex; justify-content: space-between; font-size: .75rem; color: var(--gray-400); }
select, input[type=number], input[type=email], input[type=text] {
  width: 100%; margin-top: 8px; padding: 9px 10px; font: inherit; color: inherit;
  border: 1px solid var(--gray-400); border-radius: 6px; background: var(--white); }
.wahl { border: 0; margin: 0; padding: 0; min-width: 0; }
.wahl-reihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wahl-reihe input { position: absolute; opacity: 0; pointer-events: none; }
.wahl-reihe label { padding: 7px 14px; border: 1px solid var(--gray-400); border-radius: 18px;
                    font-size: .92rem; cursor: pointer; background: var(--white);
                    transition: background var(--transition), color var(--transition), border-color var(--transition); }
.wahl-reihe input:checked + label { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* Ergebnis */
.ergebnis { position: sticky; top: 16px; background: var(--white); border: 1px solid var(--gray-200);
            border-top: 4px solid var(--blue); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.ergebnis-ueber { margin: 0; font-size: .85rem; font-weight: 600; color: var(--gray-600);
                  text-transform: uppercase; letter-spacing: .04em; }
.ergebnis-stunden { margin: 2px 0 0; font-size: 2.8rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.ergebnis-stunden small { font-size: 1rem; font-weight: 600; color: var(--gray-600); }
.ergebnis-spanne { margin: 4px 0 0; color: var(--gray-600); }
.ergebnis-kosten { margin: 10px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 6px;
                   font-size: .92rem; font-weight: 600; color: var(--navy); }
.ergebnis-bedingt { display: inline-block; margin: 10px 0 0; padding: 3px 10px; border-radius: 12px;
                    background: #FEF3C7; color: #92400E; font-size: .82rem; font-weight: 700; }
.sperre p { margin: 8px 0 0; }
.sperre .ergebnis-ueber { color: var(--fehler); margin: 0; }
.sperre-vorpruefung { font-weight: 700; color: var(--navy); }
.ergebnis-teil { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--gray-200); }
.ergebnis-teil h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em;
                    color: var(--gray-600); margin-bottom: 8px; }
.bereiche { list-style: none; margin: 0; padding: 0; }
.bereiche li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: .9rem; margin-bottom: 8px; }
.bereich-stunden { font-weight: 700; white-space: nowrap; }
.balken-bahn { grid-column: 1 / -1; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.balken { display: block; height: 100%; background: var(--cyan); border-radius: 3px; transition: width .3s ease; }
.hinweise { margin: 0; padding-left: 18px; font-size: .88rem; color: var(--gray-600); }
.hinweise li { margin-bottom: 4px; }

.aktionen { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.knopf { display: inline-block; text-align: center; padding: 11px 16px; border: 2px solid var(--blue);
         border-radius: 6px; background: var(--blue); color: var(--white); font: inherit; font-weight: 700;
         text-decoration: none; cursor: pointer; transition: background var(--transition), border-color var(--transition); }
.knopf:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.knopf:disabled { background: var(--gray-200); border-color: var(--gray-200); color: var(--gray-600); cursor: not-allowed; }
.knopf-hell { background: var(--white); color: var(--blue-hover); }
.knopf-hell:hover { background: var(--bg); }
.knopf-umriss { background: var(--white); color: var(--navy); border-color: var(--navy); }
.knopf-umriss:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }
.mail-form { background: var(--bg); padding: 12px; border-radius: 6px; }
.mail-form label { font-weight: 600; font-size: .9rem; }
.mail-form .knopf { width: 100%; margin-top: 10px; }
.honig { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.meldung { margin: 0; padding: 10px 12px; border-radius: 6px; font-size: .9rem; background: var(--bg); }
.meldung.gut { background: var(--gut-bg); color: var(--gut); }
.meldung.fehler { background: var(--fehler-bg); color: var(--fehler); }

.wichtig { background: #FEF3C7; border-left: 4px solid #D97706; border-radius: var(--radius);
           padding: 16px 20px; margin: 0 0 24px; color: #78350F; }
.wichtig h2 { color: #78350F; margin-bottom: 8px; }
.wichtig p { margin: 0 0 8px; }
.wichtig p:last-child { margin-bottom: 0; }

.text { background: var(--white); border-radius: var(--radius); padding: 28px; max-width: 800px; }
.text h2 { margin-top: 24px; }

@media (max-width: 860px) {
  .rechner { grid-template-columns: 1fr; }
  /* Die Stunden bleiben beim Scrollen durch die Fragen oben sichtbar. */
  .ergebnis { order: -1; position: sticky; top: 0; z-index: 5; border-radius: 0 0 var(--radius) var(--radius);
              margin: 0 -16px; padding: 12px 16px; }
  .ergebnis-stunden { font-size: 2rem; }
  .ergebnis-teil, .ergebnis .aktionen, .ergebnis > .klein, .ergebnis #risiko { display: none; }
  .ergebnis.offen .ergebnis-teil, .ergebnis.offen .aktionen, .ergebnis.offen > .klein, .ergebnis.offen #risiko { display: block; }
  .ergebnis.offen .aktionen { display: flex; }
  .ergebnis.offen { max-height: 100dvh; overflow-y: auto; }
  .ergebnis-mehr { display: block; }
}
.ergebnis-mehr { display: none; width: 100%; margin-top: 8px; padding: 6px; border: 0; background: none;
                 color: var(--blue-hover); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* Fussleiste: Werte wie in ralfwbalz/static/css/style.css (gemeinsames templates/_footer.html). */
.footer { background: var(--navy-dark); padding: 32px 24px; text-align: center; line-height: 1.6; flex-shrink: 0; }
.footer-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center;
                justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-logo { display: block; width: 30px; height: 30px; opacity: 0.6; flex-shrink: 0; }
.footer-copy { color: rgba(255,255,255,.4); font-size: .85rem; margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 24px; }
.footer-links a { color: var(--white); font-size: .9rem; font-weight: 600; text-decoration: underline;
                  text-underline-offset: 3px; transition: color var(--transition); }
.footer-links a:hover { color: #93C5FD; }
@media (max-width: 600px) { .footer-inner { flex-direction: column; text-align: center; } }

/* ─── Admin ─────────────────────────────────────────────────────────── */
.admin-kopf { background: var(--white); box-shadow: var(--shadow-sm); padding: 10px 22px;
              display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.admin-kopf strong { color: var(--navy); margin-right: 8px; }
.admin-kopf a { color: var(--gray-600); text-decoration: none; font-weight: 600; font-size: .95rem; }
.admin-kopf a.aktiv, .admin-kopf a:hover { color: var(--blue-hover); }
.admin-kopf .rechts { margin-left: auto; }
.admin { width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 16px 56px; flex: 1 0 auto; }
.admin h1 { font-size: 1.5rem; }
.admin h2 { margin-top: 28px; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.kachel { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px 16px; }
.kachel-zahl { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.kachel-name { font-size: .85rem; color: var(--gray-600); }
.kachel-neben { font-size: .8rem; color: var(--gray-400); }
.tafel { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--gray-200); vertical-align: top; }
th { color: var(--gray-600); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.zahl, th.zahl { text-align: right; white-space: nowrap; }
.reiter { display: flex; gap: 6px; margin: 0 0 16px; }
.reiter a { padding: 5px 12px; border-radius: 14px; background: var(--white); border: 1px solid var(--gray-200);
            text-decoration: none; color: var(--gray-600); font-size: .88rem; font-weight: 600; }
.reiter a.aktiv { background: var(--navy); color: var(--white); border-color: var(--navy); }
.marke { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .78rem; font-weight: 700;
         background: var(--gray-200); color: var(--gray-600); }
.marke.gut { background: var(--gut-bg); color: var(--gut); }
.marke.fehler { background: var(--fehler-bg); color: var(--fehler); }
.formular label { display: block; font-weight: 600; margin-top: 14px; }
.formular .hilfe { font-size: .85rem; color: var(--gray-600); font-weight: 400; margin: 2px 0 0; }
.formular input[type=text], .formular input[type=number] { max-width: 220px; }
.katalog-tabelle input[type=text] { width: 84px; margin: 0; padding: 5px 7px; }
.katalog-tabelle select { width: auto; margin: 0; padding: 5px 7px; }
.katalog-tabelle tr.option td { background: #F8FAFC; }
.katalog-tabelle tr.option td:first-child { padding-left: 28px; }
.katalog-tabelle .typ { color: var(--gray-400); font-size: .8rem; }
.vorlaeufig { background: #FEF3C7; color: #92400E; padding: 10px 14px; border-radius: 6px; font-size: .9rem; margin: 0 0 16px; }
.diagramm { width: 100%; height: auto; display: block; }
.diagramm rect { fill: var(--cyan); }
.diagramm text { font-size: 10px; fill: var(--gray-600); }
