/* ===========================================================================
   Pferde-Management – eigene Ergaenzungen zu Pico CSS
   Farbwerte der Diagramme sind geprueft (validate_palette, hell + dunkel).
   =========================================================================== */

/* ---------------------------------------------------------------- Tokens */
:root {
  --marke:       #6d4c33;
  --marke-tief:  #533825;
  --sand:        #f4e3c1;

  --flaeche:     #f6f4f0;
  --karte:       #fdfcfa;
  --karte-2:     #ffffff;
  --linie:       rgba(23, 21, 15, .09);
  --gitter:      #e6e3dc;

  --ink:         #17150f;
  --ink-2:       #55524a;
  --ink-3:       #8b8880;

  /* Status – nie fuer Serien verwenden */
  --st-good:     #0ca30c;
  --st-warn:     #fab219;
  --st-crit:     #d03b3b;
  --st-none:     #898781;

  --pill-gruen-bg: #e8f7e8; --pill-gruen-fg: #0a6b0a;
  --pill-gelb-bg:  #fdf1d5; --pill-gelb-fg:  #855a00;
  --pill-rot-bg:   #fbe6e6; --pill-rot-fg:   #ab2b2b;
  --pill-grau-bg:  #efedea; --pill-grau-fg:  #6b6862;

  /* Sequenzielle Rampe der Heatmap: ein Farbton, hell -> dunkel */
  --hm0: #ebe9e3; --hm1: #cde2fb; --hm2: #9ec5f4; --hm3: #5598e7; --hm4: #2a78d6;

  --radius:   14px;
  --radius-s: 9px;
  --schatten: 0 1px 2px rgba(23, 21, 15, .05), 0 4px 14px rgba(23, 21, 15, .05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --marke: #8a6544; --marke-tief: #6d4c33;
    --flaeche: #121110; --karte: #1c1a18; --karte-2: #232120;
    --linie: rgba(255, 255, 255, .10); --gitter: #2e2b28;
    --ink: #f7f5f1; --ink-2: #c3c0b7; --ink-3: #918d84;

    --pill-gruen-bg: rgba(12, 163, 12, .18);  --pill-gruen-fg: #6ede6e;
    --pill-gelb-bg:  rgba(250, 178, 25, .18); --pill-gelb-fg:  #f3c45c;
    --pill-rot-bg:   rgba(208, 59, 59, .20);  --pill-rot-fg:   #f08a8a;
    --pill-grau-bg:  rgba(255, 255, 255, .08); --pill-grau-fg: #a8a49b;

    --hm0: #2c2a27; --hm1: #184f95; --hm2: #1c5cab; --hm3: #256abf; --hm4: #3987e5;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --marke: #8a6544; --marke-tief: #6d4c33;
  --flaeche: #121110; --karte: #1c1a18; --karte-2: #232120;
  --linie: rgba(255, 255, 255, .10); --gitter: #2e2b28;
  --ink: #f7f5f1; --ink-2: #c3c0b7; --ink-3: #918d84;

  --pill-gruen-bg: rgba(12, 163, 12, .18);  --pill-gruen-fg: #6ede6e;
  --pill-gelb-bg:  rgba(250, 178, 25, .18); --pill-gelb-fg:  #f3c45c;
  --pill-rot-bg:   rgba(208, 59, 59, .20);  --pill-rot-fg:   #f08a8a;
  --pill-grau-bg:  rgba(255, 255, 255, .08); --pill-grau-fg: #a8a49b;

  --hm0: #2c2a27; --hm1: #184f95; --hm2: #1c5cab; --hm3: #256abf; --hm4: #3987e5;
  --schatten: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
}

/* Rueckwaertskompatible Aliase (aeltere Klassen im Projekt) */
:root { --pm-braun: var(--marke); --pm-gruen: var(--st-good); --pm-gelb: var(--st-warn);
        --pm-rot: var(--st-crit); --pm-grau: var(--st-none); }

body { min-height: 100vh; background: var(--flaeche); color: var(--ink); }
.container { max-width: 1180px; margin-inline: auto; padding-inline: 1.5rem; }

/* ------------------------------------------------- Grundgeruest mit Seitenleiste */
.app { display: flex; align-items: flex-start; min-height: 100vh; }
/* Die Rasterumbrueche richten sich nach der Breite der Inhaltsspalte,
   nicht nach dem Fenster - sonst rechnet die Seitenleiste doppelt. */
.inhalt-spalte { flex: 1 1 auto; min-width: 0; container: inhalt / inline-size; }
.inhalt-spalte > .container { padding-top: .5rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--marke); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius-s) 0;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- Seitenleiste */
.seitenleiste {
  flex: 0 0 244px; width: 244px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--karte);
  border-right: 1px solid var(--linie);
  padding: 1.1rem .75rem .9rem;
  z-index: 40;
}
.marke {
  display: flex; align-items: center; gap: .6rem;
  padding: .2rem .5rem 1.25rem; text-decoration: none;
  color: var(--ink); font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em;
}
.marke img { border-radius: 8px; flex: none; }
.marke span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.haupt-nav { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.nav-gruppe {
  margin: 1rem .75rem .3rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.nav-gruppe:first-child { margin-top: 0; }

.nav-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .58rem .75rem; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-size: .93rem; font-weight: 500;
  transition: background .13s, color .13s;
  width: 100%; border: 0; background: none; text-align: left; cursor: pointer;
  font-family: inherit;
}
.nav-link:hover { background: var(--gitter); color: var(--ink); }
.nav-icon { width: 19px; height: 19px; flex: none; opacity: .8; }
.nav-aktiv {
  background: var(--marke); color: #fff; font-weight: 600;
  box-shadow: 0 2px 8px rgba(109, 76, 51, .28);
}
.nav-aktiv:hover { background: var(--marke); color: #fff; }
.nav-aktiv .nav-icon { opacity: 1; }

.seitenleiste-fuss { border-top: 1px solid var(--linie); padding-top: .6rem; margin-top: .6rem; }
.seitenleiste-fuss form { margin: 0; }
.nav-abmelden { color: var(--ink-3); }
.nav-abmelden:hover { background: var(--pill-rot-bg); color: var(--pill-rot-fg); }

/* ------------------------------------------------- Schmale Leiste fuer Mobil */
.mobil-leiste { display: none; }
.burger {
  width: 40px; height: 40px; padding: 0; margin: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--karte); color: var(--ink);
  border: 1px solid var(--linie); border-radius: 10px; cursor: pointer;
}
.burger svg { width: 20px; height: 20px; }
.mobil-titel { font-weight: 650; font-size: 1rem; }
.app-hinweis {
  display: flex; align-items: flex-start; gap: .65rem;
  margin: .75rem auto 0; padding: .7rem .9rem;
  background: var(--karte); border: 1px solid var(--linie);
  border-left: 3px solid var(--marke);
  border-radius: var(--radius-s); box-shadow: var(--schatten);
  font-size: .86rem; color: var(--ink-2);
}
.app-hinweis svg { width: 20px; height: 20px; flex: none; margin-top: .1rem; color: var(--marke); }
.app-hinweis p { margin: 0; }
.app-hinweis strong { color: var(--ink); }
.app-hinweis em { font-style: normal; font-weight: 600; color: var(--ink); }
.hinweis-zu {
  margin: -.2rem -.3rem 0 auto; padding: 0 .35rem; width: auto; flex: none;
  background: none; border: 0; color: var(--ink-3);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.hinweis-zu:hover { color: var(--ink); }

.nav-schatten {
  position: fixed; inset: 0; background: rgba(12, 10, 8, .45); z-index: 35;
}

@media (max-width: 900px) {
  .seitenleiste {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .18);
  }
  .seitenleiste.offen { transform: translateX(0); }
  .mobil-leiste {
    display: flex; align-items: center; gap: .8rem;
    padding: .7rem 1rem; position: sticky; top: 0; z-index: 30;
    background: var(--flaeche); border-bottom: 1px solid var(--linie);
  }
}
@media (min-width: 901px) {
  .nav-schatten { display: none !important; }
}

.linklike {
  background: none; border: none; color: inherit; padding: 0; margin: 0;
  width: auto; display: inline; cursor: pointer; text-decoration: underline; font: inherit;
}
.linklike.danger { color: var(--st-crit); }

/* ------------------------------------------------------------------ Flash */
.flash { padding: .7rem 1rem; border-radius: var(--radius-s); margin: .75rem 0 1rem; border: 1px solid transparent; }
.flash-ok  { background: var(--pill-gruen-bg); color: var(--pill-gruen-fg); border-color: currentColor; }
.flash-err { background: var(--pill-rot-bg);   color: var(--pill-rot-fg);   border-color: currentColor; }

/* -------------------------------------------------------- Dashboard-Kopf */
.dash-head {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem;
  align-items: flex-end; justify-content: space-between;
  margin: 1.5rem 0 1.25rem;
}
.dash-head h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.01em; }

.filterleiste {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0;
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: 999px; padding: .3rem .5rem .3rem .9rem; box-shadow: var(--schatten);
}
.filterleiste label {
  display: inline-flex; align-items: center; gap: .4rem; margin: 0;
  font-size: .8rem; color: var(--ink-3); white-space: nowrap;
}
.filterleiste select {
  margin: 0; border: 0; background: transparent; color: var(--ink);
  font-size: .9rem; font-weight: 600; padding: .3rem 1.6rem .3rem .4rem;
  width: auto; min-width: 8rem; box-shadow: none;
}
.filterleiste select:focus-visible { outline: 2px solid var(--marke); outline-offset: 1px; border-radius: 6px; }

/* ------------------------------------------------------------ Stat-Kacheln */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin-bottom: 1.5rem; }
.stat {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--schatten);
  display: flex; flex-direction: column; gap: .1rem;
}
.stat-lbl { font-size: .78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-num { font-size: 2.15rem; font-weight: 650; line-height: 1.15; color: var(--ink); }
.stat-sub { font-size: .82rem; color: var(--ink-2); }
@media (max-width: 760px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } .stat-num { font-size: 1.8rem; } }

/* Alte KPI-Klassen weiterhin nutzbar */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .85rem; margin: 1rem 0 1.5rem; }
.kpi { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; text-align: center; }
.kpi-num { display: block; font-size: 1.9rem; font-weight: 650; line-height: 1.1; }
.kpi-lbl { display: block; font-size: .8rem; color: var(--ink-3); margin-top: .2rem; }
@media (max-width: 760px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }

/* ----------------------------------------------------------- Pferde-Karten */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: .85rem; margin-bottom: 1.75rem; }
.pferd-card {
  --ampel: var(--st-none);
  position: relative; overflow: hidden; margin: 0;
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .95rem 1.05rem; box-shadow: var(--schatten);
}
.pferd-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--ampel);
}
.pferd-card.ampel-gruen { --ampel: var(--st-good); }
.pferd-card.ampel-gelb  { --ampel: var(--st-warn); }
.pferd-card.ampel-rot   { --ampel: var(--st-crit); }
.pferd-card.ampel-grau  { --ampel: var(--st-none); }
.pferd-card header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.pferd-name { display: inline-flex; align-items: center; gap: .45rem; font-weight: 650; font-size: 1.02rem; }
.pferd-punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--pferd-farbe, var(--ink-3)); flex: none; }
.ampel-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ampel); display: inline-block; }
.pferd-letzte, .pferd-woche { font-size: .88rem; margin: .18rem 0; color: var(--ink-2); }
.pferd-woche strong { color: var(--ink); font-size: 1rem; }
.pferd-ruhe {
  margin: .5rem 0 0; padding-top: .5rem; font-size: .85rem; color: var(--ink-2);
  border-top: 1px dashed var(--linie);
}
.pferd-ruhe strong { color: var(--ink); font-size: 1rem; }
.ruhe-anteil {
  display: inline-block; margin-left: .3rem; padding: .05rem .4rem;
  border-radius: 999px; background: var(--pill-grau-bg); color: var(--pill-grau-fg);
  font-size: .76rem; font-weight: 600;
}
.ruhe-detail { color: var(--ink-3); font-size: .8rem; }

.pferd-link { font-size: .85rem; text-decoration: none; display: inline-block; margin-top: .5rem; }
.pferd-link:hover { text-decoration: underline; }
.tag-badge { display: inline-block; font-size: .8rem; background: var(--pill-grau-bg); color: var(--pill-grau-fg); border-radius: .3rem; padding: .05rem .4rem; }

/* -------------------------------------------------------------- Chart-Karte */
.chart-card {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1.1rem 1.2rem 1rem;
  box-shadow: var(--schatten); margin: 0 0 1.25rem;
}
.chart-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem;
}
.chart-card-head h2 { margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -.005em; }
.chart-sub { margin: .15rem 0 0; font-size: .8rem; color: var(--ink-3); }
.chart-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mehr-link { font-size: .85rem; text-decoration: none; white-space: nowrap; }
.mehr-link:hover { text-decoration: underline; }

.chart-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .chart-duo { grid-template-columns: 1fr; gap: 0; } }

.canvas-wrap { position: relative; height: var(--h, 300px); }
.canvas-hoch  { --h: 360px; }
@media (max-width: 700px) { .canvas-hoch { --h: 280px; } }

.leer { color: var(--ink-3); font-size: .9rem; padding: 2rem 0; text-align: center; margin: 0; }

/* Vergroessern-Knopf */
.icon-btn {
  width: 34px; height: 34px; padding: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--linie); border-radius: var(--radius-s);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--marke); border-color: var(--marke); color: #fff; }

/* Segmentierter Umschalter */
.segmented { display: inline-flex; margin: 0; border: 1px solid var(--linie); border-radius: var(--radius-s); overflow: hidden; }
.segmented button {
  width: auto; margin: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--ink-2);
  font-size: .82rem; font-weight: 600; padding: .38rem .8rem; cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--linie); }
.segmented button:hover { background: var(--gitter); color: var(--ink); }
.segmented button.is-an { background: var(--marke); color: #fff; }

/* Tabellenansicht zu jedem Diagramm */
.tabelle { margin-top: .85rem; border-top: 1px solid var(--linie); padding-top: .6rem; }
.tabelle > summary {
  cursor: pointer; font-size: .82rem; color: var(--ink-3);
  list-style: none; display: inline-flex; align-items: center; gap: .35rem;
}
.tabelle > summary::-webkit-details-marker { display: none; }
.tabelle > summary::before { content: "▸"; transition: transform .15s; display: inline-block; }
.tabelle[open] > summary::before { transform: rotate(90deg); }
.tabelle > summary:hover { color: var(--ink); }
.tabelle table { margin-top: .6rem; margin-bottom: 0; font-size: .85rem; }
.tabelle-lang { max-height: 340px; overflow-y: auto; }

/* ---------------------------------------------------------------- Tabellen
   Pico gibt Zellen 1rem Innenabstand - bei acht Spalten sind das ueber
   270px nur fuer Luft. Datentabellen bekommen deshalb ein eigenes Mass. */
.table-scroll { overflow-x: auto; }
table { font-size: .82rem; }
:where(.table-scroll, .tabelle) :is(th, td) {
  padding: .42rem .55rem;
  line-height: 1.35;
}
:where(.table-scroll) thead th {
  font-size: .76rem; letter-spacing: .02em; color: var(--ink-3);
  text-transform: uppercase; font-weight: 700; white-space: nowrap;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.notiz-cell {
  max-width: 16rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.row-inaktiv { opacity: .55; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .35rem; vertical-align: middle; }
.listinfo { color: var(--ink-3); font-size: .85rem; }
.inline-form { display: inline; margin: 0; }

/* Aktionen als Symbole – spart gegenueber Wortlinks rund 100px Spaltenbreite */
.row-actions {
  white-space: nowrap; display: flex; gap: .2rem;
  align-items: center; justify-content: flex-end;
}
.row-actions form { margin: 0; flex: none; display: flex; }
/* Das Element steht mit im Selektor, weil Pico mit
   button[type="submit"] { width: 100% } eine hoehere Spezifitaet hat als
   eine blosse Klasse - der Knopf schrumpfte sonst auf Inhaltsbreite. */
a.aktion-btn,
button.aktion-btn {
  width: 28px; height: 28px; padding: 0; margin: 0; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: 7px;
  color: var(--ink-3); cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s, border-color .12s;
}
a.aktion-btn svg, button.aktion-btn svg { width: 15px; height: 15px; }
a.aktion-btn:hover, button.aktion-btn:hover {
  background: var(--gitter); color: var(--ink); border-color: var(--linie);
}
button.aktion-loeschen:hover {
  background: var(--pill-rot-bg); color: var(--pill-rot-fg); border-color: transparent;
}
a.aktion-btn:focus-visible, button.aktion-btn:focus-visible {
  outline: 2px solid var(--marke); outline-offset: 1px;
}
/* Der aktiv/inaktiv-Schalter bleibt beschriftet - ein Symbol dafuer waere
   mehrdeutig. Er wird nur kompakter, damit er zu den Symbolen passt. */
.row-actions button.linklike {
  width: auto; padding: .18rem .45rem; border-radius: 7px;
  font-size: .76rem; text-decoration: none; color: var(--ink-3);
  border: 1px solid var(--linie); background: none;
}
.row-actions button.linklike:hover { background: var(--gitter); color: var(--ink); }

/* Auf Touchgeraeten groessere Trefferflaeche - 28px trifft man mit dem
   Finger nicht zuverlaessig. */
@media (pointer: coarse) {
  a.aktion-btn, button.aktion-btn { width: 40px; height: 40px; }
  a.aktion-btn svg, button.aktion-btn svg { width: 18px; height: 18px; }
  .row-actions { gap: .35rem; }
  .row-actions button.linklike { padding: .4rem .6rem; font-size: .8rem; }
}

/* ------------------------------------------------------------ Status-Pillen */
.pill {
  display: inline-block; padding: .12rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
}
.pill-rot   { background: var(--pill-rot-bg);   color: var(--pill-rot-fg); }
.pill-gelb  { background: var(--pill-gelb-bg);  color: var(--pill-gelb-fg); }
.pill-gruen { background: var(--pill-gruen-bg); color: var(--pill-gruen-fg); }
.pill-grau  { background: var(--pill-grau-bg);  color: var(--pill-grau-fg); }

/* ----------------------------------------------------------------- Reiter */
.tabs {
  display: flex; flex-wrap: wrap; gap: .3rem;
  border-bottom: 1px solid var(--linie); margin: 1.25rem 0 1.5rem;
}
.tab {
  padding: .5rem .9rem; text-decoration: none; font-size: .9rem; font-weight: 600;
  color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: var(--radius-s) var(--radius-s) 0 0; white-space: nowrap;
}
.tab:hover { color: var(--ink); background: var(--gitter); }
.tab-an { color: var(--marke); border-bottom-color: var(--marke); background: transparent; }
:root[data-theme="dark"] .tab-an { color: var(--sand); border-bottom-color: var(--sand); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tab-an { color: var(--sand); border-bottom-color: var(--sand); }
}

/* ------------------------------------------------------- Beobachtungs-Karten */
.beob-card {
  --kat: var(--st-none);
  position: relative; overflow: hidden; margin: 0;
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .95rem 1.05rem; box-shadow: var(--schatten);
}
.beob-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--kat); }
.beob-card header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.beob-typ { font-weight: 650; font-size: 1rem; }
.beob-pferd { margin: .1rem 0; font-size: .9rem; color: var(--ink-2); }
.beob-datum { margin: .1rem 0; font-size: .82rem; color: var(--ink-3); }
.beob-notiz { margin: .35rem 0 0; font-size: .85rem; color: var(--ink-2); white-space: pre-wrap; }
.beob-aktionen { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; }
.beob-aktionen form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.beob-aktionen input[type="date"] { margin: 0; padding: .2rem .4rem; font-size: .8rem; width: auto; }
.beob-aktionen a { font-size: .85rem; }
button.klein { width: auto; margin: 0; padding: .25rem .7rem; font-size: .8rem; }

/* Kategoriefarben – geprüfte Slots (siehe inc/palette.php) */
.kat-gesundheit { --kat: #2a78d6; }
.kat-behandlung { --kat: #eb6834; }
.kat-haltung    { --kat: #1baf7a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .kat-gesundheit { --kat: #3987e5; }
  :root:not([data-theme="light"]) .kat-behandlung { --kat: #d95926; }
  :root:not([data-theme="light"]) .kat-haltung    { --kat: #199e70; }
}
:root[data-theme="dark"] .kat-gesundheit { --kat: #3987e5; }
:root[data-theme="dark"] .kat-behandlung { --kat: #d95926; }
:root[data-theme="dark"] .kat-haltung    { --kat: #199e70; }

/* ------------------------------------------------------------- Zeitstrahl */
.zeitstrahl { display: flex; flex-direction: column; gap: 5px; }
.zs-zeile { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: .6rem; }
.zs-label { font-size: .8rem; line-height: 1.25; overflow: hidden; }
.zs-label strong { display: block; font-weight: 650; }
.zs-label span { color: var(--ink-3); }
.zs-spur {
  position: relative; height: 22px; border-radius: 5px;
  background: var(--gitter); overflow: hidden;
}
.zs-balken {
  position: absolute; top: 3px; bottom: 3px;
  background: var(--kat, var(--ink-3)); border-radius: 4px; min-width: 3px;
}
/* laufende Episoden bekommen eine Schraffur statt einer harten Kante */
.zs-offen {
  background-image: repeating-linear-gradient(45deg,
    rgba(255,255,255,.45) 0 4px, transparent 4px 9px);
  border-radius: 4px 0 0 4px;
}
.zs-achse .zs-spur { background: transparent; height: 16px; overflow: visible; }
.zs-marke {
  position: absolute; top: 0; font-size: .68rem; color: var(--ink-3);
  white-space: nowrap; border-left: 1px solid var(--linie); padding-left: 3px; height: 100%;
}
.zs-legende { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin-top: 1rem; font-size: .82rem; color: var(--ink-2); }
.zs-key { display: inline-flex; align-items: center; gap: .35rem; }
.zs-key-balken { position: static; display: inline-block; width: 22px; height: 12px; background: var(--ink-3); }
/* Im Overlay bleibt die Beschriftungsspalte gleich breit – der Gewinn ist die
   Höhe der Balken; auf schmalen Geräten wird stattdessen gescrollt. */
.zoom-body .zeitstrahl { min-width: 700px; }
.zoom-body .zs-spur { height: 32px; }
.zoom-body .zs-label { font-size: .88rem; }

@media (max-width: 620px) {
  .zs-zeile { grid-template-columns: 118px 1fr; gap: .45rem; }
  .zs-label { font-size: .72rem; }
  .zs-marke { font-size: .62rem; }
}

/* ------------------------------------------------------------- Kalender-Heatmap */
.heatmap-scroll { overflow-x: auto; padding-bottom: .35rem; }
.heatmap-wrap { --hm-size: 15px; --hm-gap: 4px; display: flex; gap: 7px; align-items: flex-start; width: max-content; }
.hm-tage {
  display: grid; grid-template-rows: repeat(7, var(--hm-size)); gap: var(--hm-gap);
  padding-top: 18px; font-size: .68rem; color: var(--ink-3);
}
.hm-tage span { line-height: var(--hm-size); }
.hm-monate {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--hm-size); gap: var(--hm-gap);
  height: 18px; font-size: .68rem; color: var(--ink-3);
}
.hm-monate span { white-space: nowrap; overflow: visible; }
.heatmap {
  display: grid; grid-template-rows: repeat(7, var(--hm-size));
  grid-auto-flow: column; grid-auto-columns: var(--hm-size); gap: var(--hm-gap);
}
.hm {
  width: var(--hm-size, 14px); height: var(--hm-size, 14px);
  border-radius: 3px; background: var(--hm0); display: inline-block;
}
.hm-1 { background: var(--hm1); }
.hm-2 { background: var(--hm2); }
.hm-3 { background: var(--hm3); }
.hm-4 { background: var(--hm4); }
.hm-future { opacity: .3; }
.heatmap-legend { display: flex; align-items: center; gap: 5px; margin: .8rem 0 0; color: var(--ink-3); }
.heatmap-legend .hm { --hm-size: 12px; }
.hm-max { margin-left: auto; }

/* ------------------------------------------------------- Overlay Vergrössern
   Pico zentriert <dialog> und erwartet ein <article> als Panel – die Struktur
   wird uebernommen, sonst schrumpft der Inhalt auf seine Mindestbreite. */
.zoom-dialog::backdrop { background: rgba(12, 10, 8, .62); }
.zoom-dialog > .zoom-panel {
  width: min(1400px, 95vw); max-width: 95vw;
  height: min(880px, 90vh); max-height: 90vh;
  margin: 0; padding: 0; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--karte); color: var(--ink);
  border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
.zoom-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.2rem; border-bottom: 1px solid var(--linie); flex: none;
}
.zoom-head h2 { margin: 0; font-size: 1.05rem; font-weight: 650; }
.zoom-close {
  width: 34px; height: 34px; padding: 0; flex: none; font-size: 1rem; line-height: 1;
  background: transparent; color: var(--ink-2);
  border: 1px solid var(--linie); border-radius: var(--radius-s); cursor: pointer;
}
.zoom-close:hover { background: var(--st-crit); border-color: var(--st-crit); color: #fff; }
.zoom-body { flex: 1 1 auto; min-height: 0; padding: 1.1rem 1.2rem 1.3rem; overflow: auto; }
.zoom-body > .canvas-wrap { --h: 100%; width: 100%; height: 100%; }
.zoom-body .heatmap-wrap { --hm-size: 28px; --hm-gap: 6px; }
.zoom-body .hm-tage { padding-top: 24px; font-size: .8rem; }
.zoom-body .hm-monate { height: 24px; font-size: .8rem; }

/* ------------------------------------------------------------------ Formulare */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.edit-card {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 1rem 0 2rem; box-shadow: var(--schatten);
}
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }
.form-actions button, .form-actions a[role="button"] { width: auto; }
label.check { display: flex; align-items: center; gap: .5rem; }
label.check input { width: auto; margin: 0; }

.chip-group { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.chip { position: relative; margin: 0; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: .45rem .9rem;
  border: 1px solid var(--linie); border-radius: 999px;
  cursor: pointer; user-select: none; font-size: .95rem; background: var(--karte);
  transition: background .15s, border-color .15s, color .15s;
}
.chip span:hover { border-color: var(--marke); }
.chip input:checked + span { background: var(--marke); border-color: var(--marke); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--marke); outline-offset: 2px; }

.erfassen-form input, .erfassen-form select, .erfassen-form textarea { max-width: 32rem; }

.filterbar, .chart-filter { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin-bottom: 1rem; }
.filterbar label, .chart-filter label { font-size: .85rem; margin: 0; }
.filterbar input, .filterbar select, .chart-filter select { margin: 0; }
.filterbar-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.filterbar-actions a[role="button"], .filterbar-actions button { width: auto; padding-block: .4rem; }

.chart-box {
  border: 1px solid var(--linie); border-radius: var(--radius);
  padding: .9rem; margin-bottom: 1.5rem; background: var(--karte);
}

/* --------------------------------------------------------------- Matrix */
.matrix th { position: sticky; left: 0; background: var(--karte); }
.matrix-cell { min-width: 8rem; }
.matrix-link { display: block; text-decoration: none; font-size: .82rem; line-height: 1.4; }
.matrix-link:hover { text-decoration: underline; }
.mc-datum { display: block; font-weight: 600; }
.mc-leer { color: var(--ink-3); }

/* ---------------------------------------------------------------- Login */
.login-wrap { display: flex; justify-content: center; padding-top: 4rem; }
.login-card {
  width: min(370px, 92vw); background: var(--karte);
  border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten);
}

/* ------------------------------------------------------------- Sonstiges */
.hint { color: var(--ink-3); font-size: .85rem; }
.hinweis-klein { color: var(--ink-3); font-style: italic; }
.site-footer { margin: 3rem auto 1.5rem; color: var(--ink-3); text-align: center; }
.export-list { list-style: none; padding: 0; }
.export-list li { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.pager { display: flex; gap: .35rem; flex-wrap: wrap; margin: 1rem 0; }
.pager a, .pager span { padding: .25rem .6rem; border: 1px solid var(--linie); border-radius: var(--radius-s); text-decoration: none; }
.pager-cur { background: var(--marke); color: #fff; border-color: var(--marke); }

h2 { margin-top: 2rem; }
.chart-card h2, .chart-card-head h2 { margin-top: 0; }

@media print {
  .seitenleiste, .mobil-leiste, .icon-btn, .segmented, .filterleiste, .site-footer { display: none !important; }
  .chart-card, .stat, .pferd-card { box-shadow: none; break-inside: avoid; }
  .app { display: block; }
}

/* =====================================================================
   Umbrueche nach Spaltenbreite (Seitenleiste ist da schon abgezogen)
   ===================================================================== */
@container inhalt (max-width: 900px) {
  .chart-duo { grid-template-columns: 1fr; gap: 0; }
}
@container inhalt (max-width: 760px) {
  .stat-grid, .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .stat-num { font-size: 1.8rem; }
}
@container inhalt (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .canvas-hoch { --h: 280px; }
}
@container inhalt (max-width: 620px) {
  .zs-zeile { grid-template-columns: 118px 1fr; gap: .45rem; }
  .zs-label { font-size: .72rem; }
  .zs-marke { font-size: .62rem; }
}
@container inhalt (max-width: 300px) {
  .stat-grid, .kpi-row { grid-template-columns: 1fr; }
}
