/* Hausrunde. Ruhige Grundfarben mit einem Salbeigruen als Akzent, jede
   Person bringt ihre eigene Farbe mit (--person). Uebernommen aus den
   Schulpunkten sind die Lehren fuer Safari 16 (kein color-mix), die feste
   Tableiste mit Sicherheitsabstand und die Knopfvariablen von Bootstrap. */

:root {
  --grund: #f6f7f4;
  --flaeche: #ffffff;
  --erhoben: #eef1ec;
  --schrift: #1f2420;
  --leise: #6b736d;
  --linie: #dfe4de;
  --akzent: #4f7a63;
  --akzent-rgb: 79, 122, 99;
  --auf-akzent: #ffffff;
  --gut: #3f7350;
  --warn: #8a6d2f;
  --schlecht: #a0453a;
  --person: #4f7a63;
  --rund: 12px;
  --leise-dunkel: #555c57;
  --gefahr-linie: #d8b3ac;

  --bs-body-bg: var(--grund);
  --bs-body-color: var(--schrift);
  --bs-border-color: var(--linie);
  --bs-primary: var(--akzent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #171a18;
    --flaeche: #1f2320;
    --erhoben: #282d29;
    --schrift: #e8ece8;
    --leise: #9aa39c;
    --linie: #343a35;
    --akzent: #8fbfa3;
    --akzent-rgb: 143, 191, 163;
    --auf-akzent: #171a18;
    --gut: #8fc79f;
    --schlecht: #e08a7e;
    --leise-dunkel: #b4bcb6;
    --gefahr-linie: #5a3832;
  }
}

/* Was per Tastatur oder Sprungmarke ins Bild rollt, soll nicht unter dem
   Kopf oder der Tableiste landen. */
html { scroll-padding-top: 4.5rem; scroll-padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }

body {
  background: var(--grund);
  color: var(--schrift);
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  padding-bottom: calc(4.75rem + env(safe-area-inset-bottom));
  overflow-wrap: break-word; hyphens: auto;
}
@media (min-width: 768px) { body { padding-bottom: 1.5rem; } }

h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; hyphens: auto; overflow-wrap: anywhere; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.125rem; margin: 26px 0 10px; }
a { color: var(--akzent); }

.hr-huelle { max-width: 760px; margin: 0 auto; padding: 16px 16px 24px; }
.hr-huelle:first-child { padding-top: calc(16px + env(safe-area-inset-top)); }

/* --- Kopf ------------------------------------------------------------- */

.hr-kopf {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
  position: sticky; top: 0; z-index: 30;
}
.hr-marke {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.125rem; color: var(--schrift); text-decoration: none;
}
.hr-marke b { color: var(--akzent); font-weight: inherit; }
.hr-logo { width: 28px; height: 28px; color: var(--akzent); flex-shrink: 0; }
.hr-haushalt { color: var(--leise); font-size: 0.8125rem; }
.hr-menue { display: none; gap: 16px; margin-left: 12px; }
.hr-menue a { color: var(--leise); text-decoration: none; font-size: 0.9375rem; }
.hr-menue a.aktiv { color: var(--akzent); font-weight: 600; }
@media (hover: hover) { .hr-menue a:hover { color: var(--akzent); } }
@media (min-width: 768px) { .hr-menue { display: flex; } }

/* --- Tableiste (Handy) ------------------------------------------------ */

.hr-tableiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--flaeche); border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
.hr-tableiste a {
  flex: 1 1 0; text-align: center; padding: 9px 2px 7px; min-height: 56px;
  min-width: 0; overflow: hidden; white-space: nowrap;
  color: var(--leise); text-decoration: none; font-size: min(0.6875rem, 13px);
}
.hr-tableiste a i { display: block; font-size: min(1.25rem, 22px); margin-bottom: 2px; }
.hr-tableiste a.aktiv { color: var(--akzent); font-weight: 600; }
@media (min-width: 768px) { .hr-tableiste { display: none; } }

/* --- Karten und Zeilen ------------------------------------------------ */

.hr-karte {
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: var(--rund); padding: 16px; margin-bottom: 14px;
}
.hr-karte > h2:first-of-type, .hr-karte > h3:first-of-type { margin-top: 0; }
.hr-schmal { max-width: 420px; margin: 6vh auto 0; }

.hr-zeile {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--linie);
}
.hr-zeile:last-child { border-bottom: 0; }
.hr-zeile .wachsen { flex: 1 1 auto; min-width: min(100%, 12rem); }
.hr-zeile > form, .hr-zeile > .btn { flex-shrink: 0; }
.hr-huelle .d-flex > .btn, .hr-huelle .d-flex > form { flex-shrink: 0; }
.hr-huelle .d-flex.align-items-center { flex-wrap: wrap; gap: 8px; }

.hr-hinweis { color: var(--leise); font-size: 0.8125rem; }
.hr-leer { color: var(--leise); padding: 8px 0; }
.leise { color: var(--leise); font-size: 0.8125rem; }

/* --- Tag: Kopf mit Fortschritt ---------------------------------------- */

.hr-tagkopf { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.hr-tagkopf .titel { flex: 1 1 auto; min-width: 0; text-align: center; }
.hr-tagkopf .titel small { display: block; color: var(--leise); font-size: 0.8125rem; }
.hr-pfeil {
  width: 44px; height: 44px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid var(--linie); background: var(--flaeche); color: var(--schrift);
  text-decoration: none;
}
.hr-balken { height: 8px; background: var(--erhoben); border-radius: 4px; overflow: hidden; }
.hr-balken > div { height: 100%; background: var(--akzent); border-radius: 4px;
                   transition: width .25s ease; }

.hr-sicht { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 4px; }
.hr-sicht a {
  padding: 6px 12px; border-radius: 16px; border: 1px solid var(--linie);
  background: var(--flaeche); color: var(--schrift); text-decoration: none;
  font-size: 0.875rem; display: inline-flex; align-items: center; gap: 6px;
}
.hr-sicht a.aktiv { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent);
                    font-weight: 600; }

.hr-punkt { width: 10px; height: 10px; border-radius: 50%; display: inline-block;
            flex-shrink: 0; }

/* --- Abschnitt und Aufgabe -------------------------------------------- */

.hr-abschnitt h2 {
  display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 1rem;
}
.hr-abschnitt h2 .zahl { margin-left: auto; color: var(--leise); font-weight: 500;
                         font-size: 0.8125rem; white-space: nowrap; }
.hr-abschnitt .thema { color: var(--leise); font-size: 0.875rem; margin: -2px 0 6px; }

.hr-aufgabe { display: flex; align-items: center; gap: 12px; padding: 4px 0;
              border-top: 1px solid var(--linie); }
.hr-aufgabe:first-of-type { border-top: 0; }
.hr-aufgabe form { margin: 0; flex-shrink: 0; }
.hr-aufgabe .text { flex: 1 1 auto; min-width: 0; padding: 6px 0; }
.hr-aufgabe .text .wer { display: inline-flex; align-items: center; gap: 4px;
                         color: var(--leise); font-size: 0.75rem; margin-left: 6px;
                         white-space: nowrap; }
.hr-aufgabe.erledigt .text .titel { color: var(--leise); text-decoration: line-through;
                                    text-decoration-color: var(--linie); }

/* Der Haken: 44 Pixel sind Apples Mindestmass, und er wird jeden Tag
   dutzendfach angetippt. */
.hr-haken {
  width: max(44px, 2.75rem); height: max(44px, 2.75rem); border-radius: 50%;
  border: 2px solid var(--linie); background: var(--flaeche); color: transparent;
  font-size: 1.125rem; line-height: 1; cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.hr-haken.erledigt { background: var(--farbe, var(--akzent));
                     border-color: var(--farbe, var(--akzent)); color: #fff; }
.hr-haken:disabled { opacity: .4; cursor: default; }
.hr-haken:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
@media (hover: hover) {
  .hr-haken:not(:disabled):not(.erledigt):hover { border-color: var(--akzent);
                                                  color: var(--linie); }
}

/* --- Wochenraster ----------------------------------------------------- */

.hr-woche { width: 100%; border-collapse: collapse; min-width: 320px; }
.hr-woche th {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--leise); font-weight: 500; padding: 4px 2px; text-align: center;
}
.hr-woche th.heute { color: var(--akzent); font-weight: 700; }
.hr-rasterkarte { padding: 12px 8px; }
.hr-woche td { padding: 3px 1px; border-top: 1px solid var(--linie); text-align: center; }
.hr-woche td.aufgabe { text-align: left; padding-right: 6px; font-size: 0.8125rem;
                      line-height: 1.25; }
.hr-woche td.abschnitt { text-align: left; font-weight: 650; font-size: 0.8125rem;
                         padding-top: 14px; color: var(--leise); border-top: 0; }
/* Sieben Tage muessen auf ein 320er Display passen. Kleiner als 44 Pixel
   ist hier vertretbar, abgehakt wird vor allem auf der Seite Heute. */
.hr-woche .hr-haken { width: 30px; height: 30px; font-size: 0.8125rem; border-width: 1.5px; }
.hr-frei { color: var(--leise); font-size: 1rem; line-height: 30px; }
@media (min-width: 600px) {
  .hr-woche .hr-haken { width: 38px; height: 38px; font-size: 0.9375rem; }
  .hr-woche td.aufgabe { font-size: 0.875rem; }
}
.hr-fokuszelle { font-size: 0.75rem; color: var(--leise); }
.hr-fokuszelle.fertig { color: var(--gut); font-weight: 600; }
.table-responsive { min-width: 0; max-width: 100%; }

/* --- Plan ------------------------------------------------------------- */

.hr-reiter { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.hr-reiter a {
  padding: 6px 12px; border-radius: 16px; border: 1px solid var(--linie);
  background: var(--flaeche); color: var(--schrift); text-decoration: none;
  font-size: 0.875rem;
}
.hr-reiter a.aktiv { background: var(--akzent); border-color: var(--akzent);
                     color: var(--auf-akzent); font-weight: 600; }
.hr-reiter a.jetzt:not(.aktiv) { border-color: var(--akzent); }

.hr-planzeile { border-top: 1px solid var(--linie); padding: 8px 0; }
.hr-planzeile:first-child { border-top: 0; }
.hr-planzeile summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
  min-height: 40px;
}
.hr-planzeile summary::-webkit-details-marker { display: none; }
.hr-planzeile summary .titel { flex: 1 1 auto; min-width: 0; }
.hr-planzeile summary .bi-pencil { color: var(--leise); }
.hr-planzeile[open] summary .bi-pencil { color: var(--akzent); }
.hr-planzeile .bearbeiten { padding: 10px 0 4px; }
.hr-tage { display: flex; gap: 4px; flex-wrap: wrap; }
.hr-tage label {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 36px; border-radius: 8px; border: 1px solid var(--linie);
  font-size: 0.8125rem; color: var(--schrift); cursor: pointer; margin: 0;
}
.hr-tage input { position: absolute; opacity: 0; pointer-events: none; }
.hr-tage input:checked + span { font-weight: 700; color: var(--akzent); }
.hr-tage label:has(input:checked) { border-color: var(--akzent);
                                    background: rgba(var(--akzent-rgb), .1); }
.hr-tage input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: 4px; }

.hr-farben { display: flex; gap: 6px; flex-wrap: wrap; }
.hr-farben label { margin: 0; cursor: pointer; }
.hr-farben input { position: absolute; opacity: 0; pointer-events: none; }
.hr-farben span { width: 32px; height: 32px; border-radius: 50%; display: block;
                  border: 3px solid transparent; }
.hr-farben input:checked + span { border-color: var(--schrift); }
.hr-farben input:focus-visible + span { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* --- Formulare und Knoepfe -------------------------------------------- */

label { font-size: 0.8125rem; color: var(--leise); overflow-wrap: anywhere; }
.form-control, .form-select {
  background: var(--flaeche); color: var(--schrift); border-color: var(--linie);
  /* 16 Pixel, sonst zoomt Safari auf dem iPhone beim Antippen hinein. */
  font-size: 1rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--akzent); box-shadow: 0 0 0 .2rem rgba(var(--akzent-rgb), .15);
}
.form-check-input:checked { background-color: var(--akzent); border-color: var(--akzent); }

/* Eigene Knoepfe brauchen jeden Zustand als Variable, sonst verschwinden
   sie unter dem Mauszeiger (siehe Schulpunkte). */
.btn-akzent {
  --bs-btn-color: var(--auf-akzent); --bs-btn-bg: var(--akzent);
  --bs-btn-border-color: var(--akzent);
  --bs-btn-hover-color: var(--auf-akzent); --bs-btn-hover-bg: var(--akzent);
  --bs-btn-hover-border-color: var(--akzent);
  --bs-btn-active-color: var(--auf-akzent); --bs-btn-active-bg: var(--akzent);
  --bs-btn-active-border-color: var(--akzent);
  --bs-btn-focus-shadow-rgb: var(--akzent-rgb);
  --bs-btn-disabled-color: var(--leise-dunkel); --bs-btn-disabled-bg: var(--erhoben);
  --bs-btn-disabled-border-color: var(--linie); --bs-btn-disabled-opacity: 1;
}
.btn-akzent:hover, .btn-akzent:focus-visible { filter: brightness(.94); }
.btn-akzent:active { filter: brightness(.88); }
.btn-rand {
  --bs-btn-color: var(--schrift); --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--linie);
  --bs-btn-hover-color: var(--schrift); --bs-btn-hover-bg: var(--erhoben);
  --bs-btn-hover-border-color: var(--akzent);
  --bs-btn-active-color: var(--schrift); --bs-btn-active-bg: var(--erhoben);
  --bs-btn-active-border-color: var(--akzent);
  --bs-btn-focus-shadow-rgb: var(--akzent-rgb);
  --bs-btn-disabled-color: var(--leise); --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--linie); --bs-btn-disabled-opacity: 1;
}
.btn-gefahr {
  --bs-btn-color: var(--schlecht); --bs-btn-bg: transparent;
  --bs-btn-border-color: var(--gefahr-linie);
  --bs-btn-hover-color: var(--schlecht); --bs-btn-hover-bg: var(--erhoben);
  --bs-btn-hover-border-color: var(--schlecht);
  --bs-btn-active-color: var(--schlecht); --bs-btn-active-bg: var(--erhoben);
  --bs-btn-active-border-color: var(--schlecht);
  --bs-btn-focus-shadow-rgb: var(--akzent-rgb);
  --bs-btn-disabled-color: var(--leise); --bs-btn-disabled-bg: transparent;
  --bs-btn-disabled-border-color: var(--linie); --bs-btn-disabled-opacity: 1;
}
.hr-gefahr { border-color: var(--gefahr-linie); }

.hr-fuss {
  max-width: 760px; margin: 0 auto; padding: 20px 16px 8px;
  display: flex; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--linie);
}
.hr-fuss a { color: var(--leise); text-decoration: none; font-size: 0.8125rem; }

.hr-text h2 { margin-top: 22px; }
.hr-text p, .hr-text li { max-width: 62ch; }
