/* Gemeinsames Grundgerüst der Inhaber-Ansicht und der Einrichtungsseite: Leiste links mit den Bereichen
   (am Tablet hochkant schmal mit Symbolen, am Handy unten), Kopf mit Titel, Karten und Kacheln.
   Farben und Schrift kommen aus design.css (wie die Website von Aikani). */

[hidden] { display: none !important; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); margin: 0; }
.ih, .ih * { box-sizing: border-box; }
.ih button, .ih input, .ih select, .ih textarea { font: inherit; color: inherit; }
.ih { --nav: 236px; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--nav) minmax(0, 1fr); }

/* ---------- Leiste links ---------- */
.ih-nav { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.ih-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; min-width: 0; }
.ih-logo { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px; letter-spacing: -0.03em; }
.ih-brand-text { min-width: 0; display: flex; flex-direction: column; }
.ih-brand-text b { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ih-brand-text span { font-size: 12px; color: var(--muted); }
.ih-navbtn { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; padding: 11px 12px; border-radius: 12px; cursor: pointer; color: var(--muted); font-weight: 550; font-size: 15px; text-align: left; text-decoration: none; }
.ih-navbtn svg { flex: 0 0 auto; width: 22px; height: 22px; }
.ih-navbtn:hover { background: var(--surface-2); color: var(--ink); }
.ih-navbtn[aria-current="page"] { background: var(--accent-soft); color: #14532D; font-weight: 650; }
.ih-navbtn .ih-label { flex: 1 1 auto; min-width: 0; }
.ih-label .kurz { display: none; }
.ih-badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.ih-badge.warn { background: #F59E0B; }
.ih-nav-spacer { flex: 1 1 auto; }
.ih-nav-foot { display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.ih-nav-foot .ih-navbtn { font-size: 14px; padding: 9px 12px; }
.ih-switch { margin-left: auto; width: 34px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; flex: 0 0 auto; transition: background-color 0.15s; }
.ih-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
[aria-pressed="true"] > .ih-switch { background: var(--brand); }
[aria-pressed="true"] > .ih-switch::after { transform: translateX(14px); }

/* ---------- Bereich rechts ---------- */
.ih-main { min-width: 0; display: flex; flex-direction: column; }
.ih-top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 16px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.ih-top h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; flex: 1 1 auto; min-width: 0; }
.ih-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ih-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.ih-chip::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.ih-chip.ok::before { background: var(--brand); }
.ih-chip.warn { background: var(--warn-soft); border-color: transparent; color: #92400E; }
.ih-chip.warn::before { background: #F59E0B; }
.ih-chip.err { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.ih-chip.err::before { background: var(--danger); }
.ih-chip.off::before { background: var(--line-strong); }
.ih-page { padding: 8px 28px 40px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.ih-meldungen { padding: 0 28px; display: flex; flex-direction: column; gap: 8px; }
.ih-meldungen:empty { display: none; }
.ih-section-title { margin: 6px 0 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ih-section-title a, .ih .ih-link { color: var(--accent); font-size: 14px; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.ih-link:hover { text-decoration: underline; }
.ih-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.ih-card.pad { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ih-card h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.ih-hint { margin: 0; color: var(--muted); font-size: 14px; }
.ih-leer { padding: 28px 20px; text-align: center; color: var(--muted); font-size: 15px; }
.ih-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Heute ---------- */
.ih-gruss { display: flex; flex-direction: column; gap: 2px; }
.ih-gruss b { font-size: 15px; color: var(--muted); font-weight: 500; }
.ih-kacheln { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.ih-kachel { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; text-align: left; cursor: default; border: 1px solid var(--line); }
button.ih-kachel { cursor: pointer; }
button.ih-kachel:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.ih-kachel .k-label { font-size: 14px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 8px; }
.ih-kachel .k-label svg { width: 18px; height: 18px; }
.ih-kachel .k-zahl { font-size: 34px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ih-kachel .k-sub { font-size: 13px; color: var(--muted); }
.ih-kachel.gruen .k-zahl { color: var(--accent); }
.ih-kachel.achtung { background: var(--warn-soft); border-color: #FCD34D; }
.ih-kachel.achtung .k-zahl, .ih-kachel.achtung .k-label { color: #92400E; }
.ih-zwei { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ih-spalte { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ih-naechste { display: flex; flex-direction: column; }
.ih-naechste-zeile { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; cursor: pointer; }
.ih-naechste-zeile:last-child { border-bottom: 0; }
.ih-naechste-zeile:hover { background: var(--surface-2); }
.ih-zeit { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.ih-zeit small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ih-wer { min-width: 0; }
.ih-wer b { font-weight: 650; }
.ih-wer div { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ih-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-variant-numeric: tabular-nums; font-weight: 650; }
.ih-woche { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ih-woche div { display: flex; flex-direction: column; gap: 2px; }
.ih-woche b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ih-woche span { font-size: 13px; color: var(--muted); }

/* ---------- Leiste unten (Handy) ---------- */
.ih-tabbar { display: none; }

/* Tablet hochkant und kleine Rechner: Leiste mit Symbolen */
@media (max-width: 1100px) {
  .ih { --nav: 92px; }
  .ih-nav .ih-label .lang { display: none; }
  .ih-nav .ih-label .kurz { display: inline; }
  .ih-nav { padding: 14px 4px; align-items: stretch; }
  .ih-brand { justify-content: center; padding: 4px 0 14px; }
  .ih-brand-text { display: none; }
  .ih-navbtn { flex-direction: column; gap: 4px; padding: 10px 2px; font-size: 10.5px; text-align: center; letter-spacing: -0.01em; }
  .ih-navbtn .ih-label { flex: 0 0 auto; }
  .ih-navbtn .ih-badge { position: absolute; top: 4px; right: 12px; height: 18px; min-width: 18px; font-size: 10.5px; padding: 0 5px; }
  .ih-nav-foot .ih-navbtn { font-size: 11px; }
  .ih-switch { margin: 0; }
  .ih-kacheln { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ih-zwei { grid-template-columns: minmax(0, 1fr); }
  .ih-top, .ih-page, .ih-meldungen { padding-inline: 20px; }
}
/* Handy: Leiste unten */
@media (max-width: 700px) {
  .ih { grid-template-columns: minmax(0, 1fr); padding-bottom: 68px; }
  .ih-nav { display: none; }
  .ih-tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .ih-tabbar .ih-navbtn { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; text-align: center; border-radius: 10px; }
  .ih-tabbar .ih-navbtn svg { width: 22px; height: 22px; }
  .ih-tabbar .ih-badge { position: absolute; top: 2px; left: calc(50% + 4px); height: 17px; min-width: 17px; font-size: 10px; padding: 0 5px; }
  .ih-top { padding: 12px 16px; }
  .ih-top h1 { font-size: 21px; }
  .ih-page, .ih-meldungen { padding-inline: 16px; }
  .ih-kacheln { gap: 10px; }
  .ih-kachel { padding: 14px; }
  .ih-kachel .k-zahl { font-size: 28px; }
  .ih-woche { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* Drucken: nur der Inhalt */
@media print {
  .ih { display: block; }
  .ih-nav, .ih-tabbar, .ih-top { display: none !important; }
  .ih-page { padding: 0; }
}
