/* ============================================================================
   WebDevCore — Statistik-Backend (Layout). Identisch für jede Website. Farben,
   Schrift und Radius kommen aus theme.css (--accent + Preset der Seite) — dadurch
   passt sich das Backend automatisch an Logo/Marke an, bleibt im Aufbau aber gleich.
   Keine externen Ressourcen (DSGVO). Prefix .wb- vermeidet Kollisionen mit base.css.
   ========================================================================== */
* { box-sizing: border-box; }
/* Bedeutungsfarben des Backends -- EINMAL hier, damit Hinweise, Marken und Knoepfe
   dieselbe Sprache sprechen. Keine Markenfarben: Erfolg ist in jeder Marke gruen. */
.wb { --wb-ok: #1f7a4d; --wb-warn: #b3791b; --wb-gefahr: #b4321e; }
.wb {
  margin: 0;
  font-family: var(--font-body, system-ui, sans-serif);
  color: var(--fg, #141a22);
  background: var(--surface-2, #f6f8fa);
  -webkit-font-smoothing: antialiased;
  line-height: var(--leading-normal, 1.6);
}
.wb h1, .wb h2 { font-family: var(--font-display, inherit); font-weight: var(--weight-semibold, 600); letter-spacing: var(--tracking-tight, -0.02em); margin: 0; }
.wb h1 { font-size: var(--step-3, 1.9rem); }
.wb h2 { font-size: var(--step-1, 1.25rem); margin-bottom: var(--space-sm, 1rem); }
.wb-muted { color: var(--fg-muted, #4d5765); font-weight: 400; }
.wb a { color: inherit; }

/* --- Topbar --- */
.wb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 2rem);
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e3e8ee);
  position: sticky; top: 0; z-index: 50;
}
.wb-brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-weight: 600; }
.wb-brand__logo { height: 30px; width: auto; max-width: 160px; object-fit: contain; display: block; }
.wb-brand__mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-md, 12px);
  background: var(--accent, #1f6feb); color: var(--accent-ink, #fff); font-weight: 700; font-size: 1.05rem;
}
.wb-brand__mark--lg { width: 52px; height: 52px; font-size: 1.5rem; border-radius: var(--radius-lg, 16px); }
.wb-brand__name { font-size: 1.02rem; }
.wb-top__meta { display: inline-flex; align-items: center; gap: 0.75rem; }
.wb-nav { display: inline-flex; align-items: center; gap: 0.3rem; }
.wb-nav a {
  font-size: 0.84rem; font-weight: 600; letter-spacing: 0.01em; padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full, 999px); text-decoration: none; color: var(--fg-muted);
}
.wb-nav a:hover { background: var(--surface-2); color: var(--fg); }
.wb-nav a.on { background: var(--accent-soft, rgba(31,111,235,0.1)); color: var(--accent-600, #1a5fd0); }
/* Zahl offener Bestellungen im Menue. Bewusst nicht rot: sie ist eine Anzahl,
   keine Stoerung -- rot wuerde sie zur Dauerwarnung machen. */
.wb-zahl {
  display: inline-block; min-width: 1.35em; padding: 0.05em 0.4em; margin-left: 0.35em;
  border-radius: var(--radius-full, 999px); background: var(--accent, #1f6feb);
  color: #fff; font-size: 0.78em; font-weight: 700; text-align: center; line-height: 1.5;
}
.wb-logout { font-size: 0.86rem; text-decoration: none; color: var(--fg-muted); padding: 0.4rem 0.7rem; border-radius: var(--radius-sm, 8px); }
.wb-logout:hover { background: var(--surface-2); color: var(--fg); }

/* --- Layout --- */
.wb-main { max-width: 1060px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.2rem) clamp(1rem, 4vw, 2rem); }
.wb-main--bare { min-height: calc(100vh - 62px); display: grid; place-items: center; }
.wb-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.wb-head h1 { margin-bottom: 0.15rem; }
.wb-link { color: var(--accent-600, var(--accent)); text-decoration: none; font-weight: 500; font-size: 0.92rem; white-space: nowrap; }
.wb-link:hover { text-decoration: underline; }
.wb-mt { margin-top: 1.6rem; }

.wb-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e3e8ee);
  border-radius: var(--radius-lg, 16px);
  padding: clamp(1rem, 3vw, 1.4rem);
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(16,24,40,0.05));
}

/* --- KPI-Kacheln --- */
.wb-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.2rem; }
.wb-kpi { display: flex; flex-direction: column; gap: 0.25rem; }
.wb-kpi__label { font-size: 0.82rem; color: var(--fg-muted); font-weight: 500; }
.wb-kpi__value { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.wb-kpi__sub { font-size: 0.8rem; color: var(--fg-subtle, #6b7785); }
.wb-kpi--accent { background: var(--accent); border-color: transparent; color: var(--accent-ink, #fff); }
.wb-kpi--accent .wb-kpi__label, .wb-kpi--accent .wb-kpi__sub { color: color-mix(in srgb, var(--accent-ink, #fff) 82%, transparent); }

/* --- Verlaufs-Chart --- */
.wb-chart { margin-bottom: 1.2rem; }
.wb-chart__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; }
.wb-chart__head h2 { margin: 0; }
.wb-legend { display: inline-flex; gap: 1rem; font-size: 0.82rem; color: var(--fg-muted); }
.wb-legend__item { display: inline-flex; align-items: center; gap: 0.35rem; }
.wb-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.wb-dot--views { background: var(--accent); }
.wb-dot--vis { background: var(--accent-600, var(--accent)); opacity: 0.55; }
.wb-svg { display: block; width: 100%; height: 200px; overflow: visible; }
.wb-grid { stroke: var(--border, #e3e8ee); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wb-area { fill: var(--accent-soft, rgba(31,111,235,0.10)); stroke: none; }
.wb-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.wb-line--views { stroke: var(--accent); }
.wb-line--vis { stroke: var(--accent-600, var(--accent)); opacity: 0.55; stroke-dasharray: 4 4; }
.wb-xaxis { position: relative; height: 16px; margin-top: 6px; padding: 0 4px; }
.wb-xaxis span { position: absolute; transform: translateX(-50%); font-size: 0.72rem; color: var(--fg-subtle, #6b7785); white-space: nowrap; }

/* --- Zwei-Spalten-Grid --- */
.wb-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* --- Balkenlisten (Top-Seiten / Referrer) --- */
.wb-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.wb-bars li {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.5rem 0.7rem; border-radius: var(--radius-sm, 8px); overflow: hidden; isolation: isolate;
  background: var(--surface-2, #f6f8fa);
}
.wb-bars--compact li { padding: 0.4rem 0.7rem; }
.wb-bars__fill { position: absolute; inset: 0 auto 0 0; z-index: -1; background: var(--accent-soft, rgba(31,111,235,0.12)); border-right: 2px solid var(--accent-ring, rgba(31,111,235,0.4)); }
.wb-bars__label { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-bars__val { font-size: 0.86rem; font-variant-numeric: tabular-nums; color: var(--fg-muted); font-weight: 600; flex: none; }

/* --- Geräte-Meter --- */
.wb-devices { display: flex; flex-direction: column; gap: 0.7rem; }
.wb-device__row { display: flex; justify-content: space-between; font-size: 0.86rem; margin-bottom: 0.25rem; }
.wb-meter { display: block; height: 8px; border-radius: 999px; background: var(--surface-3, #eef1f4); overflow: hidden; }
.wb-meter__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* --- Notizen / leerer Zustand --- */
.wb-note { border-radius: var(--radius-md, 12px); padding: 0.8rem 1rem; font-size: 0.9rem; margin: 0 0 1rem; }
.wb-note--warn { background: color-mix(in srgb, #b3791b 12%, var(--surface)); border: 1px solid color-mix(in srgb, #b3791b 35%, transparent); }
.wb-note--err { background: color-mix(in srgb, #c2401f 12%, var(--surface)); border: 1px solid color-mix(in srgb, #c2401f 35%, transparent); color: var(--fg); }
.wb-empty { text-align: center; padding: 2.5rem 1.5rem; margin-bottom: 1.2rem; }
.wb-empty h2 { margin-bottom: 0.4rem; }
.wb-empty p { max-width: 46ch; margin: 0 auto; }
.wb-fineprint { font-size: 0.78rem; color: var(--fg-subtle, #6b7785); margin-top: 1.4rem; max-width: 70ch; }

/* --- Tabellen, Filterzeile, Verlauf (Bestellverwaltung) --- */
/* Der Wrapper fehlt absichtlich nicht: eine Bestelltabelle ist auf dem Handy
   breiter als der Bildschirm, und sie soll IN SICH scrollen statt die ganze Seite
   nach rechts zu ziehen. Deshalb scrollt die Tabelle selbst. */
.wb-tabelle { width: 100%; border-collapse: collapse; font-size: 0.9rem; display: block; overflow-x: auto; }
.wb-tabelle th, .wb-tabelle td { padding: 0.55rem 0.7rem; text-align: left; vertical-align: top; }
.wb-tabelle thead th {
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--fg-muted); border-bottom: 1px solid var(--border, #e3e8ee); white-space: nowrap;
}
.wb-tabelle tbody tr + tr td, .wb-tabelle tfoot tr td { border-top: 1px solid var(--border, #e3e8ee); }
.wb-tabelle tfoot td { font-size: 0.86rem; }
.wb-tabelle .wb-muted { display: block; font-size: 0.8rem; }

.wb-filter { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1.1rem; }
.wb-filter a {
  font-size: 0.82rem; font-weight: 600; padding: 0.35rem 0.7rem; text-decoration: none;
  border-radius: var(--radius-full, 999px); color: var(--fg-muted); border: 1px solid var(--border, #e3e8ee);
}
.wb-filter a:hover { background: var(--surface-2); color: var(--fg); }
.wb-filter a.on { background: var(--accent-soft, rgba(31,111,235,0.1)); color: var(--accent-600, #1a5fd0); border-color: transparent; }

.wb-verlauf { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.wb-verlauf li { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.88rem; align-items: baseline; }
.wb-verlauf .wb-muted { min-width: 9.5em; }

/* --- Objektformular (Objekte-Modul) --- */
.wb-form { display: flex; flex-direction: column; gap: 0.9rem; }
.wb-form label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.86rem; font-weight: 600; color: var(--fg-muted);
}
.wb-form input[type="text"],
.wb-form input[type="file"],
.wb-form textarea,
.wb-form select {
  font: inherit; color: var(--fg); background: var(--surface, #fff);
  border: 1px solid var(--border, #cdd5df); border-radius: var(--radius-sm, 9px);
  padding: 0.6rem 0.75rem; width: 100%;
}
.wb-form textarea { resize: vertical; }
.wb-form input:focus-visible, .wb-form textarea:focus-visible, .wb-form select:focus-visible {
  outline: 2px solid var(--accent-ring, var(--accent)); outline-offset: 1px; border-color: var(--accent);
}
.wb-form fieldset {
  border: 1px solid var(--border, #e3e8ee); border-radius: var(--radius-md, 12px);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.8rem; margin: 0;
}
.wb-form legend { padding: 0 0.4rem; font-weight: 600; color: var(--fg); font-size: 0.92rem; }
/* Zahlenfelder (und andere kurze Gruppen) nebeneinander statt im reinen Fluss. */
.wb-form__zeile { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.9rem; }
/* Checkbox-Zeilen: Kaestchen vor dem Text, nicht Label ueber dem Feld.
   ".wb-form label" ist (0,1,1) und sticht ein alleinstehendes ".wb-form__check"
   (0,1,0) -- OHNE das "label" hier zieht die Spalten-Regel oben immer, das
   Kaestchen stand zentriert UEBER der Beschriftung statt davor (im Browser
   gemessen, Fixrunde 2 Fund 2). ".wb-form label.wb-form__check" ist (0,2,1)
   und gewinnt. */
.wb-form label.wb-form__check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--fg); }
.wb-form__check input[type="checkbox"] { width: auto; }
@media (max-width: 640px) {
  .wb-form__zeile { grid-template-columns: 1fr; }
}

/* --- Kontaktanfragen --- */
.wb-contact { padding: 1rem clamp(1rem, 3vw, 1.4rem); border-bottom: 1px solid var(--border, #e3e8ee); }
.wb-contact:last-child { border-bottom: none; }
.wb-contact__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; font-size: 0.95rem; }
.wb-contact__meta { font-size: 0.86rem; color: var(--fg-muted); margin-top: 0.15rem; }
.wb-contact__meta a { color: inherit; text-decoration: none; }
.wb-contact__meta a:hover { text-decoration: underline; }
.wb-contact__msg { margin: 0.6rem 0 0; font-size: 0.92rem; white-space: pre-line; }

/* --- Login --- */
.wb-login { width: 100%; padding: 1.5rem; }
.wb-login__card { max-width: 360px; margin: 0 auto; text-align: center; padding: 2rem 1.8rem; }
.wb-login__brand { display: grid; place-items: center; margin-bottom: 1rem; }
.wb-login__logo { max-height: 56px; max-width: 200px; width: auto; object-fit: contain; }
.wb-login__title { font-size: var(--step-2, 1.6rem); margin-bottom: 0.15rem; }
.wb-login__form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.3rem; }
.wb-login__form input {
  padding: 0.7rem 0.85rem; border: 1px solid var(--border, #cdd5df); border-radius: var(--radius-sm, 9px);
  background: var(--surface, #fff); color: var(--fg); font: inherit; width: 100%;
}
.wb-login__form input:focus-visible { outline: 2px solid var(--accent-ring, var(--accent)); outline-offset: 1px; border-color: var(--accent); }
.wb-login__form input[readonly] { color: var(--fg-muted); background: var(--surface-2); }
.wb-btn {
  padding: 0.72rem 1rem; border: none; border-radius: var(--btn-radius, var(--radius-sm, 9px)); cursor: pointer;
  background: var(--accent); color: var(--accent-ink, #fff); font: inherit; font-weight: 600;
}
.wb-btn:hover { background: var(--accent-600, var(--accent)); }
.wb-btn:focus-visible { outline: 2px solid var(--accent-ring, var(--accent)); outline-offset: 2px; }
.wb-btn:disabled { opacity: 0.55; cursor: not-allowed; }
/* Zweit- und Gefahrenknopf: gleiche Hoehe und Form wie der Primaerknopf, damit eine
   Knopfreihe als Reihe liest. Der Gefahrenknopf ist bewusst NICHT rot gefuellt -- rot
   gefuellt zieht den Blick auf die seltenste Handlung der Seite. Er wird erst beim
   Zeigen voll. */
.wb-btn--sekundaer {
  background: var(--surface, #fff); color: var(--fg, #141a22);
  box-shadow: inset 0 0 0 1px var(--border, #cdd5df);
}
.wb-btn--sekundaer:hover { background: var(--surface-2, #f6f8fa); color: var(--fg, #141a22); }
.wb-btn--gefahr {
  background: var(--surface, #fff); color: var(--wb-gefahr, #b4321e);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wb-gefahr, #b4321e) 45%, transparent);
}
.wb-btn--gefahr:hover { background: var(--wb-gefahr, #b4321e); color: #fff; }
.wb-btn--klein { padding: 0.42rem 0.75rem; font-size: 0.86rem; }
a.wb-btn { display: inline-flex; align-items: center; text-decoration: none; line-height: 1.2; }

/* Zustandsmarken: Veroeffentlicht/Entwurf, Verfuegbar/Reserviert ... Eine Farbe je
   Bedeutung, nie je Modul. Ruhig gefuellt, keine Umrandung. */
.wb-badge {
  display: inline-flex; align-items: center; gap: 0.35em; padding: 0.18em 0.6em;
  border-radius: var(--radius-full, 999px); font-size: 0.78rem; font-weight: 600; line-height: 1.5;
  background: var(--surface-3, #eef1f4); color: var(--fg-muted, #4d5765); white-space: nowrap;
}
.wb-badge--ok    { background: color-mix(in srgb, var(--wb-ok, #1f7a4d) 14%, var(--surface, #fff)); color: var(--wb-ok, #1f7a4d); }
.wb-badge--warn  { background: color-mix(in srgb, var(--wb-warn, #b3791b) 16%, var(--surface, #fff)); color: color-mix(in srgb, var(--wb-warn, #b3791b) 85%, #000); }
.wb-badge--still { background: var(--surface-3, #eef1f4); color: var(--fg-subtle, #6b7785); }
.wb-note--ok { background: color-mix(in srgb, var(--wb-ok, #1f7a4d) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--wb-ok, #1f7a4d) 35%, transparent); }
.wb-note p { margin: 0; }
.wb-note p + p { margin-top: 0.4rem; }

/* --- Fußzeile --- */
.wb-foot {
  max-width: 1060px; margin: 1.5rem auto 0; padding: 1.2rem clamp(1rem, 4vw, 2rem) 2rem;
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-size: 0.76rem; color: var(--fg-subtle, #6b7785); border-top: 1px solid var(--border, #e3e8ee);
}

/* --- Responsive --- */
@media (max-width: 860px) {
  .wb-kpis { grid-template-columns: repeat(2, 1fr); }
  .wb-grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .wb-kpis { grid-template-columns: 1fr 1fr; }
  .wb-brand__name { display: none; }
}

/* Adressen/Befehle zum Abschreiben (Cron-Ziel). Bricht um statt seitlich auszulaufen. */
.wb-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem;
  background: var(--surface-2, #f4f6f9); border: 1px solid var(--border, #e3e8ee);
  border-radius: var(--radius-sm, 9px); padding: 0.6rem 0.75rem; margin: 0.6rem 0;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
