/* Inter wird lokal aus dem Ordner fonts/ geladen, kein Internetzugriff
   nötig. Falls die Dateien fehlen, fällt der Browser automatisch auf die
   Systemschrift zurück (siehe font-family bei body weiter unten). */
@font-face {
  font-family: "Inter";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Inter-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Inter-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Inter-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Inter-Bold.woff2") format("woff2");
}

/* Poppins Bold wird nur fürs Logo (Kopfzeile + Login) gebraucht.
   Fehlt die Datei, fällt der Browser automatisch auf Arial/serifenlose
   Systemschrift zurück - das Logo bleibt dann etwas weniger "rund",
   aber nichts bricht. */
@font-face {
  font-family: "Poppins";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/Poppins-Bold.woff2") format("woff2");
}

:root {
  --surface-0: #f5f5f3;
  --surface-1: #eeeeec;
  --surface-2: #ffffff;
  --text-primary: #1c1c1a;
  --text-secondary: #6b6b66;
  --text-muted: #9a9a94;
  --icon-muted: #9a9a94;
  --border: #e2e2de;
  --border-strong: #cfcfca;
  --accent: #2c4a6e;
  --accent-bg: #eaeef3;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --info: #2c4a6e;
  --info-bg: #eaeef3;
  --highlight: #a13d63;
  --highlight-bg: #f7e6ed;
  --required-dot: #d9822b;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-0: #171715;
    --surface-1: #232320;
    --surface-2: #2b2b28;
    --text-primary: #f2f2ee;
    --text-secondary: #b7b7b0;
    --text-muted: #83837c;
    --icon-muted: #cfcfca;
    --border: #3a3a36;
    --border-strong: #4a4a45;
    --accent: #7fa3c4;
    --accent-bg: #16283a;
    --danger: #f87171;
    --danger-bg: #450a0a;
    --warning: #fbbf24;
    --warning-bg: #451a03;
    --info: #7fa3c4;
    --info-bg: #16283a;
    --highlight: #e08fb0;
    --highlight-bg: #3a1826;
    --required-dot: #e2a44f;
  }
  :root:not([data-theme="light"]) .app-body { background: #0f0f0e; }
}

:root[data-theme="dark"] {
  --surface-0: #171715;
  --surface-1: #232320;
  --surface-2: #2b2b28;
  --text-primary: #f2f2ee;
  --text-secondary: #b7b7b0;
  --text-muted: #83837c;
  --icon-muted: #cfcfca;
  --border: #3a3a36;
  --border-strong: #4a4a45;
  --accent: #7fa3c4;
  --accent-bg: #16283a;
  --danger: #f87171;
  --danger-bg: #450a0a;
  --warning: #fbbf24;
  --warning-bg: #451a03;
  --info: #7fa3c4;
  --info-bg: #16283a;
  --highlight: #e08fb0;
  --highlight-bg: #3a1826;
  --required-dot: #e2a44f;
}
[data-theme="dark"] .app-body { background: #0f0f0e; }

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
}

/* Höhe der Titelleiste zentral - .app-body rechnet damit */
:root { --header-h: 48px; }

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-h);
  box-sizing: border-box;
  padding: 0 20px;
  background: #141a22;
  border-bottom: 1px solid #262c36;
}

.brand {
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Datum + Uhrzeit mittig im Header (Text immer hell, Header ist in beiden Themes dunkel) */
.header-clock { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: baseline; gap: 10px; white-space: nowrap; pointer-events: none; }
.header-clock-date { font-size: 12px; font-weight: 500; color: #9aa4b1; }
.header-clock-time { font-size: 14px; font-weight: 600; color: #f2f4f6; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
.header-divider { width: 1px; height: 22px; background: #2e3947; margin: 0 6px; }
/* Ohne Breadcrumb ist im Header auch hochkant (iPad) Platz für KW + Datum;
   nur auf dem Handy reicht die Breite nicht */
@media (max-width: 768px) {
  .header-clock { display: none; }
}

/* Eigene Organisation rechts im Header: Name oder Logo */
.header-org { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-org-name { font-size: 13px; font-weight: 600; color: #f2f4f6; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-org-logo-wrap { height: 30px; padding: 0 10px; border-radius: 8px; background: #ffffff; align-items: center; justify-content: center; box-sizing: border-box; }
.header-org-logo { display: block; max-height: 20px; max-width: 160px; object-fit: contain; }
@media (max-width: 768px) {
  .header-org-name { max-width: 110px; }
}

/* Einstellungen: Organisationslogo */
.org-logo-row { display: flex; align-items: center; gap: 16px; margin-top: 4px; }
.org-logo-preview { width: 200px; height: 64px; flex-shrink: 0; border-radius: 10px; background: #141a22; display: flex; align-items: center; justify-content: center; }
.org-logo-empty { font-size: 12px; color: #9aa4b1; }
.org-logo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-link-danger { border: none; background: none; padding: 8px 6px; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--danger); cursor: pointer; }
.btn-link-danger:hover { text-decoration: underline; }

.user-greeting { font-size: 12px; color: #9aa4b1; cursor: pointer; }
.user-greeting strong { color: #d5d9de; font-weight: 500; }
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.user-avatar:hover { background: #38bdf8; color: #141a22; }

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: #9aa4b1;
  cursor: pointer;
  position: relative;
}
.header-icon-btn:hover { background: rgba(255, 255, 255, 0.08); }
.header-icon-btn svg { width: 18px; height: 18px; }

.header-account { position: relative; }

.user-menu {
  display: none;
  position: absolute;
  top: 36px;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 6px;
  min-width: 140px;
  z-index: 50;
}
.user-menu.user-menu-open { display: block; }
.user-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
}
.user-menu-sep { height: 1px; background: var(--border); margin: 4px 2px; }
.user-menu-item {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.user-menu-item:hover { background: var(--surface-1); }
.user-menu-item-colors { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.typ-color-dots { display: inline-flex; gap: 4px; }
.typ-color-dot { width: 12px; height: 12px; border-radius: 4px; background: var(--border-strong); }

/* Dialog Farben Kasse / Privat */
.modal-box.typ-colors-box { max-width: 600px; width: calc(100vw - 32px); box-sizing: border-box; }
.typ-colors-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.typ-colors-head .modal-title { margin: 0; }
.typ-colors-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.typ-colors-label { margin: 14px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.typ-color-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.typ-color-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: none; background: none; font-family: inherit; cursor: pointer; }
.typ-color-swatch:disabled { opacity: 0.3; cursor: not-allowed; }
.typ-color-chip { width: 40px; height: 40px; border-radius: 12px; background: var(--sw-bg); border: 2px solid var(--sw-fg); color: var(--sw-fg); display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.typ-color-swatch-on .typ-color-chip { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--sw-fg); }
.typ-color-name { font-size: 11.5px; color: var(--text-secondary); }
.typ-color-swatch-on .typ-color-name { color: var(--text-primary); font-weight: 600; }
.typ-colors-preview { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.typ-colors-preview-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.typ-colors-prow { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.typ-colors-pnr { padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.typ-colors-pbez { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: #1c1c1a; }
.typ-colors-ppill { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.typ-colors-pstep { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.typ-colors-hint { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: var(--text-muted); }
.typ-colors-actions { align-items: center; }
.typ-colors-reset { margin-right: auto; border: none; background: none; padding: 0; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--accent); cursor: pointer; }
@media (max-width: 600px) {
  .typ-color-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.start-view-pill {
  display: flex;
  gap: 2px;
  background: var(--surface-1);
  border-radius: 8px;
  padding: 2px;
}
.start-view-option {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}
.start-view-option.start-view-active { background: var(--surface-2); color: var(--text-primary); font-weight: 500; }

.home-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.home-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text-primary);
}
.home-tile:hover { border-color: var(--accent); }
.home-tile svg { width: 22px; height: 22px; color: var(--accent); }
.home-tile span { font-size: 14px; font-weight: 500; }
.home-tile p { font-size: 12px; color: var(--text-secondary); margin: 0; }

.btn-logout-mini {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--danger);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.btn-logout-mini:hover { background: var(--danger-bg); }

.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.btn:hover { background: var(--surface-1); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent); opacity: 0.9; }
.btn:disabled, .btn-primary:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

#btn-new { margin-left: auto; }

main { flex: 1; min-width: 0; padding: 20px 24px; max-width: 1320px; margin: 0 auto; overflow-y: auto; height: 100%; }

.view-list,
.zf-columns {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  flex: 1;
  min-height: 0;
}

.patient-sidebar {
  width: min(620px, calc(50% - 10px));
  flex-shrink: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: none;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  overflow: hidden;
}

.search-box {
  margin: 0;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 9px 32px 9px 12px;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13px;
}

.search-clear-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-clear-btn:hover { background: var(--surface-1); color: var(--text-primary); }

.patient-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  background: transparent;
}

.patient-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}

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

.patient-row:hover { background: var(--info-bg); }
.patient-row.selected {
  background: var(--info-bg);
  border-left-color: var(--info);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  color: white;
}

.avatar.c0 { background: #8a7ca3; }
.avatar.c1 { background: #4a8f8f; }
.avatar.c2 { background: #b5697a; }
.avatar.c3 { background: #c2703d; }
.avatar.c4 { background: #c99a3d; }
.avatar-square { border-radius: 8px; }

.patient-row-name { margin: 0; font-size: 15px; font-weight: 500; white-space: normal; word-break: break-word; }
.patient-row-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }

.detail-card {
  width: min(620px, calc(50% - 10px));
  flex-shrink: 1;
  min-width: 0;
  background: var(--surface-2);
  border-radius: 8px;
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  padding: 20px 24px;
  position: relative;
}

.empty-hint { color: var(--text-muted); font-size: 14px; }

.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.detail-header-left { display: flex; gap: 12px; align-items: center; }
.detail-name { font-weight: 600; font-size: 17px; margin: 0; }
.detail-sub { font-size: 13px; color: var(--text-secondary); margin: 2px 0 0; }

.badge {
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
}

.photo-strip { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.photo-thumb {
  width: 80px; height: 80px; border-radius: 8px;
  background: var(--surface-1); object-fit: cover; cursor: pointer;
  border: 1px solid var(--border);
}

.fact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 20px;
  font-size: 13px;
  background: var(--surface-1);
  border-radius: 8px;
  padding: 14px;
}

.fact-label { margin: 0; color: var(--text-secondary); }
.fact-value { margin: 3px 0 0; font-weight: 500; overflow-wrap: break-word; }

.history-section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.history-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 0 0 8px; }
.history-item {
  display: flex; justify-content: space-between; font-size: 13px;
  padding: 10px 12px; cursor: pointer; border-radius: 8px;
  background: var(--info-bg); margin-bottom: 6px;
}
.history-item span:last-child { font-weight: 600; color: var(--info); }
.history-item:hover { opacity: 0.85; }

.view-create {
  display: flex;
  justify-content: center;
}

.form-card {
  background: var(--surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 28px 32px;
  max-width: 900px;
  width: 100%;
  position: relative;
}

#createForm input, #createForm select, #createForm textarea { border-radius: 8px; }
#createForm .photo-add-tile { border-radius: 8px; border-color: var(--info); color: var(--info); }
#createForm button[type="submit"] { background: var(--info); border-color: var(--info); border-radius: 8px; }
#createForm #btn-cancel { border-radius: 8px; }
#createForm #formDeleteBtn { border-radius: 8px; }

/* ── Zahnfarben-Formular (Patient anlegen/bearbeiten) ─────────────────────── */
#createForm.zf-form { max-width: 1060px; padding: 0; border: none; border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05); overflow: hidden; }
.zf-form-head { display: flex; align-items: center; gap: 14px; padding: 18px 28px; border-bottom: 1px solid var(--border); }
#createForm .zf-form-avatar { width: 42px; height: 42px; font-size: 15px; flex-shrink: 0; }
.zf-form-head-text { flex: 1; min-width: 0; }
#createForm .zf-form-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.zf-form-sub { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }
.zf-form-close { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-1); flex-shrink: 0; }
.zf-form-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 32px; padding: 20px 28px 22px; }
.zf-form-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.zf-form-section { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.zf-form-section-title { margin: 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 700; color: var(--text-primary); }
.zf-form-optional { margin-left: 6px; font-size: 12px; font-weight: 400; color: var(--text-muted); }
#createForm .field-label { font-size: 12.5px; font-weight: 600; }
#createForm .grid-2 { gap: 12px 14px; }
/* ID-Selektor schlägt die globale input-Regel; Datums-/Auswahlfelder behalten Platz für ihr Icon */
#createForm input, #createForm textarea { font-size: 14px; padding: 9px 12px; border-radius: 10px; }
#createForm .date-display { padding-right: 36px; }
#createForm .combo-wrap input { padding-right: 30px; }
#createForm .zf-field-big input { font-size: 17px; font-weight: 700; padding: 11px 12px; }
.zf-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
#createForm .zf-grid-3 input { padding: 8px 10px; }

/* Weitere Details: dezent abgesetzt */
.zf-more { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border-radius: 12px; background: color-mix(in srgb, var(--surface-1) 55%, var(--surface-2)); border: 1px solid var(--border); }
.zf-more-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.zf-more-title span { font-weight: 400; color: var(--text-muted); }
#createForm .zf-more input { background: var(--surface-2); }

.zf-seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border-radius: 10px; }
.zf-seg button { flex: 1; height: 34px; border: none; border-radius: 8px; background: transparent; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.zf-seg button.zf-seg-active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

/* Fotos: größere Kacheln, Knöpfe auf dem Foto */
.zf-photos { display: flex; flex-wrap: wrap; gap: 10px; }
/* Vorhandene und neue Fotos in EINER Reihe: beide Container "auflösen".
   !important, weil renderExistingPhotoStrip() display:flex inline setzt
   (ohne Fotos ist der Container leer, es bleibt also nichts sichtbar). */
#createForm .zf-photos .photo-preview, #createForm .zf-photos .photo-tile-grid { display: contents !important; }
#createForm .photo-thumb-wrap, #createForm .photo-tile { width: 92px; height: 92px; }
#createForm .photo-thumb-wrap .photo-thumb, #createForm .photo-tile img { width: 100%; height: 100%; box-sizing: border-box; border-radius: 12px; display: block; }
#createForm .photo-delete-btn, #createForm .photo-tile-remove, #createForm .photo-rotate-btn {
  width: 26px; height: 26px; border-radius: 8px; border: none;
  background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); font-size: 13px;
}
#createForm .photo-delete-btn, #createForm .photo-tile-remove { top: 6px; right: 6px; color: var(--danger); }
#createForm .photo-rotate-btn { top: auto; bottom: 6px; left: auto; right: 6px; color: #1c1c1a; font-size: 15px; }
#createForm .photo-delete-btn.undo { color: #1c1c1a; }
#createForm .photo-pending-label span { font-size: 11px; }
#createForm .photo-add-tile { width: 92px; height: 92px; border-radius: 12px; border: 1.5px dashed color-mix(in srgb, var(--info) 45%, transparent); background: var(--info-bg); color: var(--info); flex-direction: column; gap: 2px; font-size: 22px; }
#createForm .photo-add-tile::after { content: "Foto / Zeichnung"; font-size: 11px; font-weight: 600; }
.zf-photo-limit { margin: 0; font-size: 12px; color: var(--text-muted); }

#createForm .form-error { margin: 0 28px 14px; }
.zf-form-foot { display: flex; align-items: center; gap: 10px; padding: 14px 28px; border-top: 1px solid var(--border); background: var(--surface-1); }
.zf-foot-spacer { flex: 1; }
#createForm #formDeleteBtn.zf-delete-link { align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: none; border-radius: 10px; background: transparent; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--danger); cursor: pointer; }
#createForm #formDeleteBtn.zf-delete-link:hover { background: var(--danger-bg); }
.zf-pending-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warning); }
.zf-pending-hint::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); }
.zf-form-foot .btn { height: 38px; padding: 0 16px; border-radius: 10px; }
#createForm .zf-form-foot button[type="submit"] { padding: 0 20px; font-weight: 600; }
@media (max-width: 900px) {
  .zf-form-body { grid-template-columns: 1fr; }
  .zf-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

.section-title {
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  margin: 20px 0 12px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 15px;
  width: 100%;
  font-family: inherit;
}

select option {
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: inherit;
}

.field.required .field-label::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--required-dot);
  margin-left: 5px;
  vertical-align: middle;
}

.field.required.filled .field-label::after {
  display: none;
}

.required-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-right: 44px;
}
.form-title-row h2 { margin: 0; }

.required-legend .required-legend-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--required-dot);
  display: inline-block;
}

input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover,
textarea:hover {
  background: var(--surface-1);
}

#msgSubjectInput:hover, #msgComposeBody:hover, #msgReplyInput:hover {
  background: var(--surface-2);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

textarea { resize: vertical; margin-top: 4px; }

.photo-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius); }

.form-error {
  color: var(--danger);
  background: var(--danger-bg);
  font-size: 13px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
}

.form-actions { display: flex; gap: 8px; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }

@media (max-width: 820px) {
  .form-columns { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 768px) {
  .view-list, .zf-columns { flex-direction: column; }
  .patient-sidebar { width: 100%; height: 360px; order: 2; }
  .detail-card { width: 100%; order: 1; }
  .grid-2 { grid-template-columns: 1fr; }
}

.menu-wrap { position: relative; }

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--surface-1); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.icon-btn:disabled:hover { background: var(--surface-2); }

.menu-dropdown {
  position: absolute;
  top: 38px;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  padding: 4px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.menu-item {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-primary);
  font-family: inherit;
}
.menu-item:hover { background: var(--surface-1); }
.menu-item.danger {
  color: var(--danger);
  background: var(--danger-bg);
  font-weight: 600;
}
.menu-item.danger:hover { background: var(--danger-bg); opacity: 0.85; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-box {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 380px;
  width: 90%;
}

.modal-title { font-weight: 600; font-size: 16px; margin: 0 0 8px; }
.modal-body { font-size: 13px; color: var(--text-secondary); margin: 0 0 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger); opacity: 0.85; }

.photo-thumb-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.photo-thumb-wrap .photo-thumb { width: 100%; height: 100%; }

.photo-delete-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface-2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.photo-delete-btn.undo {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.photo-rotate-btn {
  position: absolute;
  bottom: -6px;
  left: -6px;
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface-2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.photo-rotate-btn:disabled { opacity: 0.5; cursor: default; }

.photo-pending-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.photo-pending-label span {
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 8px;
  text-align: center;
}

.view-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 25% 20%, rgba(56, 189, 248, 0.22), transparent 45%),
    radial-gradient(circle at 78% 78%, rgba(122, 140, 255, 0.18), transparent 50%),
    #0b0f16;
  padding: 20px;
}

.login-logo { margin-bottom: 26px; }

.login-panel {
  width: 100%;
  max-width: 380px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-title { font-size: 20px; font-weight: 500; margin: 0 0 4px; line-height: 1.2; color: #f2f4f6; }
.login-subtitle { font-size: 13px; color: #9aa4b1; margin: 0 0 28px; }

.view-login .field-label { color: #b8c0cb; }
.view-login input:not([type="checkbox"]):not([type="radio"]) {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f2f4f6;
}
.view-login input::placeholder { color: #6b7280; }
.view-login input:-webkit-autofill,
.view-login input:-webkit-autofill:hover,
.view-login input:-webkit-autofill:focus {
  -webkit-text-fill-color: #f2f4f6;
  -webkit-box-shadow: 0 0 0 1000px #1a2029 inset;
  box-shadow: 0 0 0 1000px #1a2029 inset;
  caret-color: #f2f4f6;
  transition: background-color 9999s ease-in-out 0s;
}
.view-login .btn-primary { background: #38bdf8; color: #06222c; }
.view-login .btn-primary:hover { background: #7dd5ef; }
.view-login .input-clear-btn { color: #9aa4b1; }
.view-login .input-clear-btn:hover { background: rgba(255,255,255,0.1); color: #f2f4f6; }

.auto-logout-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
}

.auto-logout-notice svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: #9aa4b1; }
.auto-logout-title { margin: 0; font-size: 13px; font-weight: 500; color: #f2f4f6; }
.auto-logout-body { margin: 2px 0 0; font-size: 12px; color: #9aa4b1; }

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.admin-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  width: 100%;
  margin-bottom: 16px;
}
.admin-tab {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-secondary);
  padding: 0 0 10px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-tab-active { background: transparent; color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); margin-bottom: -1px; }
.admin-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
}
.admin-tab-active .admin-tab-count { background: var(--accent-bg); color: var(--accent); }

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  margin: 0;
}

.admin-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--accent-bg);
  border-radius: 0;
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  margin: 0;
  font-size: 13px;
}

.admin-settings-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  max-width: 480px;
}
.admin-settings-group-title { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin: 0 0 12px; }
.admin-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.admin-settings-label { font-size: 14px; margin: 0; }
.admin-settings-hint { font-size: 12px; color: var(--text-secondary); margin: 2px 0 0; }
#maxImagesInput { width: 72px; height: 36px; text-align: center; flex: none; }
.admin-settings-savebar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  max-width: 480px;
}
.admin-settings-dirty-hint { font-size: 13px; color: var(--warning); }

.admin-table-wrap {
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table thead tr { background: var(--surface-1); text-align: left; }
.admin-table th {
  padding: 10px 16px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.admin-table td { padding: 14px 16px; border-top: 1px solid var(--border); }
.admin-table tbody tr:hover { background: var(--surface-1); }
.admin-row-name { font-weight: 500; }
.admin-row-chevron { text-align: center; color: var(--text-muted); cursor: pointer; }
.admin-row-clickable { cursor: pointer; }

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.admin-pagination-size { display: flex; align-items: center; gap: 8px; }
.admin-pagination-size select { height: 30px; width: 70px; padding: 4px 8px; font-size: 12.5px; }
.admin-pagination-nav { display: flex; align-items: center; gap: 8px; }

.chip-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
}

.module-chip {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.module-chip-active { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.module-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.app-body {
  display: flex;
  align-items: stretch;
  height: calc(100vh - var(--header-h));
  height: calc(100dvh - var(--header-h));
  overflow: hidden;
  background: #d8d8d6;
}

.app-sidebar {
  width: 64px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: width 0.32s ease;
}
.sidebar-group { display: flex; flex-direction: column; gap: 2px; }
.sidebar-group + .sidebar-group { margin-top: 16px; }
.sidebar-group-label {
  display: none;
  margin: 0;
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}
.app-sidebar .sidebar-more-group { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.sidebar-more-toggle { display: none; }

.app-sidebar .tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 4px 8px;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}
.app-sidebar .tile:hover { background: var(--surface-1); transform: none; box-shadow: none; border-color: transparent; }
.app-sidebar .tile.tile-active { background: var(--info-bg); color: var(--info); }
.app-sidebar .tile.tile-active .tile-title { font-weight: 600; }
.app-sidebar .tile.tile-active .tile-icon { color: var(--info); }

.app-sidebar .tile-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 0;
  background: transparent;
  color: var(--text-primary);
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-sidebar .tile-icon svg { width: 18px; height: 18px; }
.app-sidebar .tile-title { font-weight: 500; font-size: 14px; margin: 0; white-space: nowrap; }
.app-sidebar .tile-desc, .app-sidebar .tile-stat { display: none; }


/* Desktop: Sidebar immer ausgefahren, kein Ein-/Ausklappen */
@media (min-width: 1025px) {
  .app-sidebar { width: 220px; }
  .app-sidebar .tile-title { display: block; }
  .sidebar-group-label { display: block; }
  /* Ungelesen-Badge ausgeklappt rechtsbündig in der Zeile statt am Icon */
  .app-sidebar .tile .tile-icon { position: static; }
  .app-sidebar .tile .tile-badge { top: 50%; right: 10px; transform: translateY(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; box-shadow: none; }
}

/* Tablet quer: schmal (nur Icons) als Ausgangszustand, per Klick ausklappbar */
@media (min-width: 769px) and (max-width: 1024px) {
  /* Ausgeklappt als Overlay über dem Inhalt: Breite wächst, der negative
     Außenabstand hält den Platzbedarf bei 64 px - der Inhalt springt nicht */
  .app-sidebar { overflow: hidden; position: relative; z-index: 26; cursor: pointer; transition: width 0.28s ease, margin-right 0.28s ease, box-shadow 0.28s ease; }
  .app-sidebar .tile { cursor: pointer; }
  .app-sidebar .tile-title { display: none; }
  .app-sidebar.sidebar-expanded .tile-title { display: block; }
  .app-sidebar.sidebar-expanded { width: 220px; margin-right: -156px; box-shadow: 12px 0 32px rgba(0, 0, 0, 0.14); }
  .app-sidebar.sidebar-expanded .sidebar-group-label { display: block; }
  .app-sidebar.sidebar-expanded .tile .tile-icon { position: static; }
  .app-sidebar.sidebar-expanded .tile .tile-badge { top: 50%; right: 10px; transform: translateY(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; box-shadow: none; }
  .app-sidebar.sidebar-expanded .tile .tile-icon { position: static; }
  .app-sidebar.sidebar-expanded .tile .tile-badge { top: 50%; right: 10px; transform: translateY(-50%); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; box-shadow: none; }
  /* Eingeklappt: kurze Trennlinie statt Überschrift zwischen den Gruppen */
  .app-sidebar:not(.sidebar-expanded) .sidebar-group + .sidebar-group:not(.sidebar-more-group) { margin-top: 8px; }
  .app-sidebar:not(.sidebar-expanded) .sidebar-group + .sidebar-group:not(.sidebar-more-group)::before {
    content: "";
    display: block;
    width: 24px;
    height: 1px;
    margin: 0 auto 8px;
    background: var(--border);
  }
  .app-sidebar:not(.sidebar-expanded) .sidebar-more-group { border-top: none; padding-top: 0; }
  .app-sidebar:not(.sidebar-expanded) .sidebar-more-group::before {
    content: "";
    display: block;
    width: 24px;
    height: 1px;
    margin: 0 auto 8px;
    background: var(--border);
  }
}

/* Tablet hoch / Mobil: Sidebar wird zur unteren Tab-Leiste, nur Icons */
@media (max-width: 768px) {
  .app-body { flex-direction: column; padding-bottom: 64px; min-height: calc(100vh - var(--header-h) - 64px); }
  .app-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto !important;
    height: 64px;
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-top: 1px solid var(--border);
    padding: 4px 4px;
    gap: 0;
    z-index: 40;
  }
  .sidebar-group:not(.sidebar-more-group) { display: contents; }
  .sidebar-group-label { display: none !important; }
  .app-sidebar .tile {
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    padding: 4px;
    border-radius: 8px;
  }
  .app-sidebar .tile-icon { width: 22px; height: 22px; }
  .app-sidebar .tile-icon svg { width: 18px; height: 18px; }
  .app-sidebar .tile-title { display: none; }
  .app-sidebar .sidebar-more-group {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 6px;
    flex-direction: column;
    gap: 2px;
    width: 200px;
  }
  .sidebar-more-group.sidebar-more-open { display: flex; }
  .sidebar-more-group .tile { flex-direction: row; justify-content: flex-start; }
  .sidebar-more-group .tile-title { font-size: 13px; }
  .sidebar-more-toggle { display: flex; }
}

.form-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; }
@media (max-width: 768px) {
  .form-columns { grid-template-columns: 1fr; }
}

.photo-tile-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.photo-tile { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }

.photo-tile-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--surface-2);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.photo-add-tile {
  width: 72px;
  height: 72px;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  border: 1.5px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
  font-family: inherit;
  box-sizing: border-box;
}
.photo-add-tile:hover { background: var(--surface-1); }

.photo-add-choice-menu {
  position: absolute;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  width: 200px;
  padding: 4px;
  z-index: 60;
}
.photo-add-choice-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  font-size: 13px;
  font-family: inherit;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-primary);
}
.photo-add-choice-menu button:hover { background: var(--surface-1); }

.draw-tool-box { max-width: 900px; width: 95vw; }
.draw-tool-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.draw-tool-color-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}
.draw-hue-slider {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, hsl(0,80%,45%), hsl(60,80%,45%), hsl(120,80%,45%), hsl(180,80%,45%), hsl(240,80%,45%), hsl(300,80%,45%), hsl(360,80%,45%));
}
.draw-hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--thumb-color, white);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
}
.draw-hue-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--thumb-color, white);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--border-strong);
  cursor: pointer;
}
.draw-tool-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.draw-tool-control input[type="range"] { width: 90px; }
.draw-tool-control span:last-child { width: 38px; color: var(--text-primary); }
.draw-tool-canvas {
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
  background: white;
  display: block;
}

.date-field-wrap { position: relative; }

.date-field-wrap .date-display { padding-right: 34px; cursor: pointer; }

.date-icon-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.date-icon-btn svg { width: 17px; height: 17px; }
.date-icon-btn:hover { color: var(--text-primary); }

.date-popover {
  position: fixed;
  z-index: 60;
  width: 280px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  padding: 12px;
}

.wheel-picker {
  position: relative;
  display: flex;
  height: 180px;
  gap: 2px;
}

.wheel-highlight {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 36px;
  transform: translateY(-50%);
  background: var(--surface-1);
  border-radius: 8px;
  pointer-events: none;
  z-index: 0;
}

.wheel-col {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  text-align: center;
  scrollbar-width: none;
}
.wheel-col::-webkit-scrollbar { display: none; }
.wheel-col-wide { flex: 1.4; }

.wheel-item {
  scroll-snap-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
}
.wheel-item.selected { font-size: 16px; font-weight: 500; color: var(--text-primary); }
.wheel-item.disabled { opacity: 0.3; cursor: default; }

.date-popover-footer {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px solid var(--border);
  margin-top: 10px;
  padding-top: 10px;
}

.theme-toggle {
  position: relative;
  flex-shrink: 0;
  width: 52px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  padding: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.theme-icon {
  position: absolute;
  width: 14px;
  height: 14px;
  opacity: 0.4;
  transition: opacity 0.2s ease;
  z-index: 1;
}

.theme-icon-sun { left: 7px; color: #ff9d0a; }
.theme-icon-moon { right: 7px; width: 12px; height: 12px; color: #8fb4d9; }

.theme-toggle:not(.dark) .theme-icon-sun { opacity: 1; }
.theme-toggle.dark .theme-icon-moon { opacity: 1; }

.theme-toggle-knob {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
  transform: translateX(0);
  position: relative;
  z-index: 1;
}

.theme-toggle.dark .theme-toggle-knob { transform: translateX(22px); }

.combo-wrap { position: relative; }

.combo-wrap input {
  padding-right: 30px;
}

.combo-wrap::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  pointer-events: none;
}

.combo-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 15;
  margin-top: 2px;
}

.combo-option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
}
.combo-option:hover { background: var(--surface-1); }

.combo-manage {
  border-top: 1px solid var(--border);
  color: var(--accent);
}

.saving-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.saving-box {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 28px 32px;
  min-width: 280px;
  max-width: 340px;
  text-align: center;
}

.saving-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: saving-spin 0.8s linear infinite;
}
@keyframes saving-spin { to { transform: rotate(360deg); } }
.saving-spinner.error {
  animation: none;
  border-color: var(--danger);
  border-top-color: var(--danger);
}

.saving-text { font-weight: 500; margin: 0 0 12px; font-size: 14px; }

.saving-progress-track {
  background: var(--surface-1);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}
.saving-progress-bar {
  background: var(--accent);
  height: 100%;
  width: 0%;
  transition: width 0.2s ease;
}

.saving-subtext { font-size: 12px; color: var(--text-secondary); margin: 0; }

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  z-index: 2;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
}

.lightbox-image {
  max-width: 75vw;
  max-height: 75vh;
  object-fit: contain;
  cursor: grab;
  user-select: none;
}

.lightbox-image.dragging { cursor: grabbing; }

.lightbox-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 14px;
}

.lightbox-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lightbox-zoom-icon {
  color: #fff;
  font-size: 16px;
  width: 16px;
  text-align: center;
}

.lightbox-zoom-row input[type="range"] {
  width: 180px;
}

.lightbox-info {
  text-align: center;
  color: #fff;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Modul: Leistungserfassung Zahntechnik
   Struktur bewusst nach dem Vorbild der Zahnfarben-Patientenliste aufgebaut
   (fester Höhen-Container + eine einzige Scroll-Ebene je Spalte) statt einem
   eigenen, mehrfach verschachtelten Flexbox-System - dieses Muster ist im
   Rest der App bereits vielfach erprobt.
   ═══════════════════════════════════════════════════════════════════════════ */

.view-leistungserfassung {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Farben Kasse/Privat: Benutzerwahl (--user-*, gesetzt von applyTypColors in
   core.js) mit Standard Blau/Violett als Fallback */
.view-leistungserfassung, .view-leistungsverzeichnis {
  --le-kasse: var(--user-kasse, #1d4ed8);    --le-kasse-bg: var(--user-kasse-bg, #dbeafe);    --le-kasse-tint: var(--user-kasse-tint, #eff6ff);
  --le-privat: var(--user-privat, #7e22ce);  --le-privat-bg: var(--user-privat-bg, #f3e8ff);  --le-privat-tint: var(--user-privat-tint, #faf5ff);
}
:root[data-theme="dark"] .view-leistungserfassung, :root[data-theme="dark"] .view-leistungsverzeichnis {
  --le-kasse: var(--user-kasse-d, #93c5fd);   --le-kasse-bg: var(--user-kasse-d-bg, rgba(59, 130, 246, 0.22));   --le-kasse-tint: var(--user-kasse-d-tint, rgba(59, 130, 246, 0.09));
  --le-privat: var(--user-privat-d, #d8b4fe); --le-privat-bg: var(--user-privat-d-bg, rgba(168, 85, 247, 0.22)); --le-privat-tint: var(--user-privat-d-tint, rgba(168, 85, 247, 0.09));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .view-leistungserfassung, :root:not([data-theme="light"]) .view-leistungsverzeichnis {
    --le-kasse: var(--user-kasse-d, #93c5fd);   --le-kasse-bg: var(--user-kasse-d-bg, rgba(59, 130, 246, 0.22));   --le-kasse-tint: var(--user-kasse-d-tint, rgba(59, 130, 246, 0.09));
    --le-privat: var(--user-privat-d, #d8b4fe); --le-privat-bg: var(--user-privat-d-bg, rgba(168, 85, 247, 0.22)); --le-privat-tint: var(--user-privat-d-tint, rgba(168, 85, 247, 0.09));
  }
}

.view-leistungserfassung { display: flex; flex-direction: column; height: 100%; }
/* Titel + Beschreibung als ein Block, Abstand zur Karte kommt vom gap */
.view-leistungserfassung > .module-head { margin-bottom: 8px; }
.le2-columns { display: flex; gap: 20px; flex: 1; min-height: 0; width: 100%; }
.le2-card {
  background: var(--surface-2);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  min-height: 0;
  overflow: hidden;
}
.le2-work { flex: 1; min-width: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.le2-work-empty { grid-template-columns: minmax(0, 1fr); }
.le2-work-empty .le2-cats { display: none; }
.le2-summary { width: 340px; flex-shrink: 0; display: flex; flex-direction: column; }
.le2-scroll { flex: 1; min-height: 0; overflow-y: auto; }

/* Kategorien */
.le2-cats { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; padding: 14px 8px 8px; }
.le2-cats-title { margin: 0; padding: 0 12px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-secondary); }
.le2-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 38px; padding: 6px 10px 6px 12px; margin-bottom: 2px; border: none; border-radius: 9px; background: none; font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--text-primary); text-align: left; cursor: pointer; line-height: 1.3; }
.le2-nav-item:hover { background: var(--surface-1); }
.le2-nav-active, .le2-nav-active:hover { background: var(--info-bg); color: var(--info); font-weight: 600; }
.le2-nav-label { min-width: 0; }
.le2-nav-count { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.le2-nav-badge { min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--info); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* Liste + Werkzeugleiste */
.le2-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.le2-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.le2-search-box { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 10px; background: var(--surface-1); color: var(--text-secondary); }
#leSearch { flex: 1; width: auto; min-width: 0; height: 100%; padding: 0; border: none; background: transparent; font-size: 13.5px; box-shadow: none; }
.le2-search-clear { background: none; border: none; font-family: inherit; color: var(--text-secondary); cursor: pointer; padding: 4px 6px; }
.le2-seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border-radius: 9px; }
.le2-chip { height: 30px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.le2-chip-active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.le2-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.le2-dot-kasse { background: var(--le-kasse); }
.le2-dot-privat { background: var(--le-privat); }

.le2-list { padding: 14px 12px; }
.le2-list-hint { margin: 0; padding: 12px; font-size: 13px; color: var(--text-secondary); }
.le2-block { margin-bottom: 18px; }
.le2-block:last-child { margin-bottom: 0; }
.le2-block-header { display: flex; align-items: baseline; gap: 8px; padding: 0 12px 2px; }
.le2-block-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.le2-block-count { font-size: 12px; color: var(--text-muted); margin-left: auto; }
.le2-block-subheader { display: flex; align-items: center; gap: 8px; padding: 14px 12px 6px; }
.le2-block-subheader .le2-block-count { margin-left: 0; }

.le2-type-pill { padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.le2-type-kasse { background: var(--le-kasse-bg); color: var(--le-kasse); }
.le2-type-privat { background: var(--le-privat-bg); color: var(--le-privat); }

.le2-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 48px; padding: 6px 12px; box-sizing: border-box; border-radius: 10px; cursor: pointer; }
.le2-row:hover { background: var(--surface-1); }
.le2-row-checked.le2-row-kasse, .le2-row-checked.le2-row-kasse:hover { background: var(--le-kasse-tint); }
.le2-row-checked.le2-row-privat, .le2-row-checked.le2-row-privat:hover { background: var(--le-privat-tint); }
.le2-row-checked .le2-row-bez { font-weight: 600; }
.le2-row-editing { box-shadow: inset 0 0 0 2px var(--accent); }
.le2-nr { justify-self: start; padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.le2-nr-kasse { background: var(--le-kasse-bg); color: var(--le-kasse); }
.le2-nr-privat { background: var(--le-privat-bg); color: var(--le-privat); }
.le2-row-bez { min-width: 0; font-size: 13.5px; color: var(--text-primary); }
.le2-row-missing { font-size: 10.5px; color: var(--text-muted); font-style: italic; margin-left: 6px; font-weight: 400; }
.le2-row-preis { font-size: 13px; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 80px; }
.le2-row-qty { display: flex; justify-content: flex-end; min-width: 104px; }

/* Stepper */
.le2-add { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-secondary); font-family: inherit; font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.le2-add:hover { border-color: var(--accent); color: var(--accent); }
.le2-add-sm { width: 26px; height: 26px; font-size: 15px; }
.le2-add-inline { width: 20px; height: 20px; font-size: 13px; vertical-align: middle; cursor: default; }
.le2-stepper { display: inline-flex; align-items: center; border-radius: 999px; }
.le2-stepper button { width: 30px; height: 30px; border: none; background: transparent; color: inherit; font-family: inherit; font-size: 16px; font-weight: 600; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 999px; }
.le2-stepper button:disabled { opacity: 0.35; cursor: default; }
.le2-stepper .le2-menge-btn { width: auto; min-width: 22px; padding: 0 2px; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.le2-stepper-sm button { width: 26px; height: 26px; font-size: 15px; }
.le2-stepper-sm .le2-menge-btn { font-size: 13px; }
.le2-stepper-kasse { background: var(--le-kasse-bg); color: var(--le-kasse); }
.le2-stepper-privat { background: var(--le-privat-bg); color: var(--le-privat); }

/* Leerzustand */
.le2-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
.le2-empty-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--info-bg); color: var(--info); display: flex; align-items: center; justify-content: center; }
.le2-empty-icon svg { width: 24px; height: 24px; }
.le2-empty-title { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.le2-empty-text { margin: 0 0 6px; max-width: 380px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

/* Auswahl-Karte */
.le2-summary-head { padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.le2-summary-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.le2-summary-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); }
#leSummary { padding: 0 20px 8px; }
.le2-summary-empty { margin: 0; padding: 20px 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.le2-summary-group { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.le2-summary-group-count { font-size: 12px; color: var(--text-muted); }
.le2-summary-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.le2-summary-item:last-child { border-bottom: none; }
.le2-summary-item-text { flex: 1; min-width: 0; }
.le2-summary-item-title { margin: 0; font-size: 13px; line-height: 1.3; color: var(--text-primary); }
.le2-summary-item-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.le2-summary-item-sub strong { color: var(--text-primary); font-weight: 600; }
.le2-summary-foot { padding: 14px 20px 18px; border-top: 1px solid var(--border); background: var(--surface-1); display: flex; flex-direction: column; gap: 6px; }
.le2-total-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.le2-total-row > span:first-child { display: flex; align-items: center; gap: 6px; }
.le2-total-sum { margin-top: 4px; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.le2-summary-actions { display: flex; gap: 8px; margin-top: 8px; }
.le2-summary-actions .btn { height: 38px; border-radius: 10px; }
.le2-summary-actions .btn-primary { flex: 1; }

@keyframes le2-row-flash {
  0%, 100% { box-shadow: none; }
  30% { box-shadow: 0 0 0 2px var(--accent); }
}
.le2-row-flash { animation: le2-row-flash 0.9s ease; }

/* ── Mengen-Rad-Popover (nutzt die Basis-Klassen des Datums-Rads) ────────── */
.le2-menge-popover { width: 190px; }
.le2-menge-wheel-picker { height: 180px; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
.le2-sheet-grip, .le2-sheet-close, .le2-float-bar, .le2-sheet-scrim, .le2-cat-trigger, .le2-cat-menu { display: none; }
.le2-summary-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

@media (max-width: 1100px) and (min-width: 1025px) {
  .le2-work { grid-template-columns: 170px minmax(0, 1fr); }
  .le2-summary { width: 290px; }
}

/* ── iPad hochkant / Handy: eine Spalte, Kategorien als Chips, Auswahl als
      schwebende Leiste + Fenster von unten ("Warenkorb") ─────────────────── */
@media (max-width: 1024px) {
  .le2-columns { flex-direction: column; }
  .le2-columns.le2-has-float { padding-bottom: 84px; }
  .le2-work { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .le2-main { display: contents; }
  .le2-toolbar { order: 1; }
  .le2-cats { order: 2; position: relative; border-right: none; border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .le2-list { order: 3; }
  .le2-cats-title, .le2-cats #leSidebar { display: none; }

  /* Kategorie als Auswahlfeld */
  .le2-cat-trigger { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); font-family: inherit; text-align: left; cursor: pointer; color: var(--text-primary); }
  .le2-cat-trigger-open { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
  .le2-cat-trigger-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
  .le2-cat-trigger-value { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .le2-cat-trigger-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
  .le2-cat-trigger-chevron { flex-shrink: 0; color: var(--text-secondary); transition: transform 0.15s; }
  .le2-cat-trigger-open .le2-cat-trigger-chevron { transform: rotate(180deg); }
  .le2-cat-menu { display: block; position: absolute; left: 14px; right: 14px; top: calc(100% - 4px); z-index: 20; max-height: 60vh; overflow-y: auto; padding: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 48px rgba(0,0,0,0.2); }
  .le2-cat-menu-head { display: flex; justify-content: space-between; gap: 8px; margin: 0; padding: 8px 12px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
  .le2-cat-menu-head span:first-child { text-transform: uppercase; letter-spacing: 0.4px; }
  .le2-cat-menu-head span:last-child { font-weight: 400; }
  .le2-cat-menu-dot { color: var(--accent); }
  .le2-cat-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 0 12px; border: none; border-radius: 10px; background: none; font-family: inherit; font-size: 14.5px; font-weight: 500; color: var(--text-primary); text-align: left; cursor: pointer; }
  .le2-cat-option:hover { background: var(--surface-1); }
  .le2-cat-option-active, .le2-cat-option-active:hover { background: var(--info-bg); color: var(--info); font-weight: 600; }
  .le2-cat-option-check { width: 16px; display: flex; flex-shrink: 0; color: var(--info); }
  .le2-cat-option-label { flex: 1; min-width: 0; }

  /* Position zweizeilig: Nr | Bezeichnung / Preis | Stepper */
  .le2-row { grid-template-columns: 58px minmax(0, 1fr) auto; grid-template-rows: auto auto; row-gap: 2px; padding: 10px 12px; }
  .le2-row .le2-nr { grid-row: 1 / 3; }
  .le2-row .le2-row-bez { grid-column: 2; grid-row: 1; font-size: 14.5px; line-height: 1.3; }
  .le2-row .le2-row-preis { grid-column: 2; grid-row: 2; text-align: left; min-width: 0; font-size: 12.5px; }
  .le2-row:not(:has(.le2-row-preis)) .le2-row-bez { grid-row: 1 / 3; }
  .le2-row .le2-row-qty { grid-column: 3; grid-row: 1 / 3; min-width: 0; }
  .le2-row .le2-add { width: 34px; height: 34px; font-size: 18px; }
  .le2-row .le2-stepper button { width: 34px; height: 34px; font-size: 17px; }

  /* Auswahl als Fenster von unten */
  .le2-summary { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; width: auto; height: 74vh; border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,0.25); transform: translateY(105%); transition: transform 0.25s ease; }
  .le2-summary.le2-sheet-open { transform: translateY(0); }
  .le2-sheet-grip { display: block; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 999px; background: var(--border-strong); }
  .le2-sheet-close { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border: none; border-radius: 10px; background: var(--surface-1); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; flex-shrink: 0; }
  .le2-sheet-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(20, 26, 34, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
  .le2-sheet-scrim.le2-sheet-scrim-open { opacity: 1; pointer-events: auto; }
  .le2-summary-head { padding: 10px 22px 12px; }
  .le2-summary-title { font-size: 18px; font-weight: 700; }
  #leSummary { padding: 0 22px 8px; }
  .le2-summary-foot { padding: 14px 22px 22px; }

  /* Schwebende Leiste */
  .le2-float-bar { display: flex; align-items: center; gap: 12px; position: fixed; left: 84px; right: 20px; bottom: 16px; z-index: 30; padding: 12px 16px; background: var(--surface-2); border-radius: 14px; box-shadow: 0 -2px 12px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.18); }
  .le2-float-text { flex: 1; min-width: 0; }
  .le2-float-title { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--text-primary); }
  .le2-float-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); display: flex; gap: 12px; flex-wrap: wrap; }
  .le2-float-kasse { color: var(--le-kasse); }
  .le2-float-privat { color: var(--le-privat); }
  .le2-float-bar .btn { height: 40px; border-radius: 10px; white-space: nowrap; }
}
@media (max-width: 768px) {
  .le2-float-bar { left: 12px; right: 12px; bottom: 80px; }
  .le2-columns.le2-has-float { padding-bottom: 150px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Modul: Digitaler Auftragszettel
   ═══════════════════════════════════════════════════════════════════════════ */

.ord-status-filter { height: 30px; padding: 0 12px; font-size: 12px; }
.ord-status-filter-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ord-filter-toggle { height: 30px; padding: 0 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.ord-filter-toggle-open { background: var(--surface-1); }
.ord-filter-count { min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.ord-filter-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; border-bottom: 1px solid var(--border); }
#ordFilterBehandler, #ordFilterTechniker, #ordFilterPanel .date-display { height: 36px; padding: 0 10px; font-size: 13px; }
#ordFilterPanel .date-display { padding-right: 34px; }
.ord-filter-reset { grid-column: 1 / -1; justify-self: start; }

.ord-badge-new { background: var(--accent-bg); color: var(--accent); }
.ord-badge-progress { background: var(--danger-bg); color: var(--danger); }
.ord-badge-done { background: var(--surface-1); color: var(--text-secondary); }

.ord-tooth-row {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-bottom: 4px;
}

.ord-tooth-btn {
  width: 26px;
  height: 30px;
  font-size: 10px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
}
.ord-tooth-btn:hover { border-color: var(--accent); }
.ord-tooth-btn.selected { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 500; }

.ord-worktype-chip {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-secondary);
  cursor: pointer;
}
.ord-worktype-chip:hover { background: var(--surface-1); }
.ord-worktype-chip.selected { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   Modul: Leistungsverzeichnis (Admin-Preispflege)
   ═══════════════════════════════════════════════════════════════════════════ */

.lv-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; color: var(--text-primary); }
.lv-subtitle { font-size: 13px; color: var(--text-secondary); margin: 0 0 20px; }
.home-title { color: var(--text-primary); }

.module-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; color: var(--text-primary); }
.module-subtitle { font-size: 13px; color: var(--text-secondary); margin: 0 0 20px; }
.module-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.module-head .module-subtitle { margin-bottom: 0; }
.module-head-action { flex-shrink: 0; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 600; }
#orderSearchInput { padding-left: 36px; }
.search-box > .search-box-icon { left: 22px; }
/* Kopf genau so breit wie Liste + Abstand + Detailkarte, damit der Button bündig abschließt */
#view-auftraege .module-head { max-width: calc(min(560px, 50% - 10px) + 20px + min(620px, 50% - 10px)); }

.view-list-page { display: flex; flex-direction: column; height: 100%; }

.zf-toolbar { display: flex; gap: 8px; flex-shrink: 0; }
/* Zahnfarben: Suche + "Neuer Patient" + Anzahl oben in der Listenkarte */
.zf-list-top { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.zf-list-meta { margin: 0; padding: 0 4px; font-size: 12px; color: var(--text-muted); }
#view-list > .module-head { margin-bottom: 16px; }
#view-list #searchInput { height: 38px; padding-top: 0; padding-bottom: 0; border-radius: 10px; background: var(--surface-1); border-color: transparent; font-size: 13.5px; }
#view-list #searchInput:focus { background: var(--surface-2); border-color: var(--accent); }
#view-list #btn-new { margin-left: 0; height: 38px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.search-box-flat { position: relative; flex: 1; }
.search-box-flat input { width: 100%; }
.search-box-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
#searchInput { border-radius: 8px; padding-left: 36px; }
#btn-new { background: var(--info); border-color: var(--info); border-radius: 8px; }

#view-leistungsverzeichnis { display: flex; flex-direction: column; height: 100%; }
.lv-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.lv-toolbar-actions .lv-head-btn { height: 38px; padding: 0 14px; font-size: 13px; }
.lv-head-btn { height: 40px; padding: 0 16px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.lv-more-wrap { position: relative; }
.lv-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 260px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}
.lv-more-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; border-radius: 8px; background: none; font-family: inherit; font-size: 13px; color: var(--text-primary); text-align: left; cursor: pointer; }
.lv-more-menu button:hover { background: var(--surface-1); }
.lv-more-menu-danger { color: var(--danger) !important; }
.lv-more-menu-danger:hover { background: var(--danger-bg) !important; }
.lv-more-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* Karte */
.lv-card { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05); overflow: hidden; }
.lv-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.lv-tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border-radius: 10px; }
.lv-tab { height: 32px; padding: 0 14px; border: none; border-radius: 8px; background: transparent; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.lv-tab-active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.lv-tab-count { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.lv-search-box { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 10px; background: var(--surface-1); color: var(--text-secondary); }
#lvSearch { flex: 1; width: auto; min-width: 0; height: 100%; padding: 0; border: none; background: transparent; font-size: 13.5px; box-shadow: none; }
.lv-search-clear { background: none; border: none; font-family: inherit; color: var(--text-secondary); cursor: pointer; padding: 4px 6px; }
.lv-undo-btn { height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); align-items: center; gap: 6px; cursor: pointer; }
.lv-undo-btn:hover { background: var(--surface-1); }
.lv-undo-count { min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box; border-radius: 999px; background: var(--surface-1); font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.lv-undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 16px;
  border-radius: 10px;
  background: #1c1c1a;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.3s;
}

.lv-add-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); }
.lv-add-form input, .lv-add-form select { height: 36px; font-size: 13px; border-radius: 8px; }
#lvNewNr { width: 110px; }
#lvNewBez { flex: 1; min-width: 200px; width: auto; }
#lvNewKat { width: 200px; }
#lvNewPreis { width: 110px; }

.lv-columns { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.lv-cats { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.lv-cats .lv-scroll { padding: 12px 8px 8px; }
.lv-list { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.lv-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.lv-nav-sep { height: 1px; background: var(--border-strong); margin: 10px 6px; }
.lv-warn-count { min-width: 18px; height: 18px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--warning-bg); color: var(--warning); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.lv-nav-hidden .le2-nav-label { color: var(--text-muted); }

.lv-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 6px 12px; }
.lv-sidebar-heading { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-secondary); }
.lv-kat-edit-toggle { height: 26px; padding: 0 8px; border: none; border-radius: 7px; background: transparent; color: var(--text-secondary); font-family: inherit; font-size: 12px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.lv-kat-edit-toggle:hover { background: var(--surface-1); color: var(--text-primary); }
.lv-kat-edit-toggle-active, .lv-kat-edit-toggle-active:hover { background: var(--accent); color: #fff; font-weight: 600; padding: 0 10px; }
.lv-sidebar-row { display: flex; align-items: center; gap: 4px; min-height: 38px; padding: 0 4px 0 12px; border-radius: 9px; cursor: pointer; }
.lv-sidebar-row:hover { background: var(--surface-1); }
.lv-sidebar-row-active, .lv-sidebar-row-active:hover { background: var(--info-bg); }
.lv-sidebar-row-label { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-sidebar-row-hidden .lv-sidebar-row-label { color: var(--text-muted); }
.lv-sidebar-row-actions { display: flex; gap: 2px; flex-shrink: 0; }
.lv-icon-btn { width: 30px; height: 30px; border: none; border-radius: 8px; background: transparent; color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; flex-shrink: 0; }
.lv-icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.lv-icon-btn:disabled { opacity: 0.35; cursor: default; }
.lv-eye-off { color: var(--warning); }
.lv-kat-delete-btn, .lv-delete-btn { color: var(--danger); }
.lv-kat-delete-btn:hover, .lv-delete-btn:hover { background: var(--danger-bg); color: var(--danger); }
.lv-kat-move-row { display: flex; align-items: center; justify-content: flex-end; gap: 2px; margin-top: 8px; padding: 4px 4px 0 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }
.lv-kat-move-row span { flex: 1; }
.lv-kat-hint { display: flex; align-items: center; gap: 4px; margin: 8px 0 0; padding: 0 12px; font-size: 11.5px; color: var(--text-muted); }
.lv-kat-add-row { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--border); }
#lvKatNewLabel { flex: 1; width: auto; min-width: 0; height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.lv-kat-add-row button { height: 34px; font-size: 12.5px; border-radius: 8px; }

/* Liste */
.lv-sticky-head { position: sticky; top: 0; z-index: 2; background: var(--surface-2); }
.lv-block-header { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.lv-block-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.lv-block-count { font-size: 12.5px; color: var(--text-muted); }
.lv-block-spacer { flex: 1; }
.lv-editing-hint { font-size: 12px; font-weight: 600; color: var(--accent); }
.lv-head-toggle { height: 30px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-primary); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.lv-head-toggle:hover { background: var(--surface-1); }
.lv-head-toggle strong { font-weight: 700; }
.lv-head-toggle-active, .lv-head-toggle-active:hover { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.lv-grid { display: grid; grid-template-columns: 72px minmax(0, 1fr) 100px 100px 64px 104px; gap: 12px; align-items: center; padding: 0 16px; }
.lv-grid.lv-grid-kat { grid-template-columns: 72px minmax(0, 1fr) 170px 100px 100px 64px 104px; }
.lv-grid.lv-grid-edit { grid-template-columns: 20px 72px minmax(0, 1fr) 110px 100px 64px 104px 32px; }
.lv-grid.lv-grid-kat.lv-grid-edit { grid-template-columns: 20px 72px minmax(0, 1fr) 170px 110px 100px 64px 104px 32px; }
.lv-table-header { height: 34px; background: var(--surface-1); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.lv-num { text-align: right; }
.lv-row { min-height: 48px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.lv-grid-edit.lv-row { min-height: 52px; }
.lv-row-selected { background: var(--info-bg); }
.lv-row-text { color: var(--text-primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-row-kat { font-size: 12.5px; color: var(--text-secondary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-row-kat-none { color: var(--warning); }
.lv-row-preis { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.lv-row-vorjahr { text-align: right; font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.lv-delta { text-align: right; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.lv-delta-up { color: var(--warning); }
.lv-delta-down { color: #3f9e5c; }
.lv-row-status { display: flex; }
.lv-badge-missing { padding: 2px 8px; border-radius: 999px; background: var(--warning-bg); color: var(--warning); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.lv-row input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
/* ID-Präfix nötig: die globale input-Regel (zwei :not()) schlägt reine Klassen */
#lvContent .lv-edit-bez, #lvContent .lv-edit-kat, #lvContent .lv-edit-preis { width: 100%; height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; min-width: 0; }
#lvContent .lv-edit-preis { text-align: right; font-variant-numeric: tabular-nums; }
.lv-list-hint { margin: 0; padding: 16px; font-size: 13px; color: var(--text-secondary); }
.lv-empty-icon-kasse { background: var(--le-kasse-bg); color: var(--le-kasse); }
.lv-empty-icon-privat { background: var(--le-privat-bg); color: var(--le-privat); }
.lv-empty-actions { display: flex; gap: 8px; margin-top: 4px; }
.lv-empty-actions .btn { height: 38px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px; }

.lv-bulk-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--info-bg); border-top: 1px solid var(--border); }
.lv-bulk-count { font-size: 13px; font-weight: 600; color: var(--info); }
.lv-bulk-bar-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
#lvBulkKat { width: 230px; height: 34px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.lv-bulk-bar-actions .btn { height: 34px; border-radius: 8px; }

/* Dialog: Preise anpassen */
.lv-price-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; background: var(--surface-2); border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,0.25); display: flex; flex-direction: column; }
.lv-price-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 14px; }
.lv-price-head > div { flex: 1; }
.lv-price-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-primary); }
.lv-price-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-secondary); }
.lv-price-body { display: flex; flex-direction: column; gap: 16px; padding: 4px 24px 18px; }
.lv-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lv-field-label { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.lv-radio { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.lv-radio input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.lv-radio > span { display: flex; flex-direction: column; gap: 1px; }
.lv-radio-on { border-color: var(--accent); background: var(--info-bg); }
.lv-radio-disabled { opacity: 0.5; cursor: default; }
.lv-radio-label { font-size: 13.5px; font-weight: 500; color: var(--text-primary); }
.lv-radio-sub { font-size: 12px; color: var(--text-muted); }
.lv-price-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: end; }
.lv-price-row-2 { grid-template-columns: 1fr 1fr; align-items: center; }
.lv-seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border-radius: 10px; }
.lv-seg-btn { flex: 1; height: 34px; border: none; border-radius: 8px; background: transparent; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.lv-seg-on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.lv-pct-box { display: flex; align-items: center; height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 10px; box-sizing: border-box; background: var(--surface-2); }
.lv-pct-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.lv-pct-box span { margin-left: 6px; font-size: 15px; font-weight: 600; color: var(--text-secondary); }
#lvPricePct { flex: 1; width: auto; min-width: 0; height: 100%; padding: 0; border: none; background: transparent; box-shadow: none; font-size: 16px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
#lvPriceRound { height: 38px; padding: 0 10px; font-size: 13px; border-radius: 10px; }
.lv-check { display: flex; align-items: flex-start; gap: 8px; padding-top: 22px; font-size: 13px; line-height: 1.4; color: var(--text-primary); cursor: pointer; }
.lv-check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.lv-preview { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 8px; background: var(--surface-1); }
.lv-preview-head { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.lv-preview-head span:last-child { font-weight: 400; color: var(--text-muted); }
.lv-preview-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 76px 14px 76px 60px; gap: 8px; align-items: center; min-height: 36px; font-size: 13px; border-bottom: 1px solid var(--border); }
.lv-preview-bez { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.lv-preview-old { text-align: right; color: var(--text-muted); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.lv-preview-arrow { text-align: center; color: var(--text-muted); }
.lv-preview-new { text-align: right; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.lv-preview-diff { text-align: right; font-size: 12px; color: var(--warning); font-variant-numeric: tabular-nums; }
.lv-preview-foot { display: flex; justify-content: space-between; padding: 8px 0 2px; font-size: 12.5px; color: var(--text-secondary); }
.lv-preview-foot strong { color: var(--warning); }
.lv-preview-empty, .lv-preview-note { margin: 6px 0; font-size: 12.5px; color: var(--text-muted); }
.lv-price-foot { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-1); }
.lv-price-foot .btn { height: 38px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.lv-price-hint { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }

@media (max-width: 1100px) {
  .lv-columns { grid-template-columns: 190px minmax(0, 1fr); }
}

/* ── iPad hochkant: Tabelle zweizeilig statt sieben schmaler Spalten ─────────
   Ansicht:    Nr | Bezeichnung / Kategorie / Status | Preis / Vj. / Δ
   Bearbeiten: ☐ | Nr | Bezeichnung / Kategorie      | Preis / Vj. | 🗑   */
@media (max-width: 1024px) {
  .lv-columns { grid-template-columns: 190px minmax(0, 1fr); }
  /* Kategorien bearbeiten: Namen + Icons brauchen etwas mehr Breite */
  .lv-columns:has(.lv-sidebar-row) { grid-template-columns: 240px minmax(0, 1fr); }
  .lv-head-actions .lv-head-btn { height: 38px; padding: 0 14px; }
  .lv-toolbar { gap: 8px; }
  .lv-search-box { min-width: 120px; }
  .lv-block-header { flex-wrap: wrap; row-gap: 8px; }
  .lv-editing-hint { display: none; }
  .lv-table-header { display: none; }

  .lv-row.lv-grid,
  .lv-row.lv-grid.lv-grid-kat {
    grid-template-columns: 62px minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    column-gap: 12px;
    row-gap: 2px;
    padding: 10px 16px;
  }
  .lv-row.lv-grid > .le2-nr { grid-column: 1; grid-row: 1 / 4; align-self: center; }
  .lv-row.lv-grid > .lv-row-text { grid-column: 2; grid-row: 1; white-space: normal; font-size: 14.5px; line-height: 1.3; }
  .lv-row.lv-grid > .lv-row-kat { grid-column: 2; grid-row: 2; font-size: 12px; }
  .lv-row.lv-grid > .lv-row-status { grid-column: 2; grid-row: 3; }
  .lv-row.lv-grid > .lv-row-preis { grid-column: 3; grid-row: 1; }
  .lv-row.lv-grid > .lv-row-vorjahr { grid-column: 3; grid-row: 2; font-size: 12px; }
  .lv-row.lv-grid > .lv-row-vorjahr::before { content: "Vj. "; }
  .lv-row.lv-grid > .lv-delta { grid-column: 3; grid-row: 3; font-size: 11.5px; }

  .lv-row.lv-grid.lv-grid-edit,
  .lv-row.lv-grid.lv-grid-kat.lv-grid-edit {
    grid-template-columns: 20px 62px minmax(0, 1fr) 110px 32px;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 6px;
  }
  .lv-row.lv-grid.lv-grid-edit > .lv-row-check { grid-column: 1; grid-row: 1 / 3; align-self: center; }
  .lv-row.lv-grid.lv-grid-edit > .le2-nr { grid-column: 2; grid-row: 1 / 3; }
  .lv-row.lv-grid.lv-grid-edit > .lv-edit-bez { grid-column: 3; grid-row: 1; }
  .lv-row.lv-grid.lv-grid-edit > .lv-edit-kat { grid-column: 3; grid-row: 2; }
  .lv-row.lv-grid.lv-grid-edit > .lv-edit-preis { grid-column: 4; grid-row: 1; }
  .lv-row.lv-grid.lv-grid-edit > .lv-row-vorjahr { grid-column: 4; grid-row: 2; align-self: center; }
  .lv-row.lv-grid.lv-grid-edit > .lv-delta { display: none; }
  .lv-row.lv-grid.lv-grid-edit > .lv-row-status { grid-column: 3; grid-row: 2; align-self: center; }
  .lv-row.lv-grid.lv-grid-kat.lv-grid-edit > .lv-row-status { display: none; }
  .lv-row.lv-grid.lv-grid-edit > .lv-delete-btn { grid-column: 5; grid-row: 1 / 3; align-self: center; }
}
@media (max-width: 768px) {
  .lv-columns { grid-template-columns: 1fr; }
  .lv-cats { border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  .lv-price-row, .lv-price-row-2 { grid-template-columns: 1fr; }
  .lv-check { padding-top: 0; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Modul: Dashboard
   ═══════════════════════════════════════════════════════════════════════════ */

.dash-head { margin-bottom: 20px; }
.dash-greeting { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; margin: 0; color: var(--text-primary); }
.dash-spruch { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0; }
.dash-secondary { font-size: 12.5px; color: var(--text-secondary); }
.dash-muted { color: var(--text-muted); }

/* Kennzahlen: ein Streifen, vier Werte, Farbe nur mit Bedeutung */
.dash-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface-2);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  margin-bottom: 20px;
}
.dash-kpi { padding: 20px 24px; min-width: 0; }
.dash-kpi + .dash-kpi { border-left: 1px solid var(--border); }
.dash-kpi-label { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.dash-kpi-label svg { width: 16px; height: 16px; flex-shrink: 0; }
.dash-kpi-value { font-size: 34px; font-weight: 700; letter-spacing: -0.8px; line-height: 1.1; margin: 0; color: var(--text-primary); }
.dash-kpi-sub { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.dash-kpi-sub-danger { color: var(--danger); }
.dash-kpi-sub-success { color: #3f9e5c; }
.dash-kpi-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.dash-main-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.dash-panel {
  background: var(--surface-2);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  padding: 18px 22px;
}
.dash-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dash-panel-head-plain { align-items: baseline; }
.dash-panel-head-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dash-panel-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text-primary); }
.dash-link { border: none; background: none; padding: 0; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--accent); cursor: pointer; white-space: nowrap; }
.dash-link:hover { text-decoration: underline; }

.dash-range { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border-radius: 9px; }
.dash-range-btn { height: 28px; padding: 0 12px; border: none; border-radius: 7px; background: transparent; font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.dash-range-btn-active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }

/* Fällig-Liste */
.dash-due-panel { padding: 18px 0 6px; overflow: hidden; }
.dash-due-panel .dash-panel-head { padding: 0 22px; }
.dash-due-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 0.9fr) 72px 150px;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-primary);
}
.dash-due-row:last-child { border-bottom: none; }
.dash-due-head { min-height: 34px; background: var(--surface-1); border-top: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.dash-due-order { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-due-nr { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dash-due-pat { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-express-tag { padding: 1px 7px; border-radius: 6px; background: var(--danger-bg); color: var(--danger); font-size: 11px; font-weight: 600; }
.dash-tech-avatar { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface-1); font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.dash-due-when { display: flex; justify-content: flex-end; text-align: right; }
.dash-due-chip { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.dash-due-chip-danger { background: var(--danger-bg); color: var(--danger); }
.dash-due-chip-warning { background: var(--warning-bg); color: var(--warning); }
.dash-due-chip-neutral { background: var(--surface-1); color: var(--text-secondary); }
.dash-due-more { margin: 0; padding: 12px 22px 8px; font-size: 12.5px; color: var(--text-secondary); }

.dash-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 22px 40px; text-align: center; }
.dash-empty-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; }
.dash-empty-icon svg { width: 22px; height: 22px; }
.dash-empty-icon-ok { background: rgba(63, 158, 92, 0.14); color: #3f9e5c; }
.dash-empty-title { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.dash-empty-text { margin: 0; max-width: 320px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }

/* In Bearbeitung: gestapelter Balken + Legende */
.dash-stack { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-1); margin-bottom: 14px; }
.dash-legend { display: flex; flex-direction: column; gap: 8px; }
.dash-legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-primary); }
.dash-legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dash-legend-label { flex: 1; }
.dash-legend-value { font-weight: 600; color: var(--text-primary); }
.dash-delivered { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-secondary); }

/* Auftragseingang: Balken pro Tag */
.dash-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: end; height: 170px; }
.dash-bar-col { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.dash-bar-num { font-size: 12px; font-weight: 600; color: var(--text-secondary); min-height: 15px; }
.dash-bar { width: 100%; max-width: 30px; border-radius: 6px; background: var(--info-bg); background: color-mix(in srgb, var(--info) 28%, var(--surface-2)); }
.dash-bar-day { font-size: 12px; font-weight: 500; color: var(--text-primary); }
.dash-bar-date { font-size: 10.5px; color: var(--text-muted); margin-top: -4px; }
.dash-bar-today .dash-bar { background: var(--info); }
.dash-bar-today .dash-bar-num, .dash-bar-today .dash-bar-day { color: var(--info); font-weight: 700; }
.dash-bar-future .dash-bar { background: var(--surface-1); }
.dash-bar-future .dash-bar-day { color: var(--text-muted); }

@media (max-width: 1180px) {
  .dash-main-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dash-due-inhalt-inline { display: none; }
.dash-due-more-link { display: block; width: 100%; border: none; background: none; text-align: left; font-family: inherit; font-weight: 500; color: var(--accent); cursor: pointer; }
.dash-due-more-link:hover { text-decoration: underline; }

/* iPad hochkant: kleine Kacheln nach oben, Fällig-Liste ans Ende und kompakt,
   damit bei vielen Aufträgen nichts nach unten aus dem Bild rutscht */
@media (max-width: 1024px) {
  .dash-main-grid { display: flex; flex-direction: column; }
  .dash-side { order: -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; width: 100%; }
  .dash-due-panel { width: 100%; }
  .dash-due-head { display: none; }
  .dash-due-row { grid-template-columns: minmax(0, 1fr) auto; min-height: 58px; }
  .dash-due-inhalt, .dash-due-col-opt { display: none; }
  .dash-due-inhalt-inline { display: inline; }
  .dash-bars { height: 120px; }
}
@media (max-width: 1024px) and (min-width: 769px) {
  .dash-kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dash-kpi { padding: 14px 16px; }
  .dash-kpi-value { font-size: 28px; }
}
@media (max-width: 768px) {
  .dash-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-kpi:nth-child(3) { border-left: none; }
  .dash-kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 768px) {
  .dash-side { grid-template-columns: minmax(0, 1fr); }
  .dash-due-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; }
  .dash-due-col-opt { display: none; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   Modul: Nachrichten
   ═══════════════════════════════════════════════════════════════════════════ */

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.app-sidebar .tile-icon { position: relative; }
.app-sidebar .tile-badge { box-shadow: 0 0 0 2px var(--surface-2); }
.tile-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 500;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.home-tile-badge { top: 14px; right: 14px; }

.msg-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  background: var(--surface-2);
}
#view-messages { display: flex; flex-direction: column; height: 100%; }


/* Liste */
.msg-sidebar { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.msg-sidebar-header { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.msg-search { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--surface-1); color: var(--text-secondary); }
.msg-search-row { display: flex; gap: 8px; }
.msg-new-btn { flex-shrink: 0; height: 38px; padding: 0 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
#msgSearchInput { flex: 1; width: auto; min-width: 0; height: 100%; padding: 0; border: none; background: transparent; font-size: 13.5px; box-shadow: none; }
.msg-tabs { display: flex; gap: 2px; background: var(--surface-1); border-radius: 9px; padding: 3px; }
.msg-tab { flex: 1; height: 28px; border: none; background: transparent; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); border-radius: 7px; cursor: pointer; font-family: inherit; }
.msg-tab-active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.msg-thread-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.msg-list-hint { margin: 0; padding: 16px 10px; font-size: 12.5px; color: var(--text-secondary); }

.msg-thread-item { display: flex; gap: 12px; padding: 12px 10px; border-radius: 10px; cursor: pointer; }
.msg-thread-item:hover { background: var(--surface-1); }
.msg-thread-item-active, .msg-thread-item-active:hover { background: var(--info-bg); }
.msg-thread-avatar { position: relative; width: 38px; height: 38px; flex-shrink: 0; }
.msg-thread-more { position: absolute; right: -3px; bottom: -3px; min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box; border-radius: 999px; border: 2px solid var(--surface-2); background: var(--info-bg); color: var(--info); font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.msg-thread-item-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.msg-thread-item-top { display: flex; align-items: baseline; gap: 8px; }
.msg-thread-subject { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-thread-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.msg-thread-names { margin: 0; font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-thread-bottom { display: flex; align-items: center; gap: 8px; }
.msg-thread-preview { flex: 1; min-width: 0; margin: 0; font-size: 12.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); flex-shrink: 0; }
.msg-thread-item-unread .msg-thread-subject { font-weight: 700; }
.msg-thread-item-unread .msg-thread-time { color: var(--info); font-weight: 600; }
.msg-thread-item-unread .msg-thread-preview { color: var(--text-primary); }

.msg-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 32px 20px; text-align: center; }
.msg-empty-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--info-bg); color: var(--info); display: flex; align-items: center; justify-content: center; }
.msg-empty-icon svg { width: 22px; height: 22px; }
.msg-empty-title { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.msg-empty-text { margin: 0; max-width: 260px; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }

/* Unterhaltung */
.msg-conversation { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.msg-conv-empty { flex: 1; display: flex; align-items: center; justify-content: center; }
.msg-conv-header { display: flex; align-items: center; gap: 6px; padding: 14px 16px 14px 22px; min-height: 68px; box-sizing: border-box; border-bottom: 1px solid var(--border); }
.msg-conv-header-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.msg-conv-title { font-size: 16px; font-weight: 600; margin: 0; line-height: 1.3; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-conv-with { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin: 0; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-avatar-stack { display: inline-flex; flex-shrink: 0; }
.msg-conv-names { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-avatar-stack .avatar { border: 2px solid var(--surface-2); box-sizing: content-box; }
.msg-avatar-stack .avatar + .avatar { margin-left: -6px; }
.msg-conv-menu-wrap { position: relative; }
.msg-conv-icon-btn { border: none; background: transparent; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.msg-conv-icon-btn:hover { background: var(--surface-1); color: var(--text-primary); }
.msg-conv-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 4px;
  min-width: 150px;
  z-index: 30;
}
.msg-conv-menu button { display: block; width: 100%; text-align: left; border: none; background: transparent; padding: 8px 10px; font-size: 13px; color: var(--text-primary); border-radius: 8px; cursor: pointer; font-family: inherit; }
.msg-conv-menu button:hover { background: var(--surface-1); }
.msg-conv-menu button.msg-conv-menu-danger { color: var(--danger); }
.msg-conv-menu button.msg-conv-menu-danger:hover { background: var(--danger-bg); }

.msg-conv-body { flex: 1; padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; background: color-mix(in srgb, var(--surface-1) 35%, var(--surface-2)); }
.msg-date-divider { align-self: center; font-size: 11.5px; font-weight: 500; color: var(--text-secondary); background: var(--surface-1); padding: 3px 10px; border-radius: 999px; margin: 6px 0 12px; position: sticky; top: 0; z-index: 3; }
.msg-bubble-row { align-self: flex-start; max-width: 70%; margin-bottom: 10px; display: flex; gap: 10px; align-items: flex-end; }
.msg-bubble-row-mine { align-self: flex-end; }
.msg-bubble-row-grouped { margin-bottom: 3px; }
.msg-bubble-avatar-slot { width: 28px; flex-shrink: 0; }
.msg-bubble-sender { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); flex-basis: 100%; }
.msg-unread-divider { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.msg-unread-divider::before, .msg-unread-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--danger) 35%, transparent); }
.msg-unread-divider span { font-size: 11px; font-weight: 600; color: var(--danger); white-space: nowrap; }
.msg-bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px 16px 16px 4px; padding: 9px 13px; font-size: 13.5px; line-height: 1.45; word-break: break-word; display: flex; flex-wrap: wrap; align-items: flex-end; column-gap: 10px; row-gap: 4px; }
.msg-bubble-mine { background: var(--info); border-color: var(--info); color: #fff; border-radius: 16px 16px 4px 16px; }
.msg-bubble-text { flex: 1 1 auto; white-space: pre-wrap; }
.msg-bubble-meta { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.msg-bubble-mine .msg-bubble-meta, .msg-bubble-mine .msg-status, .msg-bubble-mine .msg-status-read { color: rgba(255, 255, 255, 0.78); }
.msg-bubble-images { display: flex; gap: 6px; flex-basis: 100%; }
.msg-bubble-image { width: 140px; height: 140px; object-fit: cover; border-radius: 10px; cursor: pointer; }

/* Eingabe */
.msg-composer-wrap { border-top: 1px solid var(--border); padding: 12px 22px 14px; }
.msg-composer { display: flex; align-items: flex-end; gap: 6px; padding: 6px 6px 6px 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface-2); }
.msg-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.msg-composer textarea { flex: 1; min-width: 0; border: none; background: transparent; resize: none; padding: 8px 0; margin: 0; font-size: 13.5px; line-height: 1.45; max-height: 160px; overflow-y: auto; box-shadow: none; }
.msg-composer textarea:focus, .msg-composer textarea:hover { box-shadow: none; background: transparent; }
.msg-composer-actions { display: flex; align-items: center; gap: 2px; position: relative; }
.msg-send-btn { width: 36px; height: 36px; border: none; border-radius: 10px; background: var(--info); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; margin-left: 4px; flex-shrink: 0; }
.msg-send-btn:hover { opacity: 0.9; }
.msg-composer-hint { margin: 6px 0 0 4px; font-size: 11px; color: var(--text-muted); }
.msg-composer-actions .msg-emoji-picker { left: auto; right: 0; }

.msg-textbox { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.msg-textbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.msg-textbox textarea { border: none; background: transparent; display: block; width: 100%; padding: 12px; margin: 0; font-size: 13.5px; resize: none; min-height: 140px; overflow-y: auto; box-shadow: none; }
.msg-textbox textarea:focus, .msg-textbox textarea:hover { box-shadow: none; background: transparent; }
.msg-textbox-toolbar { display: flex; align-items: center; padding: 6px 8px; gap: 2px; position: relative; background: var(--surface-1); border-top: 1px solid var(--border); }
.msg-toolbar-hint { margin-left: 6px; font-size: 11.5px; color: var(--text-muted); }
.msg-emoji-btn { border: none; background: transparent; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; flex-shrink: 0; }
.msg-emoji-btn:hover { background: var(--surface-1); }
.msg-textbox-toolbar .msg-emoji-btn:hover { background: var(--surface-2); }
.msg-emoji-btn:disabled { opacity: 0.4; cursor: default; }
.msg-emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 8px;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  z-index: 20;
}
.msg-emoji-option { font-size: 18px; text-align: center; cursor: pointer; padding: 4px; border-radius: 8px; }
.msg-emoji-option:hover { background: var(--surface-1); }

.msg-attach-row { display: flex; gap: 8px; padding: 0 2px 8px; }
.msg-attach-row:empty { display: none; }
.msg-attach-tile { position: relative; width: 60px; height: 60px; flex-shrink: 0; }
.msg-attach-tile img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.msg-attach-remove { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--danger); color: white; border: none; font-size: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; }

.msg-archived-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 22px; border-top: 1px solid var(--border); background: var(--surface-1); }
.msg-archived-bar p { font-size: 12.5px; color: var(--text-secondary); margin: 0; }

/* Neue Nachricht */
.msg-compose-body { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; max-width: 720px; box-sizing: border-box; width: 100%; }
.msg-compose-field { display: flex; flex-direction: column; gap: 6px; }
.msg-compose-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
#msgSubjectInput { height: 42px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.msg-compose-actions { display: flex; justify-content: flex-end; gap: 10px; }
.msg-compose-actions .btn { height: 40px; padding: 0 16px; border-radius: 10px; }

.msg-recipient-box {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 5px 8px;
  min-height: 42px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
}
.msg-recipient-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
#msgRecipientInput { flex: 1; width: auto; min-width: 120px; height: 30px; padding: 0 4px; border: none; background: transparent; font-size: 13.5px; box-shadow: none; }
.msg-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  white-space: nowrap;
}
.msg-chip i { font-style: normal; cursor: pointer; font-size: 14px; line-height: 1; color: var(--text-muted); }
.msg-chip i:hover { color: var(--danger); }
.msg-recipient-dropdown {
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}
.msg-recipient-dropdown:empty { display: none; }
.msg-recipient-option { display: flex; align-items: center; gap: 10px; padding: 7px 8px; cursor: pointer; border-radius: 8px; font-size: 13px; }
.msg-recipient-text { display: flex; flex-direction: column; min-width: 0; }
.msg-recipient-name { font-weight: 500; color: var(--text-primary); }
.msg-recipient-sub { font-size: 11.5px; color: var(--text-muted); }
.msg-recipient-empty { margin: 0; padding: 8px 10px; font-size: 12.5px; color: var(--text-secondary); }
.msg-recipient-group { margin: 0; padding: 8px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); }
.msg-recipient-group:not(:first-child) { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; }
.msg-recipient-hint { margin: 4px 0 0; padding: 8px 10px 6px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.msg-org { color: var(--text-muted); font-weight: 400; }
.msg-bubble-mine .msg-org { color: rgba(255, 255, 255, 0.7); }
.msg-recipient-box { cursor: text; }
.msg-recipient-option:hover { background: var(--surface-1); }
@media (max-width: 1024px) {
  .msg-layout { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .msg-layout { grid-template-columns: 1fr; height: auto; }
  .msg-sidebar { border-right: none; border-bottom: 1px solid var(--border); max-height: 280px; }
  .msg-bubble-row { max-width: 88%; }
}

.header-notif { position: relative; }
.notif-dropdown {
  display: none;
  position: absolute;
  top: 36px;
  right: 0;
  width: 320px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 60;
}
.notif-dropdown.notif-dropdown-open { display: block; }
.notif-header { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 500; }
.notif-empty { padding: 14px; font-size: 12.5px; color: var(--text-secondary); margin: 0; }
.notif-item { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:last-of-type { border-bottom: none; }
.notif-item:hover { background: var(--surface-1); }
.notif-item-unread { background: var(--accent-bg); }
.notif-item-body { min-width: 0; flex: 1; }
.notif-item-title { font-size: 13px; font-weight: 500; margin: 0; }
.notif-item-sub { font-size: 12px; color: var(--text-secondary); margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item-time { font-size: 10.5px; color: var(--text-muted); margin: 2px 0 0; }
.notif-footer {
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
}
.notif-footer:hover { background: var(--surface-1); }

.msg-status { display: inline-flex; align-items: center; gap: 3px; color: var(--text-muted); }
.msg-status-read { color: var(--accent); }

.input-clear-wrap { position: relative; }
.input-clear-wrap input { padding-right: 34px; }
.input-clear-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-clear-btn:hover { background: var(--surface-1); color: var(--text-primary); }

.input-password-wrap { position: relative; }
.input-password-wrap input { padding-right: 34px; }
.input-password-wrap.input-clear-wrap input { padding-right: 60px; }
.input-eye-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.input-password-wrap.input-clear-wrap .input-eye-btn { right: 32px; }
.input-eye-btn:hover { background: var(--surface-1); color: var(--text-primary); }
.view-login .input-eye-btn { color: #9aa4b1; }
.view-login .input-eye-btn:hover { background: rgba(255,255,255,0.1); color: #f2f4f6; }

.avatar-preview-wrap { width: 90px; height: 90px; border-radius: 8px; overflow: hidden; position: relative; flex-shrink: 0; }
.avatar-preview-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preview-wrap .avatar, .avatar-preview-wrap .user-avatar { width: 100%; height: 100%; font-size: 28px; cursor: default; }

.msg-image-lightbox-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.msg-image-lightbox-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--radius); }

.admin-greeting-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.admin-greeting-input { flex: 1; height: 34px; }
.admin-greeting-delete { width: 28px; height: 28px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.admin-greeting-delete:hover { background: var(--danger-bg); color: var(--danger); }

/* ── Benutzer-Modal: zweispaltiges Layout + Toggle-Switches fuer Module/Gruppen ── */
.user-modal-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; }
.user-modal-section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 10px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-primary);
  cursor: pointer;
}
.switch-row:last-child { border-bottom: none; }
.switch { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background 0.15s; pointer-events: none; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { left: 16px; }

/* ── Registrierung: Auswahlkarten Praxis/Labor ───────────────────────────── */
.org-typ-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: #9aa4b1;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.org-typ-card.active {
  border-color: #38bdf8;
  color: #f2f4f6;
  background: rgba(56, 189, 248, 0.1);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
  font-weight: 600;
}

.register-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #6b7787;
  margin: 0 0 10px;
}
.register-divider { height: 1px; background: rgba(255, 255, 255, 0.08); margin: 20px 0; }

/* ── Login: Hinweis nach Klick auf E-Mail-Bestaetigungslink ─────────────── */
.verify-notice-success { background: rgba(63,158,92,0.12); color: #3f9e5c; }
.verify-notice-error { background: var(--danger-bg); color: var(--danger); }

/* ── Plattform-Verzeichnis (nur .env-Konto) ──────────────────────────────── */
.platform-org-list { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.platform-org { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.platform-org-header { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--accent); }
.platform-org-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.platform-org-users { display: flex; flex-direction: column; }
.platform-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.platform-user-row:last-child { border-bottom: none; }
.platform-user-name { font-size: 12.5px; color: var(--text-primary); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.platform-user-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.platform-user-meta-warn { color: var(--danger); }
.platform-user-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.platform-action-btn { font-size: 11px; padding: 5px 10px; height: auto; }
.platform-action-danger { border-color: var(--danger); color: var(--danger); }
.platform-action-danger:hover { background: var(--danger-bg); }
.platform-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 500;
}
.platform-badge-owner { background: rgba(63, 158, 92, 0.15); color: #3f9e5c; }
.platform-badge-admin { background: rgba(91, 143, 196, 0.15); color: #4a72a0; }
.platform-badge-typ-labor { background: #e8f0f7; color: #2c4a6e; }
.platform-badge-typ-praxis { background: #f7ece8; color: #a85a3a; }

/* ── Benutzer-Modal: Umschalter Einladung/Manuell ────────────────────────── */
.create-mode-toggle { display: flex; background: var(--surface-1); border-radius: 8px; padding: 3px; margin-bottom: 18px; gap: 3px; }
.create-mode-btn {
  flex: 1;
  text-align: center;
  padding: 7px 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}
.create-mode-btn.create-mode-active { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
#userModalPasswordConfirm.input-invalid, #userModalPasswordConfirm.input-invalid + .input-eye-btn { border-color: var(--danger); }
.link-btn { background: none; border: none; padding: 0; font-size: 12px; color: var(--accent); cursor: pointer; text-decoration: underline; }

/* ── Slide-over-Panel (Benutzer bearbeiten/anlegen) ──────────────────────── */
@keyframes slide-over-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.slide-over-overlay { justify-content: flex-end; align-items: stretch; }
.slide-over-panel {
  width: min(520px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
  animation: slide-over-in 0.22s ease-out;
}
.slide-over-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.admin-avatar.slide-over-avatar { width: 54px; height: 54px; font-size: 18px; }
.slide-over-head-text { flex: 1; min-width: 0; }
.slide-over-head .modal-title { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-over-meta { font-size: 13px; color: var(--text-secondary); margin: 3px 0 0; }
.slide-over-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.slide-over-foot { padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.slide-over-panel .user-modal-grid { grid-template-columns: 1fr; gap: 20px; }

@media (max-width: 640px) {
  .slide-over-panel { width: 100%; }
}

/* ── Benutzerliste: Avatar + kombinierte Namenszelle ─────────────────────── */
.admin-user-cell { display: flex; align-items: center; gap: 10px; }
.admin-avatar {
  width: 37px;
  height: 37px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.admin-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.admin-user-meta { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.admin-user-meta-pending { color: #b8712f; }
.admin-dash { color: var(--text-muted); }
.chip-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text-secondary);
}
.chip-pill-owner { background: rgba(63, 158, 92, 0.15); color: #3f9e5c; }
.chip-pill-admin { background: rgba(91, 143, 196, 0.15); color: #4a72a0; }
.admin-resend-invite-btn { font-size: 11px; padding: 5px 10px; height: auto; }

/* ── Benutzerverwaltung: Karte um Toolbar + Tabelle + Pagination ─────────── */
.admin-card {
  background: var(--surface-2);
  border-radius: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  overflow: hidden;
}

/* ── Suchfeld mit Lupe, als Pille statt Standard-Input ───────────────────── */
.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-1);
  border-radius: 10px;
  height: 37px;
  padding: 0 12px;
  width: 300px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.admin-search:focus-within { box-shadow: 0 0 0 2px var(--accent-bg), 0 0 0 1px var(--accent); }
#userSearchInput, #groupSearchInput {
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
  height: 100%;
  font-size: 13px;
  color: var(--text-primary);
}
#userSearchInput:hover, #groupSearchInput:hover,
#userSearchInput:focus, #groupSearchInput:focus { background: transparent; box-shadow: none; }
#userRoleFilter, #userStatusFilter {
  width: auto;
  height: 37px;
  padding: 0 10px;
  font-size: 13px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ── Modulzugriff-Spalte: umrandete Chips statt Text-Aufzaehlung ─────────── */
.admin-module-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-module-chip {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-secondary);
}

/* ── "Zuletzt aktiv"-Spalte: Status-Punkt + Text ─────────────────────────── */
.admin-activity { display: inline-flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12.5px; }
.admin-activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.admin-activity-online { background: #3f9e5c; }
.admin-activity-offline { background: var(--text-muted); }
.admin-activity-pending { background: var(--warning); }

/* ── Verbindungen-Tab ─────────────────────────────────────────────────────── */
.conn-section-title { display: flex; align-items: center; gap: 8px; }
.conn-code-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--surface-1);
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
}
.conn-code-value { font-family: 'SF Mono', Consolas, monospace; font-size: 17px; font-weight: 600; letter-spacing: 2px; color: var(--text-primary); }
.conn-code-expiry { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.conn-copy-btn { display: flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 6px 10px; height: auto; flex-shrink: 0; }
.conn-code-input {
  flex: 1;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ── Plattform: Einstellungen ─────────────────────────────────────────────── */
.platform-tabs { margin-bottom: 20px; }
.platform-global-badge { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--info-bg); color: var(--info); font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; }
#platformMaxImagesInput { width: 80px; flex-shrink: 0; text-align: center; }
.platform-settings-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.platform-settings-foot .admin-settings-hint { flex: 1; margin: 0; }

/* ── Liste/Detail im Tablet-Hochformat (Zahnfarben, Aufträge) ─────────────────
   Umschaltung per .split-detail-open, gesetzt von initSplitView() in core.js */
.split-back-btn { display: none; }
@media (min-width: 769px) and (max-width: 1024px) {
  .split-view { flex-direction: column; gap: 12px; }
  .split-view > .patient-sidebar { width: 100% !important; flex: 1; min-height: 0; }
  .split-view > .detail-card { display: none; width: 100%; }
  .split-view.split-detail-open > .patient-sidebar { display: none; }
  .split-view.split-detail-open > .detail-card { display: block; }
  .split-view.split-detail-open > .split-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    height: 36px;
    padding: 0 12px 0 8px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface-2);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
  }
  /* Aufträge: Kopf nicht mehr an die beiden Spalten gekoppelt */
  #view-auftraege .module-head { max-width: none; }
}

/* ── Zahnfarben, iPad hochkant: Details als Fenster von unten ────────────────
   Außerhalb dieses Bereichs ist .zf-sheet neutral (display: contents), die
   Detailkarte steht wie gewohnt neben der Liste. */
.zf-sheet { display: contents; }
.zf-sheet-bar, .zf-sheet-scrim { display: none; }
@media (min-width: 769px) and (max-width: 1024px) {
  .sheet-view > .patient-sidebar { width: 100%; }
  .zf-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    height: 80vh;
    background: var(--surface-2);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.25);
    transform: translateY(105%);
    transition: transform 0.28s ease;
  }
  .sheet-view.split-detail-open .zf-sheet { transform: translateY(0); }
  .zf-sheet-bar { display: flex; align-items: center; justify-content: flex-end; position: relative; padding: 10px 16px 4px; flex-shrink: 0; touch-action: none; }
  .zf-sheet-grip { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 40px; height: 5px; border-radius: 999px; background: var(--border-strong); }
  .zf-sheet-close { height: 34px; padding: 0 12px; border: none; border-radius: 10px; background: var(--surface-1); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; }
  .zf-sheet > .detail-card { flex: 1; min-height: 0; width: 100%; overflow-y: auto; box-shadow: none; border-radius: 0; background: transparent; padding: 8px 24px 28px; box-sizing: border-box; }
  .zf-sheet-scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(20, 26, 34, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.28s ease; }
  .sheet-view.split-detail-open + .zf-sheet-scrim { opacity: 1; pointer-events: auto; }
}

/* ── Aufträge: Liste + Auftragsseite (Formular / gesperrte Ansicht) ───────── */
#ordListView { display: flex; flex-direction: column; height: 100%; }
#view-auftraege .ord-list-card { width: 100%; flex: 1; min-height: 0; }
.ordp { display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
.ordp-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ordp-back { height: 36px; padding: 0 12px 0 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; }
.ordp-head-text { flex: 1; min-width: 220px; }
.ordp-head-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 20px; font-weight: 700; color: var(--text-primary); }
.ordp-head-sub { margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.ordp-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ordp-head-actions .btn { height: 38px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
.ordp-head-actions .btn-primary { padding: 0 18px; font-weight: 600; }
.ordp-danger-link { color: var(--danger); }
.ordp-status { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--info-bg); color: var(--info); }
.ordp-status-in_arbeit { background: #fef3c7; color: #b45309; }
.ordp-status-fertig, .ordp-status-ausgeliefert { background: #dcfce7; color: #15803d; }
.ordp-express { padding: 3px 9px; border-radius: 7px; background: var(--danger-bg); color: var(--danger); font-size: 12px; font-weight: 600; }
.ordp-lockbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-size: 13px; }
.ordp-lockbar svg { flex-shrink: 0; }

.ordp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.ordp-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ordp-card { background: var(--surface-2); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05); padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.ordp-card .field { margin: 0; }
.ordp-card .grid-2 { gap: 12px 14px; }
.ordp-card-head { display: flex; align-items: center; gap: 10px; }
.ordp-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.ordp-card-hint { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--text-muted); }
.field-label .ordp-card-hint { margin-left: 6px; }
.ordp-lock { margin-left: auto; color: var(--text-muted); display: flex; }
.ordp-num { width: 24px; height: 24px; border-radius: 7px; background: var(--info-bg); color: var(--info); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.ordp-empty { margin: 0; font-size: 13px; color: var(--text-muted); }

/* Nur-Lese-Felder */
.ordp-ro-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.ordp-ro { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ordp-ro-label { font-size: 12px; color: var(--text-secondary); }
.ordp-ro-value { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }
.ordp-ro-sub { font-size: 12px; color: var(--text-muted); }
.ordp-typ-kasse { color: var(--user-kasse, #1d4ed8); }
.ordp-typ-privat { color: var(--user-privat, #7e22ce); }
.ordp-tooth-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.ordp-tooth-chip { padding: 4px 8px; border-radius: 7px; background: var(--surface-1); font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.ordp-tk-krone, .ordp-tooth.ordp-tk-krone { background: #dbeafe; color: #1d4ed8; border-color: #1d4ed8; }
.ordp-tk-glied, .ordp-tooth.ordp-tk-glied { background: #fef3c7; color: #b45309; border-color: #b45309; }
.ordp-tk-implantat, .ordp-tooth.ordp-tk-implantat { background: #f3e8ff; color: #7e22ce; border-color: #7e22ce; }

/* Umschalter und Chips */
.ordp-seg { display: flex; gap: 2px; padding: 3px; background: var(--surface-1); border-radius: 10px; }
.ordp-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 10px; border: none; border-radius: 8px; background: transparent; font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.ordp-seg button.ordp-seg-on { background: var(--surface-2); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.ordp-seg-dot { width: 8px; height: 8px; border-radius: 50%; }
.ordp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ordp-chip { height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2); font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text-primary); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.ordp-chip.ordp-chip-on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ordp-chip-soft.ordp-chip-on { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.ordp-chip-check { border-radius: 10px; }
.ordp-chip-check .ordp-box { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); box-sizing: border-box; }
.ordp-chip-check.ordp-chip-on { background: var(--info-bg); color: var(--info); border-color: var(--info); }
.ordp-chip-check.ordp-chip-on .ordp-box { background: var(--info); border-color: var(--info); box-shadow: inset 0 0 0 3px var(--info-bg); }
#ordPage input.ordp-chip-input { width: 160px; height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; }
.ordp-inline { display: flex; gap: 8px; }
.ordp-inline input { flex: 1; min-width: 0; }
.ordp-shade-btn { white-space: nowrap; height: 40px; border-radius: 10px; font-size: 12.5px; }
.ordp-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
#ordPage .ordp-check input { width: auto; }

/* Patient */
.ordp-patient { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 12px; }
.ordp-patient-av { width: 38px; height: 38px; border-radius: 8px; background: #8a7ca3; color: #fff; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ordp-patient-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.ordp-patient-text span { font-size: 12.5px; color: var(--text-secondary); }

/* Zahnschema */
.ordp-tooth-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ordp-tooth-head .field-label { margin: 0; flex: 1; }
.ordp-tooth-mode-label { font-size: 12px; color: var(--text-secondary); }
.ordp-tooth-head .ordp-seg button { flex: none; }
.ordp-tooth-box { margin-top: 8px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--surface-1) 55%, var(--surface-2)); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.ordp-tooth-sides { display: grid; grid-template-columns: 1fr auto 1fr; font-size: 11px; color: var(--text-muted); padding: 0 4px; }
.ordp-tooth-sides span:nth-child(2) { text-align: center; }
.ordp-tooth-sides span:last-child { text-align: right; }
.ordp-tooth-row { display: flex; gap: 4px; justify-content: center; }
.ordp-tooth-mid { width: 2px; margin: 0 6px; border-radius: 2px; background: var(--border-strong); }
.ordp-tooth-sep { height: 1px; background: var(--border); margin: 2px 0; }
.ordp-tooth { width: 36px; height: 44px; flex-shrink: 0; border-radius: 9px; border: 1.5px solid var(--border-strong); background: var(--surface-2); font-family: inherit; font-size: 12px; font-weight: 600; color: var(--text-secondary); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 0; }
.ordp-tooth small { font-size: 10px; font-weight: 700; }
.ordp-tooth-summary { margin: 8px 0 0; font-size: 12.5px; color: var(--text-secondary); }

/* Anproben */
/* zweizeilig: Bezeichnung oben, Datum + Uhrzeit + Entfernen darunter */
.ordp-tryin { display: grid; grid-template-columns: minmax(0, 1fr) 96px 32px; gap: 6px; align-items: center; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.ordp-tryin .ordp-tryin-label { grid-column: 1 / -1; }
#ordPage .ordp-tryin input { font-size: 13px; }
#ordPage .ordp-tryin .date-display { padding-right: 30px; }

/* Fotos */
.ordp-photos { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.ordp-contents { display: contents !important; }
.ordp-photo { width: 92px; height: 92px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border); box-sizing: border-box; }
.ordp-photo-add, #ordPage .photo-add-tile { width: 92px; height: 92px; border-radius: 12px; border: 1.5px dashed color-mix(in srgb, var(--info) 45%, transparent); background: var(--info-bg); color: var(--info); font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ordp-photo-add span { font-size: 22px; line-height: 1; }
#ordPage .photo-add-tile { font-size: 22px; }
#ordPage .photo-add-tile::after { content: "Foto / Zeichnung"; font-size: 11px; }
#ordPage .photo-thumb-wrap, #ordPage .photo-tile { width: 92px; height: 92px; }
#ordPage .photo-thumb-wrap .photo-thumb, #ordPage .photo-tile img { width: 100%; height: 100%; box-sizing: border-box; border-radius: 12px; display: block; }
#ordPage .photo-delete-btn, #ordPage .photo-tile-remove { top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 8px; border: none; background: #fff; color: var(--danger); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.ordp-photo-marked { opacity: 0.35; }

/* Notizen */
.ordp-note-add { display: flex; flex-direction: column; gap: 8px; }
.ordp-note-add-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ordp-note-add-row .btn { height: 36px; border-radius: 10px; font-weight: 600; }
.ordp-notes { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.ordp-note { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ordp-note-av { width: 30px; height: 30px; border-radius: 7px; background: #4a8f8f; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ordp-note-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ordp-note-meta { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.ordp-note-meta span { font-size: 12px; color: var(--text-muted); }
.ordp-note-meta .ordp-note-flag { padding: 1px 7px; border-radius: 6px; background: var(--info-bg); color: var(--info); font-size: 11px; font-weight: 600; }
.ordp-note-text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ordp-note-sys { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0 8px 42px; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text-secondary); }
.ordp-note-change { padding: 10px 12px; margin: 8px 0; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; font-size: 12.5px; color: #92400e; display: flex; flex-direction: column; gap: 4px; }
.ordp-note-change .ordp-note-meta b { color: #92400e; }

/* Rechte Spalte */
.ordp-side .ordp-seg button { padding: 0 6px; font-size: 12.5px; }
.ordp-qr { display: flex; gap: 14px; align-items: center; }
.ordp-qr-img { width: 124px; height: 124px; flex-shrink: 0; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; box-sizing: border-box; }
.ordp-qr-img svg { width: 100%; height: 100%; display: block; }
.ordp-qr-text { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }
.ordp-timeline { display: flex; flex-direction: column; }
.ordp-tl { position: relative; display: flex; gap: 12px; padding-bottom: 14px; }
.ordp-tl:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.ordp-tl-dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface-2); box-sizing: border-box; flex-shrink: 0; }
.ordp-tl-done .ordp-tl-dot { background: #15803d; border-color: #15803d; }
.ordp-tl-next .ordp-tl-dot { background: var(--accent); border-color: var(--accent); }
.ordp-tl-text { flex: 1; display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.ordp-tl-text span { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }

/* Schmaler (iPad hochkant): Status, QR und Termine als Reihe OBEN, damit
   das Wichtigste ohne Scrollen sichtbar ist */
@media (max-width: 1100px) {
  .ordp-grid { grid-template-columns: 1fr; }
  .ordp-side { order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
}
@media (max-width: 768px) {
  .ordp-ro-grid { grid-template-columns: 1fr 1fr; }
  .ordp-tooth { width: 30px; height: 38px; font-size: 11px; }
}

/* ── Auftrag: Aktuell bei ─────────────────────────────────────────────────── */
.ordp-holder { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-1); }
.ordp-holder-me { background: #f0fdf4; border: 1px solid #bbf7d0; }
.ordp-holder-av { width: 40px; height: 40px; border-radius: 9px; background: #b5697a; color: #fff; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ordp-holder b { display: block; font-size: 15px; color: var(--text-primary); }
.ordp-holder span:not(.ordp-holder-av) { font-size: 12.5px; color: var(--text-secondary); }
.ordp-take-btn { height: 40px; border-radius: 10px; font-weight: 600; }
.ordp-praxis-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.ordp-tl-text small { display: block; font-size: 12px; color: var(--text-muted); }

/* ── Übernahme-Dialog (von unten, auf dem Desktop mittig) ─────────────────── */
.tko-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 26, 34, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.tko-sheet { width: min(620px, 100%); max-height: 90vh; overflow-y: auto; box-sizing: border-box; background: var(--surface-2); border-radius: 20px 20px 0 0; padding: 10px 24px 26px; box-shadow: 0 -12px 40px rgba(0,0,0,0.3); display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) {
  .tko-overlay { align-items: center; }
  .tko-sheet { border-radius: 18px; }
}
.tko-grip { align-self: center; width: 40px; height: 5px; border-radius: 999px; background: var(--border-strong); }
.tko-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tko-title { margin: 0; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.tko-text { margin: 0; font-size: 13.5px; line-height: 1.45; color: var(--text-secondary); }
.tko-mine { margin: 0; padding: 12px 14px; border-radius: 12px; background: #f0fdf4; border: 1px solid #bbf7d0; font-size: 13.5px; color: #166534; }
.tko-flow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-1); }
.tko-person { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.tko-person div { display: flex; flex-direction: column; min-width: 0; }
.tko-person span:not(.tko-av) { font-size: 12px; color: var(--text-secondary); }
.tko-person b { font-size: 14px; color: var(--text-primary); }
.tko-person small { font-size: 12px; color: var(--text-muted); }
.tko-av { width: 36px; height: 36px; border-radius: 8px; background: #4a8f8f; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tko-av-me { background: #b5697a; }
.tko-av-empty { background: var(--border-strong); }
.tko-arrow { font-size: 22px; color: var(--text-muted); }
.tko-label { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.tko-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.tko-hint { margin: 8px 0 0; font-size: 12px; color: var(--text-muted); }
.tko-actions { display: flex; gap: 10px; }
.tko-actions .btn { height: 46px; padding: 0 18px; border-radius: 12px; font-size: 14px; }
.tko-actions .tko-wide { flex: 1; font-size: 15px; font-weight: 600; }
#tkoScanInput.tko-scan-input { height: 48px; font-size: 16px; border-radius: 12px; }

/* ── Mein Arbeitsplatz ────────────────────────────────────────────────────── */
.ap-scan-btn { display: inline-flex; align-items: center; gap: 8px; }
.ap-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface-2); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05); margin-bottom: 16px; }
.ap-kpi { padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.ap-kpi + .ap-kpi { border-left: 1px solid var(--border); }
.ap-kpi span { font-size: 12.5px; color: var(--text-secondary); }
.ap-kpi b { font-size: 30px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; }
.ap-kpi small { min-height: 16px; font-size: 12px; color: var(--text-muted); }
.ap-red { color: var(--danger) !important; }
.ap-amber { color: #b45309 !important; }
.ap-green { color: #15803d !important; }
.ap-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ap-card { background: var(--surface-2); border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05); overflow: hidden; }
.ap-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; }
.ap-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.ap-hint { font-size: 12.5px; color: var(--text-secondary); }
.ap-period button { padding: 0 12px; height: 28px; font-size: 12px; }
.ap-row { width: 100%; display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px 150px; gap: 12px; align-items: center; padding: 12px 18px; border: none; border-bottom: 1px solid var(--border); background: none; font-family: inherit; font-size: 13.5px; color: var(--text-primary); text-align: left; cursor: pointer; }
button.ap-row:hover, .ap-done:hover { background: var(--surface-1); }
.ap-row-head { cursor: default; padding: 8px 18px; background: var(--surface-1); border-top: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.ap-row-head span:last-child, .ap-due { text-align: right; }
.ap-nr { font-weight: 700; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.ap-express { padding: 1px 6px; border-radius: 6px; background: var(--danger-bg); color: var(--danger); font-size: 11px; font-weight: 600; }
.ap-two { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ap-two small { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--surface-1); color: var(--text-secondary); font-size: 12px; font-weight: 600; white-space: nowrap; }
.ap-chip-red { background: var(--danger-bg); color: var(--danger); }
.ap-chip-amber { background: #fef3c7; color: #b45309; }
.ap-done { width: 100%; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 18px; border: none; border-top: 1px solid var(--border); background: none; font-family: inherit; font-size: 13px; color: var(--text-primary); text-align: left; cursor: pointer; }
.ap-check { color: #15803d; font-weight: 700; }
.ap-when { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.ap-empty { padding: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
@media (max-width: 1024px) {
  .ap-grid { grid-template-columns: 1fr; }
  .ap-row { grid-template-columns: 110px minmax(0, 1fr) auto; }
  .ap-row > :nth-child(3) { display: none; }
}
@media (max-width: 768px) {
  .ap-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-kpi:nth-child(3) { border-left: none; }
  .ap-kpi:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ── Übernahme: Person wählen + PIN ───────────────────────────────────────── */
.tko-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; max-height: 220px; overflow-y: auto; }
.tko-pp { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--text-primary); text-align: left; cursor: pointer; }
.tko-pp span:last-child { display: flex; flex-direction: column; min-width: 0; }
.tko-pp small { font-size: 11px; color: var(--text-muted); }
.tko-pp:disabled { opacity: 0.45; cursor: not-allowed; }
.tko-pp.tko-pp-on { border-color: var(--accent); background: var(--info-bg); box-shadow: 0 0 0 2px var(--accent); }
.tko-pp .tko-av { width: 32px; height: 32px; font-size: 11.5px; }
#tkoPin.tko-pin, #ppPin.tko-pin { height: 52px; max-width: 220px; font-size: 24px; letter-spacing: 10px; text-align: center; border-radius: 12px; }

/* Konto-Menü + Dialog "Übernahme-PIN" */
.pin-state { font-size: 11.5px; font-weight: 600; color: #15803d; }
.pin-state.pin-state-missing { color: #b45309; }
.modal-box.pin-box { max-width: 420px; width: calc(100vw - 32px); box-sizing: border-box; display: flex; flex-direction: column; gap: 12px; }
.pin-intro { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.pin-box .field { margin: 0; }
#pinNew, #pinRepeat { font-size: 20px; letter-spacing: 8px; }
.tko-pin-row { display: flex; flex-direction: column; gap: 6px; }
.tko-pin-row .tko-label { margin: 0; }

/* Mein Arbeitsplatz: Person wechseln (gemeinsame Geräte) */
.ap-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ap-viewing { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 10px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-size: 13px; }
.ap-viewing .btn { height: 34px; border-radius: 9px; flex-shrink: 0; }

/* ── Leistungen am Auftrag ────────────────────────────────────────────────── */
.ordp-le { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ordp-le-text { font-size: 13.5px; color: var(--text-secondary); }
.ordp-le .btn { height: 38px; border-radius: 10px; font-weight: 600; }
.view-leistungserfassung > .le2-order-head { justify-content: flex-start; align-items: center; gap: 14px; flex-wrap: wrap; }
.le2-order-head-text { flex: 1; min-width: 220px; }
.le2-order-head .module-subtitle .link-btn { margin-left: 6px; font-size: 13px; }
.le2-save-state { font-size: 12.5px; font-weight: 600; color: #15803d; }
.le2-save-state.le2-save-dirty { color: #b45309; }
.le2-summary-tabs { margin: 10px 20px 6px; }
.le2-summary-tabs button { flex: 1; }
.le2-tech { padding: 10px 0; border-bottom: 1px solid var(--border); }
.le2-tech-name { display: flex; justify-content: space-between; margin: 0 0 6px; font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.le2-tech-name span { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.le2-tech-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; }
.le2-tech-row .le2-nr { justify-self: start; }
.le2-tech-bez { color: var(--text-primary); min-width: 0; }
.le2-tech-menge { font-weight: 600; color: var(--text-secondary); }

/* ── Abrechnung (festgeschrieben) ─────────────────────────────────────────── */
.ordp-billed { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; font-size: 13px; }
.ordp-billed svg { flex-shrink: 0; }
.ordp-le-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.le2-billed-banner { margin-bottom: 14px; }
.le2-billed-card { padding: 8px 20px 18px; overflow-y: auto; }
.le2-billed-block { padding: 10px 0; border-bottom: 1px solid var(--border); }
.le2-billed-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 60px 110px 110px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.le2-billed-row.le2-billed-noprice { grid-template-columns: 64px minmax(0, 1fr) 60px; }
.le2-billed-row .le2-nr { justify-self: start; }
.le2-billed-head { padding: 10px 0 8px; border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.le2-billed-head span:nth-child(n+3), .le2-billed-row .le2-tech-menge, .le2-billed-price, .le2-billed-sum { text-align: right; }
.le2-billed-sum { font-weight: 600; }
.le2-billed-totals { max-width: 320px; margin: 14px 0 0 auto; }

/* ── Einladungen neuer Organisationen ─────────────────────────────────────── */
.inv-overlay { z-index: 60; }
.modal-box.inv-box { max-width: 560px; width: calc(100vw - 32px); box-sizing: border-box; padding: 0; overflow: hidden; display: flex; flex-direction: column; max-height: 90vh; }
.inv-head { padding: 20px 24px 6px; }
.inv-head .modal-title { margin: 0; font-size: 18px; font-weight: 700; }
.inv-intro { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.inv-body { padding: 14px 24px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.inv-body .field { margin: 0; }
.inv-note { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.inv-optional { font-weight: 400; color: var(--text-muted); }
.inv-actions { padding: 12px 24px; border-top: 1px solid var(--border); background: var(--surface-1); margin: 0; }
.inv-box-amber, .inv-box-info { padding: 12px 14px; border-radius: 12px; display: flex; flex-direction: column; gap: 8px; }
.inv-box-amber { background: #fffbeb; border: 1px solid #fde68a; }
.inv-box-info { background: var(--info-bg); border: 1px solid color-mix(in srgb, var(--info) 25%, transparent); }
.inv-box-title { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.inv-box-amber .inv-box-title { color: #92400e; }
.inv-box-text { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }
.inv-hit { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.inv-hit-av { width: 32px; height: 32px; border-radius: 8px; background: #8a7ca3; color: #fff; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.inv-hit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inv-hit-text b { font-size: 13.5px; color: var(--text-primary); }
.inv-hit-text span { font-size: 12px; color: var(--text-secondary); }
.inv-hit .btn { height: 32px; border-radius: 9px; font-size: 12.5px; white-space: nowrap; }
.inv-state { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.inv-checks { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-secondary); }
.inv-ok { color: #15803d; font-weight: 700; margin-right: 4px; }
.inv-warn { color: #b45309; }
.inv-done { display: flex; flex-direction: column; gap: 10px; }
.inv-done-title { margin: 0; font-size: 16px; font-weight: 700; color: #15803d; }
.inv-link { display: flex; gap: 8px; }
.inv-link input { flex: 1; min-width: 0; font-size: 12.5px; }
.inv-link .btn { white-space: nowrap; }

/* Einstellungskarten sind max. 480 px breit: Kopf und Zeilen untereinander */
.inv-card-head { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.inv-card-head .admin-settings-hint { margin: 4px 0 0; }
.inv-list { margin-top: 12px; }
.inv-list-empty { font-size: 12.5px; padding: 6px 0; }
.inv-row { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "text text" "pill actions"; gap: 8px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.inv-row-text { grid-area: text; }
.inv-row .inv-pill { grid-area: pill; justify-self: start; }
.inv-row-actions { grid-area: actions; justify-content: flex-end; }
.inv-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13.5px; }
.inv-row-text span { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.inv-pill { padding: 3px 10px; border-radius: 999px; background: #fef3c7; color: #b45309; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.inv-pill-grey { background: var(--surface-1); color: var(--text-muted); }
.inv-row-actions { display: flex; gap: 6px; }
.inv-row-actions .btn { height: 32px; font-size: 12.5px; }
.inv-row-actions .inv-revoke { color: var(--danger); }

/* Plattform: Registrierungsmodus */
.reg-mode { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.reg-mode-opt { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.reg-mode-opt:has(input:checked) { border-color: var(--accent); background: var(--info-bg); }
.reg-mode-opt input { width: auto; margin-top: 3px; }
.reg-mode-opt b { display: block; font-size: 14px; color: var(--text-primary); }
.reg-mode-opt small { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }

/* Registrierung gesperrt */
.register-closed { padding: 14px 16px; border-radius: 10px; background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.3); color: #dbe7f3; font-size: 13.5px; line-height: 1.5; }
.register-closed p { margin: 0; }
.register-closed p + p { margin-top: 6px; }

/* Öffentliche Einladungsseite (auf dem dunklen Login-Hintergrund) */
.inv-page-panel { display: flex; flex-direction: column; gap: 14px; }
.inv-page-panel .field { margin: 0; }
.inv-page-from { display: flex; align-items: center; gap: 12px; }
.inv-page-from div { display: flex; flex-direction: column; }
.inv-page-from span:not(.inv-page-av) { font-size: 12.5px; color: #9aa4b1; }
.inv-page-from b { font-size: 16px; color: #f2f4f6; }
.inv-page-av { width: 42px; height: 42px; border-radius: 10px; background: #2c4a6e; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.inv-page-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); font-size: 13px; line-height: 1.45; color: #dbe7f3; }
.inv-page-title { margin: 6px 0 0; }
.inv-page-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inv-page-text { margin: 0; font-size: 13.5px; line-height: 1.5; color: #c9d1db; }
.inv-page-hint { display: block; margin: 4px 0 0; font-size: 12px; color: #9aa4b1; text-align: left; }
.inv-page-panel > .inv-page-hint { text-align: center; }
.inv-page-btn { width: 100%; min-height: 46px; height: auto; padding: 10px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; line-height: 1.3; }
.inv-page-ok { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.35); color: #bbf7d0; font-size: 13px; line-height: 1.45; }
.inv-page-ok b { color: #dcfce7; font-size: 14px; }
#view-invitation .inv-page-locked { opacity: 0.75; }

/* ── Scannen mit der Kamera ───────────────────────────────────────────────── */
.tko-cam-btn { height: 64px; border-radius: 14px; font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 12px; }
.tko-or { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-muted); }
.tko-or span { flex: 1; height: 1px; background: var(--border); }

.cam-overlay { position: fixed; inset: 0; z-index: 70; background: #0b0f14; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px); }
.cam-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; color: #fff; }
.cam-title { font-size: 16px; font-weight: 600; }
.cam-tools { display: flex; gap: 8px; min-width: 96px; justify-content: flex-end; }
.cam-btn { height: 40px; padding: 0 14px; border: none; border-radius: 10px; background: rgba(255,255,255,0.14); color: #fff; font-family: inherit; font-size: 14px; cursor: pointer; }
.cam-icon { width: 40px; padding: 0; font-size: 18px; }
.cam-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.cam-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-frame { position: absolute; left: 50%; top: 50%; width: min(66vw, 66vh, 360px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 18px; box-shadow: 0 0 0 200vmax rgba(0,0,0,0.38); }
.cam-c { position: absolute; width: 48px; height: 48px; border: 0 solid #38bdf8; }
.cam-c1 { top: -2px; left: -2px; border-width: 4px 0 0 4px; border-top-left-radius: 18px; }
.cam-c2 { top: -2px; right: -2px; border-width: 4px 4px 0 0; border-top-right-radius: 18px; }
.cam-c3 { bottom: -2px; left: -2px; border-width: 0 0 4px 4px; border-bottom-left-radius: 18px; }
.cam-c4 { bottom: -2px; right: -2px; border-width: 0 4px 4px 0; border-bottom-right-radius: 18px; }
.cam-line { position: absolute; left: 14px; right: 14px; height: 2px; background: linear-gradient(90deg, transparent, #38bdf8, transparent); animation: cam-scan 2.2s ease-in-out infinite; }
@keyframes cam-scan { 0%, 100% { top: 12%; } 50% { top: 86%; } }
.cam-toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: rgba(185, 28, 28, 0.9); color: #fff; font-size: 13.5px; font-weight: 600; }
.cam-hint { margin: 0; padding: 16px 22px 24px; text-align: center; font-size: 15px; line-height: 1.45; color: #e5e7eb; }
@media (prefers-reduced-motion: reduce) { .cam-line { animation: none; top: 50%; } }

/* ── Feinschliff Desktop / Tablet hochkant ───────────────────────────────── */
/* Verbindungen: Zeilen mit zwei Buttons (Anfrage annehmen/ablehnen) umbrechen
   statt über den Kartenrand hinauszuragen */
#connectionsList .admin-settings-row { flex-wrap: wrap; row-gap: 8px; }
#connectionsList .admin-settings-row > div:first-child { flex: 1 1 220px; min-width: 0; }
#connectionsList .conn-row-end { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-left: auto; }
#connectionsList .conn-row-end .btn { margin-left: 0 !important; }

@media (max-width: 1024px) {
  /* Benutzerliste: Spalte "Modulzugriff" ausblenden, damit Namen nicht umbrechen */
  #userTable th:nth-child(5), #userTable td:nth-child(5) { display: none; }
  /* Auftragsseite: Aktionen in eigene Zeile, Titel bekommt die volle Breite */
  .ordp-head-actions { width: 100%; justify-content: flex-end; }
}

/* Patientensuche im Auftragsformular: Lupe statt Auswahlpfeil */
.ordp-search .ordp-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.ordp-search::after { display: none; }
#ordPage #ordPatientSearch { padding-left: 36px; }

/* Übernahme-/Scan-Dialoge am Desktop (Maus): kompakter als für Finger */
@media (min-width: 1025px) and (pointer: fine) {
  .tko-sheet { width: min(540px, 100%); padding: 18px 24px 22px; gap: 12px; }
  .tko-sheet.tko-sheet-scan { width: min(440px, 100%); }
  .tko-grip { display: none; }
  .tko-title { font-size: 16px; }
  .tko-actions .btn { height: 38px; padding: 0 14px; border-radius: 10px; font-size: 13.5px; }
  .tko-actions .tko-wide { font-size: 13.5px; }
  .tko-cam-btn { height: 44px; border-radius: 10px; font-size: 14px; gap: 8px; }
  .tko-cam-btn svg { width: 18px; height: 18px; }
  #tkoScanInput.tko-scan-input { height: 40px; font-size: 14px; border-radius: 10px; }
  #tkoPin.tko-pin, #ppPin.tko-pin { height: 44px; font-size: 20px; }
}
