/* VINORUM – Stylesheet der App-Hülle.
   Farbschema über CSS-Variablen; Dunkelmodus per [data-theme="dark"] auf <html>. */

/* CI-Farben: Anthrazit #232323 · Champagner #D8BF92 · Weinrot #6D2330 · Weiss #FFFFFF */
:root {
  --brand: #6d2330;          /* Weinrot (Akzent) */
  --brand-dark: #551a25;
  --accent: #d8bf92;         /* Champagner */
  --anthracite: #232323;
  --bg: #f7f5f2;
  --card: #ffffff;
  --text: #232323;
  --muted: #6f6b67;
  --border: #e7e2db;
  --danger: #b3261e;
  --ok: #2e7d32;
  --warn-bg: #f6efe2;
  --shadow: 0 1px 3px rgba(35, 35, 35, 0.10), 0 4px 14px rgba(35, 35, 35, 0.06);
  --radius: 14px;
  --nav-height: 62px;
}

[data-theme='dark'] {
  --brand: #b3495a;
  --brand-dark: #8f3543;
  --accent: #d8bf92;
  --anthracite: #f2ede7;
  --bg: #1b1917;
  --card: #262322;
  --text: #f2ede7;
  --muted: #a6a09a;
  --border: #38332f;
  --danger: #e57373;
  --ok: #81c784;
  --warn-bg: #322b1c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 14px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  /* CI-Schrift Montserrat (auf dem Server unter vendor/fonts/ ergänzbar);
     geometrische System-Fallbacks für Offline-Betrieb. */
  font-family: 'Montserrat', 'Century Gothic', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}

/* ---------- Kopfzeile ---------- */
.app-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-left { display: flex; align-items: center; gap: 10px; }

.brand-logo { height: 26px; width: auto; display: block; }

/* Kopfzeile zeigt die kompakte Wortmarke (ohne Claim); im Dunkelmodus hell. */
[data-theme='dark'] .brand-logo { content: url('../branding/logo_wordmark_light.png'); }
/* Kundenlogo (per JS gesetzt): Dunkelmodus-Tausch aufheben, src gilt für beide Themes */
[data-theme='dark'] .brand-logo.is-custom { content: normal; }

.demo-badge {
  background: var(--accent);
  color: #3a2f10;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Demo-Umgebung: Abzeichen einblenden + dezenter Farbstreifen an der Kopfzeile.
   Die eigene Datenbank je Host regelt das Backend (config.<host>.php). */
body.is-demo .app-header { box-shadow: inset 0 3px 0 var(--brand); }

.brand-actions { display: flex; align-items: center; gap: 6px; }

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.subtitle {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Sprachumschalter (Dropdown) ---------- */
.lang-switch-host { position: relative; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.lang-btn:hover { background: color-mix(in srgb, var(--text) 12%, transparent); }

.lang-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.lang-caret-wrap { display: inline-flex; }
.lang-caret { opacity: 0.55; }

.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 60;
  min-width: 168px;
}

.lang-menu[hidden] { display: none; }

.lang-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  text-align: left;
}

.lang-item:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.lang-item.is-active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 700; }

/* ---------- Buttons ---------- */
.icon-btn {
  border: none;
  background: none;
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }

.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
}

.btn svg { width: 18px; height: 18px; fill: currentColor; }

.btn:hover { border-color: var(--brand); }

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn.block { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
}

.field input, .field select, .field textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
}

/* Passwortfeld mit „Auge" zum Ein-/Ausblenden */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.pw-eye:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.pw-eye svg { width: 20px; height: 20px; fill: currentColor; }

/* Textlink-Button (z. B. „Passwort vergessen?") */
.link-btn {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}
.link-btn:hover { text-decoration: underline; }

/* Hinweistext im Sheet-Dialog */
.sheet-hint { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.sheet-section { font-weight: 700; font-size: 13px; color: var(--muted); margin: 4px 0 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Login-Kontextzeile (Weingutname / Operator) */
.login-context { margin: -8px 0 16px; color: var(--brand); font-weight: 700; }

/* „Weingut nicht verfügbar" */
.unavailable-ic { color: var(--accent); margin: 4px auto 8px; }
.unavailable-ic svg { width: 44px; height: 44px; fill: currentColor; }

/* ---------- VINORUM ADMINISTRATION ---------- */
.admin-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-head .hint { margin: 2px 0 0; }

.tenant-list { display: flex; flex-direction: column; gap: 10px; }

.tenant-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  flex-wrap: wrap;
}

.tenant-main { flex: 1; min-width: 180px; }
.tenant-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tenant-name { font-weight: 700; }
.tenant-sub { color: var(--muted); font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- Hauptbereich / Karten ---------- */
/* Mobil/Tablet: zentrierte, lesbare Spalte. Desktop (ab 1024px): volle Breite –
   siehe Media-Query unten (wie CURENA). */
.view {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}

/* Desktop nutzt die volle Bildschirmbreite, nur angenehme Seitenränder.
   Dialoge bleiben bewusst schmal/lesbar. */
@media (min-width: 1024px) {
  .view { max-width: none; padding: 20px 28px calc(var(--nav-height) + 20px); }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.card p.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

.login-card {
  max-width: 380px;
  margin: 8vh auto 0;
  text-align: center;
}

.login-logo { width: min(280px, 78%); height: auto; margin: 4px auto 20px; display: block; }

[data-theme='dark'] .login-logo { content: url('../branding/logo_vinorum_dark.png'); }
/* Kundenlogo am Anmeldebildschirm: kein Theme-Tausch, Höhe begrenzen */
.login-logo.is-custom { width: auto; max-width: min(280px, 78%); max-height: 96px; }
[data-theme='dark'] .login-logo.is-custom { content: normal; }

.login-card form { text-align: left; }

.form-error {
  color: var(--danger);
  font-size: 14px;
  margin: 4px 0 10px;
  min-height: 18px;
}

.version-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 18px;
}

/* ---------- Banner (offline / Update / Installieren) ---------- */
.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 16px;
  font-size: 14px;
}

.banner .btn { padding: 5px 12px; border-radius: 9px; }

.banner.offline { background: var(--warn-bg); color: var(--text); }

.banner.update { background: var(--brand); color: #fff; }

.banner.update .btn { background: #fff; color: var(--brand); border-color: #fff; }

.banner.install { background: var(--card); border-bottom: 1px solid var(--border); }

/* ---------- Untere Navigation ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
}

.bottom-nav:empty { display: none; }

.nav-btn {
  flex: 1;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.nav-btn svg { width: 24px; height: 24px; fill: currentColor; }
/* Bei vielen Tabs (7 im Mandanten-Kontext) nicht umbrechen, sondern kürzen */
.nav-btn { min-width: 0; padding-left: 2px; padding-right: 2px; }
.nav-btn .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.nav-btn.is-active { color: var(--brand); }

/* „Mehr"-Menü: Popup über der Leiste, nur wenn nicht alle Tabs passen */
.nav-mehr-panel {
  position: fixed; right: 8px;
  bottom: calc(var(--nav-height) + 8px + env(safe-area-inset-bottom, 0px));
  z-index: 30; padding: 8px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); max-width: min(92vw, 340px);
}
.nav-mehr-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: none; background: none; cursor: pointer; color: var(--muted);
  font: inherit; font-size: 11px; font-weight: 600;
  padding: 10px 6px; border-radius: 10px; min-width: 86px;
}
.nav-mehr-item svg { width: 24px; height: 24px; fill: currentColor; }
.nav-mehr-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.nav-mehr-item.is-active { color: var(--brand); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
  max-width: min(90vw, 480px);
  text-align: center;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 16, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  width: 100%;
  max-width: 440px;
  max-height: 85vh;
  overflow: auto;
}

.modal h3 { margin: 0 0 12px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- Einstellungen ---------- */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child { border-bottom: none; }

.settings-row .label { font-weight: 600; }

.settings-row .sub { color: var(--muted); font-size: 13px; }

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.seg button {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
}

.seg button.is-active { background: var(--brand); color: #fff; }

/* ---------- Dashboard / Modul-Roadmap ---------- */
.hero { border-left: 4px solid var(--accent); }

.stage-title {
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.module-tile {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.module-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--anthracite);
}

.module-icon svg { width: 22px; height: 22px; fill: currentColor; }

.module-text { min-width: 0; }

.module-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.module-name { font-weight: 700; }

.module-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- Dashboard: Überblick-Kennzahlen ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
/* Dashboard-Kacheln: Kopfzeile mit „Nicht mehr anzeigen" + Wetter-Sektion */
.dash-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-card-head .stage-title { margin-bottom: 0; }
.dash-hide { opacity: 0.45; }
.dash-hide:hover { opacity: 1; }
.dash-wetter { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; }
.dash-wetter-quelle { margin: 0 0 -8px; font-size: 11.5px; }
.dash-wetter-station { border-top: 1px solid var(--border); padding-top: 10px; }
.dash-wetter-station:first-child { border-top: none; padding-top: 0; }
.dash-wetter-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
/* Eine Zeile: aktuelle Werte + (abgesetzt) Vorhersage-Kacheln in gleicher Größe.
   Anzahl der Vorhersage-Tage rechnet dashWetterZeile aus der Breite (2–7). */
.dash-wetter-zeile { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.dash-wetter-zeile .cl-tile { min-width: 96px; flex: 0 0 auto; }
.dash-wetter-sep { width: 1px; align-self: stretch; margin: 2px 4px; background: var(--border); }
.dash-fc-tile { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.dash-fc-tmin { font-weight: 400; font-size: 13px; color: var(--muted); }
.kpi-tile {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 12px 14px; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.kpi-tile:hover { border-color: var(--brand); }
.kpi-ic { display: inline-flex; margin-bottom: 4px; color: var(--brand); }
.kpi-ic svg { width: 20px; height: 20px; fill: currentColor; }
.kpi-val { font-size: 22px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
/* Aufmerksamkeits-Kennzahl (überfällig, Bestand niedrig …) hervorgehoben */
.kpi-tile.is-accent {
  border-color: color-mix(in srgb, var(--brand) 45%, transparent);
  background: color-mix(in srgb, var(--brand) 7%, transparent);
}
.kpi-tile.is-accent .kpi-val { color: var(--brand); }

/* Hinweistext unter einem Formularfeld */
.field-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Druckvorlagen: Formular links, Live-PDF-Vorschau rechts */
.dv-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: 24px; align-items: start; }
@media (max-width: 1000px) { .dv-grid { grid-template-columns: 1fr; } }
.dv-form .field { margin-bottom: 12px; }
.dv-color { width: 64px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; }
.sd-layout-hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
/* Shop-Kategorie-Zuordnung im Artikel-Dialog (Mehrfachauswahl, Kinder eingerückt) */
.sk-check-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.sk-check-list .check-row { margin: 0; padding: 3px 0; }
.sk-check-list .check-row.is-sub { padding-left: 22px; }
.dv-bp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.dv-bp-label { flex: none; min-width: 140px; font-size: 13.5px; }
.dv-bp-file { font-size: 12.5px; max-width: 230px; }
.dv-bp-status { font-size: 12px; color: var(--muted); padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; }
.dv-bp-status.is-ok { color: #1b7f3b; border-color: color-mix(in srgb, #1b7f3b 40%, transparent); }
.dv-preview-box { position: sticky; top: 12px; }
.dv-preview-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 10px; }
.dv-preview-head .field { margin-bottom: 0; flex: 1; }
.dv-preview { width: 100%; height: 620px; border: 1px solid var(--border); border-radius: 12px; background: #525659; }

/* Shop-Einstellungen (Mandant): Zahlart-Zeile = Checkbox + Hinweistext daneben */
.shop-zahlart { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 10px; align-items: center; margin-bottom: 8px; }
.shop-zahlart .check-row { margin: 0; }
@media (max-width: 700px) { .shop-zahlart { grid-template-columns: 1fr; gap: 4px; } }

/* Website-Bilder der Storefront (Hero-Slider + „Über uns"): Vorschau + Upload/Entfernen */
.shop-bild-zeile { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dotted var(--border); }
.shop-bild-preview { flex: none; width: 86px; height: 48px; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--muted) 12%, transparent); display: grid; place-items: center; }
.shop-bild-preview img { width: 100%; height: 100%; object-fit: cover; }
.shop-bild-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 14px; }
.shop-bild-zeile .btn { padding: 6px 12px; }
@media (max-width: 700px) { .shop-bild-zeile { flex-wrap: wrap; } }

/* Shop-Design (Operator): Formular links, Live-Mockup rechts (nutzt .dv-grid) */
.sd-field input[type='color'] { width: 100%; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); cursor: pointer; }
.sd-preview { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); }
.sdp-kopf { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.sdp-marke { font-weight: 700; letter-spacing: 0.06em; }
.sdp-links span { margin-left: 12px; }
.sdp-nav { display: flex; gap: 14px; padding: 8px 14px; border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.sdp-hero { padding: 26px 14px; text-align: center; background: linear-gradient(135deg, #6d6d6d, #3c3c3c); }
.sdp-hero-text { font-size: 15px; font-weight: 700; letter-spacing: 0.12em; }
.sdp-inhalt { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sdp-h1 { font-size: 17px; font-weight: 700; }
.sdp-h2 { font-size: 14px; font-weight: 700; }
.sdp-h3 { font-size: 13px; font-weight: 600; }
.sdp-karte { border-radius: 10px; padding: 10px 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); display: flex; flex-direction: column; gap: 6px; }
.sdp-text { font-size: 12px; }
.sdp-btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.sdp-btn { display: inline-block; padding: 5px 11px; border-radius: 8px; font-size: 11.5px; font-weight: 600; }
.sdp-alter { border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.sdp-alter-text { font-size: 12px; }
.sdp-footer { padding: 10px 14px; font-size: 11.5px; text-align: center; }

/* Artikel: E-Label-QR + Flaschenfoto im Dialog */
.elabel-qr { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.elabel-qr img { border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.artikel-foto { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.artikel-foto img { max-height: 180px; max-width: 60%; border-radius: 10px; border: 1px solid var(--border); }

/* Kontoauszüge einlesen: Zahlungseingang-Zeilen mit Rechnungszuordnung */
.bk-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.bk-row:last-of-type { border-bottom: none; }
.bk-check { flex: none; padding-top: 3px; }
.bk-main { flex: 1; min-width: 0; }
.bk-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.bk-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-betrag { flex: none; font-variant-numeric: tabular-nums; font-weight: 600; }
.bk-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-ziel { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.bk-ziel select { flex: 1; min-width: 0; }
.bk-chip { flex: none; }

/* Gutschrift erstellen: gleiche Positionszeilen wie Auftrag/Angebot (.pos-row),
   nur ohne Rabatt-/Positionsart-Spalte. */
.pos-row.is-gsrow {
  grid-template-columns: 22px minmax(0, 1fr) 96px 108px 38px;
  grid-template-areas: 'handle main menge preis x';
}
@media (max-width: 700px) {
  .pos-row.is-gsrow {
    grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) auto 38px;
    grid-template-areas:
      'handle main main main x'
      '. menge preis . .';
  }
}

/* Rechte-Matrix im Mitarbeiter-Dialog */
.perm-matrix { border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px 10px; margin-bottom: 12px; }
.perm-rubrik { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand); margin: 12px 0 4px; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; flex-wrap: wrap; }
.perm-main { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.perm-extra { margin-left: auto; display: inline-flex; gap: 14px; }
.perm-extra-item { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }

/* ---------- Modul Auswertungen ---------- */
.kpi-tile.is-static { cursor: default; }
.kpi-tile.is-static:hover { border-color: var(--border); }
.kpi-tile.is-static.is-accent:hover { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.aw-section { margin-top: 20px; }
.aw-chart svg { width: 100%; height: auto; display: block; }
.aw-bar-rect { fill: var(--brand); opacity: 0.85; }
.aw-bar-rect.is-zero { fill: var(--border); opacity: 0.6; }
.aw-bar-val { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.aw-bar-lbl { font-size: 10.5px; fill: var(--muted); }
.aw-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 26px; }
.aw-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 13.5px; }
.aw-rank { flex: none; width: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.aw-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.aw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-sub { color: var(--muted); font-size: 12px; }
.aw-track { display: block; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 10%, transparent); overflow: hidden; }
.aw-fill { display: block; height: 100%; border-radius: 999px; background: var(--brand); opacity: 0.8; }
.aw-val { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Dokument-Upload: Drop-Zone ---------- */
.doc-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 22px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 12px; background: var(--bg); color: var(--muted);
}
.doc-drop:hover { border-color: var(--brand); }
.doc-drop.is-dragover { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); color: var(--text); }
.doc-drop.has-file { border-style: solid; color: var(--text); }
.doc-drop-ic { display: inline-flex; }
.doc-drop-ic svg { width: 30px; height: 30px; fill: currentColor; }
.doc-drop-text { font-size: 14px; overflow-wrap: anywhere; }
.doc-drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.chip {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.chip-live { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }
.chip-soon { background: color-mix(in srgb, var(--accent) 45%, transparent); color: #6a5312; }
.chip-plan { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }

[data-theme='dark'] .chip-soon { color: var(--accent); }

/* Webshop-Bestellung: Icon in der Auftragsliste (weinrot) + Herkunfts-Chip im Formular */
.module-icon.is-shop-order { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); }
[data-theme='dark'] .module-icon.is-shop-order { color: color-mix(in srgb, var(--brand) 55%, #fff); }
.chip-shop-order {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
  color: var(--brand);
}
.chip-shop-order svg { width: 13px; height: 13px; fill: currentColor; }
[data-theme='dark'] .chip-shop-order { color: color-mix(in srgb, var(--brand) 55%, #fff); }

/* ---------- „Was ist neu?"-Popup (Bottom-Sheet, wie CURENA) ---------- */
/* Von unten eingeschoben statt zentriert. */
.sheet-backdrop { align-items: flex-end; padding: 0; }

.modal-changelog {
  width: 100%;
  max-width: 560px;
  padding: 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  animation: sheetUp 0.22s ease;
}

@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.cl-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.cl-title-ic { display: inline-flex; flex: none; }
.cl-title-ic svg { width: 22px; height: 22px; fill: var(--brand); }

.cl-scroll { flex: 1; overflow-y: auto; padding: 14px 18px; }

.cl-version { margin-bottom: 16px; }
.cl-version:last-child { margin-bottom: 0; }

.cl-vhead { font-size: 12.5px; font-weight: 700; color: var(--brand); margin-bottom: 6px; }

.cl-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.cl-list li { font-size: 14px; line-height: 1.45; }

.cl-ok { margin: 8px 18px calc(16px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Generischer Bottom-Sheet-Dialog (z. B. Passwort ändern) ---------- */
.modal-sheet {
  width: 100%;
  max-width: 480px;
  padding: 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  animation: sheetUp 0.22s ease;
}

/* Klick auf den Backdrop schließt NICHT (Datenverlust-Schutz) – der Dialog
   „wackelt" stattdessen kurz, damit klar ist: Schließen über die Buttons. */
.is-nudge { animation: sheetNudge 0.3s ease; }
@keyframes sheetNudge {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(0.985); }
  60% { transform: scale(1.004); }
}

.sheet-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 700;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.sheet-title-ic { display: inline-flex; flex: none; }
.sheet-title-ic svg { width: 22px; height: 22px; fill: var(--brand); }
/* Rundes Schließen-X oben rechts in der Titelzeile */
.sheet-title-x {
  margin-left: auto; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: none; border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted); cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.sheet-title-x svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.sheet-title-x:hover { background: color-mix(in srgb, var(--brand) 16%, transparent); color: var(--brand); }
/* Bestätigungsdialog (confirmModal) */
.confirm-msg { margin: 0 0 18px; line-height: 1.5; font-size: 15px; }
@media (min-width: 860px) { .modal-sheet.confirm-sheet { max-width: 460px; } }
/* Status-Chip + Pfeil-Button (nächster Status) oben rechts in der Titelzeile */
.sheet-title-status { margin-left: auto; flex: none; font-weight: 400; display: inline-flex; align-items: center; gap: 8px; }
.status-advance { padding: 5px 8px; }
.status-advance svg { width: 18px; height: 18px; fill: currentColor; display: block; }

.sheet-body { overflow-y: auto; padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px)); }

.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* Aktionen nebeneinander in einer Einstellungszeile */
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- Desktop: zentrierter Dialog statt Bottom-Sheet ----------
   Auf Mobilgeräten bleibt das Sheet am unteren Rand (Daumen-Ergonomie);
   ab 860px wird daraus ein mittiger, breiter Dialog, und Formulare nutzen
   die Breite mit einem zweispaltigen Raster. */
@media (min-width: 860px) {
  .sheet-backdrop { align-items: center; padding: 32px; }

  .modal-sheet,
  .modal-changelog {
    max-height: min(86vh, 920px);
    border-radius: 18px;
    animation: dialogIn 0.18s ease;
  }
  .modal-sheet { max-width: min(720px, 92vw); }
  /* Breite Dialoge (z. B. Auftrag anlegen): wachsen dynamisch mit dem Bildschirm */
  .modal-sheet.is-wide { max-width: clamp(720px, 80vw, 1240px); }
  .modal-changelog { max-width: 620px; }

  .sheet-title { padding: 20px 26px 14px; border-bottom: 1px solid var(--border); }
  .sheet-body { padding: 20px 26px 24px; }
  .cl-ok { margin-bottom: 18px; }

  /* Formulare zweispaltig: Standard = volle Zeile, einzelne Eingabefelder
     halbbreit; .grid2-Paare lösen sich ins Raster auf (display: contents). */
  .sheet-body form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 22px;
    align-items: start;
  }
  .sheet-body form > * { grid-column: 1 / -1; min-width: 0; }
  .sheet-body form > .field { grid-column: auto; }
  .sheet-body form > .field:has(textarea),
  .sheet-body form > .field:has(input[type='file']) { grid-column: 1 / -1; }
  .sheet-body form > .grid2 { display: contents; }
  .sheet-body form > .check-row { grid-column: auto; }
  .sheet-body form > .btn { justify-self: start; }
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* Ansprechpartner-Liste (Kunde anlegen/bearbeiten): Name + Telefon + Entfernen */
.contact-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.contact-row { display: flex; gap: 8px; align-items: center; }
.contact-row input {
  flex: 1; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
.contact-row input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.contact-remove { flex: none; padding: 8px 10px; }
.contact-remove svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Modul CRM ---------- */
.module-tile.is-clickable { cursor: pointer; }
.module-tile.is-clickable:hover { border-color: var(--brand); }
.tenant-item.is-clickable { cursor: pointer; }
.tenant-item.is-clickable:hover { border-color: var(--brand); }

.crm-search { margin-bottom: 12px; }

.chip-vip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent); color: #232323; border: none;
}
.chip-vip svg { width: 12px; height: 12px; fill: currentColor; }

.cust-no { flex: none; font-size: 12px; color: var(--muted); align-self: center; }

/* Geburtstags-Übersicht (nächste 14 Tage) */
.birthday-box {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 12px;
}
.birthday-title {
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-size: 13px; margin-bottom: 6px;
}
.birthday-title svg { width: 16px; height: 16px; fill: var(--brand); }
.birthday-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 0; font-size: 14px; cursor: pointer;
}
.birthday-row:hover { color: var(--brand); }
.birthday-date { font-weight: 600; flex: none; }
.birthday-when { margin-left: auto; color: var(--muted); font-size: 12px; }

/* Checkbox-Zeilen (z. B. VIP, Newsletter) */
.check-row {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 0; cursor: pointer; font-size: 15px;
}
.check-row input[type='checkbox'] {
  width: 18px; height: 18px; accent-color: var(--brand); flex: none;
}

/* Gefahren-Button (Löschen) links in den Sheet-Aktionen */
.btn.danger { color: #b3261e; border-color: #b3261e; }
.btn.danger:hover { background: rgba(179, 38, 30, 0.08); }
.btn.danger svg { fill: currentColor; width: 18px; height: 18px; }
.sheet-actions .sheet-left { margin-right: auto; }

/* ---------- Modul Lager ---------- */
.chip-low { background: rgba(179, 38, 30, 0.12); color: #b3261e; border: none; }

.bestand-col { display: flex; flex-direction: column; align-items: flex-end; flex: none; align-self: center; }
.bestand-wert { font-weight: 700; font-variant-numeric: tabular-nums; }
.bestand-wert.is-low { color: #b3261e; }

.buchen-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.buchen-row input {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.buchen-row input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

.journal-row {
  display: flex; gap: 10px; align-items: center;
  font-size: 13px; padding: 3px 0; color: var(--text);
}
.journal-date { color: var(--muted); flex: none; }
.journal-delta { font-weight: 600; font-variant-numeric: tabular-nums; flex: none; min-width: 44px; text-align: right; }
.journal-delta.is-plus { color: #1b7f3b; }
.journal-delta.is-minus { color: #b3261e; }
.journal-user { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ---------- Modul Aufträge ---------- */
.order-sum { flex: none; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Status-Chips je Auftragsstatus */
.chip-os-offen            { background: rgba(216, 191, 146, 0.35); color: var(--text); border: none; }
.chip-os-kommissionierung { background: rgba(46, 116, 181, 0.15); color: #2e74b5; border: none; }
.chip-os-versendet        { background: rgba(109, 35, 48, 0.12); color: var(--brand); border: none; }
.chip-os-fakturiert       { background: rgba(27, 127, 59, 0.14); color: #1b7f3b; border: none; }
.chip-os-abgeschlossen    { background: rgba(27, 127, 59, 0.14); color: #1b7f3b; border: none; }
.chip-os-storniert        { background: rgba(179, 38, 30, 0.12); color: #b3261e; border: none; }

/* Positionszeilen im Anlegen-Dialog: festes Raster, damit die Spalten aller
   Zeilenarten (Artikel, Einmal-, Textposition) exakt untereinander stehen. */
.pos-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pos-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 96px 108px 76px 126px 38px;
  grid-template-areas: 'handle main menge preis rabatt typ x';
  gap: 8px; align-items: center;
}
/* Reine Textzeile: Text läuft über die Menge-/Preis-/Rabatt-Spalten */
.pos-row.is-textrow { grid-template-areas: 'handle main main main main typ x'; }
.pos-handle { grid-area: handle; }
.pos-main { grid-area: main; min-width: 0; }
.pos-menge { grid-area: menge; }
.pos-preis { grid-area: preis; }
.pos-rabatt { grid-area: rabatt; }
.pos-typtg { grid-area: typ; justify-self: start; }
.pos-x { grid-area: x; }
.pos-row > input,
.pos-row > select.pos-mwst {
  width: 100%; min-width: 0; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.pos-row > input:focus,
.pos-row > select.pos-mwst:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.pos-row > select.pos-mwst:disabled { opacity: 0.45; }
/* Einmalposition: zusätzliche MwSt-Spalte (Satz direkt an der Zeile, 19/7/0 %) */
.pos-row.is-einmal {
  grid-template-columns: 22px minmax(0, 1fr) 96px 108px 78px 76px 126px 38px;
  grid-template-areas: 'handle main menge preis mwst rabatt typ x';
}
.pos-mwst { grid-area: mwst; }
/* Schmale Bildschirme: zweizeilig (Artikel oben, Menge/Preis/Rabatt/Art darunter) */
@media (max-width: 700px) {
  .pos-row {
    grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 70px auto 38px;
    grid-template-areas:
      'handle main main main main x'
      '. menge preis rabatt typ .';
  }
  .pos-row.is-einmal {
    grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 70px 70px auto 38px;
    grid-template-areas:
      'handle main main main main main x'
      '. menge preis mwst rabatt typ .';
  }
  .pos-row.is-textrow { grid-template-areas: 'handle main main main typ x'; }
}

/* Kleine „Position/Einmal/Text"-Buttons direkt unter den Positionen */
.pos-add-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.pos-add-btn { padding: 6px 11px; font-size: 13px; }
.pos-add-btn svg { width: 16px; height: 16px; }
/* Zusammenfassung rechts: Gesamtnachlass ÜBER der Summe; € bricht nicht um */
.pos-summary { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-bottom: 12px; }
.pos-summe-line { font-weight: 700; white-space: nowrap; }

/* Gesamtnachlass im Positionsfuß */
.pos-gr-wrap { color: var(--muted); font-weight: 400; white-space: nowrap; }
.pos-gesamtrabatt {
  width: 72px; padding: 7px 9px; font: inherit; font-size: 13.5px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.pos-gesamtrabatt:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* Rabattausweis in Auftrags-/Rechnungsdetail */
.oi-rabatt {
  margin-left: 8px; font-size: 12px; color: var(--brand); white-space: nowrap;
}

/* Positionsart als Icon-Toggle: € berechnet / Geschenk ohne Berechnung / Auge-zu intern */
.typ-toggle {
  display: inline-flex; flex: none; overflow: hidden;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.typ-toggle button {
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; padding: 9px 10px; cursor: pointer; color: var(--muted);
}
.typ-toggle button + button { border-left: 1px solid var(--border); }
.typ-toggle button.is-active { background: var(--brand); color: #fff; }
.typ-toggle svg { width: 18px; height: 18px; fill: currentColor; }

/* Drag-Handle zum Sortieren der Positionen */
.pos-handle {
  display: inline-flex; flex: none; cursor: grab; touch-action: none;
  color: var(--muted); align-self: center;
}
.pos-handle svg { width: 20px; height: 20px; fill: currentColor; }
.pos-row.is-dragging { opacity: 0.55; }

/* Freitext-Eingabe (Einmal-/Textposition) – Optik wie die anderen Felder */
.pos-text {
  min-width: 0; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.pos-text:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

.pos-foot-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-row > input:disabled { opacity: 0.45; }
.oi-chip { margin-left: 8px; }
/* Reine Textzeile in Auftrags-/Rechnungsdetail */
.oi-text { font-style: italic; color: var(--muted); }

/* ---------- Filterkopf über Listen: Zeitraum + Status als Dropdowns ---------- */
.filter-head {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 14px;
}

/* Suchfeld in der Filterzeile (wächst; schiebt den Export-Knopf nach rechts) */
.filter-search { flex: 1 1 200px; min-width: 150px; display: flex; }
.filter-search input {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.filter-search input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* Export-Menü: gleiche Optik wie die Filter-Dropdowns, Panel rechtsbündig */
.exp-menu { flex: none; }
.exp-menu .fdrop-panel { left: auto; right: 0; min-width: 210px; }
.exp-ic { display: inline-flex; }
.exp-ic svg { width: 16px; height: 16px; fill: currentColor; }

.fdrop { position: relative; display: inline-block; }
.fdrop-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 12px; font: inherit; font-size: 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.fdrop-btn:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.fdrop-prefix { color: var(--muted); font-size: 12.5px; }
.fdrop-prefix::after { content: ':'; }
.fdrop-label { font-weight: 600; }

.fdrop-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 235px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 8px;
}
.fdrop-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.fdrop-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.fdrop-item.is-selected { background: color-mix(in srgb, var(--brand) 14%, transparent); font-weight: 600; }

.fdrop-dates {
  border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.fdrop-dates label {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; color: var(--muted);
}
.fdrop-dates input {
  padding: 7px 9px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.fdrop-dates input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }

/* ---------- Auswahlfeld mit integrierter Suche (searchSelect) ---------- */
.ssel { position: relative; }
.ssel-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; font: inherit; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.ssel-btn:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.ssel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssel-label.is-placeholder { color: var(--muted); }
.ssel-arrow { display: inline-flex; flex: none; }
.ssel-arrow svg { width: 20px; height: 20px; fill: var(--muted); }

.ssel-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 8px;
}
.ssel-search {
  width: 100%; padding: 8px 10px; margin-bottom: 6px; font: inherit;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.ssel-search:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.ssel-list { max-height: 220px; overflow-y: auto; }
.ssel-item {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.ssel-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.ssel-item.is-selected { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.ssel-item-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssel-sub { color: var(--muted); font-size: 12px; flex: none; }
.ssel-empty { padding: 8px 10px; color: var(--muted); font-size: 14px; }
.pos-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pos-summe { font-weight: 600; }

.order-status-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; }

.order-items { margin-bottom: 10px; }
.order-item-row { display: flex; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.order-item-row.is-clickable { cursor: pointer; }
.order-item-row.is-clickable:hover { color: var(--brand); }
.oi-menge { flex: none; color: var(--muted); min-width: 64px; }
.oi-name { flex: 1; min-width: 0; }
.oi-preis { flex: none; font-variant-numeric: tabular-nums; }
.oi-total { border-top: 1px solid var(--border); font-weight: 700; margin-top: 4px; padding-top: 8px; }

.cust-history { margin-bottom: 6px; }

/* Versand-Aktionen (Lieferschein/Paketlabel) im Auftragsdetail */
.versand-group { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 10px; }
.versand-group .versand-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.versand-group .btn { padding: 6px 8px; }
.versand-group .btn svg { width: 18px; height: 18px; fill: currentColor; }
.liefer-box { margin: 4px 0 10px; }
.liefer-addr { font-size: 14px; line-height: 1.45; }

/* Accordion (zusammenklappbarer Formular-Abschnitt, natives <details>) */
.acc { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; background: var(--bg); }
.acc > .acc-head {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; user-select: none;
}
.acc > .acc-head::-webkit-details-marker { display: none; }
.acc .acc-chev { display: inline-flex; flex: none; }
.acc .acc-chev svg { width: 20px; height: 20px; fill: var(--muted); transition: transform 0.15s ease; }
.acc[open] .acc-chev svg { transform: rotate(180deg); }
.acc .acc-badge {
  margin-left: auto; flex: none; font-weight: 500; font-size: 12px; color: var(--muted);
  padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; white-space: nowrap;
}
.acc .acc-body { padding: 2px 14px 14px; }
.acc .acc-body .field:last-child { margin-bottom: 0; }
@media (min-width: 860px) {
  /* Gleiches zweispaltiges Raster wie im Formular selbst */
  .acc .acc-body { display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; align-items: start; }
  .acc .acc-body > * { grid-column: 1 / -1; min-width: 0; }
  .acc .acc-body > .field { grid-column: auto; }
  .acc .acc-body > .field:has(textarea) { grid-column: 1 / -1; }
  .acc .acc-body > .grid2 { display: contents; }
  .acc .acc-body > .check-row { grid-column: auto; }
  .acc .acc-body > .btn { justify-self: start; }
}

/* Mehrere Lieferadressen im Adress-Dialog (je Adresse eine Karte) */
.addr-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.addr-card { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--card-bg, transparent); }
.addr-card .addr-x { position: absolute; top: 8px; right: 8px; }
.addr-card .field:last-child { margin-bottom: 0; }

/* Aktionsbuttons rechts in der Auftragszeile (Bearbeiten/Stornieren/Export) */
.order-row-acts { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; flex: none; }
.order-row-acts .fdrop-btn { padding: 6px 8px; }
.order-row-acts .fdrop-label { display: none; }
/* Platzhalter für fehlende Aktions-Icons: gleiche Breite wie .icon-act (38px),
   damit die Aktionsspalte konstant bleibt und die Beträge untereinander stehen. */
.icon-act-ph { display: inline-block; width: 38px; height: 38px; flex: none; }
/* Ausgabe-Band oben im Auftrag: zentriert, dicht unter der Titel-Linie, mit
   eigener Trennlinie darunter (grenzt die Ausgabe vom Inhaltsbereich ab). Das
   negative margin-top zieht das Band nah an die Titel-Linie (reduziert das
   sheet-body-Padding); padding-bottom = gleicher Abstand zur Linie darunter. */
.order-form-actions {
  justify-content: center;
  margin: -8px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.order-form-versand { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
@media (min-width: 860px) { .order-form-actions { margin-top: -12px; } }
/* Schreibgeschützte Auftragsansicht (ab versendet): identisch, aber nicht interaktiv.
   Nur die Versand-Belege oben und der Schließen-Button bleiben klickbar. */
.order-form-ro { pointer-events: none; }
.order-form-ro .order-form-actions, .order-form-ro .sheet-actions { pointer-events: auto; }
.order-form-ro .pos-x, .order-form-ro .pos-handle { visibility: hidden; }
/* Rechnungslink links vom Status-Chip (Status „fakturiert") */
.invoice-link { padding: 4px 9px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.invoice-link svg { width: 15px; height: 15px; fill: currentColor; }

/* Ausgabe-Protokoll (gemailt/gedruckt/geteilt) in der Rechnungsliste */
.inv-flags { display: inline-flex; flex-wrap: wrap; gap: 10px; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.inv-flag { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.inv-flag svg { width: 13px; height: 13px; fill: currentColor; }
.order-status-row .inv-flags { margin: 0 0 0 4px; align-self: center; }

/* ---------- Modul Faktura ---------- */
.invoice-addr {
  white-space: pre-line; font-size: 14px; margin: 8px 0 4px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
}

/* Bereichs-Umschalter: Rechnungen vorbereiten | Rechnungen */
/* Belege-Tab: Bereichs-Umschalter (Angebote | Aufträge | Rechnungen) */
.belege-seg { margin-bottom: 14px; }

.fk-seg {
  display: inline-flex; overflow: hidden; flex: none;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.fk-seg-btn {
  border: none; background: none; padding: 9px 14px; font: inherit; font-size: 13.5px;
  font-weight: 600; cursor: pointer; color: var(--muted); white-space: nowrap;
}
.fk-seg-btn + .fk-seg-btn { border-left: 1px solid var(--border); }
.fk-seg-btn.is-active { background: var(--brand); color: #fff; }

/* Rechnungen vorbereiten: Kundengruppen mit abwählbaren Aufträgen */
.fk-vb-gruppe {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 12px;
}
.fk-vb-kopf {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.fk-vb-kopf-rechts { display: inline-flex; align-items: center; gap: 12px; }
.fk-vb-row {
  display: flex; gap: 10px; align-items: center; padding: 8px 0;
}
.fk-vb-row + .fk-vb-row { border-top: 1px solid var(--border); }
.fk-vb-check { display: flex; flex: none; padding: 4px; cursor: pointer; }
.fk-vb-check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.fk-vb-row .tenant-main.is-clickable { cursor: pointer; }
.fk-vb-row .tenant-main.is-clickable:hover .tenant-name { color: var(--brand); }

/* Kunden-Dialog: Nachlass je Artikelkategorie */
.cd-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.cd-row select {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.cd-row input {
  width: 90px; flex: none; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}

/* ---------- Modul Kellerbuch ---------- */
.kb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.kb-tile {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.kb-tile.is-clickable { cursor: pointer; }
.kb-tile.is-clickable:hover { border-color: var(--brand); }
.kb-tile-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kb-nummer { font-weight: 700; font-size: 16px; }
.kb-inhalt { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.kb-wein { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-liter { flex: none; font-variant-numeric: tabular-nums; }
.kb-leer { color: var(--muted); font-style: italic; }
.kb-bar { height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; }
.kb-bar-fill { height: 100%; background: var(--brand); border-radius: 3px; }
.kb-bar-fill.is-over { background: #b3261e; }
.kb-vol { font-size: 11.5px; color: var(--muted); text-align: right; }

.kb-menge { flex: none; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.kb-menge.is-plus { color: #1b7f3b; }
.kb-menge.is-minus { color: #b3261e; }
.tenant-item.kb-storniert .tenant-name, .tenant-item.kb-storniert .tenant-sub { text-decoration: line-through; opacity: 0.65; }

.kb-storno-row { display: flex; gap: 8px; margin: 10px 0 4px; }
.kb-storno-row input {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}

/* Stammdaten-Gliederung nach Modulen (Einstellungen -> Stammdaten -> Modul) */
.stamm-modul {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--brand); margin: 18px 2px 6px;
}
.stamm-modul:first-of-type { margin-top: 6px; }

/* ---------- Einstellungen: Kachel-Navigation (Muster CURENA) ---------- */
.stamm-page-title { margin: 2px 2px 14px; display: flex; align-items: center; gap: 6px; }
.stamm-page-title svg { width: 22px; height: 22px; fill: currentColor; }

/* Zurück-Leiste */
.set-backbar {
  margin-bottom: 12px; display: inline-flex; align-items: center; gap: 4px;
  padding: 7px 12px;
}
.set-backbar svg { width: 18px; height: 18px; fill: currentColor; }

/* Navigations-Kachel (Card-Button) */
.set-tile {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  font: inherit; cursor: pointer; color: var(--text);
}
.set-tile-ico { flex: 0 0 auto; display: inline-flex; }
.set-tile-ico svg { width: 24px; height: 24px; fill: var(--brand); }
.set-tile-txt { flex: 1; min-width: 0; }
.set-tile-label { display: block; font-weight: 700; }
.set-tile-desc { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.set-tile-chev { flex: 0 0 auto; display: inline-flex; }
.set-tile-chev svg { width: 20px; height: 20px; fill: var(--muted); }

/* ---------- Stammdaten: filterbare Listenseite ---------- */
.stamm-list-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 4px 2px 10px;
}
.stamm-lh-title { display: inline-flex; align-items: center; gap: 7px; font-size: 17px; font-weight: 700; }
.stamm-lh-title svg { width: 22px; height: 22px; fill: currentColor; }
.stamm-lh-title > span:last-child { white-space: nowrap; }
.stamm-lh-hint { margin: 0 2px 10px; }
.stamm-search {
  flex: 1 1 160px; min-width: 120px; display: flex; align-items: center; gap: 7px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0 10px; height: 38px;
}
.stamm-search:focus-within { border-color: var(--brand); }
.stamm-search svg { width: 17px; height: 17px; fill: var(--muted); flex: 0 0 auto; }
.stamm-search-input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font: inherit; font-size: 14px; color: var(--text); padding: 0;
}
/* „Neu"-Button rechts, auch bei Umbruch neben dem Suchfeld */
.stamm-list-head .btn.primary { flex: 0 0 auto; }

.stamm-list { display: flex; flex-direction: column; }
.stamm-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--border);
}
.stamm-row:first-child { border-top: none; }
.stamm-row.is-inactive { opacity: 0.6; }
.stamm-main { flex: 1; min-width: 0; }
.stamm-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stamm-badge { flex: 0 0 auto; }
.stamm-sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Aktions-Icons je Zeile (Bearbeiten / Löschen) */
.icon-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.icon-act {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--muted);
}
.icon-act svg { width: 20px; height: 20px; fill: currentColor; }
.icon-act:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.icon-act.is-del.is-armed { border-color: #b3261e; background: color-mix(in srgb, #b3261e 12%, transparent); }
.icon-act.is-del.is-armed svg { fill: #b3261e; }
.icon-act:disabled { opacity: 0.5; cursor: default; }

/* ---------- Stammdaten: Kategorien-Pflege ---------- */
.cat-add { display: flex; gap: 8px; margin-bottom: 12px; }
.cat-add input {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.cat-add input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.cat-row { display: flex; gap: 8px; align-items: center; padding: 5px 0; }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cat-row input {
  flex: 1; min-width: 0; padding: 8px 10px; font: inherit;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}

/* Vorschau des Kundenlogos im Bearbeiten-Dialog */
.logo-preview {
  display: block; max-height: 56px; max-width: 100%; width: auto;
  margin-bottom: 10px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #fff;
}

/* ---------- Modul Plantafel (VINORUM Rental) ---------- */
/* Tagesbasiertes Belegungsbrett (Muster NAMI): horizontal scrollbares Grid mit
   sticky Objektspalte; Buchungen als Parallelogramme mit diagonalen Enden. */
.rt-wrap { margin-top: 4px; }
.rt-scroll {
  overflow-x: auto; overflow-y: hidden; cursor: grab;
  border: 1px solid var(--border); border-radius: 12px; user-select: none;
}
.rt-scroll:active { cursor: grabbing; }
.rt-grid { position: relative; }

.rt-row { display: flex; }
.rt-row + .rt-row .rt-track, .rt-row + .rt-row .rt-rescell { border-top: 1px solid var(--border); }

/* Objektspalte links – bleibt beim Scrollen stehen */
.rt-rescell {
  position: sticky; left: 0; z-index: 5; flex: none; width: 160px;
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px; font-size: 13.5px; background: var(--card);
  border-right: 1px solid var(--border);
  overflow: hidden; white-space: nowrap;
}
.rt-rescell.is-clickable { cursor: pointer; }
.rt-rescell.is-clickable:hover { color: var(--brand); }
.rt-objname { overflow: hidden; text-overflow: ellipsis; }
.rt-geo { display: inline-flex; flex: none; }
.rt-geo svg { width: 14px; height: 14px; fill: var(--muted); }

/* Gruppenzeile */
.rt-group .rt-groupcell {
  font-weight: 700; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: color-mix(in srgb, var(--text) 4%, var(--card));
  height: 30px;
}
.rt-grouptrack { flex: none; height: 30px; background: color-mix(in srgb, var(--text) 4%, transparent); }

/* Kopfzeile mit den Tagen */
.rt-head { position: sticky; top: 0; z-index: 6; }
.rt-corner, .rt-track-head { height: 46px; background: var(--card); }
.rt-track { position: relative; flex: none; height: 46px; }
.rt-dayhead {
  position: absolute; top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 10.5px; color: var(--muted); border-left: 1px solid var(--border);
  overflow: hidden;
}
.rt-dayhead .rt-tag { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.1; }
.rt-dayhead.is-we { background: color-mix(in srgb, var(--text) 5%, transparent); }
.rt-dayhead.is-heute { background: color-mix(in srgb, var(--brand) 14%, transparent); }
.rt-dayhead.is-heute .rt-tag { color: var(--brand); }
.rt-monat {
  position: absolute; top: 1px; left: 3px; font-size: 9px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--brand); white-space: nowrap;
}

/* Objekt-Zeilen: Spur mit Tageslinien (per Inline-Gradient) + Balken */
.rt-row:not(.rt-head):not(.rt-group) .rt-track { height: 44px; background-color: var(--bg); }
.rt-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--brand); opacity: 0.55; z-index: 1; pointer-events: none; }

/* Buchungsbalken: Parallelogramm (Anreise mittags -> Abreise mittags) */
.rt-bar {
  position: absolute; top: 7px; bottom: 7px; z-index: 2;
  display: flex; align-items: center; overflow: hidden;
  background: var(--brand); color: #fff; cursor: pointer;
  font-size: 12px; white-space: nowrap;
}
.rt-bar:hover { filter: brightness(1.15); }
.rt-bar-label { overflow: hidden; text-overflow: ellipsis; padding-right: 4px; }
/* Sperrzeit: schraffiert (45°-Streifen wie NAMI) */
.rt-bar.is-sperre {
  background: repeating-linear-gradient(45deg,
    color-mix(in srgb, var(--text) 38%, transparent) 0, color-mix(in srgb, var(--text) 38%, transparent) 6px,
    color-mix(in srgb, var(--text) 18%, transparent) 6px, color-mix(in srgb, var(--text) 18%, transparent) 12px);
  color: var(--text);
}

/* ---------- Modul Protect: Wetterstationen + Risikoampel ---------- */
/* ---------- Modul Climate: Sensor-Monitoring ---------- */
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.cl-werte { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin: 12px 0; }
.cl-werte-detail { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.cl-tile { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--muted) 8%, transparent); }
.cl-tile b { font-size: 16px; font-weight: 700; }
.cl-tile-lbl { font-size: 11px; color: var(--muted); }
/* Vorhersage: „Morgen"-Zeile auf der Karte + 7-Tage-Streifen im Detail (DWD).
   Die Sensorkacheln füllen den variablen Raum, damit die „Morgen"-Zeile bei
   allen Karten auf gleicher Linie (unten, vor dem Fuß) steht. */
.pt-card > .cl-werte { flex: 1 1 auto; }
.cl-morgen { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 0; }
.cl-morgen:not(:empty) { padding: 8px 10px; border-radius: 10px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--accent) 16%, transparent); }
.cl-morgen-sym { font-size: 18px; line-height: 1; }
.cl-forecast { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px; }
.cl-fc-tag { display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 6px; border-radius: 12px; background: color-mix(in srgb, var(--muted) 8%, transparent); }
.cl-fc-name { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.cl-fc-sym { font-size: 24px; line-height: 1.2; }
.cl-fc-temp { font-size: 13px; }
.cl-fc-temp b { font-size: 14px; }
.cl-fc-sub { font-size: 11px; color: var(--muted); }

/* Sensor-Auswahl im Detail-Chart */
.cl-sensor-seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cl-sensor-seg button {
  border: 1px solid var(--border); background: none; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.cl-sensor-seg button.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Protect-Prognose: 7-Tage-Ampel-Ausblick aus der DWD-Vorhersage je Karte.
   Die Gründe-Liste füllt den variablen Raum, damit die Prognose bei allen
   Karten (Grid stretcht sie gleich hoch) auf gleicher Höhe unten steht. */
.pt-card > .pt-gruende { flex: 1 1 auto; margin-bottom: 0; }
.pt-prognose { margin: 4px 0; }
.pt-prognose:empty { display: none; }
.pt-prognose-lbl { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.pt-fc-quelle { display: block; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.pt-fc-streifen { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 5px; }
.pt-fc-tag { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pt-fc-wt { font-size: 10.5px; color: var(--muted); }
.pt-fc-dot { width: 100%; height: 9px; border-radius: 4px; background: var(--muted); }
.pt-fc-dot.is-niedrig   { background: #1b7f3b; }
.pt-fc-dot.is-mittel    { background: #b58a00; }
.pt-fc-dot.is-hoch      { background: #cf5b13; }
.pt-fc-dot.is-sehr-hoch { background: #b3261e; }
.pt-fc-dot.is-unbekannt { background: var(--muted); }

/* Krankheitsmodell-Umschalter (Peronospora/Oidium/Botrytis) über dem Raster */
.pt-modell-seg { display: flex; flex-wrap: wrap; margin: 4px 0 14px; }
.pt-modell-seg button { flex: 1 1 auto; white-space: nowrap; }
.pt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }

/* Hinweis „Daten werden aktualisiert …" (Snapshot sichtbar, Hintergrund lädt frisch) */
.pt-refresh { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pt-refresh-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: var(--brand);
  animation: ptPuls 1.1s ease-in-out infinite;
}
@keyframes ptPuls { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.pt-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.pt-card.is-inactive { opacity: 0.6; flex-direction: row; align-items: center; justify-content: space-between; }
.pt-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pt-card-head strong { font-size: 15.5px; }

/* Ampel-Chip */
.pt-ampel {
  flex: none; padding: 5px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; color: #fff;
}
.pt-ampel.is-unbekannt { background: var(--muted); }
.pt-ampel.is-niedrig   { background: #1b7f3b; }
.pt-ampel.is-mittel    { background: #b58a00; }
.pt-ampel.is-hoch      { background: #cf5b13; }
.pt-ampel.is-sehr-hoch { background: #b3261e; }

/* Aktuelle Messwerte */
.pt-werte { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pt-werte span { display: flex; flex-direction: column; font-size: 11.5px; color: var(--muted); }
.pt-werte b { font-size: 14.5px; color: var(--text); font-variant-numeric: tabular-nums; }

.pt-gruende { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.pt-gruende li { margin: 2px 0; }
.pt-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: auto; }
.pt-meta { font-size: 11.5px; color: var(--muted); }

/* Detail: Chart + Tageswerte */
.pt-detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pt-h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 16px 0 6px; }
.pt-chart { overflow-x: auto; }
.pt-svg { width: 100%; min-width: 560px; height: auto; display: block; }

/* Interaktives Chart (Pan/Zoom im Protect-Detail): kein Scrollen, Ziehen greift */
.pt-chart.is-interaktiv { overflow: hidden; cursor: grab; touch-action: none; user-select: none; }
.pt-chart.is-interaktiv.is-dragging { cursor: grabbing; }
.pt-chart.is-interaktiv .pt-svg { min-width: 0; pointer-events: none; }
.pt-chart-ctrl { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pt-chart-btns { margin-left: auto; display: flex; gap: 6px; }
.pt-chart-btn { padding: 3px 12px; font-weight: 700; min-width: 34px; }
.pt-chart-lade { color: var(--brand); }
.pt-grid-l { stroke: var(--border); stroke-width: 1; }
.pt-ax { font-size: 10px; fill: var(--muted); }
.pt-line-temp { fill: none; stroke: var(--brand); stroke-width: 1.8; }
.pt-line-rh { fill: none; stroke: #4a7fb5; stroke-width: 1.2; stroke-dasharray: 4 3; opacity: 0.85; }
.pt-rain { fill: #4a7fb5; opacity: 0.65; }
.pt-wet { fill: #1b7f3b; opacity: 0.8; }
.pt-tagrow {
  display: flex; gap: 16px; padding: 5px 0; font-size: 13.5px;
  border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.pt-tagrow:last-child { border-bottom: none; }
.pt-tag-datum { font-weight: 600; min-width: 78px; }

/* ---------- Modul KI-Assistent: Chat ---------- */
.ki-card {
  display: flex; flex-direction: column;
  height: calc(100dvh - 200px); min-height: 380px;
}
.ki-thread {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 10px;
  padding: 6px 2px; margin-bottom: 10px;
}

/* Sprechblasen */
.ki-msg { max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.ki-msg.is-user {
  align-self: flex-end; background: var(--brand); color: #fff;
  border-bottom-right-radius: 4px; white-space: pre-wrap;
}
.ki-msg.is-assistant {
  align-self: flex-start; background: color-mix(in srgb, var(--text) 6%, transparent);
  border-bottom-left-radius: 4px;
}
.ki-md p { margin: 0 0 8px; }
.ki-md p:last-child { margin-bottom: 0; }
.ki-md ul, .ki-md ol { margin: 0 0 8px; padding-left: 20px; }
.ki-md li { margin: 2px 0; }
.ki-md code {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  padding: 1px 5px; border-radius: 5px;
}

/* Transparenz-Zeile: welche Daten wurden nachgeschlagen */
.ki-used { align-self: flex-start; font-size: 11.5px; color: var(--muted); margin: -4px 0 2px 6px; }
.ki-errline { color: #b3261e; }

/* Tipp-Indikator (drei springende Punkte) */
.ki-typing { display: flex; gap: 5px; align-items: center; padding: 14px 16px; }
.ki-typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: ki-blink 1.2s infinite;
}
.ki-typing span:nth-child(2) { animation-delay: 0.2s; }
.ki-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ki-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; transform: translateY(-2px); } }

/* Begrüßung / Einrichtung + Beispielfragen */
.ki-setup { margin: auto; text-align: center; max-width: 460px; padding: 20px 10px; }
.ki-setup-ic svg { width: 44px; height: 44px; fill: var(--brand); opacity: 0.8; }
.ki-setup p { margin: 10px 0 6px; }
.ki-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.ki-chip {
  padding: 8px 13px; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--text);
}
.ki-chip:hover { border-color: var(--brand); color: var(--brand); }

/* Eingabezeile */
.ki-inputrow { display: flex; gap: 8px; align-items: flex-end; }
.ki-input {
  flex: 1; min-width: 0; resize: none; padding: 11px 14px; font: inherit;
  border: 1px solid var(--border); border-radius: 14px; background: var(--bg); color: var(--text);
  max-height: 140px;
}
.ki-input:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.ki-send { flex: none; padding: 11px 13px; border-radius: 14px; }
.ki-send svg { width: 19px; height: 19px; fill: currentColor; display: block; }

/* Undo-Leiste unten (Muster NAMI: 8 s sichtbar, Aktion rückgängig machbar) */
.undo-bar {
  position: fixed; left: 50%; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 90;
  transform: translate(-50%, 16px); opacity: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--anthracite, #232323); color: #fff;
  box-shadow: var(--shadow); font-size: 14px; max-width: min(92vw, 480px);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.undo-bar.show { transform: translate(-50%, 0); opacity: 1; }
.undo-msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo-bar .btn { background: transparent; color: var(--accent, #D8BF92); border-color: color-mix(in srgb, #fff 25%, transparent); }
