/* Ertrago Portal — CI v2.0 "Guardian" (Navy/Teal, Inter + IBM Plex Mono)
   Wortmarke im Portal: nur "ertrago" (ohne Guardian-Zusatz). */

@font-face { font-family: 'Inter'; src: url("fonts/inter-latin-400-normal.da03732a27e1.woff2") format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("fonts/inter-latin-500-normal.51205681a1ba.woff2") format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("fonts/inter-latin-600-normal.2ede57db1a3a.woff2") format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("fonts/inter-latin-700-normal.8ca0a5155296.woff2") format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url("fonts/inter-latin-800-normal.900ae45e40b8.woff2") format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url("fonts/ibm-plex-mono-latin-500-normal.b1c8a895f5fd.woff2") format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url("fonts/ibm-plex-mono-latin-600-normal.5a2ce7798732.woff2") format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  /* Marke */
  --navy: #081D3A;        /* Ertrago Navy: Primaerfarbe, dunkle Flaechen, Text */
  --navy-2: #0E2A52;      /* hellere Navy-Stufe (Hover auf dunkel) */
  --teal: #00C2A8;        /* Guardian Teal: Verifikation, Erfolg, CTA */
  --teal-dark: #00A18B;   /* Teal-Hover */
  --teal-text: #007A69;   /* Teal als TEXT auf hell (kontrastfest) */
  --blue: #1E4FFF;        /* Signal Blue: Links, Fokus, technische Interaktion */
  --gold: #F2B84B;        /* Revenue Gold: monetaeres Delta */
  --gold-text: #96700F;   /* Gold als Text */
  --coral: #E96C63;       /* Alert Coral: nur kritische Abweichung */
  --coral-text: #C6423A;  /* Coral als Text */
  /* Neutrale */
  --page: #F5F7FA;        /* Cloud */
  --paper: #FFFFFF;
  --ink: #111827;
  --ink-2: #3D4757;
  --muted: #6B7280;       /* Steel */
  --line: #E3E8F0;
  /* Status */
  --status-ok: #008672; --status-warn: #8A5F0E; --status-snow: #2F6A9E; --status-crit: var(--coral-text);
  /* Rollen, die im Dunkelmodus andere Werte brauchen */
  --ink-brand: var(--navy);   /* Navy als Vordergrund: Linien, Piktogramme, Chips */
  --solid: var(--navy);       /* gefuellte Auswahl (aktiver Schalter, Filter) */
  --field: #FFFFFF;           /* Eingabefelder */
  --field-line: #D6DBE3;
  --baseline: #C9D3E0;        /* Achsen, "keine Daten" */
  --faint: #C3CBD8;           /* leere Tabellenzellen */
  --row-line: #EDF1F7; --row-alt: #F7F9FC; --row-hover: #F3F6FF; --row-selected: #EBF0FF;
  --skeleton-a: #EEF2F7; --skeleton-b: #F7F9FC;
  --tabbar: rgba(255,255,255,.92);
  /* Typografie */
  --font-ui: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  /* Zahlen in derselben Schrift mit Tabellenziffern (CI v1.0: eine Sans fuer alles) */
  --font-num: var(--font-ui);
  color-scheme: light;
}
/* Dunkelmodus: data-theme setzt core/_theme_head.html vor dem ersten Zeichnen
   (Wahl im Kontomenue, sonst wie das Geraet). Navy bleibt Markenflaeche
   (Kopfleiste, Live-Kachel); Akzente als Text werden heller, damit sie auf
   dunklem Grund lesbar bleiben. Diagramm-Farben: PALETTE in core/plant-common.js. */
:root[data-theme="dark"] {
  --teal-text: #3DDBC3;
  --blue: #7B93FF;
  --gold-text: #F2C46B;
  --coral-text: #FF8F86;
  --page: #0A1322;
  --paper: #111D30;
  --ink: #E7ECF3;
  --ink-2: #B4BFCE;
  --muted: #8794A7;
  --line: #24344F;
  --status-ok: #3DDBC3; --status-warn: #F2B84B; --status-snow: #8EC3F0;
  --ink-brand: #D5DEEB;
  --solid: #2E4570;
  --field: #0C1729;
  --field-line: #2E4060;
  --baseline: #3A4A64;
  --faint: #45556F;
  --row-line: #1B2A42; --row-alt: #0E192B; --row-hover: #1A2A4A; --row-selected: #213560;
  --skeleton-a: #172539; --skeleton-b: #1F2F47;
  --tabbar: rgba(17,29,48,.92);
  color-scheme: dark;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* Tabellenziffern (gleich breite Ziffern) nur an Zahlen, nie am body: Inter macht mit
   tabular-nums auch Bindestriche gleich breit ("E - Mail"). Zahlenstellen bekommen die
   Klasse .num oder stehen hier bzw. an ihrer Regel mit font-family: var(--font-num). */
.num, time, .settle-table tfoot, .log-when, .alarm-meta, .svg-sum, .nav-count { font-variant-numeric: tabular-nums; }
body { font-family: var(--font-ui); background: var(--page); color: var(--ink);
  min-height: 100vh; display: flex; flex-direction: column; }  /* Fusszeile auch bei kurzen Seiten unten */

/* Kopfleiste: Marke, Hauptnavigation, Kontomenue; mobil wandert die Navigation als Tab-Leiste nach unten */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1.5rem;
  height: 60px; padding: 0 max(1.4rem, env(safe-area-inset-left)) 0 max(1.4rem, env(safe-area-inset-right));
  background: var(--navy); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 16px rgba(8,29,58,.12); }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; flex: none; }
.brand img { display: block; border-radius: 8px; box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
.wordmark { font-size: 1.3rem; font-weight: 800; letter-spacing: -.02em; color: #fff; text-decoration: none; }
.wordmark span { color: inherit; }
.wordmark.big { font-size: 2.2rem; color: var(--ink-brand); }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.mainnav { display: flex; align-items: center; gap: .25rem; flex: 1; }
.mainnav a { position: relative; display: inline-flex; align-items: center; gap: .5rem; height: 38px;
  padding: 0 .85rem; border-radius: 9px; color: rgba(255,255,255,.72); text-decoration: none;
  font-size: .9rem; font-weight: 500; transition: background-color .15s, color .15s; }
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.mainnav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.11); }
.mainnav a[aria-current="page"] .ico { color: var(--teal); }
.mainnav a:focus-visible, .nav-more:focus-visible, .account summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
/* offene Alarme an "Alarme" (core/alarms.py context): Seitenleiste rechts, Tab-Leiste am Symbol */
.nav-count { min-width: 1.35rem; height: 1.35rem; padding: 0 .4rem; border-radius: 999px; display: inline-grid;
  place-items: center; margin-left: auto; background: var(--gold); color: var(--navy); font-size: .72rem;
  font-weight: 700; line-height: 1; }
.nav-count.crit { background: #C6423A; color: #fff; }   /* --coral-text hell: weisse Schrift besteht 4,5:1 */
.nav-more { display: none; }   /* nur in der mobilen Tab-Leiste, am Desktop steht die Fusszeile unten */
.footer-pages { display: none; } /* nur mobil im Blatt "Mehr" */

.account { position: relative; margin-left: auto; flex: none; }
.account summary { list-style: none; cursor: pointer; display: flex; align-items: center;
  padding: 3px; border-radius: 50%; }
.account summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--teal); color: var(--navy); font-size: .8rem; font-weight: 700; letter-spacing: .02em;
  transition: box-shadow .15s; }
.account summary:hover .avatar, .account[open] .avatar { box-shadow: 0 0 0 3px rgba(0,194,168,.35); }
.account-name { display: none; }   /* nur in der Seitenleiste (Desktop) */
.account-menu { position: absolute; right: 0; top: calc(100% + .55rem); min-width: 240px; max-width: calc(100vw - 1.5rem);
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(8,29,58,.18); padding: .4rem; }
.account-who { padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--line); margin-bottom: .35rem; }
.account-who b { display: block; font-size: .92rem; overflow-wrap: anywhere; }
.account-who span { display: block; font-size: .8rem; color: var(--muted); margin-top: .1rem; overflow-wrap: anywhere; }
.account-menu a, .account-menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .6rem .7rem;
  border: none; border-radius: 8px; background: none; color: var(--ink); font-family: inherit;
  font-size: .9rem; cursor: pointer; text-align: left; text-decoration: none; }
.account-menu a:hover, .account-menu a[aria-current="page"] { background: var(--page); }
.account-menu a[aria-current="page"] .ico { color: var(--teal-text); }
.account-menu form { border-top: 1px solid var(--line); margin-top: .35rem; padding-top: .35rem; }
.account-menu button:hover { background: var(--page); color: var(--coral-text); }
.account-menu .ico { width: 18px; height: 18px; }
/* Darstellung im Kontomenue: Hell, Dunkel, System (core/nav.js) */
.theme-pick { padding: .5rem .7rem .6rem; }
.theme-pick-label { display: flex; align-items: center; gap: .6rem; font-size: .9rem; margin-bottom: .5rem; }
.theme-pick-options { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--page); }
.account-menu .theme-pick-options button { flex: 1; justify-content: center; width: auto; padding: .38rem .3rem;
  border-radius: 6px; font-size: .8rem; color: var(--ink-2); }
.account-menu .theme-pick-options button:hover { background: none; color: var(--ink); }
.account-menu .theme-pick-options button[aria-checked="true"] { background: var(--paper); color: var(--ink);
  font-weight: 600; box-shadow: 0 1px 3px rgba(8,29,58,.18); }
.theme-pick-options button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.content { flex: 1 0 auto; width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.6rem 1.2rem 3rem; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1.5rem;
  width: 100%; max-width: 1100px; margin: 0 auto; padding: 1rem 1.2rem 1.2rem; border-top: 1px solid var(--line);
  font-size: .78rem; color: var(--muted); }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.footer-links { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }

/* Kontaktformular (core/contact.html) */
.contact-card { max-width: 760px; }
.contact-card > p.muted { margin-bottom: 1.1rem; }
.contact-card p { margin-bottom: .8rem; }
.contact-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 0 1rem; }
.contact-form label { display: block; font-size: .82rem; color: var(--ink-2); margin-bottom: .9rem; }
.contact-form input, .contact-form select, .contact-form textarea { display: block; width: 100%; margin-top: .25rem;
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--field);
  font-size: .95rem; font-family: inherit; color: var(--ink); }
.contact-form textarea { resize: vertical; min-height: 9rem; line-height: 1.5; }
.contact-form :is(input, select, textarea):focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.contact-form .btn-primary { width: auto; padding: .6rem 1.4rem; margin-bottom: .9rem; }
.contact-form .field-error { display: block; color: var(--status-crit); font-size: .8rem; margin-top: .25rem; }
.contact-form .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Rechtstexte (Impressum, Datenschutz, Nutzungsbedingungen) */
.legal-text { max-width: 760px; line-height: 1.6; overflow-wrap: anywhere; }
.legal-text h2 { margin: 1.4rem 0 .5rem; }
.legal-text h2:first-child { margin-top: 0; }
.legal-text p { margin-bottom: .8rem; }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 1rem; }
h2 { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: .8rem; }
h2 .muted { font-weight: 400; font-size: .85rem; }
.muted { color: var(--ink-2); }
.small { font-size: .82rem; }
a { color: var(--blue); }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.3rem 1.4rem; margin-bottom: 1.3rem; }

/* Kennzahlen (Anlagenseite: Live-Kachel, Energiefluss) */
.tile-stats { display: flex; gap: 2rem; margin: .9rem 0 .6rem; }
.live-card .tile-stats { flex-wrap: wrap; row-gap: .75rem; }
.stat-value { display: block; font-size: 1.45rem; font-weight: 600;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-label { color: var(--ink-2); font-size: .78rem; }
.status-badge { font-size: .75rem; white-space: nowrap; font-family: var(--font-ui); }
.s-ok { color: var(--status-ok); }
.s-warn { color: var(--status-warn); }
.s-crit { color: var(--status-crit); }
.s-none { color: var(--muted); }

/* Anlagen-Detail */
.controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.range-switch { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--paper); }
.range-switch button { border: none; background: none; padding: .42rem .85rem; font-size: .85rem;
  cursor: pointer; color: var(--ink-2); font-family: inherit; }
.range-switch button.active { background: var(--solid); color: #fff; font-weight: 600; }
.range-switch.small button { padding: .28rem .6rem; font-size: .78rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 0; }
.card-head + .chart { margin-top: .6rem; }
#date-picker { border: 1px solid var(--line); border-radius: 8px; padding: .38rem .6rem;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .82rem; background: var(--paper); color: var(--ink); }
.chart { width: 100%; height: 340px; }
.chart.tall { height: 420px; }

/* Login */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login-card { width: 340px; max-width: 100%; text-align: center; }
.login-card p { margin: .3rem 0 1.2rem; }
.login-card label { display: block; text-align: left; font-size: .82rem; color: var(--ink-2); margin-bottom: .8rem; }
.login-card input[type=text], .login-card input[type=password] { width: 100%; margin-top: .25rem;
  padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; font-family: inherit;
  background: var(--field); color: var(--ink); }
.login-card input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn-primary { width: 100%; background: var(--teal); color: var(--navy); border: none;
  padding: .6rem; border-radius: 8px; font-size: .95rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn-primary:hover { background: var(--teal-dark); }
.form-error { color: var(--status-crit); font-size: .85rem; margin-bottom: .8rem; }
.login-card p.small { font-size: .82rem; margin: .9rem 0 0; }
.login-card p.left { text-align: left; color: var(--ink-2); margin: 0 0 1rem; }
.login-card a.btn-primary { display: inline-block; text-decoration: none; }
/* Demo-Plattform: oeffentliche Zugaenge als Kacheln ueber dem persoenlichen Login */
.login-card.demo { width: 560px; }
.login-card h2 { font-size: 1rem; margin: 1.2rem 0 .5rem; text-align: left; }
.login-card .demo-picker h2 { margin-top: .4rem; }
.demo-accounts { list-style: none; margin: 0 0 .4rem; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .7rem; }
.demo-account form { height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem;
  text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; background: var(--page); }
.demo-account h3 { font-size: .95rem; margin: 0; }
.login-card .demo-account p { font-size: .82rem; color: var(--ink-2); margin: 0 0 .3rem; flex: 1; }
.login-personal { border-top: 1px solid var(--line); padding-top: 1rem; }

/* Seitenkopf + Reiter */
.page-head { display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: 0; }

/* Stammdaten-Kachel */
.chip { display: inline-block; background: var(--page); color: var(--ink-brand);
  border: 1px solid var(--line); border-radius: 999px; padding: .1rem .65rem;
  font-size: .8rem; font-weight: 500; margin-right: .35rem; }

/* Info-Banner (Abrechnung) */
.info-banner { display: flex; gap: .8rem; align-items: flex-start;
  background: var(--page); border: 1px solid var(--line); border-left: 4px solid var(--teal);
  border-radius: 10px; padding: .9rem 1.1rem; margin-bottom: 1.2rem;
  font-size: .87rem; color: var(--ink-2); line-height: 1.5; }
.info-banner b { color: var(--ink); }
.info-icon { color: var(--teal-text); font-size: 1.05rem; line-height: 1.4; }

/* Jahres-Stepper + Buttons */
.year-stepper { display: flex; align-items: center; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); overflow: hidden; }
.year-stepper button { border: none; background: none; padding: .42rem .7rem; font-size: 1rem;
  cursor: pointer; color: var(--blue); font-family: inherit; line-height: 1; }
.year-stepper button:hover:not(:disabled) { background: var(--page); }
.year-stepper button:disabled { color: var(--line); cursor: default; }
.year-stepper span { min-width: 3.4rem; text-align: center; font-weight: 600;
  font-size: .88rem; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.btn-small { display: inline-flex; align-items: center; gap: .3rem; padding: .45rem .95rem;
  border-radius: 8px; font-size: .87rem; background: var(--teal); color: var(--navy);
  text-decoration: none; font-weight: 700; transition: background .12s;
  border: 0; cursor: pointer; font-family: inherit; }   /* auch als <button> ohne Browser-Rahmen */
.btn-small:hover { background: var(--teal-dark); }
.btn-small.ghost { background: none; border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; }
.btn-small.ghost:hover { background: var(--page); border-color: var(--ink-2); }

/* Abgleichs-Tabelle */
.table-scroll { overflow-x: auto; position: relative; }  /* relative: sonst hebeln absolute .sr-only-Texte in den Zellen die Seite in die Breite */
.table-scroll th:first-child, .table-scroll td:first-child { position: sticky; left: 0; z-index: 1;
  background: var(--paper); }
.settle-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.settle-table th, .settle-table td { padding: .58rem .75rem; text-align: left; }
.settle-table thead th { color: var(--ink-2); font-weight: 600; font-size: .76rem;
  border-bottom: 2px solid var(--line); }
.settle-table thead .unit { text-transform: none; }   /* kWh bleibt kWh */
.settle-table tbody td { border-bottom: 1px solid var(--row-line); }
.settle-table tbody tr:nth-child(even) td, .table-scroll tbody tr:nth-child(even) td:first-child { background: var(--row-alt); }
.settle-table td.num, .settle-table th.num { text-align: right; }
.settle-table td.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .82rem; }
.settle-table td { white-space: nowrap; }
.settle-table .sep { border-left: 1px solid var(--line); }
.settle-table .empty { color: var(--faint); }
.settle-table tfoot th { border-top: 2px solid var(--ink-brand); padding-top: .7rem;
  color: var(--ink); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.settle-table tr.clickable { cursor: pointer; }
.settle-table tr.clickable:hover td { background: var(--row-hover) !important; }
.settle-table tr.selected td { background: var(--row-selected) !important; }
.doc-link { display: inline-block; text-decoration: none; font-size: .8rem;
  border: 1px solid var(--line); border-radius: 6px; padding: .1rem .45rem; margin-right: .3rem; }
.doc-link:hover { border-color: var(--blue); }

/* Einzelpruefungen-Detail */
.check-row { padding: .18rem 0; color: var(--ink-2); }
.check-row.ok span { color: var(--status-ok); font-weight: 700; }
.check-row.fail span { color: var(--status-crit); font-weight: 700; }
.check-row.fail { color: var(--ink); }

/* Anlagenteil-Filter (Chips) */
.part-filter { display: flex; align-items: center; gap: .45rem; margin: -.4rem 0 1rem; flex-wrap: wrap; }
.part-filter button { border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
  border-radius: 999px; padding: .3rem .85rem; font-size: .84rem; cursor: pointer; font-family: inherit; }
.part-filter button:hover { border-color: var(--ink-brand); }
.part-filter button.active { background: var(--solid); border-color: var(--solid); color: #fff; font-weight: 600; }

/* Info-Button + Erklaer-Modal (Verguetung) */
.info-btn { display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; margin-left: .4rem; vertical-align: text-bottom;
  border-radius: 50%; border: 1px solid var(--blue); background: none;
  color: var(--blue); font-size: .72rem; font-weight: 700; font-style: italic;
  font-family: Georgia, serif; cursor: pointer; line-height: 1; }
.info-btn:hover { background: rgba(30, 79, 255, 0.08); }
.modal-overlay { position: fixed; inset: 0; background: rgba(8, 29, 58, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal-overlay[hidden] { display: none; }  /* display:flex wuerde hidden sonst aushebeln */
.modal { background: var(--paper); border-radius: 10px; max-width: 720px; width: 100%;
  max-height: 90vh; max-height: 90dvh; overflow-y: auto; padding: 1.4rem 1.6rem 1.5rem;
  box-shadow: 0 18px 50px rgba(8, 29, 58, 0.35); }
.modal p { margin: .6rem 0; font-size: .92rem; line-height: 1.55; color: var(--ink-2); }
.modal p b { color: var(--ink); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.modal-head h2 { margin-bottom: .2rem; font-size: 1.1rem; }
.modal-close { border: none; background: none; font-size: 1.5rem; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 .2rem; }
.modal-close:hover { color: var(--ink); }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px;
  margin-right: .3rem; vertical-align: baseline; }
.dot-mw { background: var(--blue); }
.dot-pm { background: var(--teal); }
.info-svgs { display: flex; flex-wrap: wrap; justify-content: center; margin: .8rem 0 .2rem; }
.info-svg { flex: 1 1 260px; max-width: 330px; height: auto; }
.info-svg .svg-title { font-size: 13px; font-weight: 600; fill: var(--ink); }
.info-svg .svg-aw { stroke: var(--ink-brand); stroke-width: 1.5; stroke-dasharray: 6 4; }
.info-svg .svg-awlabel { font-size: 11px; fill: var(--ink-brand); font-weight: 600; }
.info-svg .svg-base { stroke: var(--line); stroke-width: 2; }
.info-svg .svg-mw { fill: var(--blue); rx: 3; }
.info-svg .svg-pm { fill: var(--teal); rx: 3; }
.info-svg .svg-seg { font-size: 12px; font-weight: 700; fill: #fff; }
.info-svg .svg-seg-dark { fill: var(--navy); }
.info-svg .svg-segsub { font-size: 9.5px; fill: var(--ink-2); }
.info-svg .svg-seg-light { fill: #fff; opacity: .95; }
.info-svg .svg-segsub.svg-seg-light { fill: #E7EDFB; }
.info-svg .svg-segsub.svg-seg-dark { fill: var(--navy-2); }
.info-svg .svg-sum { font-size: 11.5px; font-weight: 600; fill: var(--ink); }
.info-svg text { font-family: var(--font-ui); }

/* Live-Kacheln + Datums-Stepper */
.live-card { padding: .9rem 1.4rem; }
/* Live-Werte bei anderem Tag/Zeitraum: "Jetzt, HH:MM" (app.js syncNowLabels) */
.live-now { margin: 0 0 .6rem; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.live-snow { margin: 0 0 .6rem; font-size: .8rem; font-weight: 600; color: var(--status-snow); }
.live-pv { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem 1.2rem; margin-top: .6rem; font-size: .85rem; color: var(--ink-2); }
.live-pv[hidden] { display: none; }
.date-stepper { display: flex; align-items: center; border: 1px solid var(--line);
  border-radius: 8px; background: var(--paper); overflow: hidden; }
.date-stepper input { border: none; background: none; padding: .38rem .3rem;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .82rem; color: var(--ink); }
.date-stepper button { border: none; background: none; padding: .38rem .65rem; font-size: 1rem;
  cursor: pointer; color: var(--blue); font-family: inherit; line-height: 1; }
.date-stepper button:hover:not(:disabled) { background: var(--page); }
.date-stepper button:disabled { color: var(--line); cursor: default; }

/* WR-Status-Ampel */
[hidden] { display: none !important; }
.inv-list { display: flex; flex-direction: column; gap: .15rem; }
.inv-summary { font-size: .85rem; color: var(--ink-2); margin: .2rem 0 .5rem; }
.dc-detail { border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .8rem; }
.dc-detail .card-head { gap: .6rem; }
.dc-detail h3 { margin: 0; font-size: .95rem; flex: 1; }
.dc-detail .modal-close { font-size: 1.3rem; }
.dc-detail p.small { margin: .4rem 0 0; }
.dc-table th, .dc-table td { padding: .3rem .55rem; }
.dc-table thead th { text-transform: none; }
.dc-table td:nth-child(2) { white-space: normal; }
.inv-row { display: grid; grid-template-columns: 14px minmax(140px, 240px) 1fr auto; gap: .7rem; align-items: center;
  padding: .38rem .5rem; border-radius: 8px; font-size: .9rem; }
.inv-row:nth-child(even) { background: var(--page); }
.inv-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--status-ok); display: inline-block; }
.inv-row.auffaellig .dot { background: var(--status-warn); }
.inv-row.ausfall .dot { background: var(--status-crit); }
.inv-row.lernphase .dot, .inv-row.keine_daten .dot, .inv-row.nicht_bewertbar .dot { background: var(--baseline); }
.inv-row.beobachten .dot { background: var(--status-ok); box-shadow: inset 0 0 0 2px var(--status-warn); }
.inv-row.nicht_bewertbar .inv-text b { color: var(--status-warn); }
.inv-row .inv-name { font-weight: 600; color: var(--ink); }
.inv-row .inv-name small { color: var(--muted); font-weight: 400; }
.inv-row .inv-text { color: var(--ink-2); overflow-wrap: anywhere; }
.badge-recur { display: inline-block; font-size: .68rem; font-weight: 600; padding: .05rem .4rem; border-radius: 999px;
  background: rgba(242, 184, 75, 0.18); color: var(--gold-text); vertical-align: middle; white-space: nowrap; }
.badge-ack { display: inline-block; font-size: .68rem; font-weight: 600; padding: .05rem .4rem; border-radius: 999px;
  background: rgba(90, 140, 220, 0.16); color: var(--ink-2); vertical-align: middle; white-space: nowrap; }
.ack-form { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .35rem; }
.ack-form input[name="note"] { flex: 1 1 10rem; min-width: 8rem; }
.ack-form select, .ack-form input[name="note"] { padding: .3rem .5rem; border: 1px solid var(--field-line);
  border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: .85rem; }
.events-table td { white-space: normal; vertical-align: top; }
.events-table td.ev-start, .events-table td.ev-end, .events-table td.ev-dur, .events-table td.ev-cat { white-space: nowrap; }
.events-table td.ev-title { min-width: 150px; }
.events-table .ev-msg { color: var(--ink-2); font-size: .88rem; }
.events-table tr.open td { font-weight: 500; }
.inv-row.auffaellig .inv-text, .inv-row.ausfall .inv-text { font-weight: 600; }
.inv-row.ausfall .inv-text { color: var(--status-crit); }
.inv-row.auffaellig .inv-text { color: var(--status-warn); }
/* vom WR gemeldeter Zustand (INV_STATE) */
.inv-row.dev-warn:not(.ausfall) .dot { background: var(--status-warn); }
.inv-row.dev-fault .dot { background: var(--status-crit); }
.inv-row.dev-warn .inv-text b { color: var(--status-warn); }
.inv-row.dev-fault .inv-text b { color: var(--status-crit); }
.inv-row .inv-kwh, .inv-row .inv-kw { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .85rem; color: var(--muted);
  white-space: nowrap; text-align: right; }
.inv-row .inv-now { color: var(--ink); font-weight: 600; }
/* WR-Ampel: Zeilen teilen sich die Spalten, sonst stehen kW und kWh je nach Textbreite versetzt */
#inv-status { display: grid; grid-template-columns: 14px minmax(140px, 240px) 1fr auto auto; column-gap: .7rem; row-gap: .15rem; }
#inv-status .inv-summary { grid-column: 1 / -1; }
#inv-status .inv-row { grid-column: 1 / -1; grid-template-columns: subgrid; }
.chart-toggle { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ink-2); cursor: pointer; }
/* Tooltip der WR-Leistung: Spalten von oben nach unten, auch bei 30+ WR lesbar */
.inv-tip { display: grid; grid-auto-flow: column; column-gap: 1.2rem; margin-top: .2rem; font-size: 12px; line-height: 1.3; }
.inv-tip-row { display: flex; align-items: baseline; gap: .45rem; }
.inv-tip-name { flex: 1; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.inv-tip-spec { min-width: 4.8rem; text-align: right; color: var(--muted); }
.info-banner.flash { border-color: var(--teal, #00C2A8); margin-bottom: 1rem; }
/* Formulare (Beleg-Upload, Benachrichtigungen) */
.bu-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:.7rem 1rem; }
.bu-grid label { display:block; font-size:.78rem; color:var(--muted); margin-bottom:.15rem; }
.bu-grid input, .bu-grid select, .bu-grid textarea {
    width:100%; padding:.4rem .5rem; border:1px solid var(--field-line); border-radius:8px;
    font:inherit; background:var(--field); color:var(--ink); }
.bu-grid .full { grid-column:1 / -1; }
.bu-field-err { color:var(--coral,#E96C63); font-size:.78rem; margin-top:.15rem; }
.bu-section { grid-column:1 / -1; font-weight:700; font-size:.8rem; color:var(--ink-brand);
    border-bottom:1px solid var(--line); padding-bottom:.2rem; margin-top:.4rem; }
/* Ablageflaeche: ein <label> fuer das (versteckte) Datei-Feld, Ziehen und Ablegen in core/beleg.js */
.bu-drop { display: flex; flex-direction: column; align-items: center; gap: .55rem; border: 2px dashed var(--baseline);
  border-radius: 10px; padding: 2rem 1rem; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.bu-drop:hover, .bu-drop.drag { border-color: var(--teal); background: rgba(0,194,168,.06); }
.bu-drop:focus-within { outline: 2px solid var(--teal); outline-offset: 2px; }
.bu-drop.chosen { border-style: solid; border-color: var(--teal); }
.bu-drop.bad { border-color: var(--status-crit); }
.bu-drop-ico { width: 28px; height: 28px; color: var(--muted); }
.bu-drop-name { color: var(--muted); overflow-wrap: anywhere; }
.bu-drop.chosen .bu-drop-name { color: var(--ink); font-weight: 500; }
.bu-drop.bad .bu-drop-name { color: var(--coral-text); }
.bu-actions { margin-top:1rem; display:flex; gap:.6rem; align-items:center; }
.bu-model { font-size:.75rem; color:var(--muted); }
.bu-grid label input:is([type=checkbox], [type=radio]) { width: auto; margin-right: .5rem; vertical-align: middle; }
.notify-mode { border: 0; display: grid; gap: .5rem; }
.notify-mode legend { font-weight: 700; font-size: .9rem; margin-bottom: .3rem; }
.notify-mode label { font-size: .88rem; color: var(--ink); }

/* Neuigkeiten (Changelog) */
.changelog-kind { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em;
  margin: 1rem 0 .3rem; color: var(--ink-2); }
.changelog-kind.changelog-wichtig { color: var(--coral-text); }
.changelog-kind.changelog-neu { color: var(--teal-text); }
.changelog-list { margin: 0; padding-left: 1.2rem; }
.changelog-list li { margin: .25rem 0; }
.changelog-commits { margin-top: 1rem; font-size: .88rem; }
.changelog-commits summary { cursor: pointer; color: var(--ink-2); }
.changelog-commits ul { list-style: none; padding-left: 0; }
.changelog-commits li { margin: .3rem 0; }

/* Mobil: Kopfleiste nur Marke + Konto, Navigation als Tab-Leiste am unteren Rand */
@media (max-width: 760px) {
  .topbar { height: 54px; padding: 0 max(1rem, env(safe-area-inset-left)) 0 max(1rem, env(safe-area-inset-right)); }
  .brand img { width: 28px; height: 28px; }
  .wordmark { font-size: 1.2rem; }
  .mainnav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; gap: 0; justify-content: space-around;
    padding: .3rem max(.4rem, env(safe-area-inset-right)) calc(.3rem + env(safe-area-inset-bottom)) max(.4rem, env(safe-area-inset-left));
    background: var(--tabbar); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--line); }
  .mainnav a, .nav-more { flex: 1 1 0; max-width: 120px; flex-direction: column; justify-content: center; gap: .2rem;
    height: 54px; padding: 0 .2rem; color: var(--muted); font-size: .7rem; font-weight: 600; border-radius: 12px; }
  .nav-more { display: flex; align-items: center; border: none; background: none; font-family: inherit; cursor: pointer; }
  /* Berichte, Abrechnung, Verwaltung, Konto stehen mobil unter "Mehr" (docs/redesign.md) */
  .mainnav a.nav-wide { display: none; }
  .footer-pages { display: block; width: 100%; }
  .footer-pages a { display: block; padding: .85rem .4rem; border-bottom: 1px solid var(--line); font-weight: 600; }
  .account-menu a.acct-page { display: none; }   /* stehen mobil im Blatt "Mehr", nicht doppelt */
  .mainnav a:hover, .nav-more:hover { color: var(--ink-brand); background: none; }
  .mainnav .nav-count { position: absolute; top: 3px; left: calc(50% + 5px); margin: 0; min-width: 1.15rem; height: 1.15rem;
    padding: 0 .3rem; font-size: .66rem; box-shadow: 0 0 0 2px var(--paper); }
  .mainnav .ico { width: 44px; height: 26px; padding: 3px 12px; border-radius: 13px; box-sizing: border-box;
    transition: background-color .15s; }
  .mainnav a[aria-current="page"], .mainnav .nav-more:is([aria-current="page"], [aria-expanded="true"]) { color: var(--ink-brand); background: none; }
  .mainnav a[aria-current="page"] .ico, .mainnav .nav-more:is([aria-current="page"], [aria-expanded="true"]) .ico {
    color: var(--teal-text); background: rgba(0,194,168,.16); }
  .has-nav .content { padding-bottom: calc(2rem + 62px + env(safe-area-inset-bottom)); }
  .has-nav .install-banner { bottom: calc(1rem + 62px + env(safe-area-inset-bottom)); }
  /* Fusszeile steckt hinter "Mehr": Blatt direkt ueber der Tab-Leiste, Seite dahinter abgedunkelt */
  .has-nav .site-footer { display: none; }
  .has-nav .site-footer.open { display: flex; position: fixed; z-index: 29; left: 0; right: 0;
    bottom: calc(62px + env(safe-area-inset-bottom)); max-width: none; flex-direction: column; align-items: stretch; gap: 0;
    padding: .4rem max(.75rem, env(safe-area-inset-right)) .8rem max(.75rem, env(safe-area-inset-left));
    background: var(--paper); border: none; border-radius: 16px 16px 0 0; font-size: .95rem; color: var(--ink);
    box-shadow: 0 -8px 30px rgba(8,29,58,.14), 0 0 0 100vmax rgba(8,29,58,.32); }
  .site-footer.open .footer-links { flex-direction: column; gap: 0; }
  .site-footer.open .footer-links a { display: block; padding: .85rem .4rem; border-bottom: 1px solid var(--line); }
  body:has(.site-footer.open) .install-banner { display: none; }
  .site-footer.open .footer-version { order: 1; padding: .8rem .4rem 0; font-size: .8rem; color: var(--muted); }
}

/* Mobil (Smartphone hochkant) */
@media (max-width: 640px) {
  .content { padding: 1rem .75rem 3rem; }
  .site-footer { padding-left: .75rem; padding-right: .75rem; }
  h1 { font-size: 1.25rem; }
  .card { padding: 1rem; }
  .live-card { padding: .9rem 1rem; }
  .live-card .tile-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
  .ems-day-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; }
  .ems-window-src { margin-left: 0; }
  .chart { height: 280px; }
  .modal { padding: 1rem 1rem 1.2rem; }
  .info-banner { padding: .8rem .9rem; }
  /* Steuerung volle Breite: Zeitraum-Schalter und Datum je eine Zeile */
  :is(.page-head, .ui-toolbar) .controls { width: 100%; }
  :is(.page-head, .ui-toolbar) :is(.range-switch, .date-stepper) { flex: 1 1 auto; }
  :is(.page-head, .ui-toolbar) .range-switch button { flex: 1; }
  :is(.page-head, .ui-toolbar) .date-stepper input { flex: 1; min-width: 0; text-align: center; }
  /* Tabellen bis an den Kartenrand wischen */
  .table-scroll { margin: 0 -1rem; padding: 0 1rem; }
  /* sticky rechnet ab Innenrand -> bis an die Kante kleben, sonst scheint der Rand durch */
  .table-scroll th:first-child, .table-scroll td:first-child { left: -1rem; box-shadow: 1px 0 0 var(--line); }
  /* WR-/Ereignis-Zeilen: Text unter Name + kWh statt eigener Spalte */
  .inv-row { grid-template-columns: 14px minmax(0, 1fr) auto; row-gap: .15rem; align-items: start; }
  .inv-row .dot { margin-top: .35rem; }
  .inv-row .inv-text { grid-column: 2 / -1; grid-row: 2; }
  #inv-status { display: flex; flex-direction: column; }
  #inv-status .inv-row { grid-template-columns: 14px minmax(0, 1fr) auto; }
  .inv-row .inv-kwh { white-space: normal; text-align: right; }
  .inv-row .inv-kwh .muted { display: block; white-space: nowrap; }
  #inv-status .inv-kw { grid-column: 3; grid-row: 1; }
  #inv-status .inv-kwh { grid-column: 2 / -1; grid-row: 3; }
  /* bis zu fuenf Ansichten passen nicht in eine Zeile: umbrechen, die Knoepfe fuellen sie */
  #inv-view { flex-wrap: wrap; }
  #inv-view button { flex: 1 1 auto; }
  /* Titel und Schliessen oben, der Schalter darunter ueber die ganze Breite */
  .dc-detail h3 { flex: 1 1 0; min-width: 0; }
  .dc-detail .range-switch { order: 1; flex-basis: 100%; }
  .dc-detail .range-switch button { flex: 1; }
  /* Ereignis-Verlauf als Liste: Zeitraum + Dauer oben (bricht um), darunter Titel und Meldung */
  .events-table thead { display: none; }
  .events-table, .events-table tbody { display: block; }
  .events-table tr { display: flex; flex-wrap: wrap; column-gap: .3rem; padding: .55rem .2rem .6rem;
    border-bottom: 1px solid var(--row-line); }
  .events-table tbody tr:nth-child(even) { background: var(--row-alt); }
  .events-table tbody td, .events-table tbody td:nth-child(-n+3) { position: static; box-shadow: none;
    background: none; border-bottom: none; padding: 0; font-size: .82rem; }
  .events-table td.ev-end::before { content: '– '; }
  .events-table td.ev-dur { color: var(--muted); white-space: normal; }
  .events-table td.ev-dur::before { content: '· '; }
  .events-table td.ev-cat { margin-left: auto; }
  .events-table td.ev-title { flex-basis: 100%; min-width: 0; margin-top: .2rem; order: 1; }
  .events-table td.ev-part, .events-table td.ev-dev { order: 2; color: var(--muted); }
  .events-table td.ev-part + td.ev-dev:not(:empty)::before { content: '· '; }
  /* iOS zoomt bei Feldern unter 16 px beim Antippen in die Seite */
  input, select, textarea, #date-picker, .date-stepper input { font-size: 16px; }
}

/* Touch: Bedienelemente mind. ~40 px hoch */
@media (pointer: coarse) {
  .range-switch button, .date-stepper button, .year-stepper button { min-height: 40px; min-width: 40px; }
  .part-filter button { min-height: 36px; }
  .info-btn { width: 1.5rem; height: 1.5rem; font-size: .85rem; }
  .modal-close { min-width: 44px; min-height: 44px; }
  .btn-small { min-height: 40px; }
  .footer-links a, .footer-version a { display: inline-block; padding: .45rem 0; }
}

/* Energiesystem: Piktogramm in der Stammdaten-Kachel + Energiefluss */
.flow-svg text { font-family: var(--font-ui); }
.energy-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.2rem; align-items: center; }
.energy-flow svg { width: 100%; height: auto; display: block; }
.flow-svg .fn-title { font-size: 12px; fill: var(--ink-2); font-weight: 600; }
.flow-svg .fn-value { font-size: 17px; fill: var(--ink); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; }
.flow-svg .fn-sub { font-size: 10.5px; fill: var(--muted); }
.flow-svg .fn-flag { font-size: 10.5px; font-weight: 400; fill: var(--muted); }
.flow-node.dim .fn-value { fill: var(--muted); font-size: 14px; font-weight: 500; }
.flow-node.dim rect { stroke-dasharray: 4 3; }
.flow-line.fwd, .flow-line.rev { stroke-dasharray: 7 7; }
.flow-line.fwd { animation: flow-fwd 1.1s linear infinite; }
.flow-line.rev { animation: flow-rev 1.1s linear infinite; }
@keyframes flow-fwd { to { stroke-dashoffset: -28; } }
@keyframes flow-rev { to { stroke-dashoffset: 28; } }
@media (prefers-reduced-motion: reduce) { .flow-line.fwd, .flow-line.rev { animation: none; } }
/* Kartenkopf: Live-Status rechts (core/app.js drawFlowStatus) */
.energy-head { margin-bottom: .8rem; }
.flow-status { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--ink-2); }
.flow-status .ico { width: 18px; height: 18px; stroke-width: 2; color: var(--muted); }
.flow-status .dot { fill: currentColor; }
.flow-status b { font-weight: 600; color: var(--ink-2); }
.flow-status .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.flow-status.live .ico, .flow-status.live b { color: var(--teal-text); }
.flow-status.live .w1, .flow-status.live .w2 { animation: flow-wave 1.8s ease-in-out infinite; }
.flow-status.live .w2 { animation-delay: .25s; }
.flow-status.off .w1, .flow-status.off .w2 { opacity: .35; }
@keyframes flow-wave { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flow-status.live .w1, .flow-status.live .w2 { animation: none; } }
.flow-resume { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: .2rem .55rem;
  font: inherit; font-size: .75rem; color: var(--blue); cursor: pointer; }
.flow-resume:hover { border-color: var(--blue); }
.flow-resume:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.energy-side-label { font-size: .82rem; font-weight: 600;
  color: var(--muted); margin-bottom: .4rem; }
.energy-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1.4rem; margin: 0 0 1rem; }
.energy-kpis .stat-value { font-size: 1.2rem; }
/* USV (core/energy.js Knoten, core/ups.js Bereich unter dem Energiefluss) */
.flow-svg .fn-ups { font-size: 13.5px; fill: var(--ink); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; }
.flow-svg .fn-flag.alert { fill: var(--status-warn); font-weight: 600; }
.flow-ups { cursor: pointer; }
.flow-ups:hover rect { stroke: var(--baseline); }
.flow-ups:focus { outline: none; }
.flow-ups:focus-visible rect { stroke: var(--ink-brand); stroke-width: 2; }
.ups-panel { border-top: 1px solid var(--line); margin: .9rem 0 .4rem; padding-top: .8rem; }
.card > .ups-panel:first-child { border-top: 0; margin-top: 0; padding-top: 0; }   /* im Reiter USV: Karte hat schon den Rand */
.ups-head { display: flex; align-items: baseline; gap: .6rem; }
.ups-head h3 { margin: 0; font-size: .95rem; margin-right: auto; }
.ups-stats { flex-wrap: wrap; row-gap: .75rem; margin: .6rem 0 .4rem; }
.ups-stats .stat-value { font-size: 1.2rem; }
.ups-stats .status-badge { font-size: 1.05rem; font-weight: 600; }
.ups-msgs { flex-basis: 100%; }
.ups-xfer { flex-basis: 100%; margin: 0; }
.ups-plate { margin: .2rem 0 0; }
.ups-chart { height: 200px; }
.ups-log-head { margin: .6rem 0 .3rem; font-size: .85rem; }
.ups-log { list-style: none; margin: 0; padding: 0; font-size: .8rem; max-height: 220px; overflow-y: auto; }
.ups-ev { display: grid; grid-template-columns: 10px minmax(8rem, 1fr) auto; column-gap: .55rem; align-items: baseline;
  padding: .28rem 0; border-bottom: 1px solid var(--line); }
.ups-ev i { width: 8px; height: 8px; border-radius: 50%; background: var(--baseline); align-self: center; }
.ups-ev.crit i { background: var(--status-crit); }
.ups-ev.warn i { background: var(--status-warn); }
.ups-ev.info i { background: var(--blue); }
.ups-ev.running.crit b { color: var(--status-crit); }
.ups-ev.running.warn b { color: var(--status-warn); }
.ups-ev .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.ups-ev .muted { grid-column: 2 / -1; font-size: .74rem; }
/* Speicher je Einheit (core/storage.js) */
.storage-totals { flex-wrap: wrap; row-gap: .75rem; margin: 0 0 1rem; }
.storage-totals .stat-value { font-size: 1.25rem; }
.storage-totals small { font-size: .75em; color: var(--muted); font-weight: 500; }
.storage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: .6rem; }
.storage-grid.single { grid-template-columns: minmax(0, 360px); }
.su-tile { border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 8px;
  padding: .55rem .65rem .6rem; background: var(--paper); display: flex; flex-direction: column; gap: .35rem;
  font-size: .8rem; color: var(--ink-2); min-width: 0; }
.su-tile.su-charging { border-left-color: var(--teal); }
.su-tile.su-discharging { border-left-color: var(--gold); }
.su-tile.su-derating, .su-tile.su-warning { border-left-color: var(--status-warn); }
.su-tile.su-fault { border-left-color: var(--coral); background: color-mix(in srgb, var(--coral) 6%, var(--paper)); }
.su-tile.su-local, .su-tile.su-off, .su-tile.su-nodata { border-left-color: var(--baseline); }
.su-tile { cursor: pointer; }
/* oben/rechts/unten: der linke Rand traegt den Zustand */
.su-tile:hover { border-top-color: var(--baseline); border-right-color: var(--baseline); border-bottom-color: var(--baseline); }
.su-tile.focus { border-top-color: var(--ink-brand); border-right-color: var(--ink-brand); border-bottom-color: var(--ink-brand);
  box-shadow: inset 0 0 0 1px var(--ink-brand); }
.su-tile:focus-visible { outline: 2px solid var(--ink-brand); outline-offset: 1px; }
.su-unfocus { font: inherit; font-size: .8rem; color: var(--ink-brand); background: none; border: 0;
  padding: 0; margin-left: .35rem; cursor: pointer; text-decoration: underline; }
.su-head { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; min-height: 1.3rem; }
.su-head b { color: var(--ink); font-size: .85rem; margin-right: auto; overflow-wrap: anywhere; }
.su-badge { font-size: .68rem; font-weight: 600; border-radius: 999px; padding: .05rem .45rem; white-space: nowrap;
  border: 1px solid currentColor; }
.su-badge.crit { color: var(--status-crit); }
.su-badge.warn { color: var(--status-warn); }
.su-badge.local { color: var(--ink-brand); cursor: help; }
.su-soc { display: flex; align-items: center; gap: .45rem; }
.su-soc .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .78rem; color: var(--ink); min-width: 3.2em; text-align: right; }
.su-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--page); border: 1px solid var(--line); overflow: hidden; }
.su-bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.su-fault .su-bar i, .su-nodata .su-bar i { background: var(--baseline); }
.su-power { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.su-kw { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.su-kw.chg { color: var(--teal-text); }
.su-kw.dis { color: var(--gold-text); }
.su-op { color: var(--muted); }
.su-fault .su-op { color: var(--status-crit); font-weight: 600; }
.su-lims { display: flex; flex-direction: column; gap: .05rem; font-size: .74rem; color: var(--muted); }
.su-lim .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.su-lim.low, .su-lim.low .num { color: var(--status-warn); font-weight: 600; }
.su-meta { font-size: .72rem; color: var(--muted); }
.su-meta .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.su-stale { font-size: .7rem; color: var(--status-warn); }
/* Werte vom Batteriemanagement (Zellen, Isolation, Pack): Schluessel links, Wert rechts */
.su-bms { margin: .15rem 0 0; padding-top: .3rem; border-top: 1px solid var(--line); display: grid; gap: .1rem;
  font-size: .72rem; color: var(--muted); }
.su-bms div { display: flex; justify-content: space-between; gap: .5rem; cursor: help; }
.su-bms dt { margin: 0; }
.su-bms dd { margin: 0; color: var(--ink-2); text-align: right; }
.su-bms .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.su-msg { margin: 0; padding: 0; list-style: none; font-size: .74rem; font-weight: 600; line-height: 1.3; }
.su-msg.warn { color: var(--status-warn); }
.su-msg.crit { color: var(--status-crit); }
.storage-day-head { margin-top: 1.1rem; }
.storage-day-head h3 { margin: 0; font-size: .95rem; }
@media (max-width: 640px) {
  .storage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
  .storage-grid.single { grid-template-columns: minmax(0, 1fr); }
  .su-tile { padding: .45rem .5rem .5rem; }
  .su-kw { font-size: .95rem; }
  .su-power { flex-wrap: wrap; }
}
.share { margin-bottom: .9rem; }
.share-head { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-2); margin-bottom: .3rem; }
.share-head span { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.share-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--line); }
.share-bar span { display: block; height: 100%; }
.share-legend { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .76rem; color: var(--ink-2); margin-top: .35rem; }
.share-legend i { display: inline-block; width: .65rem; height: .65rem; border-radius: 2px; margin-right: .3rem; vertical-align: baseline; }
#chart-energy { margin-top: 1rem; }
@media (max-width: 760px) {
  .energy-grid { grid-template-columns: 1fr; }
}

/* App-Installation (PWA): Hinweis unten, unter Modals; siehe core/pwa.js */
.install-banner { position: fixed; z-index: 40; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom));
  width: min(520px, calc(100% - 1.5rem)); display: flex; align-items: center; gap: .9rem;
  background: var(--navy); color: #fff; border-radius: 14px; padding: .85rem .9rem .85rem 1rem;
  box-shadow: 0 12px 32px rgba(8, 29, 58, .28);
  transform: translate(-50%, 1.5rem); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.install-banner.visible { transform: translate(-50%, 0); opacity: 1; }
.install-banner img { flex: none; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255,255,255,.22); }
.install-text { flex: 1; min-width: 0; font-size: .84rem; line-height: 1.4; color: rgba(255,255,255,.8); }
.install-text b { display: block; color: #fff; font-size: .92rem; margin-bottom: .1rem; }
.install-banner .btn-small { flex: none; border: none; cursor: pointer; font-family: inherit; }
.install-close { flex: none; align-self: flex-start; background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.7); font-size: 1.3rem; line-height: 1; padding: .1rem .25rem; font-family: inherit; }
.install-close:hover { color: #fff; }
.ios-share { width: .8em; height: 1em; vertical-align: -.1em; color: var(--teal); }
.offline-icon { display: block; margin: 0 auto 1rem; border-radius: 14px; }
@media (pointer: coarse) { .install-close { min-width: 40px; min-height: 40px; } }
@media (prefers-reduced-motion: reduce) { .install-banner { transition: none; } }

/* Anlagenuebersicht (core/dashboard.html, core/dashboard.js) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dash-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: .2rem 1rem; margin-bottom: 1rem; }
.dash-head h1 { margin: 0; }
.dash-updated { font-variant-numeric: tabular-nums; }

/* Summen ueber alle Anlagen; die erste Kachel (Leistung jetzt) dunkel als Blickfang */
.fleet { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.4rem; }
.fleet-kpi { flex: 1 1 200px; display: flex; flex-direction: column; gap: .25rem; min-width: 0;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: .95rem 1.15rem 1rem;
  color: var(--ink); font: inherit; text-align: left; }
.fleet-label { font-size: .82rem; color: var(--muted); }
.fleet-value { font-size: .9rem; color: var(--ink-2); white-space: nowrap; }
.fleet-value b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 1.65rem; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.fleet-note { font-size: .78rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.fleet-note a { color: inherit; }
.fleet-note.s-warn { color: var(--status-warn); font-weight: 600; }
.fleet-note.s-crit { color: var(--status-crit); font-weight: 600; }
.meter { display: block; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin: .3rem 0 .1rem; }
.meter span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--teal); transition: width .6s ease; }
button.fleet-status { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button.fleet-status:hover { border-color: var(--teal); }
button.fleet-status[aria-pressed="true"] { border-color: var(--ink-brand); box-shadow: inset 0 0 0 1px var(--ink-brand); }
button.fleet-status:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* Werkzeugleiste: Suche, Status-Filter, Sortierung, Gruppen je Kunde */
.plant-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; margin-bottom: .5rem; }
.search-field { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-field input { width: 100%; height: 36px; padding: 0 2rem 0 2.1rem; border: 1px solid var(--line);
  border-radius: 9px; background: var(--paper); font-family: inherit; font-size: .9rem; color: var(--ink); }
.search-field input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search-hint { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); pointer-events: none;
  font-family: var(--font-num); font-size: .72rem; color: var(--muted); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 .3rem; background: var(--page); }
.search-field input:focus + .search-hint, .search-field input:not(:placeholder-shown) + .search-hint { display: none; }
.plant-toolbar .range-switch { border-radius: 9px; }
.plant-toolbar .range-switch button { height: 34px; padding: 0 .75rem; }
.range-switch [data-count] { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: .9em; opacity: .7; margin-left: .15rem; }
.toolbar-select, .toolbar-check { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--ink-2); }
.toolbar-select select { height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 .5rem;
  background: var(--paper); font-family: inherit; font-size: .85rem; color: var(--ink); }
.toolbar-check input { accent-color: var(--solid); width: 1rem; height: 1rem; }
.toolbar-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .9rem; }
.filter-toggle { display: none; position: relative; flex: none; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink-2); cursor: pointer; }
.filter-toggle[aria-expanded="true"] { background: var(--solid); border-color: var(--solid); color: #fff; }
.filter-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.filter-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 0 2px var(--paper); }
.plant-result { margin-bottom: 1rem; min-height: 1.1em; }
.plant-group { margin-bottom: 1.8rem; }
.plant-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem;
  padding-bottom: .45rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line); }
.plant-group-head h2 { margin: 0; }
.plant-group .tile-customer { display: none; }   /* steht schon in der Gruppen-Ueberschrift */
.plant-empty { text-align: center; padding: 2rem 1rem; color: var(--ink-2); }
.plant-empty p { margin-bottom: .8rem; }
.plant-empty button { cursor: pointer; font-family: inherit; }

/* Anlagen-Kachel: Kopf mit Status, aktuelle Leistung gross, Tageskurve, Kennzahlen, Fuss */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 1rem; }
.tile { position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  padding: 1rem 1.15rem .85rem; text-decoration: none; color: var(--ink);
  box-shadow: 0 1px 2px rgba(8,29,58,.04); transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile:hover { border-color: rgba(0,194,168,.7); box-shadow: 0 10px 28px rgba(8,29,58,.09); transform: translateY(-1px); }
.tile:has(.tile-link:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
/* gestreckter Link: die ganze Kachel oeffnet die Anlage; das Verwaltungs-Symbol der
   Mitarbeiter (Verwaltung) liegt darueber */
.tile-link { position: static; }
.tile-link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.tile-link:focus-visible { outline: none; }
.tile-admin { position: relative; z-index: 2; display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px; margin: -.4rem -.5rem -.4rem auto; border-radius: 8px; color: var(--ink-2); }
.tile-admin:hover { background: var(--page); color: var(--ink); }
.tile-admin:focus-visible { outline: 2px solid var(--blue); outline-offset: 0; }
/* auffaellige Anlagen: farbige Kante oben */
.tile::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; }
.tile[data-tone="warn"]::before { background: var(--gold); }
.tile[data-tone="crit"]::before { background: var(--coral); }
.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.tile-title { min-width: 0; }
.tile-name { display: block; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile-sub { display: block; color: var(--ink-2); font-size: .8rem; margin-top: .1rem; }
.tile .status-badge { flex: none; display: inline-flex; align-items: center; gap: .38rem; margin-top: .1rem;
  padding: .2rem .6rem .2rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  background: var(--page); color: var(--muted); }
.tile .status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tile .status-badge.s-ok { background: rgba(0,134,114,.1); color: var(--status-ok); }
.tile .status-badge.s-warn { background: rgba(242,184,75,.2); color: var(--status-warn); }
.tile .status-badge.s-crit { background: rgba(233,108,99,.13); color: var(--status-crit); }
.tile .status-badge.s-snow { background: rgba(70,130,190,.14); color: var(--status-snow); }
.tile .status-badge.s-ok::before { animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(0,134,114,.45); } 70%, 100% { box-shadow: 0 0 0 5px rgba(0,134,114,0); } }
.tile-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .6rem; margin-top: .85rem; }
.hero-value { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 1.9rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.hero-value small { margin-left: .3rem; font-family: var(--font-ui); font-size: .9rem; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.hero-note { font-size: .76rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* Tageskurve bis an die Kachelraender */
.spark { position: relative; height: 64px; margin: .45rem -1.15rem 0; }
.spark svg { display: block; width: 100%; height: 100%; }
.spark-area { fill: rgba(0,194,168,.13); }
.spark-line { fill: none; stroke: var(--teal); stroke-width: 1.7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.spark-now { position: absolute; top: 4px; bottom: 0; border-left: 1px dashed var(--baseline); }
.spark-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px rgba(0,194,168,.35); }
.spark[data-empty]::after { content: 'Heute noch keine Leistung'; position: absolute; inset: 0; display: grid;
  place-items: center; font-size: .75rem; color: var(--muted); }
.tile[data-tone="crit"] .spark-area { fill: rgba(233,108,99,.12); }
.tile[data-tone="crit"] .spark-line { stroke: var(--coral); }
.tile[data-tone="crit"] .spark-dot { background: var(--coral); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px rgba(233,108,99,.35); }
.tile .tile-stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .8rem;
  margin: 0 -1.15rem; padding: .75rem 1.15rem 0; border-top: 1px solid var(--line); }
.tile .stat-value { font-size: 1.05rem; letter-spacing: -.02em; }
.tile .stat-value.s-crit { color: var(--status-crit); }
.tile .stat-label { display: block; font-size: .72rem; line-height: 1.3; margin-top: .1rem; }
.tile-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem .8rem;
  margin-top: auto; padding-top: .8rem; font-size: .74rem; }
/* Geraetezustand je Kachel (Neugestaltung M5): schlimmste Anlagenteile */
.tile-health { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; min-height: 1.4rem; }
.tile-health .ui-health { font-weight: 600; }
.tile-health .th-more { font-size: .74rem; color: var(--muted); align-self: center; }
/* bis die Live-Werte da sind: Platzhalter statt Striche */
.tile[data-loading] .hero-value > span, .tile[data-loading] [data-role="e_day"] {
  color: transparent; border-radius: 6px; }
.tile[data-loading] .hero-value > span, .tile[data-loading] [data-role="e_day"], .tile[data-loading] .spark {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%) 0 0 / 200% 100%;
  animation: skeleton 1.3s linear infinite; }
.tile[data-loading] .spark { margin-left: 0; margin-right: 0; border-radius: 8px; }
@keyframes skeleton { to { background-position: -200% 0; } }

/* Laden (core/plant-common.js busy, core/nav.js): nichts davon nimmt Platz ein oder
   verschiebt etwas. Laufleiste an der Oberkante einer Karte, solange ihre Daten
   laden; erst nach 250 ms, damit schnelle Antworten nicht flackern. */
.card, .trk-panel, .ups-panel { position: relative; }
.busy::after { content: ''; position: absolute; z-index: 2; top: -1px; left: 10px; right: 10px; height: 2px;
  border-radius: 2px; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, var(--teal) 50%, transparent) 0 0 / 35% 100% no-repeat;
  animation: busy-in .2s .25s forwards, busy-run 1.2s ease-in-out infinite; }
.ups-panel.busy::after { left: 0; right: 0; }
@keyframes busy-in { to { opacity: 1; } }
@keyframes busy-run { from { background-position: -50% 0; } to { background-position: 150% 0; } }
/* Platzhalter, bis die ersten Werte da sind: Kennzahlen ohne Wert fuer die
   Ansicht (data-pending, app.js drawKpis) und noch leere Bereiche, jeweils in
   etwa der Hoehe, die sie danach haben */
.skel, .live-card.busy[data-pending] .stat-value,
.busy :is(#inv-status, #energy-flow, #energy-kpis, #storage-totals, #storage-units, #tracker-units,
          #tracker-totals, #ups-stats):empty,
#sensor-list.busy:empty {
  color: transparent !important; border-radius: 6px;
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%) 0 0 / 200% 100%;
  animation: skeleton 1.3s linear infinite; }
.live-card.busy[data-pending] .status-badge { min-width: 5.5rem; }
/* WR-Liste: Zeilen wie .inv-row (Anzahl erst mit der Antwort bekannt, etwa fuenf) */
.busy #inv-status:empty { min-height: 12rem;
  -webkit-mask: repeating-linear-gradient(#000 0 1.85rem, transparent 1.85rem 2.1rem);
  mask: repeating-linear-gradient(#000 0 1.85rem, transparent 1.85rem 2.1rem); }
.busy #energy-flow:empty { aspect-ratio: 4 / 3; }
.busy :is(#energy-kpis, #storage-totals, #tracker-totals, #ups-stats):empty { min-height: 2.7rem; }
.busy #storage-units:empty { min-height: 10.6rem; }
.busy #tracker-units:empty { min-height: 8rem; }
#sensor-list.busy:empty { min-height: 20rem; }
/* .skel: Platzhalter, die schon im HTML stehen und mit den Daten verschwinden */
.skel { display: block; }
.skel-block { height: 3.2rem; }
/* Monatszeile der Abrechnung: Status und Grund in zwei Zeilen */
.skel-row td { padding-top: .55rem; padding-bottom: .55rem; }
.skel-row .skel { height: 2.1rem; }
.cam-skel { aspect-ratio: 16 / 9; }
/* Abrechnung aller Anlagen: Zeile bzw. Kennzahlen, deren Anfrage noch laeuft */
#settle-fleet-kpis[data-pending] .fleet-value b { color: transparent; display: inline-block; min-width: 3.5rem; }
tr[data-pending] td[data-col] { font-size: 0; }   /* "–" weg, der Balken (::after) steht dafuer */
#settle-fleet-kpis[data-pending] .fleet-value b, tr[data-pending] :is(td.ui-c, td[data-col])::after {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%) 0 0 / 200% 100%;
  animation: skeleton 1.3s linear infinite; border-radius: 6px; }
tr[data-pending] :is(td.ui-c, td[data-col])::after { content: ''; display: inline-block; width: 1rem; height: 1rem;
  vertical-align: middle; }
tr[data-pending] td[data-col]::after { width: 3rem; }
@media (prefers-reduced-motion: reduce) {
  .busy::after { animation: busy-in .2s .25s forwards; background-size: 100% 100%; opacity: .6; }
  .skel, .live-card.busy[data-pending] .stat-value, .busy :is(#inv-status, #energy-flow, #energy-kpis, #storage-totals,
    #storage-units, #tracker-units, #tracker-totals, #ups-stats):empty, #sensor-list.busy:empty,
  #settle-fleet-kpis[data-pending] .fleet-value b, tr[data-pending] :is(td.ui-c, td[data-col])::after { animation: none; }
}
/* Seitenwechsel (core/nav.js): duenner Balken am oberen Rand, der bis kurz vor
   das Ende laeuft, bis die naechste Seite da ist */
.nav-progress { position: fixed; z-index: 100; top: 0; left: 0; right: 0; height: 3px; pointer-events: none;
  background: var(--teal); box-shadow: 0 0 8px var(--teal); transform-origin: 0 50%; transform: scaleX(0); opacity: 0; }
html.nav-pending .nav-progress { opacity: 1; transform: scaleX(.92);
  transition: opacity .15s .15s, transform 12s cubic-bezier(.08, .7, .15, 1) .15s; }
html.nav-pending, html.nav-pending a { cursor: progress; }
@media (prefers-reduced-motion: reduce) { html.nav-pending .nav-progress { transform: scaleX(1); opacity: .7; transition: opacity .15s .15s; } }
@media (prefers-reduced-motion: reduce) {
  .tile, .meter span { transition: none; }
  .tile:hover { transform: none; }
  .tile .status-badge.s-ok::before, .tile[data-loading] .hero-value > span,
  .tile[data-loading] [data-role="e_day"], .tile[data-loading] .spark { animation: none; }
}
@media (max-width: 640px) {
  .fleet { gap: .6rem; margin-bottom: 1.1rem; }
  .fleet-kpi { flex-basis: 9rem; padding: .8rem .9rem; }
  .fleet-kpi:first-child { flex-basis: 100%; }
  .fleet-value b { font-size: 1.35rem; }
  /* Werkzeugleiste: Suche + Filter-Knopf, der Rest klappt darunter auf */
  .search-field { flex: 1 1 0; min-width: 0; max-width: none; }
  .search-field input { height: 40px; }
  .filter-toggle { display: grid; }
  .toolbar-filters { display: none; flex-basis: 100%; padding: .2rem 0 .3rem; }
  .plant-toolbar.filters-open .toolbar-filters { display: flex; }
  .plant-toolbar { margin-bottom: 1rem; }
  .plant-result { margin-top: -.4rem; }
  .plant-result:not(.filtered) { display: none; }   /* "12 Anlagen" steht schon in der Summe oben */
  .plant-toolbar .range-switch { flex: 1 1 100%; }
  .plant-toolbar .range-switch button { flex: 1; }
  .search-hint { display: none; }
  .tile { padding: .9rem 1rem .8rem; }
  .spark { margin: .45rem -1rem 0; }
  .tile .tile-stats { margin: 0 -1rem; padding: .75rem 1rem 0; }
}

/* Testinstanz (ERTRAGO_INSTANCE=test): nicht mit der Produktion verwechseln */
.instance-banner { background: repeating-linear-gradient(-45deg, var(--gold), var(--gold) 14px, #F5C66B 14px, #F5C66B 28px);
  color: var(--navy); font-size: .82rem; font-weight: 600; text-align: center; padding: .35rem 1rem; }
/* Demo-Plattform (ERTRAGO_INSTANCE=demo): fuer alle sichtbar, aber ruhig */
.instance-banner.demo { background: var(--page); color: var(--ink-2); font-weight: 500;
  border-bottom: 1px solid var(--line); }
/* Mitarbeiter sieht das Portal als Kunde (core/impersonate.py) */
.impersonate-banner { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; justify-content: center;
  background: var(--gold); color: var(--navy); font-size: .85rem; padding: .4rem 1rem; }
.impersonate-banner form { margin: 0; }
.impersonate-banner button { font: inherit; font-weight: 600; color: #fff; background: var(--navy);
  border: 0; border-radius: 999px; padding: .2rem .8rem; cursor: pointer; }

/* Dunkelmodus: Navy-Flaechen heben sich kaum vom Grund ab -> feine Kante */
[data-theme="dark"] .topbar { box-shadow: 0 1px 0 var(--line), 0 4px 16px rgba(0,0,0,.25); }
[data-theme="dark"] .fleet-kpi:first-child { border-color: var(--line); }
[data-theme="dark"] .install-banner { box-shadow: 0 0 0 1px var(--line), 0 12px 32px rgba(0,0,0,.45); }
[data-theme="dark"] :is(.account-menu, .modal) { box-shadow: 0 16px 40px rgba(0,0,0,.5); }
[data-theme="dark"] .modal { border: 1px solid var(--line); }
[data-theme="dark"] .tile:hover { box-shadow: 0 10px 28px rgba(0,0,0,.35); }

/* Energiemanagement (core/ems.html) */
.ems-head-main { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ems-online { color: var(--muted); }
.ems-online::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--baseline); margin-right: .35rem; vertical-align: middle; }
.ems-online.on { color: var(--status-ok); }
.ems-online.on::before { background: var(--status-ok); }
.ems-sync { text-align: right; }
.ems-sync-ok b { color: var(--status-ok); }
.ems-sync-pending b { color: var(--status-warn); }
.ems-sync-rejected b { color: var(--status-crit); }
.ems-kpis { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: .9rem; padding-top: .8rem;
  border-top: 1px solid var(--line); }
.ems-kpis .stat-value { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ems-kpis-now { flex-basis: 100%; margin-bottom: -1.2rem; }
.ems-window { display: flex; align-items: center; gap: .3rem .6rem; flex-wrap: wrap; margin-top: .9rem;
  padding: .55rem .8rem; border-radius: 8px; background: var(--page); border-left: 4px solid var(--line); }
.ems-window.on { background: rgba(242, 184, 75, 0.16); border-left-color: var(--gold); }
.ems-window.on b { color: var(--gold-text); }
.ems-window-src { margin-left: auto; }
.ems-window-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold);
  box-shadow: 0 0 0 0 rgba(242, 184, 75, .6); animation: ems-pulse 2s infinite; }
@keyframes ems-pulse { 70% { box-shadow: 0 0 0 7px rgba(242, 184, 75, 0); } 100% { box-shadow: 0 0 0 0 rgba(242, 184, 75, 0); } }
@media (prefers-reduced-motion: reduce) { .ems-window-dot { animation: none; } }
.ems-day-kpis { flex-wrap: wrap; row-gap: .75rem; }
.ems-day-kpis .stat-value { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 1.2rem; }
.ems-day-kpis .ems-ok .stat-value { color: var(--status-ok); }
.ems-day-kpis .ems-bad .stat-value { color: var(--status-crit); }
#ems-csv[hidden] { display: none; }
.ems-year-label { padding: .38rem .4rem; min-width: 3.2rem; text-align: center; font-weight: 600; }
.ems-zone-sum { margin-top: .6rem; }
.ems-preview { margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.ems-preview-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ems-preview-head input { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: .15rem .3rem;
  background: var(--paper); color: var(--ink); }
.ems-preview-grid { display: grid; grid-template-columns: 5.2rem 1fr; gap: 3px .6rem; margin-top: .5rem;
  font-size: .76rem; align-items: center; }
.ems-preview-bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--page); }
.ems-preview-bar i { flex: 1 1 0; }
.ems-preview-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: .7rem; }
.ems-preview-legend { display: flex; gap: .4rem 1rem; flex-wrap: wrap; margin-top: .45rem; font-size: .76rem; }
.ems-preview-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px;
  margin-right: .3rem; vertical-align: -1px; background: var(--sw); }
.ems-preview-err { color: var(--status-crit); }
.ems-zone-sum td.ok { color: var(--status-ok); }
.ems-zone-sum td.bad { color: var(--status-crit); }
.ems-tip { font-size: .8rem; line-height: 1.5; }
.ems-tip-win { color: var(--gold-text); font-weight: 600; }
.ems-tip-bad { color: var(--status-crit); font-weight: 600; }
.ems-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 1.2rem;
  border: none; padding: 0; margin: 0; min-width: 0; }
.ems-grid :is(#ems-zones, #ems-feedin) { grid-column: 1 / -1; }
.ems-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: .3rem 1rem;
  padding: .45rem 0; border-top: 1px solid var(--row-line); align-items: start; font-size: .9rem; }
.ems-row label small { display: block; font-size: .76rem; line-height: 1.35; margin-top: .1rem; }
.ems-input input[type=text], .ems-input select {
  border: 1px solid var(--field-line); background: var(--field); color: var(--ink); border-radius: 6px;
  padding: .3rem .45rem; font: inherit; font-size: .88rem; }
.ems-input input.num { width: 7rem; text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ems-input input[type=text]:not(.num) { width: 100%; }
/* Editor der Hochlastzeitfenster (core/ems-zones.js) */
.ems-z-card { border: 1px solid var(--line); border-left: 4px solid var(--zc); border-radius: 10px;
  padding: .9rem 1rem; margin: .8rem 0; background: var(--page); }
.ems-z-head { display: flex; gap: .8rem 1rem; align-items: flex-end; flex-wrap: wrap; }
.ems-z-field { display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; }
.ems-z-field > span:first-child { font-size: .76rem; color: var(--muted); display: flex; align-items: center; gap: .3rem; }
.ems-z-grow { flex: 1 1 14rem; }
.ems-z-card :is(input[type=text], input[type=time], input[type=date], select) {
  border: 1px solid var(--field-line); background: var(--field); color: var(--ink); border-radius: 6px;
  padding: .3rem .45rem; font: inherit; font-size: .88rem; }
.ems-z-name { width: 100%; }
.ems-z-num { width: 5.5rem; text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ems-z-short { width: 4.5rem; }
.ems-z-raw { width: 100%; font-family: ui-monospace, Menlo, monospace; }
.ems-z-sum { margin-top: .5rem; font-size: .86rem; line-height: 1.5; }
.ems-z-sum b { color: var(--teal-text); font-weight: 600; }
.ems-z-block { margin-top: .9rem; }
.ems-z-lbl { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
.ems-z-rule { position: relative; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; margin-bottom: .5rem;
  background: var(--paper); }
.ems-z-rdel { position: absolute; top: .45rem; right: .45rem; }
.ems-z-line { display: flex; align-items: center; gap: .35rem .6rem; flex-wrap: wrap; margin: .3rem 0; font-size: .86rem; }
.ems-z-k { width: 4.2rem; color: var(--muted); font-size: .8rem; }
.ems-z-chips { display: flex; gap: 3px; flex-wrap: wrap; }
.ems-z-chip { border: 1px solid var(--field-line); background: var(--field); color: var(--muted); border-radius: 6px;
  width: 2.6rem; padding: .22rem 0; font: inherit; font-size: .8rem; cursor: pointer; }
.ems-z-chip[aria-pressed=true] { background: var(--solid); border-color: var(--solid); color: #fff; }
.ems-z-chip:disabled { cursor: default; }
.ems-z-chip:not(:disabled):hover { border-color: var(--muted); }
.ems-z-quick { display: inline-flex; gap: .6rem; margin-left: .3rem; }
.ems-z-link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-size: .8rem; cursor: pointer; }
.ems-z-link:hover { text-decoration: underline; }
.ems-z-range { display: inline-flex; align-items: center; gap: .3rem; }
.ems-z-x { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px;
  width: 1.9rem; height: 1.9rem; cursor: pointer; font-size: .85rem; }
.ems-z-x.small { width: 1.5rem; height: 1.5rem; font-size: .7rem; }
.ems-z-x:hover { color: var(--status-crit); border-color: var(--status-crit); }
.ems-z-err { color: var(--status-crit); font-size: .8rem; margin-top: .2rem; }
.ems-z-warn { color: var(--gold-text); font-size: .8rem; margin-top: .2rem; }
.ems-z-adv { margin-top: .8rem; }
.ems-z-adv > summary { cursor: pointer; color: var(--muted); font-size: .84rem; }
.ems-z-advgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; margin-top: .6rem; font-size: .86rem; }
@media (max-width: 760px) { .ems-z-advgrid { grid-template-columns: 1fr; } .ems-z-k { width: 100%; } }
.ems-z-add { margin-top: .2rem; }
.ems-z-add:disabled { opacity: .45; cursor: not-allowed; }
/* "i" mit Erklärung zum Aufklappen (auch auf dem Telefon) */
.ems-help { display: inline-block; position: relative; vertical-align: middle; }
.ems-help > summary { list-style: none; cursor: pointer; width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 1px solid var(--muted); color: var(--muted); font: italic 600 .68rem/1rem Georgia, serif; text-align: center;
  text-transform: none; letter-spacing: 0; }
.ems-help > summary::-webkit-details-marker { display: none; }
.ems-help[open] > summary, .ems-help > summary:hover { color: var(--blue); border-color: var(--blue); }
.ems-help-body { position: absolute; z-index: 20; top: 1.5rem; left: -1rem; width: min(22rem, 80vw); padding: .6rem .75rem;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25); font-size: .8rem; line-height: 1.5; text-transform: none; letter-spacing: 0;
  font-weight: 400; white-space: normal; }
.ems-note { background: var(--page); border-left: 4px solid var(--gold); border-radius: 8px;
  padding: .7rem .9rem; margin: .4rem 0 .8rem; font-size: .86rem; line-height: 1.5; color: var(--ink-2); }
.ems-confirm { display: flex; gap: .5rem; align-items: flex-start; margin-top: .6rem; padding: .6rem .8rem;
  border: 1px solid var(--gold); border-radius: 8px; }
.ems-confirm[hidden] { display: none; }
.ems-actions .bu-actions { justify-content: flex-end; }
.ems-errors { border-left-color: var(--coral); }
.ems-errors ul { margin: .3rem 0 0 1rem; padding: 0; }
.ems-status { font-size: .8rem; }
.ems-status-applied { color: var(--status-ok); }
.ems-status-accepted, .ems-status-pending { color: var(--status-warn); }
.ems-status-rejected { color: var(--status-crit); }
@media (max-width: 640px) {
  .ems-grid { grid-template-columns: 1fr; }
  .ems-row { grid-template-columns: 1fr; }
  .ems-sync { text-align: left; }
}

.storage-totals .stat.s-warn .stat-value { color: var(--status-warn); }
.staff-hint { margin: .75rem 0 0; }

/* Rahmen mit Seitenleiste (Body-Klasse has-nav, alle angemeldeten Seiten): am Desktop wird
   die Kopfleiste zur Seitenleiste links; mobil bleibt alles wie auf den anderen Seiten
   (Kopfleiste oben, Navigation als Tab-Leiste unten). Darunter Anlagenkopf, Reiter, Inhalt. */
@media (min-width: 761px) {
  .has-nav { padding-left: 220px; }
  .has-nav .topbar { position: fixed; inset: 0 auto 0 0; width: 220px; height: auto; flex-direction: column;
    align-items: stretch; gap: 1.1rem; padding: 1.1rem .7rem 1rem; box-shadow: none; }
  .has-nav .brand { padding: 0 .5rem; }
  .has-nav .mainnav { flex: 0 0 auto; flex-direction: column; align-items: stretch; gap: 2px; }
  .has-nav .mainnav a { height: 38px; padding: 0 .65rem; gap: .65rem; }
  .has-nav .account { margin: auto 0 0; border-top: 1px solid rgba(255,255,255,.08); padding-top: .7rem; }
  .has-nav .account summary { gap: .65rem; padding: .3rem .4rem; border-radius: 9px; color: rgba(255,255,255,.85); }
  .has-nav .account summary:hover { background: rgba(255,255,255,.07); }
  .has-nav .account-name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: .88rem; font-weight: 500; }
  .has-nav .avatar { width: 30px; height: 30px; flex: none; }
  .has-nav .account-menu { top: auto; bottom: calc(100% + .5rem); left: 0; right: auto; }
  .has-nav .content, .has-nav .site-footer { max-width: 1280px; margin: 0; padding-left: 2rem; padding-right: 2rem; }
}
.has-nav .content { padding-top: 1.3rem; }
[data-theme="dark"] .has-nav .topbar { box-shadow: 1px 0 0 var(--line); }

.ui-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 1.5rem; flex-wrap: wrap;
  padding: 1.4rem 2rem 1rem; background: var(--paper); border-bottom: 1px solid var(--line); }
.ui-head-main { min-width: 0; }
.ui-head-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ui-head h1 { display: flex; align-items: center; gap: .6rem; margin: 0; font-size: 1.55rem; }
.ui-sub { margin-top: .2rem; color: var(--muted); }
.ui-switch { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 0 0 .6rem; color: var(--ink-2); background: var(--paper); }
.ui-switch select { border: 0; background: transparent; font: inherit; font-weight: 500; color: var(--ink);
  max-width: 16rem; padding: .45rem .6rem; min-height: 36px; cursor: pointer; }
.ui-switch:focus-within { outline: 2px solid var(--blue); outline-offset: 1px; }
.ui-switch select:focus { outline: none; }
.ui-switch-go { border: 0; border-radius: 6px; background: var(--solid); color: #fff; font: inherit; font-size: .82rem;
  font-weight: 600; padding: .2rem .6rem; cursor: pointer; }
.ui-switch .cb-trigger { border: 0; background: transparent; padding: .45rem .6rem .45rem 0; min-height: 36px;
  min-width: 9rem; max-width: 18rem; font-weight: 500; }   /* wie das <select> davor: der Rahmen bleibt eine Tipp-Flaeche */
.ui-switch .cb-trigger:focus-visible { outline: none; }
.ui-switch { cursor: pointer; }
.ui-switch:hover { border-color: var(--field-line); }

/* Durchsuchbare Auswahl (core/combobox.js): Knopf statt <select>, Liste mit Suchfeld darueber */
.cb-native { display: none !important; }
.cb-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: .5rem; min-width: 10rem;
  padding: .42rem .55rem; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field);
  color: var(--ink); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.cb-trigger:hover { border-color: var(--baseline); }
.cb-trigger:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.cb-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-chevron { flex: none; width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
.cb-trigger[aria-expanded="true"] .cb-chevron { transform: rotate(180deg); }
.cb-trigger.cb-loading { opacity: .6; cursor: progress; }
.cb-pop { position: fixed; z-index: 60; display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(8,29,58,.18); animation: cb-in .12s ease-out; }
.cb-pop[hidden] { display: none; }
.cb-pop.cb-up { flex-direction: column-reverse; animation-name: cb-in-up; }
@keyframes cb-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes cb-in-up { from { opacity: 0; transform: translateY(4px); } }
[data-theme="dark"] .cb-pop { box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.cb-search { position: relative; display: flex; align-items: center; flex: none; border-bottom: 1px solid var(--line); }
.cb-pop.cb-up .cb-search { border-bottom: 0; border-top: 1px solid var(--line); }
.cb-search-ico { position: absolute; left: .8rem; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.cb-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit;
  font-size: .95rem; padding: .75rem 2.2rem .75rem 2.3rem; }
.cb-search input::placeholder { color: var(--muted); }
.cb-search input:focus { outline: none; }
.cb-clear { position: absolute; right: .45rem; width: 1.6rem; height: 1.6rem; border: 0; border-radius: 6px;
  background: none; color: var(--muted); font-size: 1.15rem; line-height: 1; cursor: pointer; }
.cb-clear:hover { background: var(--page); color: var(--ink); }
.cb-list { list-style: none; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: .3rem; scroll-padding: .3rem; }
.cb-list li[role="option"] { display: flex; align-items: center; gap: .45rem; padding: .48rem .6rem .48rem .4rem;
  border-radius: 8px; cursor: pointer; }
.cb-list li[aria-selected="true"] { background: var(--row-selected); }
.cb-check { flex: none; width: 16px; height: 16px; color: var(--teal-text); }
.cb-check svg { display: block; width: 16px; height: 16px; }
.cb-text { display: flex; flex-direction: column; min-width: 0; }
.cb-label { overflow-wrap: anywhere; }
.cb-current .cb-label { font-weight: 600; }
.cb-hint { font-size: .78rem; color: var(--muted); margin-top: .05rem; overflow-wrap: anywhere; }
.cb-label mark { background: none; color: inherit; font-weight: 700; text-decoration: underline;
  text-decoration-color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cb-empty { padding: 1rem .7rem; color: var(--muted); font-size: .9rem; text-align: center; }
.cb-foot { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex: none;
  padding: .4rem .75rem; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); white-space: nowrap; }
.cb-pop.cb-up .cb-foot { display: none; }
.cb-keys kbd { display: inline-block; min-width: 1.25rem; padding: 0 .25rem; margin: 0 .05rem; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 4px; font: inherit; font-size: .7rem; text-align: center; color: var(--ink-2); }
@media (pointer: coarse) {
  .cb-keys { display: none; }
  .cb-search input { font-size: 16px; }   /* iOS zoomt sonst beim Fokus */
  .cb-list li[role="option"] { padding-top: .65rem; padding-bottom: .65rem; }
}
/* Einfache Auswahl in Filtern wie der Knopf der durchsuchbaren (.cb-trigger): eigener Pfeil
   (der aus core/combobox.js), Rand-Hover, Fokusring. Farbe des Pfeils = --muted je Modus. */
:is(.alarms-filter, .rep-form, .log-filter, .ui-logbook-filter, .toolbar-select, .trk-buttons) select:not([multiple]):not(.cb-native) {
  appearance: none; -webkit-appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5' fill='none' stroke='%236B7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center; background-size: 16px; }
:root[data-theme="dark"] :is(.alarms-filter, .rep-form, .log-filter, .ui-logbook-filter, .toolbar-select, .trk-buttons) select:not([multiple]):not(.cb-native) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5' fill='none' stroke='%238794A7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
:is(.alarms-filter, .rep-form, .log-filter, .ui-logbook-filter, .toolbar-select, .trk-buttons) select:not([multiple]):hover { border-color: var(--baseline); }
:is(.alarms-filter, .rep-form, .log-filter, .ui-logbook-filter, .toolbar-select, .trk-buttons) select:not([multiple]):focus-visible {
  outline: 2px solid var(--blue); outline-offset: 1px; }
.ui-tabs { display: flex; align-items: stretch; gap: 1.4rem; padding: 0 2rem; background: var(--paper);
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
/* rechts ausblenden: da geht es weiter (nur wenn die Leiste auch mit Symbolen nicht passt) */
.ui-tabs.overflows { mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent); }
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .7rem 0; white-space: nowrap;
  color: var(--ink-2); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; }
.ui-tabs a:hover { color: var(--ink); }
.ui-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }
.ui-tabs .ico { width: 16px; height: 16px; color: var(--muted); }
.ui-tabs a[aria-current="page"] .ico { color: var(--ink); }
.ui-tabs a:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
/* eigene Seiten rechts, durch eine Linie von den Reitern getrennt */
.ui-tabs-sec { display: flex; gap: 1.2rem; margin-left: auto; padding-left: 1.2rem; border-left: 1px solid var(--line); }
.ui-tabs-sec a { font-size: .9rem; }
.ui-tabs-sec a.icon-only > span:not(.ui-dot) { display: none; }
/* Name der Symbol-Reiter beim Hover (plant/base.html), schwebt ueber der Seite */
.ui-tip { position: fixed; z-index: 50; padding: .25rem .55rem; border-radius: 4px; pointer-events: none;
  background: var(--ink); color: var(--paper); font-size: .78rem; font-weight: 500; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25); }
.ui-tip[hidden] { display: none; }
/* passt die Leiste nicht (viele Anlagenteile, schmales Fenster; plant/base.html misst):
   rechts nur Symbole, die aktive Seite mit Namen */
.ui-tabs.compact .ui-tabs-sec a > span:not(.ui-dot) { display: none; }
.ui-tabs.compact .ui-tabs-sec a[aria-current="page"]:not(.icon-only) > span:not(.ui-dot) { display: inline; }
/* Alarm-Punkt: Warnung voll, kritisch mit Ring (nicht nur die Farbe unterscheidet) */
.ui-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--status-warn); }
.ui-dot.crit { background: var(--status-crit); box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--status-crit); }
.ui-head h1 .ui-dot { width: 11px; height: 11px; }

/* dringendster Alarm oben auf der Uebersicht */
.ui-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center;
  margin-bottom: 1.1rem; padding: .85rem 1.1rem; border-radius: 10px; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; }
.ui-banner .ico { width: 20px; height: 20px; }
.ui-banner.crit { background: rgba(233,108,99,.11); border-color: rgba(233,108,99,.45); }
.ui-banner.crit .ico:first-child, .ui-banner.crit b { color: var(--coral-text); }
.ui-banner.warn { background: rgba(242,184,75,.13); border-color: rgba(242,184,75,.5); }
.ui-banner.warn .ico:first-child, .ui-banner.warn b { color: var(--gold-text); }
.ui-banner:is(.crit, .warn):hover { box-shadow: 0 2px 10px rgba(8,29,58,.08); }
.ui-banner.none { grid-template-columns: auto 1fr; padding: .6rem 1rem; background: rgba(0,194,168,.08);
  border-color: rgba(0,194,168,.3); color: var(--ink-2); font-size: .9rem; }
.ui-banner.none .ico { width: 18px; height: 18px; color: var(--teal-text); }
/* Anlage mit Tagesdaten: letzter Tag mit Daten liegt vor gestern (api.last_data_day) */
.ui-banner.stale { grid-template-columns: auto minmax(0, 1fr); }
.ui-banner.stale:hover { box-shadow: none; }

/* Reiter Einstellungen: Stammdaten als Liste, Kasten fuer Mitarbeiter */
.ui-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1.6rem; margin: 0; }
.ui-facts dt { color: var(--muted); }
.ui-facts dd { margin: 0; overflow-wrap: anywhere; }
.chip.off { color: var(--muted); border-style: dashed; }
.ui-staff-box { border: 1px dashed var(--baseline); background: var(--page); }
.ui-inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; }   /* Einstellungen: Alarme stumm */
.ui-staff-box .card-head { margin-bottom: .5rem; }
/* "nur Mitarbeiter": im Titel jedes Mitarbeiter-Kastens, der Verwaltung und an einzelnen
   Feldern (Berichte "per Mail versenden"); Rahmen gestrichelt wie der Kasten */
.ui-staff-chip { display: inline-block; vertical-align: middle; margin-left: .45rem; font-size: .68rem;
  font-weight: 600; line-height: 1.5; color: var(--muted); border: 1px dashed var(--baseline); border-radius: 5px;
  padding: 0 .4rem; white-space: nowrap; letter-spacing: .01em; }

/* Tag/Zeitraum (und im Reiter PV die Anlagenteile) ueber den Karten */
.ui-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1.2rem;
  margin-bottom: 1rem; }
.ui-toolbar .part-filter { margin: 0; }

@media (max-width: 640px) {
  .ui-facts { grid-template-columns: 1fr; gap: .1rem; }
  .ui-facts dd { margin-bottom: .5rem; }
}
@media (max-width: 760px) {
  .ui-head { padding: 1rem 1rem .8rem; }
  .ui-head h1 { font-size: 1.3rem; }
  .ui-switch { width: 100%; }
  .ui-head-tools { width: 100%; }
  .ui-switch select { flex: 1; max-width: none; }
  .ui-switch .cb-trigger { flex: 1; max-width: none; }
  .ui-tabs { padding: 0 2rem 0 1rem; gap: 1.1rem; }   /* rechts so breit wie das Ausblenden */
  .ui-tabs-sec { padding-left: 1.1rem; gap: 1.1rem; }
}

/* Seite Alarme (core/alarms.html): Filter, Chips je Anlagenteil, Gruppen mit Zeilen */
.alarms-sub { margin-top: .2rem; }
/* Filter als <details>: am Handy zu, solange keiner gesetzt ist; ab 761 px offen ohne Kopfzeile */
.alarms-filter-box { padding: 0; }
.alarms-filter-box > summary { display: flex; align-items: center; gap: .6rem; padding: .8rem 1.1rem; cursor: pointer;
  list-style: none; font-size: .92rem; font-weight: 600; color: var(--ink); min-height: 44px; }
.alarms-filter-box > summary::-webkit-details-marker { display: none; }
.alarms-filter-box > summary::after { content: ''; width: 16px; height: 16px; margin-left: auto; flex: none;
  background: currentColor; color: var(--muted); transition: transform .15s;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6.5L8 10l3.5-3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; }
.alarms-filter-box[open] > summary::after { transform: rotate(180deg); }
.alarms-filter-box > summary:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 10px; }
.alarms-filter-active { padding: .05rem .5rem; border-radius: 999px; background: var(--solid); color: #fff;
  font-size: .74rem; font-weight: 600; }
.alarms-filter-box > .alarms-filter { padding-top: .2rem; }
@media (min-width: 761px) {
  .alarms-filter-box[open] > summary { display: none; }
  .alarms-filter-box > .alarms-filter { padding-top: .9rem; }
}
.alarms-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem 1rem; padding: .9rem 1.1rem; }
.alarms-filter label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.alarms-filter select, .alarms-filter input { min-width: 10rem; padding: .42rem .55rem; border: 1px solid var(--field-line);
  border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: .9rem; }
.alarms-filter .alarms-q { flex: 1 1 12rem; }
.alarms-filter .alarms-q input { width: 100%; }
.alarms-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: -.3rem 0 1rem; }
.alarms-chips a { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .8rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--paper); color: var(--ink-2); font-size: .85rem; text-decoration: none; }
.alarms-chips a:hover { border-color: var(--ink-brand); }
.alarms-chips a[aria-current="true"] { background: var(--solid); border-color: var(--solid); color: #fff; }
.alarms-chips .ico { width: 15px; height: 15px; }
.alarms-group .card-head h2 { display: flex; align-items: center; gap: .5rem; }
.alarms-group .card-head .ico { width: 18px; height: 18px; color: var(--muted); }
.alarm-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: .8rem; align-items: center;
  padding: .7rem .3rem; border-top: 1px solid var(--row-line); color: var(--ink); text-decoration: none; }
.alarm-row:first-of-type { margin-top: .5rem; }
.alarm-row:hover { background: var(--row-hover); }
.alarm-row.ended { opacity: .7; }
.alarm-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.alarm-main .muted { overflow-wrap: anywhere; }
.alarm-meta { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; white-space: nowrap; }
.sev-pill { font-size: .72rem; font-weight: 600; border-radius: 5px; padding: .08rem .45rem; }
.sev-pill.crit { background: var(--status-crit); color: #fff; }
:root[data-theme="dark"] .sev-pill.crit { color: #3A0B08; }
.sev-pill.warn { background: rgba(242,184,75,.22); color: var(--gold-text); }
@media (max-width: 640px) {
  .alarms-filter label { flex: 1 1 45%; }
  .alarms-filter select, .alarms-filter input { min-width: 0; width: 100%; }
  .alarm-row { grid-template-columns: 12px minmax(0, 1fr); }
  .alarm-meta { grid-column: 2; flex-direction: row; align-items: center; gap: .6rem; }
  .alarms-chips a, .account-menu .theme-pick-options button, .acct-theme button { min-height: 36px; }
}

/* Berichte (core/plant/reports.html, Seite Berichte core/fleet_reports.html): Formular mit
   Beschriftungen, Status als Pille, Knoepfe nur fuer Mitarbeiter in der Zeile */
.rep-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem 1rem; margin: .4rem 0 .6rem; }
.rep-form > label { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.rep-form > label[hidden] { display: none; }
.rep-form select { min-width: 9rem; padding: .42rem .55rem; border: 1px solid var(--field-line); border-radius: 8px;
  background: var(--field); color: var(--ink); font: inherit; font-size: .9rem; }
.rep-form .rep-check { flex-direction: row; align-items: center; gap: .4rem; padding-bottom: .5rem; font-size: .85rem;
  color: var(--ink-2); }
.rep-form button[disabled] { opacity: .5; cursor: not-allowed; }
.rep-table .doc-link { display: inline-flex; align-items: center; gap: .25rem; }
.rep-table .doc-link .ico { width: 15px; height: 15px; }
.rep-actions { white-space: nowrap; text-align: right; }
.rep-act { display: inline; margin-left: .35rem; }
.rep-mini { padding: .1rem .5rem; font-size: .76rem; }
.rep-pend { color: var(--muted); font-style: italic; }
.rep-err { color: var(--coral-text); cursor: help; }
.rep-error td { background: rgba(233,108,99,.06); }
.rep-plant { color: var(--ink); text-decoration: none; }
.rep-plant:hover { text-decoration: underline; }
.rep-customer { display: block; }
.rep-st { display: inline-block; font-size: .74rem; font-weight: 600; border-radius: 5px; padding: .06rem .45rem;
  white-space: nowrap; }
.rep-st.ok { background: rgba(0,134,114,.1); color: var(--status-ok); }
.rep-st.part { background: var(--page); color: var(--ink-2); }
.rep-st.pend { background: rgba(60,110,220,.1); color: var(--blue); }
.rep-st.err { background: rgba(233,108,99,.13); color: var(--coral-text); cursor: help; }

/* Verwaltung (core/verwaltung.html): Unternavigation links, rechts Kennzahlen,
   Karten je Bereich und zwei Listen; schmal steht die Unternavigation als Zeile ueber den Karten */
.vw-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.vw-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.vw-nav { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 1px; padding: .5rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.vw-nav a { display: flex; align-items: center; gap: .55rem; padding: .42rem .55rem; border-radius: 7px;
  color: var(--ink-2); font-size: .88rem; font-weight: 500; text-decoration: none; }
.vw-nav a > span { flex: 1; }
.vw-nav .ico { width: 16px; height: 16px; color: var(--muted); }
.vw-nav a:hover { background: var(--row-hover); color: var(--ink); }
.vw-nav a[aria-current="page"] { background: var(--solid); color: #fff; }
.vw-nav a[aria-current="page"] .ico { color: var(--teal); }
.vw-navg { margin: .65rem .55rem .2rem; font-size: .68rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); }
.vw-badge { background: var(--status-crit); color: #fff; font-size: .7rem; border-radius: 999px; padding: 0 .42rem; line-height: 1.5; }
.vw-nav a.vw-admin { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); border-radius: 0;
  font-size: .8rem; color: var(--muted); }
.vw-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; }
.vw-card { display: flex; flex-direction: column; gap: .2rem; padding: .85rem 1rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.vw-card:hover { border-color: var(--ink-brand); }
.vw-card-head { display: flex; align-items: center; gap: .5rem; }
.vw-card-head .ico { width: 18px; height: 18px; color: var(--teal-text); }
.vw-card-n { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; }
.vw-card small { color: var(--muted); font-size: .8rem; }
.vw-card.warn { box-shadow: inset 3px 0 0 var(--status-warn); }
.vw-card.warn .vw-card-n { color: var(--gold-text); }
.vw-card.crit { box-shadow: inset 3px 0 0 var(--status-crit); }
.vw-card.crit .vw-card-n { color: var(--coral-text); }
.vw-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; align-items: start; }
.vw-split .card { margin: 0; }
.vw-split h2 { display: flex; align-items: center; gap: .5rem; }
.vw-split h2 .ico { width: 18px; height: 18px; color: var(--muted); }
.vw-list { list-style: none; margin: 0; padding: 0; }
.vw-list li { display: flex; flex-direction: column; gap: .1rem; padding: .5rem 0; border-top: 1px solid var(--row-line); }
.vw-list li:first-child { border-top: 0; padding-top: 0; }
.vw-list a { color: var(--blue); font-weight: 500; text-decoration: none; }
.vw-list a:hover { text-decoration: underline; }
.vw-list small { color: var(--muted); font-size: .8rem; }
@media (max-width: 1100px) {
  .vw-layout { grid-template-columns: minmax(0, 1fr); }
  .vw-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
  .vw-navg { display: none; }
  .vw-nav a { flex: none; white-space: nowrap; }
  .vw-nav a.vw-admin { margin: 0 0 0 .4rem; padding-top: .42rem; border-top: 0; border-left: 1px solid var(--line); }
}

/* Geraetezustand (core/health.py) und Logbuch: Pille je Zustand,
   Modus daneben, Liste der Geraete, Kacheln je Anlagenteil, Unterreiter */
.ui-health { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600;
  border-radius: 999px; padding: .05rem .55rem; white-space: nowrap; }
.ui-health::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ui-health.ok { background: rgba(0,194,168,.13); color: var(--status-ok); }
.ui-health.degraded { background: rgba(242,184,75,.18); color: var(--status-warn); }
.ui-health.down { background: rgba(233,108,99,.14); color: var(--status-crit); }
.ui-health.unknown { background: var(--page); color: var(--muted); border: 1px dashed var(--baseline); }
.ui-mode { font-size: .72rem; font-weight: 600; color: var(--ink-2); border: 1px solid var(--line);
  border-radius: 5px; padding: .02rem .4rem; white-space: nowrap; }
.sev-pill.info { background: var(--page); color: var(--muted); border: 1px solid var(--line); }

.ui-seg { display: inline-flex; gap: 2px; margin-bottom: 1rem; padding: 3px; border-radius: 9px; background: var(--line); }
.ui-seg a { padding: .35rem .9rem; border-radius: 7px; color: var(--ink-2); font-size: .88rem; font-weight: 500;
  text-decoration: none; }
#revenue-table.fixed .mv { display: none; }   /* feste Verguetung: Marktwert/-praemie gibt es nicht */
@media (max-width: 600px) { #revenue-table .mv { display: none; } }   /* Handy: Einspeisung und Summe sichtbar */
.src-check { accent-color: var(--solid); width: 1.1rem; height: 1.1rem; }   /* Geteilte Sensoren */
.ui-seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ui-seg a { white-space: nowrap; }
.ui-seg a[aria-current="page"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(8,29,58,.12); }

.ui-state.slim { padding: .75rem 1.4rem; }
.ui-state.slim h2 { margin: 0; font-size: 1rem; }
.ui-devices { list-style: none; margin: .6rem 0 0; padding: 0; columns: 2 22rem; column-gap: 2rem; }
.ui-devices:has(> li:only-child) { columns: 1; }
.ui-devices li { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .45rem 0;
  border-top: 1px solid var(--row-line); break-inside: avoid; }
.ui-dev-name { font-weight: 600; min-width: 7rem; }

.ui-parts { margin: .3rem 0 1.3rem; }
.ui-parts-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .4rem 1rem;
  margin-bottom: .6rem; }
.ui-parts-head h2 { margin: 0; }
.ui-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.ui-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: .9rem 1rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; color: var(--ink);
  text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.ui-tile:hover { border-color: var(--field-line); box-shadow: 0 2px 10px rgba(8,29,58,.06); }
.ui-tile.degraded { border-color: rgba(242,184,75,.55); box-shadow: inset 3px 0 0 var(--status-warn); }
.ui-tile.down { border-color: rgba(233,108,99,.5); box-shadow: inset 3px 0 0 var(--status-crit); }
.ui-tile.unknown { background: var(--row-alt); }
.ui-tile-head { display: flex; align-items: center; gap: .45rem; align-self: stretch; }
.ui-tile-head b { flex: 1; }
.ui-tile-line { color: var(--muted); font-size: .85rem; }
.ui-tile.degraded .ui-tile-line { color: var(--gold-text); font-weight: 500; }
.ui-tile.down .ui-tile-line { color: var(--coral-text); font-weight: 500; }
.ui-hdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--status-ok); }
.ui-hdot.degraded { background: var(--status-warn); }
.ui-hdot.down { background: var(--status-crit); box-shadow: 0 0 0 3px rgba(233,108,99,.2); }
.ui-hdot.unknown { background: var(--baseline); }
.ui-tile-head .ico { width: 18px; height: 18px; color: var(--muted); }

.ui-ups-facts .ui-facts { margin-bottom: .7rem; }
.ui-ups-rule { margin: 0; }
.ui-crumbs { margin-bottom: .8rem; font-size: .9rem; color: var(--muted); }
.ui-crumbs a { color: var(--blue); text-decoration: none; }
/* Seite einer Speicher-Einheit: Pfad links, ‹ vorige · naechste › rechts */
.ui-crumbs-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1rem; margin-bottom: .8rem; }
.ui-crumbs-row .ui-crumbs { margin-bottom: 0; }
.unit-step { display: flex; gap: .4rem; margin-left: auto; font-size: .85rem; }
.unit-step a, .unit-step-off { padding: .2rem .65rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.unit-step a:hover { border-color: var(--blue); color: var(--blue); }
.unit-step-off { color: var(--line); }
.su-more { display: inline-block; margin-top: .4rem; font-size: .8rem; color: var(--blue); text-decoration: none; }
.su-more:hover { text-decoration: underline; }
.sensor-chart { height: 260px; }

/* Abrechnung (core/plant/abrechnung.html, beleg.html, core/settlement.js) und
   Abrechnung aller Anlagen (core/fleet_settlement.html, settlement-fleet.js) */
.ui-st { display: inline-block; width: 1rem; margin-right: .25rem; text-align: center; line-height: 1; }
.ui-st.ok { color: var(--status-ok); }
.ui-st.dev { color: var(--status-warn); font-size: .82em; }
.ui-st.open { color: var(--muted); }
.ui-st.unchecked { color: var(--status-warn); font-size: 1.2em; }
.ui-settle td small, .ui-matrix td small, .ui-settle tfoot small { display: block; color: var(--muted); font-size: .74rem; }
.ui-settle-legend { margin: .7rem 0 0; }
.ui-settle-detail h3 { margin: 1.1rem 0 .4rem; font-size: .95rem; }
.ui-settle-detail .card-head { justify-content: flex-start; }
.ui-settle-detail .card-head [data-settle-close] { margin-left: auto; }
.ui-checks { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .45rem; }
.ui-checks li { display: grid; grid-template-columns: 1.2rem minmax(0, 1fr); gap: .4rem; }
.ui-checks small { display: block; color: var(--ink-2); font-size: .82rem; }
.ui-check-mark { font-weight: 700; }
.ui-checks li.ok .ui-check-mark { color: var(--status-ok); }
.ui-checks li.fail .ui-check-mark { color: var(--status-crit); }
.ui-checks li.note .ui-check-mark { color: var(--status-warn); }
.ui-tag { display: inline-block; padding: .05rem .4rem; border-radius: 4px; font-size: .74rem; font-weight: 600;
  background: rgba(0,134,114,.12); color: var(--status-ok); }
.ui-tag.manual { background: var(--page); color: var(--ink-2); border: 1px solid var(--line); }
.ui-settle-basis summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: baseline; }
.ui-settle-basis[open] summary { margin-bottom: .9rem; }
.ui-settle-basis .table-scroll { margin-top: 1rem; }
.ui-matrix th.ui-c, .ui-matrix td.ui-c { padding-left: .2rem; padding-right: .2rem; text-align: center; }
.ui-matrix td.ui-c a { display: inline-block; padding: .1rem .2rem; border-radius: 4px; text-decoration: none; }
.ui-matrix td.ui-c a:hover { background: var(--row-hover); }
.ui-matrix td.ui-c .ui-st { margin: 0; }
.ui-matrix td:first-child a { color: var(--ink); text-decoration: none; }
@media (max-width: 640px) {
  .ui-matrix td:first-child, .ui-matrix th:first-child { max-width: 8.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ui-matrix td:first-child small { display: none; }
  .ui-matrix td.ui-c a { padding: .45rem .4rem; min-width: 32px; }
}

/* Seite Konto (core/account.html, Neugestaltung M9) und Benachrichtigungen */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr)); gap: 0 1.2rem; }
.acct-note { margin: .8rem 0 0; }
.acct-head { margin-bottom: .9rem; }
.acct-h3 { margin: 1.3rem 0 .5rem; font-size: .95rem; }
.acct-theme { display: inline-flex; }
.acct-theme button { padding: .38rem 1rem; border: none; border-radius: 6px; background: none; color: var(--ink-2);
  font: inherit; font-size: .85rem; cursor: pointer; }
.acct-theme button:hover { color: var(--ink); }
.acct-theme button[aria-checked="true"] { background: var(--paper); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 3px rgba(8,29,58,.18); }
.acct-links { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.acct-links a { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; color: var(--ink);
  text-decoration: none; }
.acct-links a + a { border-top: 1px solid var(--line); }
.acct-links a::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.2rem; }
.acct-links a:hover { background: var(--page); }
.acct-links .ico { width: 18px; height: 18px; color: var(--muted); }
.acct-links span b { display: block; font-weight: 600; }
.acct-links span small { display: block; color: var(--muted); font-size: .8rem; }
.acct-form { max-width: 420px; }
.acct-form label:last-of-type { margin-bottom: .5rem; }
.acct-form :is(input, button):disabled { opacity: .55; cursor: not-allowed; }
.acct-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.acct-chips .chip { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .3rem .75rem;
  font-size: .85rem; text-decoration: none; }
.acct-chips .chip:hover { border-color: var(--ink-brand); }
.acct-chips .ico { width: 15px; height: 15px; }
.acct-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.acct-table :is(th, td) { padding: .45rem .5rem; border-bottom: 1px solid var(--line); text-align: left; }
.acct-table th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.acct-logout .ico { width: 16px; height: 16px; }
button.acct-logout { font-family: inherit; cursor: pointer; }
.acct-bottom { margin-top: .4rem; }
.acct-pw-title { margin-top: 0; }
.acct-ro { align-items: center; }
.notify-kinds { margin: 0 0 .8rem; padding-left: 1.2rem; line-height: 1.55; }
.notify-kinds li { margin-bottom: .3rem; }
.btn-small[data-off], .has-nav :is(.bu-actions button, .bu-grid input):disabled { opacity: .55; pointer-events: none; }

/* Reiter Geräte: Netzwerksuche des Edge (core/discovery.py) */
.lan-table td { white-space: normal; vertical-align: top; }
.lan-table td.num { white-space: nowrap; text-align: left; }
.lan-svc { margin: .1rem .35rem .1rem 0; font-family: var(--font-num); }
.lan-svc.lan-http, .lan-svc.lan-https { border-color: var(--status-ok); }
.lan-svc.lan-modbus { border-color: var(--status-warn); }
.lan-gone { opacity: .55; }
.lan-hidden { margin-top: .6rem; }
a.lan-open { text-decoration: none; cursor: pointer; }
a.lan-open:hover { background: var(--line); }

/* Tracker (docs/redesign/09): Kopfzahlen, Grund, DWD, Steuerung, Kacheln mit Stellung */
.trk-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper); overflow: hidden; }
.trk-stat { padding: .8rem 1rem; border-left: 1px solid var(--line); min-width: 0; }
.trk-stat:first-child { border-left: 0; }
.trk-stat b { display: block; font-size: 1.45rem; font-weight: 600; overflow-wrap: anywhere; }
.trk-stat.warn b { color: var(--status-warn); }
.trk-stat small { font-size: .8rem; font-weight: 400; }
.trk-stat span { color: var(--ink-2); font-size: .8rem; }
.trk-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.trk-panel h3 { margin: 0 0 .45rem; font-size: .95rem; }
.trk-panel p { margin: .2rem 0; }
.trk-why { font-size: 1.1rem; font-weight: 600; }
.trk-actions .card-head { margin-bottom: .6rem; }
.trk-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .5rem 0; }
.trk-buttons label { display: inline-flex; align-items: center; gap: .4rem; color: var(--ink-2); }
/* Felder wie in den Filtern (S15): Rahmen, Feldfarbe, Fokusring; Auswahl mit eigenem Pfeil (oben) */
.trk-buttons :is(select, input) { padding: .42rem .55rem; border: 1px solid var(--field-line); border-radius: 8px;
  background-color: var(--field); color: var(--ink); font: inherit; font-size: .9rem; }
.trk-buttons select { min-width: 5.5rem; }
.trk-buttons input { width: 5rem; }
.trk-buttons input:hover:not(:disabled) { border-color: var(--baseline); }
.trk-buttons input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.trk-buttons :is(button, select, input):disabled { opacity: .45; cursor: not-allowed; }
.trk-note { color: var(--status-warn); font-size: .88rem; }
/* Steuerkarte: oben der Stand (Automatik oder Eingriff mit Restzeit), darunter Gruppen */
.trk-now { display: grid; gap: .5rem; padding: .75rem 1rem; border: 1px solid var(--line); border-left: 4px solid var(--status-ok);
  border-radius: 10px; background: color-mix(in srgb, var(--status-ok) 5%, var(--paper)); }
.trk-now.manual { border-left-color: var(--status-warn); background: color-mix(in srgb, var(--gold) 8%, var(--paper)); }
.trk-now-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; }
.trk-now-row + .trk-now-row { padding-top: .5rem; border-top: 1px solid var(--line); }
.trk-now-text b { font-size: 1.05rem; }
.trk-now-label { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.trk-group { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.trk-group h3 { margin: 0; font-size: .92rem; }
.trk-group > p { margin: .1rem 0 0; }
.trk-leads summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.trk-leads summary .muted { font-weight: 400; }
.trk-leads[open] summary { margin-bottom: .3rem; }
/* Schalter und Zusatzgeraete (switches.js) */
.sw-list { display: grid; gap: 1rem; }
.sw-item + .sw-item { padding-top: 1rem; border-top: 1px solid var(--line); }
.sw-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; }
.sw-values { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: .3rem 0; }
.sw-history { margin: .4rem 0 0; padding-left: 1rem; }
.trk-warn { margin: .25rem 0; padding-left: .6rem; font-size: .88rem; border-left: 3px solid var(--status-warn); }
.trk-warn.off { border-left-color: var(--baseline); color: var(--muted); }
.trk-log { width: 100%; margin-top: .5rem; font-size: .82rem; border-collapse: collapse; }
.trk-log td { padding: .15rem .6rem .15rem 0; }
.trk-alerts { margin: 0; padding: 0; list-style: none; }
.trk-alerts li { padding: .3rem 0 .3rem .6rem; border-left: 3px solid var(--status-warn); }
.trk-alerts li.crit { border-left-color: var(--coral); }
/* Spalten setzt trackers.js (balance): gleich volle Reihen (8 Tracker 4 + 4 statt 7 + 1) */
.trk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: .7rem; }
.trk-tile { padding: .7rem; border: 1px solid var(--line); border-radius: 10px; font-size: .8rem; }
.trk-tile.degraded { border-color: var(--status-warn); background: color-mix(in srgb, var(--gold) 8%, var(--paper)); }
.trk-tile.down { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 6%, var(--paper)); }
.trk-tile svg { display: block; width: 100%; height: 44px; color: var(--ink); }
.trk-tile.unknown svg { color: var(--baseline); }
.trk-head { display: flex; justify-content: space-between; margin: .3rem 0; font-size: .9rem; }
.trk-tile p { margin: .25rem 0 0; color: var(--ink-2); }
.trk-tile.hand { border-style: dashed; }
.trk-tile .trk-hand { font-weight: 600; color: var(--ink); }
@media (max-width: 760px) {
  .trk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trk-stat { border-left: 0; border-top: 1px solid var(--line); }
  .trk-panels { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .trk-buttons :is(select, input) { font-size: 16px; }   /* iOS zoomt sonst beim Antippen */
  /* Handy: erst der Grund, dann der Link (im Kopf stuende er zwischen Ueberschrift und Wert) */
  .trk-why-card { display: flex; flex-direction: column; }
  .trk-why-card > .card-head { display: contents; }
  .trk-why-card > .card-head h2 { margin-bottom: .5rem; }
  .trk-why-card > .card-head > a { order: 1; align-self: flex-start; margin-top: .6rem; }
}

/* Unterreiter, die ein Skript ausblendet (ems.js initViews); eigene Klasse, damit hidden der Karte selbst bleibt */
.view-off { display: none !important; }

/* Logbuch der Anlage (core/plant/events.html, core/plant_log.py; Entwurf docs/redesign/55) */
.log-active { list-style: none; margin: .4rem 0 0; padding: 0; }
.log-active li { display: grid; grid-template-columns: auto minmax(12rem, 1.2fr) minmax(0, 1.5fr) auto; gap: .2rem 1rem;
  align-items: start; padding: .7rem .6rem; border-top: 1px solid var(--row-line); border-radius: 6px; }
.log-active li.crit { background: linear-gradient(90deg, rgba(233,108,99,.09), transparent 60%); }
.log-active li.warn { background: linear-gradient(90deg, rgba(242,184,75,.10), transparent 60%); }
.log-active .ui-hdot { margin-top: .35rem; }
.log-msg { color: var(--ink-2); font-size: .9rem; }
.log-when { text-align: right; white-space: nowrap; }
.log-filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem 1rem; padding: .9rem 1.2rem; }
.log-filter label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--muted); }
.log-filter select, .log-filter input[type="search"] { padding: .45rem .55rem; border: 1px solid var(--field-line);
  border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: .9rem; min-width: 9rem; }
.log-filter .log-q { flex: 1 1 14rem; }
.log-filter .log-infos { flex-direction: row; align-items: center; gap: .4rem; padding-bottom: .5rem; }
/* "Was bedeutet das?": Erklaerung unter Logbuch, Zaehlern und Geteilten Sensoren, zugeklappt */
.ui-explain { margin: .2rem 0 1rem; font-size: .88rem; color: var(--ink-2); }
.ui-explain summary { cursor: pointer; color: var(--muted); font-size: .85rem; width: fit-content; }
.ui-explain summary:hover { color: var(--ink); }
.ui-explain[open] summary { margin-bottom: .5rem; }
.ui-explain p, .ui-explain ul { margin: .4rem 0; max-width: 70ch; }
.ui-explain ul { padding-left: 1.2rem; }
@media (max-width: 760px) {
  .log-active li { grid-template-columns: auto 1fr; }
  .log-active .log-msg, .log-active .log-when { grid-column: 2; text-align: left; }
}

/* Zaehler-Zuordnung (core/plant/meters.html) */
.meter-why { margin: .2rem 0 .8rem; padding-left: 1.2rem; }
.meter-why li { margin-bottom: .35rem; }
.meter-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.meter-findings li { display: flex; gap: .6rem; align-items: baseline; }
.meter-findings .sev-pill { flex: none; }
.card p + .meter-findings { margin-top: .7rem; }
.meter-note { margin-top: .6rem; }
.sev-pill.ok { background: rgba(0,194,168,.16); color: var(--status-ok); }
.meter-table select { min-width: 19rem; max-width: 26rem; width: 100%; padding: .42rem .55rem; border: 1px solid var(--field-line);
  border-radius: 8px; background: var(--field); color: var(--ink); font: inherit; font-size: .88rem; }
.meter-table td.meter-now { white-space: normal; min-width: 16rem; }
.meter-sub { font-size: .95rem; margin: 1.6rem 0 .3rem; }
.meter-sub:first-of-type { margin-top: .2rem; }
.meter-actions { display: flex; gap: .8rem; align-items: center; margin-top: .9rem; }
.meter-errors { margin-bottom: .8rem; border-color: var(--status-crit); }

/* Reiter Kameras (core/plant/kameras.html, cameras.js) */
.cam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.cam-grid.cam-size-m { grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); }
.cam-grid.cam-size-l { grid-template-columns: 1fr; }
.cam-tile { border: 1px solid var(--line, #ddd); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
/* --ar/--arn: Seitenverhältnis der Kamera (API "aspect"); Bilder füllen die Fläche in
   diesem Verhältnis, auch wenn sie verzerrt ankommen (704x576 von einer 16:9-Kamera) */
.cam-view { --ar: 16 / 9; --arn: 1.7778; aspect-ratio: var(--ar); background: #0f1416; position: relative; overflow: hidden; }
.cam-size-l .cam-view { width: min(100%, calc(82vh * var(--arn))); margin: 0 auto; }
.cam-media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; }
.cam-media > span.muted { padding: .5rem; color: #B4BFCE; }   /* hell auf der dunklen Bildflaeche, auch im Hellmodus */
.cam-media video, .cam-media img { width: 100%; height: 100%; object-fit: fill; display: block; cursor: zoom-in; }
/* Vollbild: echtes Fullscreen, sonst (iPhone) über die ganze Seite */
.cam-view:fullscreen, .cam-view.cam-fs-page { aspect-ratio: auto; width: 100vw; height: 100vh; margin: 0; background: #000; }
.cam-view.cam-fs-page { position: fixed; inset: 0; z-index: 1000; height: 100dvh; }
:is(.cam-view:fullscreen, .cam-view.cam-fs-page) :is(video, img) { width: min(100vw, calc(100dvh * var(--arn))); height: auto;
  aspect-ratio: var(--ar); cursor: zoom-out; }
.cam-view .cam-fs { position: absolute; right: .4rem; bottom: .4rem; border: 0; border-radius: 6px; background: #000a; color: #fff;
  font-size: 1rem; line-height: 1; padding: .3rem .45rem; cursor: pointer; opacity: .8; }
.cam-view .cam-fs:hover, .cam-view .cam-fs:focus-visible { opacity: 1; }
.cam-actions select { font: inherit; font-size: .8rem; padding: .2rem .3rem; border: 1px solid var(--line); border-radius: 6px; }
.cam-meta { padding: .5rem .75rem 0; }
.cam-actions { padding: .5rem .75rem .75rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.cam-events { list-style: none; padding: 0; margin: 0; }
.cam-events li { padding: .2rem 0; }
.cam-rule { margin-top: .75rem; }
.cam-reason { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--page); }
.cam-reason label { display: block; font-weight: 600; margin-bottom: .4rem; }
.cam-reason-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.cam-reason-row input { flex: 1 1 18rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.cam-reason-set { margin: 0 0 1rem; }
.cam-reason.cam-reason-missing { border-color: var(--status-crit); }
.cam-reason.cam-reason-missing input { border-color: var(--status-crit); }
.cam-reason-error { color: var(--status-crit); font-weight: 600; margin: .4rem 0 0; }
.cam-view .cam-badge { position: absolute; z-index: 1; top: .4rem; left: .4rem; background: #000a; color: #fff; font-size: .75rem; padding: .1rem .45rem; border-radius: 6px; }
