:root {
  --bg: #050a12;
  --text: #f2f6fb;
  --muted: #c9d6e8;
  --dim: #8fa3bf;
  --or: #ff8a1f;
  --or2: #ffb547;
  --pv: #ff9d2e;
  --house: #2fa8ff;
  --bat: #3dffb5;
  --grid: #b89aff;
  --cyan: #42cfff;
  --glass: linear-gradient(165deg, rgba(22, 30, 46, .58), rgba(6, 10, 20, .74));
  --edge: rgba(255, 138, 31, .75);
  --glow: 0 0 16px rgba(255, 120, 20, .32), inset 0 0 18px rgba(255, 120, 20, .07);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
.bg { position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(5, 10, 18, .55), rgba(5, 10, 18, .78)), url('/huawei-haus-abend.png?v=3') center / cover no-repeat,
              linear-gradient(180deg, #1b2539 0%, #33344a 40%, #6e4a39 80%, #9a6038 100%); }
.wrap { max-width: 1320px; margin: 0 auto; padding: 18px 16px 28px; display: flex; flex-direction: column; gap: 16px; }
.glass { background: var(--glass); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--edge); border-radius: 14px; box-shadow: var(--glow); }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* Kopf */
.head { display: flex; align-items: center; gap: 20px; padding: 14px 20px; flex-wrap: wrap; }
.brand .logo { height: 70px; width: auto; display: block; }
.ttl { flex: 1 1 260px; min-width: 0; }
.ttl h1 { font-size: 24px; }
.sub { margin: 6px 0 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.live { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em;
  color: #ff9d4a; border: 1px solid rgba(255, 138, 31, .7); background: rgba(255, 138, 31, .12); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--or); box-shadow: 0 0 6px var(--or); animation: blink 1.6s ease-in-out infinite; }
.live.off { color: var(--dim); border-color: rgba(140, 160, 190, .5); background: rgba(140, 160, 190, .1); } .live.off i { background: var(--dim); box-shadow: none; animation: none; }
.meta { display: flex; align-items: center; gap: 20px; }
.clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.clock b { font-size: 30px; } .clock span { font-size: 13px; color: var(--muted); }
.wx { display: flex; align-items: center; gap: 10px; padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, .25); }
.wx b { display: block; font-size: 22px; } .wx span { font-size: 13px; color: var(--muted); }
.wxi svg { width: 40px; height: 40px; display: block; filter: drop-shadow(0 0 8px rgba(255, 157, 46, .7)); }

/* Raster */
.grid { display: grid; gap: 14px; }
.g-charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-flow { grid-template-columns: minmax(0, 1fr); }
.g-tanks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 1101px) { .g-tanks:has(> [hidden] ~ [hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.g-kpi { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-rooms { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.span2 { grid-column: span 2; }
.card { padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tag { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: #9fd8ff; border: 1px solid rgba(120, 190, 255, .55); background: rgba(80, 160, 255, .1); padding: 1px 6px; border-radius: 6px; text-transform: uppercase; }
.sect { display: flex; align-items: center; gap: 12px; font-size: 17px; margin-top: 4px; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.sect::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 138, 31, .85), rgba(255, 138, 31, 0)); box-shadow: 0 0 6px rgba(255, 138, 31, .6); }

/* Kennzahlen */
.kpi { padding: 12px 14px; display: grid; grid-template-columns: 46px minmax(0, 1fr); grid-template-areas: "i n" "i v" "i s"; column-gap: 12px; align-items: center; }
.kpi .ic { grid-area: i; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 28%, rgba(70, 95, 130, .95), rgba(5, 9, 18, .95) 68%); border: 2px solid var(--c); box-shadow: 0 0 14px var(--c); }
.kpi .ic svg { width: 22px; height: 22px; stroke: var(--c); filter: drop-shadow(0 0 4px var(--c)); }
.kpi .n { grid-area: n; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { grid-area: v; font-size: 22px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.kpi .v small, .room small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.kpi .s { grid-area: s; font-size: 12px; font-weight: 600; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Energiefluss am Hausfoto */
.flowcard { position: relative; overflow: hidden; padding: 0; }
.ftitle { position: absolute; left: 16px; top: 12px; z-index: 2; display: flex; align-items: center; gap: 8px; font-size: 15px; padding: 5px 10px; border-radius: 10px;
  background: rgba(7, 11, 20, .6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.flow svg { width: 100%; height: auto; display: block; }
.flow text { font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
.flow .fv { fill: #fff; font-weight: 700; }
.flow .fs { font-weight: 600; }
.flow .fl path { fill: none; stroke-linecap: round; }
.flow .fl .base { opacity: .3; }
.flow .fl .run, .flow .fl .dot { opacity: 0; transition: opacity .4s; }
.flow .fl.on .run { opacity: .95; animation: fdash 1s linear infinite; }
.flow .fl.on.rev .run { animation-direction: reverse; }
.flow .fl.on .dot { opacity: .95; }
.flow .fn .halo { transform-box: fill-box; transform-origin: center; }
.flow .fn.on .halo { animation: fhalo 2.4s ease-out infinite; }
@keyframes fdash { to { stroke-dashoffset: calc(-30px * var(--k, 1)); } }
@keyframes fhalo { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.35); opacity: 0; } }

/* Diagramme */
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { fill: var(--dim); font-size: 10px; }
.chart .gl { stroke: rgba(150, 175, 210, .14); stroke-dasharray: 3 3; }
.chart .now { stroke: #2fa8ff; stroke-dasharray: 4 4; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend span::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); }

/* Tanks & Akku (wie im Dashboard) */
.tk { display: flex; align-items: center; gap: 18px; --bgc: #0a1220; }
.tw { position: relative; flex: 0 0 auto; display: flex; align-items: stretch; gap: 6px; padding-top: 9px; }
.tank { position: relative; width: 96px; height: 170px; padding: 5px; border: 2px solid rgba(220, 236, 255, .6); border-radius: 18px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02) 40%, rgba(255, 255, 255, .07));
  box-shadow: 0 0 18px color-mix(in srgb, var(--c1) 55%, transparent), inset 0 0 10px rgba(0, 0, 0, .6); }
.tank::before { content: ''; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); width: 32px; height: 7px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #e9eef4, #7d8896); }
.tank.cell { border-radius: 14px; }
.in { position: relative; width: 100%; height: 100%; border-radius: 12px; overflow: hidden; isolation: isolate; clip-path: inset(0 round 12px); background: var(--bgc); }
.liq { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; transition: height 1.2s ease;
  background: linear-gradient(90deg, var(--c2), var(--c1) 38%, color-mix(in srgb, var(--c1) 60%, #fff) 50%, var(--c1) 62%, var(--c2)); }
.liq::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(0, 0, 0, .25)); }
.wv { position: absolute; left: 0; top: -1px; width: 200%; height: 7px; z-index: 2; animation: wave 3s linear infinite; }
.wv path { fill: var(--bgc); }
.sg { position: absolute; left: 6px; right: 6px; height: 2px; margin-bottom: -1px; background: var(--bgc); opacity: .85; z-index: 2; }
.glass2 { position: absolute; left: 7px; top: 7px; bottom: 7px; width: 7px; border-radius: 4px; z-index: 4; background: linear-gradient(180deg, rgba(255, 255, 255, .35), rgba(255, 255, 255, .08)); }
.lvl { position: absolute; left: 0; right: 0; height: 2px; margin-bottom: -1px; z-index: 3; background: linear-gradient(90deg, transparent, #fff, transparent); opacity: .7; }
.bb { position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, .7); z-index: 1; animation: bub 3s ease-in infinite; }
.bb:nth-child(2) { left: 26%; } .bb:nth-child(3) { left: 56%; animation-delay: 1s; } .bb:nth-child(4) { left: 76%; animation-delay: 2s; }
.ar { position: absolute; left: 50%; top: 0; bottom: 0; width: 24px; transform: translateX(-50%); z-index: 5; }
.ar b { position: absolute; left: 0; width: 24px; height: 13px; opacity: 0; }
.ar b::before { content: ''; position: absolute; inset: 0; border-left: 3px solid #fff; border-top: 3px solid #fff; transform: rotate(45deg) scale(.6); }
.ar.chg b { animation: up 2.1s linear infinite; } .ar.dis b { animation: down 2.1s linear infinite; } .ar.dis b::before { transform: rotate(225deg) scale(.6); }
.ar b:nth-child(2) { animation-delay: .7s; } .ar b:nth-child(3) { animation-delay: 1.4s; }
.sc { position: relative; width: 28px; margin: 7px 0; }
.sc i { position: absolute; left: 0; width: 6px; height: 1px; background: rgba(255, 255, 255, .35); } .sc i.mj { width: 10px; background: rgba(255, 255, 255, .7); }
.sc em { position: absolute; left: 13px; transform: translateY(50%); font-style: normal; font-size: 9.5px; color: var(--dim); line-height: 1; }
.pt { position: absolute; left: -7px; width: 0; height: 0; transform: translateY(50%); border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 7px solid var(--c1); }
.rows { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.big { font-size: 32px; font-weight: 700; line-height: 1.1; text-shadow: 0 0 10px var(--c1); }
.st { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 700; color: var(--muted); }
.st i { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.st.chg { color: var(--bat); } .st.chg i { background: var(--bat); box-shadow: 0 0 8px var(--bat); animation: blink 1.4s ease-in-out infinite; }
.st.dis { color: var(--or2); } .st.dis i { background: var(--or2); box-shadow: 0 0 8px var(--or2); animation: blink 1.4s ease-in-out infinite; }
.r { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; border-bottom: 1px dashed rgba(255, 255, 255, .12); padding-bottom: 4px; }
.r i { font-style: normal; color: var(--muted); } .r b { font-weight: 600; white-space: nowrap; }
.off .big { color: var(--dim); font-size: 22px; text-shadow: none; }

/* Wetter */
.fc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.fc div { text-align: center; padding: 8px 4px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); font-size: 12px; color: var(--muted); }
.fc b { display: block; font-size: 15px; color: var(--text); margin-top: 2px; }
.fc svg { width: 28px; height: 28px; display: block; margin: 4px auto; }

/* Räume */
.room { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.room .rn { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.room .rt { font-size: 24px; font-weight: 700; }
.room .rh { font-size: 12px; color: var(--cyan); font-weight: 600; }
.room .bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 4px; }
.room .bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #42cfff, #3dffb5 45%, #ffb547 70%, #ff5e3a); background-size: 300% 100%; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--dim); padding: 4px 4px 0; }
.foot b { color: var(--or2); }

@keyframes blink { 50% { opacity: .3; } }
@keyframes dash { to { stroke-dashoffset: -24; } }
@keyframes pulse { 50% { filter: drop-shadow(0 0 10px currentColor); } }
@keyframes wave { to { transform: translateX(-50%); } }
@keyframes bub { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .9; } 100% { transform: translateY(-130px); opacity: 0; } }
@keyframes up { 0% { bottom: 4%; opacity: 0; } 20%, 80% { opacity: .9; } 100% { bottom: 88%; opacity: 0; } }
@keyframes down { 0% { bottom: 88%; opacity: 0; } 20%, 80% { opacity: .9; } 100% { bottom: 4%; opacity: 0; } }

@media (max-width: 1100px) {
  .g-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-tanks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .g-flow, .g-charts, .g-tanks { grid-template-columns: minmax(0, 1fr); }
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .head { justify-content: center; text-align: center; }
  .brand .logo { height: 52px; }
  .sub { justify-content: center; }
  .meta { width: 100%; justify-content: center; }
  .kpi .v { font-size: 19px; }
  .kpi { grid-template-columns: 38px minmax(0, 1fr); column-gap: 10px; padding: 10px; }
  .kpi .ic { width: 38px; height: 38px; } .kpi .ic svg { width: 18px; height: 18px; }
  .kpi .s { white-space: normal; }
  .ftitle { position: static; margin: 12px 14px 10px; padding: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .chart .ax { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }

/* Huawei: Akku + grosse Wetterkarte, ohne Zisterne und Raumklima. */
.g-tanks { grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); }
.weather-large .r { padding-top: 12px; padding-bottom: 12px; font-size: 16px; }
.weather-large .fc { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.weather-large .fc div { padding: 16px 6px; font-size: 14px; }
.weather-large .fc svg { width: 44px; height: 44px; margin: 12px auto; }
.weather-large .fc b { font-size: 22px; }
@media (max-width: 1100px) { .weather-large .fc { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g-tanks { grid-template-columns: minmax(0, 1fr); } .weather-large .r { font-size: 14px; } }
