/* Shared styles of the web pages. Colors, type and controls as defined in
   docs/design.md; layouts follow docs/mockups/*.html. */
:root {
  --bg: #F6FAF2;
  --surface: #FFFFFF;
  --border: #DCE8D6;
  --control-border: #CFDCC9;
  --grid: #E7EFE2;
  --text: #17241B;
  --text-secondary: #4F5F55;
  --text-muted: #7E8C83;
  /* Brand (logo, home page): green with the sun's yellow. */
  --green: #2F8F5B;
  --green-dark: #1E6B42;
  --green-light: #DDF0D8;
  --sun: #FFD95E;
  --nav: #14171A;
  --nav-active: #2A2E33;
  --nav-text: #D5D8DC;
  --nav-muted: #9DA4AC;
  /* Energy semantics (docs/design.md): never used for anything else. */
  --export: #1F5FA8;
  --export-light: #D3E0EF;
  --import: #B4531A;
  --import-light: #EFD9C8;
  --generation: #C98A14;
  --self: #E8C46A;
  --community-export: #A8C2DF;
  --grid-export: #E08B4F;
  --consumption: #14171A;
  --idle: #9DA4AC;
  --idle-light: #E4EBDD;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
}
a { color: var(--export); }
:focus-visible { outline: 2px solid var(--export); outline-offset: 2px; border-radius: 6px; }
/* Text fields and selects: the focus ring inside the field, same size and corners, so it stays in line with its neighbours. */
input:not([type="checkbox"]):not([type="radio"]):focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--export); box-shadow: inset 0 0 0 1px var(--export); border-radius: 10px; }
.side :focus-visible { outline-color: #FFFFFF; }
a:hover { color: #16457A; }
h1, h2, .num-big { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; }
h1 { margin: 0; font-size: 26px; letter-spacing: -0.4px; }
h2 { margin: 0; font-size: 18px; }
.subtitle { margin-top: 3px; font-size: 13px; color: var(--text-secondary); }
.muted { color: var(--text-secondary); }
.tabular { font-variant-numeric: tabular-nums; }

/* --- Frame: dark navigation on the left, content on the right ----------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 256px; flex-shrink: 0; padding: 22px 14px; background: var(--nav); color: #FFFFFF;
  display: flex; flex-direction: column; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 14px; padding: 0 10px; line-height: 1.35; color: #FFFFFF; text-decoration: none; }
.brand img { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.35); }
.brand em { font-style: normal; color: var(--sun); }
.brand:hover { color: #FFFFFF; }
.menu-toggle { display: none; }
.nav-links { display: flex; flex-direction: column; gap: 1px; }
.nav-links a {
  display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 10px; border-radius: 8px;
  text-decoration: none; font-size: 13.5px; color: var(--nav-text);
}
.nav-links a:hover { background: var(--nav-active); color: #FFFFFF; }
.nav-links a.sub { padding-left: 27px; font-size: 13px; color: var(--nav-muted); }
.nav-links a.sub2 { padding-left: 44px; font-size: 13px; color: var(--nav-muted); }
.nav-links a[aria-current="page"], .nav-links a.open { background: var(--nav-active); color: #FFFFFF; font-weight: 600; }
.nav-links svg { flex-shrink: 0; }
.nav-links .badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--sun); color: #17241B; font-size: 12px; font-weight: 600; text-align: center; }
.nav-links .spacer { width: 10px; display: inline-block; }
.side-foot { margin-top: auto; padding: 14px; border-radius: 14px; background: var(--nav-active); display: flex; flex-direction: column; gap: 12px; }
.account { display: flex; flex-direction: column; gap: 10px; }
.account-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--sun); color: #17241B; font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 14px; }
.account-name { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.account-name strong { color: #FFFFFF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name span { color: #B9BDC2; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { font-size: 11.5px; color: #B9BDC2; padding: 3px 9px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; align-self: flex-start; }
.account-actions { display: flex; gap: 6px; }
.foot-btn { flex: 1; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 10px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3); background: transparent; color: #FFFFFF; font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: none; }
.foot-btn:hover, .foot-btn[aria-current="page"] { border-color: #FFFFFF; }
.foot-btn.primary { background: #FFFFFF; color: #14171A; border-color: #FFFFFF; }
.foot-field { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid #3A3F45; }
.foot-form { display: flex; flex-direction: column; gap: 6px; }
.foot-form input { min-height: 36px; padding: 0 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.3); background: var(--nav); color: #FFFFFF; font: inherit; font-size: 13px; }
/* Band on top of the page while viewing as a role. */
.view-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 12px;
  background: #FFF3D6; border: 1px solid #E8C46A; color: #5A4310; font-size: 13.5px; }
.view-band .btn { min-height: 34px; }
.side-foot label { display: block; font-size: 11px; color: #B9BDC2; }
.side-foot .who { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; font-size: 13px; }
.side-foot .who span { font-size: 11px; color: #B9BDC2; }
.side-foot .logout {
  align-self: flex-start; margin-top: 6px; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent; color: #FFFFFF; font: inherit; font-size: 13px; cursor: pointer;
}
a.logout { display: inline-flex; align-items: center; text-decoration: none; }
.side-foot .logout[aria-current="page"] { border-color: #FFFFFF; }
.side-foot select {
  width: 100%; margin-top: 6px; min-height: 40px; padding: 0 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.3);
  background: var(--nav); color: #FFFFFF; font: inherit; font-size: 13px;
}
.content { flex-grow: 1; min-width: 0; }
.crumbs {
  min-height: 64px; padding: 0 32px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.crumbs a { color: var(--text-secondary); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs .sep { color: #B0AA9D; }
.crumbs .here { font-weight: 600; }
main { max-width: 1180px; padding: 26px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }

/* --- Cards, tiles, buttons, chips ---------------------------------------- */
.card { padding: 20px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; min-width: 0; box-shadow: 0 8px 24px rgba(30, 107, 66, 0.05); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.card h2, .card .title { font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 14px; font-weight: 600; }
.card .hint { margin-top: 2px; font-size: 12px; color: var(--text-secondary); }
.card-link { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }
.row { display: flex; gap: 20px; align-items: stretch; }
.row > .grow { flex-grow: 1; }
.side-col { width: 340px; flex-shrink: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.tile { padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; min-width: 0; }
.tile .label { font-size: 12px; color: var(--text-secondary); }
.tile .value { font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 22px; font-weight: 700; margin-top: 3px; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.tile .note { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.tile.big .value { font-size: 32px; letter-spacing: -0.8px; }
.eff-value { font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 32px; font-weight: 700; letter-spacing: -0.8px; margin-top: 8px; font-variant-numeric: tabular-nums; }
.tile.dark { background: var(--nav); border-color: var(--nav); color: #FFFFFF; }
.tile.dark .label, .tile.dark .note { color: #B9BDC2; }
.tile.accent { background: #F0F4F9; border-color: #D3E0EE; }
.bar { height: 8px; background: #E7EFE2; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.bar > div { height: 8px; border-radius: 4px; background: var(--export); }
.buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.buttons button, .btn {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--control-border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; text-decoration: none;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #FFFFFF; font-weight: 600; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.table-text th, .table-text td { text-align: left; }
.buttons button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #FFFFFF; font-weight: 600; }
.chip { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: #E7F0F8; color: var(--export); }
.chip.idle { background: #F1EFE9; color: var(--text-secondary); }
.chip.off { background: #F7E7DA; color: #8A3E12; }
/* Info circle with its text on hover or focus. */
.info { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 6px;
  border: 1.4px solid var(--text-muted); border-radius: 50%; color: var(--text-muted); font: italic 600 11px/1 Georgia, serif; cursor: help; vertical-align: middle; }
.info:hover, .info:focus-visible { color: var(--text); border-color: var(--text); outline: none; }
.info::after { content: attr(data-tip); position: absolute; z-index: 20; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: min(320px, 80vw); padding: 10px 12px; border-radius: 10px; background: var(--text); color: var(--surface);
  font: 400 13px/1.45 inherit; font-style: normal; text-align: left; white-space: normal; box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  pointer-events: none; display: none; }
/* Not shown, it takes no room: a hidden tooltip must not widen the page on a phone. */
.info:hover::after, .info:focus-visible::after { display: block; }

/* When a car is plugged in: weekdays × hours, darker = more often. */
/* Green scale: strong = almost always plugged in, pale = rarely, white = never. */
.presence { display: grid; grid-template-columns: 28px repeat(24, minmax(10px, 1fr)); gap: 2px; margin-top: 10px; font-size: 11px; color: var(--text-muted); }
.presence .cell { height: 22px; border-radius: 3px; border: 1px solid #DCE8D6; background: #FFFFFF; display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-variant-numeric: tabular-nums; color: #1D4A31; overflow: hidden; }
.presence .cell.dark { color: #FFFFFF; border-color: transparent; }
.presence .cell.none { background: repeating-linear-gradient(135deg, #F1EEE8 0 3px, #FFFFFF 3px 6px); }
.presence .head { text-align: center; }
.presence-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.presence-scale .swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid #DCE8D6; vertical-align: -3px; margin-right: 4px; }
@media (max-width: 760px) {
  .presence { grid-template-columns: 22px repeat(24, minmax(6px, 1fr)); gap: 1px; }
  .presence .cell { font-size: 0; height: 16px; border-radius: 2px; }
}

/* Warning sign for missing settings, in the menu and on the cards. */
.warn-sign { display: inline-flex; align-items: center; margin-left: auto; padding-left: 6px; }
h2 .warn-sign { margin-left: 6px; padding-left: 0; vertical-align: -2px; }
.warn-note { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: #FBF3DC; color: #5C4300; font-size: 13px; }
.warn-note .warn-sign { margin: 1px 0 0; padding: 0; }

/* Location map from OpenStreetMap tiles, drawn in the page. */
.map { position: relative; height: 240px; margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #E7EFE2; cursor: crosshair; }
.map .map-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; }
.map .map-pin { position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -27px 0 0 -14px; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.map .map-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.map .map-zoom button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--control-border); background: var(--surface); font-size: 16px; line-height: 1; cursor: pointer; }
.map .map-credit { position: absolute; right: 0; bottom: 0; padding: 2px 6px; font-size: 11px; background: rgba(255, 255, 255, 0.85); color: var(--text-secondary); }

/* Legal texts: readable line length, headings close to their paragraph. */
.legal h2 { margin: 18px 0 4px; font-size: 15px; }
.legal p { margin: 0; line-height: 1.55; max-width: 65ch; }
.legal .note-box { margin-top: 18px; }

/* Text areas in forms look like the inputs. */
.field textarea { padding: 8px 12px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; resize: vertical; }
.field label > input, .field label > select, .field label > textarea { display: block; width: 100%; margin-top: 6px; box-sizing: border-box; }

/* Platform: partners as blocks with their users and actions. */
.partner-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.partner { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.partner.ended { opacity: 0.6; }
.partner-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.partner-users { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.partner-actions { margin-top: 10px; align-items: center; flex-wrap: wrap; }
.partner-actions .user-email { min-height: 44px; padding: 0 12px; border: 1px solid var(--control-border); border-radius: 10px; font: inherit; min-width: 0; flex: 1 1 200px; }
.chip-x { border: 0; background: transparent; cursor: pointer; font: inherit; padding: 0 0 0 4px; color: var(--text-secondary); }

/* The price band that applies now. */
tr.current td { font-weight: 600; background: #F0F4F9; }

/* Forecast page: key figures in a row, charts below. */
.prognosis-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

/* Device states with a symbol (running, locked, car at the charger). */
.chip.flag { display: inline-flex; align-items: center; gap: 5px; }
.chip.flag svg { width: 14px; height: 14px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tile .value.flag-value { display: flex; align-items: center; gap: 8px; }
.tile .value.flag-value svg { width: 22px; height: 22px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
a.obj, div.obj {
  display: block; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  color: var(--text); text-decoration: none; min-width: 0;
}
a.obj:hover { border-color: #C3D2BC; color: var(--text); }
.obj .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.obj .name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.obj .kind { font-size: 12px; color: var(--text-secondary); }
.obj .desc { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.obj .value { font-family: 'Space Grotesk', system-ui, sans-serif; font-size: 22px; font-weight: 700; margin-top: 8px; font-variant-numeric: tabular-nums; }
.obj .value.none { color: #9AA1A8; }
.imp { color: var(--import); }
.exp { color: var(--export); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 4px; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid #F1EFE9; }
.list li:first-child { border-top: 0; }
.list a { color: var(--text); text-decoration: none; }
.list a:hover { text-decoration: underline; }
.list .grow { flex-grow: 1; min-width: 0; }
.list .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.list .num { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 15px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.note-box { font-size: 12px; color: var(--text-muted); }
.empty { padding: 40px 0; text-align: center; color: var(--text-secondary); font-size: 14px; }

/* --- Forms (management) ---------------------------------------------------- */
.public-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.public-head select { min-height: 34px; padding: 0 8px; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
/* Page «Gerätebibliothek». */
.lib-filter { display: flex; flex-direction: column; gap: 10px; }
.lib-filter input { min-height: 44px; padding: 0 12px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; max-width: 420px; }
.choices-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #FFFFFF; }
.chip-btn[aria-pressed="true"] .muted { color: #C9CDD2; }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 14px; }
.lib-item { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.lib-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.lib-products { font-size: 12px; margin-top: 4px; }
.lib-facts { margin: 10px 0 0; display: grid; gap: 4px; font-size: 13px; }
.lib-facts div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.lib-facts dt { color: var(--text-secondary); }
.lib-facts dd { margin: 0; }
.lib-missing { display: grid; gap: 8px; margin-top: 12px; }
.lib-group { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; }
.lib-group summary { cursor: pointer; }
.lib-names { columns: 2 260px; margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.lib-names li { break-inside: avoid; }

/* Page «Regelung»: the cycle in steps, the surplus as a waterfall, checks. */
.flow-steps { list-style: none; counter-reset: step; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.flow-steps li { counter-increment: step; position: relative; padding: 12px 14px 12px 44px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.flow-steps li::before { content: counter(step); position: absolute; left: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); color: #FFFFFF; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.flow-steps .step-head { font-weight: 600; font-size: 14px; }
.flow-steps .step-text { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.flow-steps .step-value { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 15px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.waterfall { margin-top: 14px; display: grid; gap: 6px; }
.wf-row { display: grid; grid-template-columns: minmax(110px, 30%) 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.wf-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-track { position: relative; height: 20px; background: var(--grid); border-radius: 4px; }
.wf-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; background: var(--export); }
.wf-row.plus .wf-bar { background: var(--community-export); }
.wf-row.minus .wf-bar { background: repeating-linear-gradient(135deg, #9DA4AC 0 3px, #C9CDD2 3px 6px); }
.wf-row.take .wf-bar { background: var(--self); }
.wf-row.total .wf-bar { background: var(--text); }
.wf-row.total { font-weight: 600; }
.wf-value { text-align: right; font-variant-numeric: tabular-nums; }
.hp-checks { display: grid; gap: 12px; margin-top: 12px; }
.hp-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.hp-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.check-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.check-list li { display: flex; gap: 8px; align-items: baseline; }
.check { font-weight: 700; width: 14px; flex-shrink: 0; }
.check.yes { color: #1E7A46; }
.check.no { color: var(--import); }
@media (max-width: 600px) { .wf-row { grid-template-columns: 104px 1fr 72px; } .wf-label { white-space: normal; line-height: 1.2; } }
.edit-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; background: #FBF1DD; border: 1px solid #EBD9A6; border-radius: 12px; font-size: 13px; }
.control-list { display: grid; gap: 12px; margin-top: 12px; }
.control-item { padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.control-item .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.control-item .name { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }
.control-item .meta { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.control-item .buttons { margin-top: 10px; }
.pause-row { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.pause-row label { font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .btn { min-width: 48px; min-height: 48px; padding: 0; font-size: 20px; justify-content: center; }
.stepper input { width: 84px; min-height: 48px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 18px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.control-item .btn { min-height: 44px; }
.install-hint { display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; background: #F0F4F9; border: 1px solid #D3E0EE; border-radius: 12px; font-size: 13px; }
.install-hint span { flex: 1 1 180px; }
.install-hint a { font-weight: 600; color: var(--text); }
@media (max-width: 760px) { .install-hint { display: flex; } }
.offline-bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50; padding: 8px 16px; background: #5A4A12; color: #FFFFFF; font-size: 13px; text-align: center; }
.steps { margin: 8px 0 0; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(20, 23, 26, 0.45); }
.dialog-body { padding: 20px 22px; }
.dialog-body h2 { margin: 0; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 14px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.field label { color: var(--text-secondary); }
.field select, .field input {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px;
}
.choices { border: 0; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.choices legend { font-size: 13px; margin-bottom: 6px; }
.choice {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--control-border); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 14px;
}
.choice input { width: 16px; height: 16px; accent-color: var(--export); }
.choice:has(input:checked) { border: 2px solid var(--export); background: #F4F8FC; }
.status { font-size: 13px; }

/* --- Flow chain (docs/design.md, Flussschema) ----------------------------- */
.chain {
  padding: 22px 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.station {
  display: flex; flex-direction: column; align-items: center; gap: 8px; flex-shrink: 0; text-align: center;
  color: var(--text); text-decoration: none; padding: 6px; border-radius: 12px; min-width: 96px;
}
a.station:hover { background: #F7F5F0; color: var(--text); }
.station .name { font-size: 13px; font-weight: 600; }
.station .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.houses { display: flex; align-items: flex-end; gap: 4px; }
.link {
  flex-grow: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--idle);
}
.link.import { color: var(--import); }
.link.export { color: var(--export); }
.link .value { font-family: 'Space Grotesk', system-ui, sans-serif; font-weight: 700; line-height: 1; letter-spacing: -1px; font-size: 30px; font-variant-numeric: tabular-nums; }
.chain.two .link .value { font-size: 44px; letter-spacing: -1.2px; }
.link .direction { font-size: 13px; font-weight: 500; text-align: center; }
.link .line { width: 100%; max-width: 320px; height: 20px; overflow: visible; }
.link .line .base { stroke: var(--idle-light); }
.link.import .line .base { stroke: var(--import-light); }
.link.export .line .base { stroke: var(--export-light); }
.link .line .dashes { stroke: currentColor; stroke-dasharray: 16 12; }
.link .line .arrow { fill: currentColor; }
.link.import .line .dashes { animation: flow-right var(--duration, 1.1s) linear infinite; }
.link.export .line .dashes { animation: flow-left var(--duration, 1.1s) linear infinite; }
@keyframes flow-right { to { stroke-dashoffset: -28; } }
@keyframes flow-left { to { stroke-dashoffset: 28; } }
@media (prefers-reduced-motion: reduce) {
  .link .line .dashes { animation: none !important; }
}
.status-line { font-size: 13px; color: var(--text-secondary); text-align: center; font-variant-numeric: tabular-nums; }
.status-line.stale { color: var(--import); }

/* --- Findings -------------------------------------------------------------- */
.findings ul { margin: 6px 0 0; padding: 0; list-style: none; }
.findings li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 13px; line-height: 1.45; }
.findings li + li { border-top: 1px solid var(--border); }
.findings svg { flex-shrink: 0; margin-top: 2px; color: var(--text-secondary); }
.findings .why { color: var(--text-secondary); }

/* --- Energy chart (docs/design.md, Verlaufsdiagramm) ----------------------- */
.chart { position: relative; margin-top: 14px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.axis { font-size: 11px; fill: var(--text-secondary); font-family: 'IBM Plex Sans', system-ui, sans-serif; }
/* Legend: plain entries side by side; grouped ones (flow charts) as rows of
   «title · entries» that sit next to each other where there is room and
   stack on the phone, no separators that could end up alone on a line. */
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 14px; font-size: 12px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend:has(.legend-title) { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 20px; }
/* The title in its own column: wrapped entries line up under the first. */
.legend-group { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; min-width: 0; }
.legend-group:has(.legend-title) { padding-left: 92px; }
.legend-title { position: absolute; left: 0; top: 5px; width: 88px; font-weight: 600; color: var(--text); }
.legend > .incomplete { grid-column: 1 / -1; padding: 3px 8px 0 0; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--text-secondary); font: inherit; font-size: 12px; cursor: pointer; }
.legend-item:hover { border-color: var(--border); }
.legend-item[aria-pressed="false"] { opacity: 0.45; text-decoration: line-through; }
.legend-item:focus-visible { outline: 2px solid var(--export); outline-offset: 1px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend i.line { width: 14px; height: 3px; border-radius: 2px; }
.legend .incomplete i { background: repeating-linear-gradient(45deg, #C3D2BC 0 2px, transparent 2px 4px); border: 1px solid #C3D2BC; }
.tooltip {
  position: absolute; pointer-events: none; min-width: 210px; padding: 10px 12px; z-index: 2;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(20, 23, 26, .12); font-size: 12px; line-height: 1.6;
}
.tooltip b { display: block; font-size: 13px; margin-bottom: 2px; }
.tooltip .trow { display: flex; justify-content: space-between; gap: 16px; }
.tooltip .trow span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.tooltip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tooltip .num { font-variant-numeric: tabular-nums; }
details { margin-top: 14px; font-size: 13px; }
summary { cursor: pointer; color: var(--text-secondary); min-height: 44px; display: flex; align-items: center; }
.table-wrap { overflow-x: auto; max-height: 380px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { position: sticky; top: 0; background: var(--surface); font-weight: 600; }

/* Tab bar of the mobile app, only on narrow screens (docs/mockups/Mobil.html). */
.tabbar { display: none; }
.place-select { display: none; flex: 0 1 auto; max-width: 58vw; min-height: 40px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 10px;
  background: var(--nav); color: #FFFFFF; font: inherit; font-size: 14px; text-overflow: ellipsis; }

/* --- Narrow screens: navigation on top, chain vertical (docs/design.md) --- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { width: auto; padding: 10px 16px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
  .brand { padding: 0; }
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 10px; background: transparent; color: #FFFFFF; cursor: pointer;
  }
  .nav-links, .side-foot { display: none; width: 100%; }
  .app-view .menu-toggle { display: none; }
  .app-view .place-select { display: block; flex: 1 1 auto; max-width: none; }
  /* With a place to choose the place is the title: no brand beside it. */
  .app-view .side:has(.place-select) .brand { display: none; }
  .side.open .nav-links, .side.open .side-foot { display: flex; }
  .side.open .side-foot { display: block; margin-top: 4px; }
  .crumbs { padding: 10px 16px; min-height: 0; }
  main { padding: 18px 16px 32px; }
  body:has(.tabbar) .app { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .tabbar {
    display: flex; justify-content: space-around; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 72px; min-height: 48px; justify-content: center;
    text-decoration: none; color: var(--text-secondary); font-size: 12px; border-radius: 10px; }
  .tabbar a[aria-current="page"] { color: var(--export); font-weight: 600; }
  .tabbar a:focus-visible { outline: 2px solid var(--export); outline-offset: -2px; }
  .tabbar .badge { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--import); color: #FFFFFF; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
  .row { flex-direction: column; }
  .side-col { width: auto; }
  /* Chain as a compact list, grid on top (docs/mockups/Mobil.html). */
  .chain { flex-direction: column; align-items: stretch; padding: 10px 8px; gap: 0; }
  .station { flex-direction: row; justify-content: flex-start; text-align: left; gap: 12px; padding: 7px 11px; min-width: 0; min-height: 44px; }
  .station > svg { width: 34px; height: 34px; flex-shrink: 0; }
  .station .houses { width: 34px; justify-content: center; flex-shrink: 0; gap: 1px; }
  .station .houses svg { width: 17px; height: 15px; }
  .station .houses svg:nth-child(n+3) { display: none; }
  .link { flex-direction: row; justify-content: flex-start; align-items: center; gap: 8px; padding-left: 13px; min-height: 36px; }
  .link .line { order: -1; flex-shrink: 0; width: 34px; height: 12px; transform: rotate(90deg); }
  .link .value, .chain.two .link .value { font-size: 16px; letter-spacing: 0; }
  .link .direction { font-size: 12px; color: var(--text-secondary); }
  .tile.big .value { font-size: 24px; letter-spacing: -0.4px; }
  .tile .value { white-space: nowrap; }
  /* Range buttons share one row (docs/mockups/Mobil.html). */
  .card-head .buttons, .page-head .buttons { width: 100%; flex-wrap: nowrap; gap: 5px; }
  .card-head .buttons button, .page-head .buttons button { flex: 1 1 0; min-width: 0; padding: 0 6px; justify-content: center; font-size: 13px; }
  /* A lone icon button (remove) keeps its size at the end of the row. */
  .page-head .buttons:has(> .icon-only:only-child) { justify-content: flex-end; }
  .page-head .buttons button.icon-only:only-child { flex: 0 0 44px; }
}
@media (min-width: 901px) {
  /* Navigation stays in view while the content scrolls. */
  .side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}

/* Navigation: main entries (community, Auswertung, Benutzer, Einstellungen)
   on one level; the community and Auswertung fold in and out. */
.nav-links a.top { color: #FFFFFF; font-weight: 600; }
.nav-row { display: flex; align-items: center; border-radius: 8px; margin-top: 6px; }
.nav-row:first-child { margin-top: 0; }
.nav-row:hover { background: var(--nav-active); }
.nav-row a.top { flex: 1; padding-left: 0; }
.nav-row a.top:hover { background: transparent; }
.nav-row.current { background: var(--nav-active); }
.nav-links > a.top { margin-top: 6px; }
.twisty { width: 27px; min-height: 36px; padding: 0 0 0 10px; border: 0; background: transparent; color: var(--nav-muted); cursor: pointer; display: flex; align-items: center; border-radius: 8px 0 0 8px; }
.twisty:hover { color: #FFFFFF; }
.twisty svg { transition: transform 0.15s; }
.twisty[aria-expanded="false"] svg { transform: rotate(-90deg); }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .twisty svg { transition: none; } }
.side-foot .badge { margin-left: 8px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--sun); color: #17241B; font-size: 12px; font-weight: 600; text-align: center; }

/* Tabs of the own account (profile, notifications). */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin-top: -6px; }
.tabs a { padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-secondary); text-decoration: none; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

/* Structure of the community (settings): community, properties, units. */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 22px; padding-left: 18px; border-left: 2px solid var(--grid); display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.tree li { position: relative; }
.tree ul > li::before { content: ""; position: absolute; left: -18px; top: 24px; width: 16px; border-top: 2px solid var(--grid); }
.node { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.node.root { background: var(--bg); }
.node .name { font-weight: 600; }
.node .meta { color: var(--text-secondary); font-size: 13px; }
.node .actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; }
.node .actions .btn, .node-form .btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
.node-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; padding: 10px 14px; border: 1px dashed var(--control-border); border-radius: 12px; }
.node-form input, .node-form select { min-height: 34px; padding: 0 10px; border: 1px solid var(--control-border); border-radius: 8px; font: inherit; background: var(--surface); }
.node-form input { flex: 1 1 180px; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; }
/* Adding as the last tile of a list of devices or gateways. */
.add-tile { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 110px; border: 1.5px dashed var(--control-border);
  background: transparent; color: var(--text-secondary); font: inherit; font-weight: 500; cursor: pointer; }
.add-tile:hover { border-color: var(--text); color: var(--text); background: var(--surface); }
.add-tile:focus-visible { outline: 2px solid var(--export); outline-offset: 2px; }
/* Jump links to the sections of a property or unit. */
.section-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.section-nav:empty { display: none; }
.section-nav a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 13px; }
.section-nav a:hover { border-color: var(--text); }
.section { scroll-margin-top: 16px; }
.icon-only, .node .actions .icon-only { width: 34px; min-height: 34px; padding: 0; justify-content: center; }
.icon-btn svg, .icon-only svg { flex-shrink: 0; }
.icon-only.danger:hover, .icon-only.armed { color: var(--import); border-color: var(--import); }
.icon-only:disabled { opacity: 0.35; cursor: default; }
.node a.name { color: var(--text); text-decoration: none; }
.node a.name:hover { text-decoration: underline; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
p.status:empty { display: none; }
pre.code { margin: 8px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; overflow-x: auto; }
.obj .kind svg { vertical-align: -3px; }
.share-cell { font-variant-numeric: tabular-nums; color: var(--text-secondary); }

/* Tariff kind in the structure tree: 1 = single, 2 = dual tariff; dashed when inherited. */
.tariff-mark { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 8px; flex: none;
  border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface); color: var(--text); font: 600 12px/1 inherit; cursor: pointer; }
.tariff-mark.inherited { border-style: dashed; color: var(--text-muted); }
.tariff-mark:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
