:root {
  --bg: #0F1115; --flaeche: #171A21; --flaeche2: #1E222B; --flaeche3: #262B36;
  --rand: #2C3240; --text: #E7EAF0; --matt: #98A1B3; --akzent: #4C8DFF;
  --akzent2: #3A78E7; --deal: #FF7A18; --gut: #31C48D; --schlecht: #F1626B;
  --warn: #F5A623; --radius: 12px;
  /* Seite „Server“: Farbe je Dienst (geprueft mit dem Farb-Validator gegen --flaeche) */
  --s-dealtool: #3987e5; --s-filament: #d95926; --s-caddy: #199e70;
  --s-system: #6b7280; --s-gesamt: #c3c2b7;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--akzent); }
button, input, textarea, select { font: inherit; color: inherit; }
.leer { color: var(--matt); padding: 24px; text-align: center; }

/* ------------------------------------------------------------ Gerüst */
.geruest { display: flex; min-height: 100vh; }
.seitenleiste {
  width: 230px; flex: none; background: var(--flaeche);
  border-right: 1px solid var(--rand); padding: 16px 10px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.marke { font-size: 20px; font-weight: 700; padding: 4px 10px 2px; }
.marke-sub { font-size: 12px; color: var(--matt); padding: 0 10px 14px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin: 2px 0; border-radius: 8px;
  color: var(--matt); text-decoration: none;
}
.nav a:hover { background: var(--flaeche2); color: var(--text); }
.nav a.aktiv { background: var(--flaeche3); color: var(--text); font-weight: 600; }
.abzeichen {
  min-width: 22px; padding: 1px 7px; border-radius: 11px; font-size: 12px;
  background: var(--deal); color: #fff; text-align: center; font-weight: 600;
}
.inhalt { flex: 1; min-width: 0; padding: 22px 28px 60px; max-width: 1100px; }
h1 { font-size: 22px; margin: 0 0 4px; }
.unter { color: var(--matt); margin: 0 0 18px; }
.oben-leiste { display: none; }

@media (max-width: 820px) {
  .geruest { display: block; }
  .seitenleiste {
    position: fixed; inset: 0 30% 0 0; height: auto; z-index: 30;
    transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.6);
  }
  .seitenleiste.offen { transform: none; }
  .oben-leiste {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0;
    z-index: 20; background: var(--flaeche); border-bottom: 1px solid var(--rand);
    padding: 10px 14px;
  }
  .oben-leiste .titel { font-weight: 700; flex: 1; }
  .inhalt { padding: 16px 14px 60px; }
}

/* ------------------------------------------------------------ Bausteine */
.karten { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.karte {
  background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 16px;
}
a.karte { display: block; color: inherit; text-decoration: none; }
a.karte:hover { border-color: var(--akzent); }
.karte h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--matt); margin: 0 0 10px; font-weight: 600; }
.gross { font-size: 28px; font-weight: 700; }
.matt { color: var(--matt); }
.klein { font-size: 13px; }
.gut { color: var(--gut); } .schlecht { color: var(--schlecht); } .warn { color: var(--warn); }

.knopf {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--rand); background: var(--flaeche2); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.knopf:hover { background: var(--flaeche3); }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.primaer:hover { background: var(--akzent2); }
.knopf.gefahr { border-color: rgba(241,98,107,.5); color: var(--schlecht); }
.knopf.klein { padding: 5px 10px; font-size: 13px; }
.knopf:disabled { opacity: .5; cursor: default; }
.leiste { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.leiste .raum { flex: 1; }

.banner {
  border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--rand); background: var(--flaeche);
}
.banner .text { flex: 1; min-width: 220px; }
.banner.ansicht { border-color: rgba(245,166,35,.55); background: rgba(245,166,35,.08); }
.banner.betrieb { border-color: rgba(49,196,141,.5); background: rgba(49,196,141,.07); }
.banner.fehler { border-color: rgba(241,98,107,.55); background: rgba(241,98,107,.08); }

.marke-chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px;
  background: var(--flaeche3); color: var(--matt); margin: 2px 4px 2px 0;
}
.marke-chip.an { background: rgba(76,141,255,.18); color: #9cc0ff; }
.status { font-weight: 600; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.status.wartet { background: rgba(76,141,255,.16); color: #9cc0ff; }
.status.laeuft { background: rgba(245,166,35,.18); color: var(--warn); }
.status.fertig { background: rgba(49,196,141,.16); color: var(--gut); }
.status.fehler { background: rgba(241,98,107,.16); color: var(--schlecht); }
.status.teilweise { background: rgba(245,166,35,.14); color: var(--warn); }

/* ------------------------------------------------------------ Listen */
.liste { display: flex; flex-direction: column; gap: 10px; }
.zeile {
  display: flex; gap: 14px; background: var(--flaeche); border: 1px solid var(--rand);
  border-radius: var(--radius); padding: 12px;
}
.zeile .bild {
  width: 72px; height: 72px; flex: none; border-radius: 8px; object-fit: contain;
  background: #fff;
}
.zeile .bild.ohne { background: var(--flaeche3); }
.zeile .mitte { flex: 1; min-width: 0; }
.zeile .titel { font-weight: 600; overflow-wrap: anywhere; }
.zeile .knoepfe { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.zeile details { margin-top: 6px; }
.zeile summary { cursor: pointer; color: var(--matt); font-size: 13px; }
.posttext {
  white-space: pre-wrap; overflow-wrap: anywhere; background: var(--flaeche2);
  border-radius: 8px; padding: 10px; font-size: 13px; margin-top: 6px;
}
textarea.feld, input.feld, select.feld {
  width: 100%; background: var(--flaeche2); border: 1px solid var(--rand);
  border-radius: 8px; padding: 9px 11px; color: var(--text);
}
select.feld { width: auto; max-width: 100%; padding: 8px 10px; }
input.feld.kurz { width: 110px; }
textarea.feld { min-height: 160px; resize: vertical; }
input.feld:focus, textarea.feld:focus, select.feld:focus { outline: 2px solid var(--akzent); border-color: transparent; }
.abschnitt { margin: 22px 0 10px; font-size: 14px; color: var(--matt);
  text-transform: uppercase; letter-spacing: .06em; }

.proto { font: 12.5px/1.5 ui-monospace, Consolas, monospace; }
.proto div { padding: 3px 8px; border-bottom: 1px solid var(--flaeche2); overflow-wrap: anywhere; }
.proto .warn { color: var(--warn); } .proto .error { color: var(--schlecht); }
.proto time { color: var(--matt); margin-right: 8px; }

.meldung { padding: 12px 14px; }
.meldung.neu { border-left: 3px solid var(--deal); }
.meldung .kopf { display: flex; gap: 10px; justify-content: space-between; }

.qr { background: #fff; padding: 12px; border-radius: 12px; width: 280px; max-width: 100%; }

/* ------------------------------------------------------------ Deals */
.filter { align-items: flex-end; }
.filter label { display: flex; flex-direction: column; gap: 3px; }
.filter label.haken-inline { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 8px; }
.haken-inline input { width: 17px; height: 17px; }
.info { margin: -4px 0 12px; }
.deals { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.deals > .leer { grid-column: 1 / -1; }
.dealkarte {
  display: flex; flex-direction: column; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden;
}
.dbild { width: 100%; height: 170px; object-fit: contain; background: #fff; display: block; }
.dbild.ohne { background: var(--flaeche3); }
.dkoerper { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dtitel {
  font-weight: 600; overflow-wrap: anywhere; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dkoerper .knoepfe { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.preiszeile { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.preiszeile strong { font-size: 18px; color: var(--deal); }
.preiszeile .alt { color: var(--matt); text-decoration: line-through; font-size: 13px; }
.rabatt { background: rgba(255,122,24,.16); color: var(--deal); font-weight: 700;
  font-size: 12px; padding: 1px 7px; border-radius: 999px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips:empty { display: none; }
.chip { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  background: var(--flaeche3); color: var(--matt); }
.chip.neu { background: rgba(76,141,255,.18); color: #9cc0ff; }
.chip.gepostet { background: rgba(49,196,141,.16); color: var(--gut); }
.chip.vorgemerkt { background: rgba(245,166,35,.16); color: var(--warn); }
.chip.fehler { background: rgba(241,98,107,.16); color: var(--schlecht); }
.chip.gemerkt { background: rgba(245,166,35,.12); color: #ffd27a; }
.mehr { display: flex; justify-content: center; margin: 16px 0; }

.freigabe { display: flex; gap: 18px; padding: 18px; }
.fbild { width: 240px; height: 240px; flex: none; object-fit: contain; background: #fff; border-radius: 10px; }
.fbild.ohne { background: var(--flaeche3); }
.fkoerper { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ftitel { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.gruende { line-height: 1.5; }
.fknoepfe { margin: 8px 0 0; }
@media (max-width: 820px) {
  .freigabe { flex-direction: column; padding: 14px; }
  .fbild { width: 100%; height: 220px; }
  .filter label { flex: 1 1 140px; }
  .filter select.feld { width: 100%; }
}

.fernrahmen {
  position: relative;
  margin: 12px 0; border: 2px solid var(--rand); border-radius: 10px; overflow: hidden;
  background: #fff; cursor: pointer; outline: none; line-height: 0;
}
.fernrahmen:focus-within { border-color: var(--akzent); }
/* Unsichtbares Eingabefeld: nimmt die Tastatur auf, faengt aber keine Klicks.
   16px, damit das iPhone beim Fokus nicht hineinzoomt. */
.fernfang {
  position: absolute; left: 0; top: 0; width: 2px; height: 2px; padding: 0; border: 0;
  opacity: 0; resize: none; overflow: hidden; font-size: 16px; pointer-events: none;
  background: transparent; color: transparent; caret-color: transparent;
}
/* Kurzer Kreis an der Klickstelle - sofort sichtbar, bevor das neue Bild kommt. */
.fernpunkt {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  border: 3px solid var(--akzent); pointer-events: none; opacity: 0;
}
.fernpunkt.an { animation: fernpunkt 0.7s ease-out; }
@keyframes fernpunkt { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
.fernbild { width: 100%; height: auto; display: block; user-select: none; }
.fernleiste .leiste { margin: 0 0 8px; }
.fernleiste .feld { flex: 1; min-width: 180px; }

.dialog.breit { max-width: 680px; max-height: 92vh; overflow-y: auto; }
.dialog .abschnitt { margin: 16px 0 8px; }
.dialog .leiste { margin: 8px 0 0; justify-content: flex-start; }
.dialog > .leiste:last-child { justify-content: flex-end; margin-top: 16px; }
.ziele { display: flex; flex-direction: column; gap: 6px; }
.ziel { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.ziel input { margin-top: 3px; width: 17px; height: 17px; flex: none; }
.ziel.aus { opacity: .55; cursor: default; }

/* ------------------------------------------------------------ Anmeldung */
.anmeldung {
  max-width: 380px; margin: 12vh auto 0; padding: 26px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 16px;
}
.anmeldung h1 { margin-bottom: 14px; }
.anmeldung form { display: flex; flex-direction: column; gap: 12px; }
.fehlertext { color: var(--schlecht); min-height: 1.2em; font-size: 14px; }

/* ------------------------------------------------------------ Fenster */
.schleier {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dialog {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
  padding: 20px; max-width: 520px; width: 100%;
}
.dialog h2 { margin: 0 0 10px; font-size: 18px; }
.dialog .leiste { margin: 16px 0 0; justify-content: flex-end; }
.haken { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; }
.haken input { margin-top: 4px; width: 18px; height: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--flaeche3); border: 1px solid var(--rand); border-radius: 10px;
  padding: 10px 16px; z-index: 60; max-width: 92vw; box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
.toast.fehler { border-color: rgba(241,98,107,.6); }

/* ------------------------------------------------------------ Topdeals, Radar, Auswertung */
.spalten { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.spalte { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.spaltenkopf { font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--matt); margin: 0 0 2px; font-weight: 600; }
.extra { display: flex; flex-direction: column; gap: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.leiste .feld.breit { flex: 1 1 260px; min-width: 0; width: auto; }
.chipleiste { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 12px; }
.chipleiste .haken-inline { display: flex; align-items: center; gap: 8px; cursor: pointer; }
details.mehr-filter { margin: 0 0 10px; }
details.mehr-filter > summary { cursor: pointer; color: var(--matt); font-size: 13px; margin: 0 0 10px; }
.reiter { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.reiter .knopf.aktiv { background: var(--flaeche3); border-color: var(--akzent); }
.tabellen-rahmen { overflow-x: auto; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); }
table.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th, .tabelle td { padding: 8px 12px; border-bottom: 1px solid var(--flaeche2); text-align: left; }
.tabelle th { color: var(--matt); font-weight: 600; font-size: 13px; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bericht-text p { margin: 0 0 10px; }
.bericht-text ul { margin: 0 0 10px; padding-left: 20px; }
.bericht-text h3 { font-size: 16px; margin: 14px 0 6px; }
.bericht-text > :last-child { margin-bottom: 0; }

/* ------------------------------------------------------------ Manuell, Freifeld */
.status-zeile { margin: 0 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-zeile ul { margin: 6px 0 0; padding-left: 20px; }
.formular { margin-top: 14px; }
.formular > .abschnitt:first-child { margin-top: 0; }
.leiste.rechts { justify-content: flex-end; margin: 16px 0 0; }
.leiste.oben { margin-top: 10px; }
.linkliste { margin: 6px 0 0; line-height: 1.6; }
.linkliste .url { overflow-wrap: anywhere; color: var(--text); }
.versteckt { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bildvorschau { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 6px; }
.bildvorschau:empty { display: none; }
.bildvorschau img { max-width: 160px; max-height: 160px; border-radius: 8px; background: #fff; }
input.feld.uhr { width: auto; }
.dialog ul.zielliste { margin: 4px 0 12px; padding-left: 20px; }
.dialog .posttext { max-height: 40vh; overflow-y: auto; }

/* ------------------------------------------------------------ Server */
.kachel .gross { line-height: 1.2; }
.meter { height: 6px; border-radius: 3px; background: rgba(76, 141, 255, .18); overflow: hidden; margin: 8px 0 8px; }
.meter > span { display: block; height: 100%; background: var(--akzent); border-radius: 0 3px 3px 0; }
.meter.warn { background: rgba(245, 166, 35, .18); } .meter.warn > span { background: var(--warn); }
.meter.knapp { background: rgba(241, 98, 107, .18); } .meter.knapp > span { background: var(--schlecht); }
.spalten.zwei { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 14px; }
/* Schmaler, geteilter Balken: 8px, runde Enden, 2px Abstand in der Kartenfarbe */
.segmentbalken { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0 14px; }
.segmentbalken > span { min-width: 2px; flex-basis: 0; height: 100%; }
.segmentbalken > span.rest, .farbfeld.rest { background: var(--flaeche3); }
.farbfeld { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.werteliste { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.werte-zeile { display: grid; grid-template-columns: 10px 1fr auto 56px; gap: 10px; align-items: center; font-size: 14px; }
.werte-zeile .zahl, .meter-zeile .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.meterliste { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.meter-zeile { display: grid; grid-template-columns: 170px 1fr 56px; gap: 10px; align-items: center; font-size: 14px; }
.meter-zeile .name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.meter-zeile .spur { height: 8px; border-radius: 4px; background: var(--flaeche3); overflow: hidden; }
.meter-zeile .spur > span { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 0; }
@media (max-width: 520px) {
  .meter-zeile { grid-template-columns: 1fr 56px; }
  .meter-zeile .spur { grid-column: 1 / -1; grid-row: 2; }
}
.karte.verlauf { margin-top: 14px; }
.legende { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--matt); margin: 0 0 6px; }
.legende-eintrag { display: inline-flex; align-items: center; gap: 6px; }
.linienschluessel { display: inline-block; width: 14px; height: 2px; border-radius: 1px; flex: none; }
.diagramm-flaeche { position: relative; }
svg.diagramm { display: block; outline: none; touch-action: pan-y; }
svg.diagramm:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }
svg.diagramm .raster { stroke: var(--flaeche3); stroke-width: 1; }
svg.diagramm .achse { stroke: var(--rand); stroke-width: 1; }
svg.diagramm .achsentext { fill: var(--matt); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.diagramm .kreuz { stroke: var(--matt); stroke-width: 1; }
svg.diagramm .kreuzpunkt { stroke: var(--flaeche); stroke-width: 2; }
.diagramm-tipp {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--flaeche2); border: 1px solid var(--rand); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; line-height: 1.5; box-shadow: 0 6px 20px rgba(0,0,0,.4); white-space: nowrap;
}
.tipp-zeile { display: flex; align-items: center; gap: 8px; }
