/*
 * Gemeinsame Designschicht fuer Admin Portal und Org Portal ("Framed App",
 * 2026-10-24). Wird nach dem jeweiligen style.css geladen und ueberschreibt
 * nur Optik: die ganze Anwendung sitzt als grosse abgerundete Karte auf
 * einem weichen Hintergrund, die Seitenleiste ist ein helles, abgerundetes
 * Panel mit hervorgehobenem aktivem Menuepunkt, Karten, Kacheln, Tabellen und Formulare sind
 * weicher und luftiger. Farben bleiben in der Kundenpalette (Blau), seit
 * dem zweiten Durchgang (2026-10-24) mit heller Seitenleiste und hellerem
 * Akzentblau.
 * Markup und Klassen der Seiten bleiben unveraendert.
 */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --page-bg: #e4ebf3;
  --frame: #f7f9fc;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #e6ebf2;

  --text: #0f1b2d;
  --text-2: #56657a;
  --text-3: #8d99ab;

  --primary: #0b8fd6;
  --primary-dark: #0a72ad;
  --primary-light: #e3f3fc;
  --accent: #39a9f0;

  --nav-bg: linear-gradient(180deg, #1f93e0 0%, #0f80c8 50%, #0a6fb0 100%);
  --nav-text: rgba(255, 255, 255, 0.82);
  --nav-hover-bg: rgba(255, 255, 255, 0.14);
  --nav-active-bg: #ffffff;
  --nav-active-text: #0a72ad;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --sidebar-w: 236px;
  --topbar-h: 72px;

  --shadow: 0 1px 2px rgba(15, 35, 70, 0.04), 0 6px 24px rgba(15, 35, 70, 0.06);
  --shadow-lg: 0 24px 60px rgba(15, 35, 70, 0.12);

  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
  background: var(--page-bg);
  background-attachment: fixed;
  font-family: var(--font-ui);
  letter-spacing: -0.005em;
}

/* ---------- Zwei Flaechen: Seitenleiste und Inhalt ---------- */

/* Kein gemeinsamer Rahmen mehr: Seitenleiste und Inhalt sind zwei
   eigenstaendige, abgerundete Flaechen mit Abstand auf dem Seitenhintergrund. */
.shell {
  margin: 16px;
  height: calc(100vh - 32px);
  min-height: 0;
  gap: 16px;
  background: transparent;
}

.sidebar {
  height: 100%;
  position: relative;
  top: 0;
  border-radius: 26px;
  background: var(--nav-bg);
  box-shadow: 0 12px 32px rgba(10, 111, 176, 0.25);
}

.brand { padding: 26px 22px 22px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.brand-text strong { font-size: 15.5px; color: #fff; }
.brand-text span { color: rgba(255, 255, 255, 0.72); }

.nav-scroll { padding: 6px 14px 20px; }
.nav-item {
  padding: 11px 14px;
  border-radius: 14px;
  margin-bottom: 4px;
  color: var(--nav-text);
  font-weight: 600;
}
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { background: var(--nav-hover-bg); color: #fff; }
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  box-shadow: 0 6px 16px rgba(10, 60, 110, 0.18);
}

.nav-subgroup { padding-left: 22px; margin: 4px 0 12px; gap: 2px; }
.nav-subitem { border-radius: 10px; padding: 8px 14px; color: rgba(255, 255, 255, 0.72); }
.nav-subitem:hover { background: var(--nav-hover-bg); color: #fff; }
.nav-subitem.active { background: rgba(255, 255, 255, 0.2); color: #fff; }

.sidebar-foot { padding: 16px 22px 22px; color: rgba(255, 255, 255, 0.6); }

/* ---------- Hauptbereich ---------- */

.main-col {
  height: 100%;
  overflow: hidden;
  border-radius: 28px;
  background: var(--frame);
  box-shadow: 0 1px 2px rgba(15, 35, 70, 0.04), 0 10px 30px rgba(15, 35, 70, 0.06);
}

.topbar {
  background: transparent;
  border-bottom: none;
  padding: 0 26px;
}

.search {
  background: var(--surface);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  padding: 11px 18px;
}
.search:focus-within { border-color: rgba(11, 143, 214, 0.35); }

.avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #5cc0f7, #0b8fd6);
  color: #fff;
  box-shadow: 0 4px 12px rgba(11, 143, 214, 0.28);
}
.bell-btn { width: 40px; height: 40px; background: var(--surface); box-shadow: var(--shadow); }

.dropdown { border: none; border-radius: 16px; box-shadow: var(--shadow-lg); padding: 8px; }
.dropdown a, .dropdown button { border-radius: 10px; }

.content { padding: 8px 26px 40px; }

.page-head { margin-bottom: 20px; align-items: center; }
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { color: var(--text-3); font-weight: 500; }

/* ---------- Karten ---------- */

.card {
  border: none;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
}
.card-head { margin-bottom: 14px; }
.card h3, .section-head { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card p.hint { color: var(--text-3); }

.empty-state {
  border-radius: 16px;
  background: var(--bg);
  border: 1px dashed #d6deea;
}

/* ---------- Kennzahlen ---------- */

.kpi-grid { gap: 16px; }
.kpi {
  border: none;
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: -34px;
  right: -34px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 70%, rgba(92, 192, 247, 0.25), rgba(11, 143, 214, 0.08) 70%);
  pointer-events: none;
}
.kpi::after {
  content: '';
  position: absolute;
  left: 20px;
  bottom: 0;
  width: 36px;
  height: 4px;
  border-radius: 4px 4px 0 0;
  background: #0b8fd6;
}
.kpi:nth-child(4n + 2)::before { background: radial-gradient(circle at 30% 70%, rgba(14, 149, 148, 0.2), rgba(14, 149, 148, 0.06) 70%); }
.kpi:nth-child(4n + 2)::after { background: #0e9594; }
.kpi:nth-child(4n + 3)::before { background: radial-gradient(circle at 30% 70%, rgba(232, 160, 32, 0.22), rgba(232, 160, 32, 0.06) 70%); }
.kpi:nth-child(4n + 3)::after { background: #e8a020; }
.kpi:nth-child(4n + 4)::before { background: radial-gradient(circle at 30% 70%, rgba(209, 41, 61, 0.18), rgba(209, 41, 61, 0.05) 70%); }
.kpi:nth-child(4n + 4)::after { background: #d1293d; }
.kpi > * { position: relative; }
.kpi-label { color: var(--text-3); font-weight: 600; font-size: 12px; }
.kpi-value { font-size: 30px; margin-top: 8px; }

/* ---------- Buttons ---------- */

.btn { border-radius: var(--radius-pill); padding: 10px 20px; font-weight: 700; }
.btn-primary {
  background: linear-gradient(135deg, #2aa6ea, #0b8fd6);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(11, 143, 214, 0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, #0b8fd6, #0a72ad); }
.btn-secondary { background: var(--surface); border-color: var(--border); box-shadow: 0 1px 2px rgba(15, 35, 70, 0.05); }
.btn-secondary:hover { background: var(--bg); }
.btn-sm { padding: 6px 14px; }

/* ---------- Formulare ---------- */

.input, .select, textarea.input {
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid transparent;
  padding: 11px 14px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, textarea.input:focus {
  background: var(--surface);
  border-color: rgba(11, 143, 214, 0.45);
  box-shadow: 0 0 0 4px rgba(11, 143, 214, 0.1);
  outline: none;
}
.field label { color: var(--text-2); font-weight: 600; }
input[type='checkbox'], input[type='radio'] { accent-color: var(--primary); width: 16px; height: 16px; }

.filter-chip { border-radius: var(--radius-pill); }
.filter-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

.toggle.on { background: var(--primary); }

/* ---------- Tabellen ---------- */

table { border-collapse: separate; border-spacing: 0; }
th {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: var(--bg);
  border-bottom: none;
}
th:first-child { border-radius: 12px 0 0 12px; }
th:last-child { border-radius: 0 12px 12px 0; }
td { border-bottom: 1px solid #eef2f7; }
tr.row-link:hover td { background: #f6f9fd; }

/* ---------- Chips und Reiter ---------- */

.chip { border-radius: var(--radius-pill); font-weight: 700; padding: 4px 11px; }

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border-bottom: none;
  margin-bottom: 18px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  border-bottom: none !important;
  margin-bottom: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
.tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 35, 70, 0.08);
}

/* ---------- Seitenleiste rechts, Dialoge, Login ---------- */

.drawer-overlay { background: rgba(15, 27, 45, 0.28); backdrop-filter: blur(3px); }
.drawer {
  margin: 12px;
  height: calc(100vh - 24px);
  border-radius: 26px;
  background: var(--frame);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 48px;
}
.drawer-head { border-bottom: none; padding-bottom: 6px; }
.drawer-close { background: var(--surface); box-shadow: var(--shadow); }

.modal-overlay { backdrop-filter: blur(3px); }
.modal { border-radius: 24px; box-shadow: var(--shadow-lg); border: none; }

.danger-zone { border-radius: 20px; }

.login-wrap { background: transparent; }
.login-card { border: none; border-radius: 28px; box-shadow: var(--shadow-lg); padding: 40px 38px; }
.login-card .brand-mark { background: linear-gradient(135deg, #5cc0f7, #0b8fd6); color: #fff; }

.map { border-radius: 18px; overflow: hidden; }

/* ---------- Mobil (bis 860 px), 2026-10-24 ---------- */

/* Menueknopf und Hintergrund fuer die ausklappbare Seitenleiste, nur mobil sichtbar */
.menu-btn { display: none; }
.sidebar-backdrop { display: none; }

/* Kontaktzeilen fuer die Leitstelle (Org Portal, Geraet, Reiter Leitstelle) */
.contact-grid-row {
  display: grid;
  grid-template-columns: 28px 1.3fr 1fr 1.3fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.contact-grid-row > span:first-child { color: var(--text-3); text-align: right; }
.contact-grid-row > div:last-child { display: flex; gap: 4px; }

@media (max-width: 860px) {
  body { background: var(--frame); }
  .shell { margin: 0; height: 100dvh; gap: 0; }
  .main-col { border-radius: 0; box-shadow: none; }

  /* Seitenleiste bleibt wie im Basis-Stylesheet ausklappbar und ueberlagert den Inhalt */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: min(290px, 84vw);
    height: 100dvh;
    border-radius: 0 26px 26px 0;
  }
  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(15, 27, 45, 0.35);
    backdrop-filter: blur(2px);
  }
  .menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 14px;
    border: none;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
  }
  .menu-btn svg { width: 20px; height: 20px; }

  .topbar { height: 64px; padding: 0 14px; gap: 10px; }
  .search { flex: 1; min-width: 0; padding: 10px 14px; }
  .content { padding: 4px 14px 32px; }

  .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 16px; }
  .page-title { font-size: 22px; }
  .page-actions { flex-wrap: wrap; }
  .page-actions .btn { flex: 1; justify-content: center; }

  .card { padding: 16px; border-radius: 18px; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters > * { width: 100%; max-width: none; }
  .field-row { flex-direction: column; gap: 0; }

  /* 16 px verhindert das automatische Hineinzoomen auf iOS beim Antippen */
  .input, .select, textarea.input { font-size: 16px; min-height: 44px; }
  .btn { min-height: 42px; }
  .toggle-row { gap: 12px; }

  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px 16px; border-radius: 16px; }
  .kpi-value { font-size: 22px; }

  .map { height: 260px; }

  .drawer { margin: 0; height: 100dvh; border-radius: 0; padding: 0 14px 40px; }
  .drawer-head {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--frame);
    padding: 16px 0 10px;
    margin-bottom: 8px;
  }
  .drawer-head .page-title { font-size: 20px; }

  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 92dvh;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    margin: 0;
  }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; justify-content: center; }

  .contact-grid-row {
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    border-radius: 14px;
    background: var(--bg);
  }
  .contact-grid-row > span:first-child { display: none; }
  .contact-grid-row .input { background: var(--surface); }
  .contact-grid-row > input:nth-of-type(1) { grid-column: 1 / -1; }
  .contact-grid-row > div:last-child { grid-column: 1 / -1; justify-content: flex-end; }
}

/* Tabellen als Karten: jede Zeile eine Karte, jede Zelle "Bezeichnung: Wert"
   (Bezeichnung aus data-label, gesetzt von labelTableCells in app.js) */
@media (max-width: 640px) {
  .card table, .drawer table, .content table { display: block; width: 100%; }
  table thead { display: none; }
  table tbody { display: block; }
  table tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 12px;
    margin-bottom: 10px;
  }
  table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border: none;
    text-align: right;
    word-break: break-word;
  }
  table td::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
    max-width: 45%;
  }
  table td:not([data-label])::before, table td[data-label='']::before { content: none; }
  table td:not([data-label]), table td[data-label=''] { text-align: left; justify-content: flex-start; }
  tr.row-link:hover td { background: none; }
  tr.row-link:active { background: var(--bg); }
}

/* In der rechten Seitenleiste (Geraete- und Organisationsdetail) kompaktere Reiter, damit alle in eine Zeile passen */
.drawer .tab { padding: 7px 12px; font-size: 13px; }

/* ---------- Bewegung (2026-10-25) ---------- */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide-in-right { from { transform: translateX(104%); } to { transform: none; } }
@keyframes slide-out-right { from { transform: none; } to { transform: translateX(104%); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes shimmer { from { background-position: -320px 0; } to { background-position: 320px 0; } }
@keyframes load-bar-run { 0% { transform: translateX(-100%) scaleX(0.3); } 50% { transform: translateX(10%) scaleX(0.6); } 100% { transform: translateX(110%) scaleX(0.3); } }

/* Ladebalken oben (loadStart/loadEnd in app.js) */
.load-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  overflow: hidden;
}
.load-bar.active { opacity: 1; }
.load-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, #5cc0f7, #0b8fd6);
  box-shadow: 0 0 10px rgba(11, 143, 214, 0.6);
  transform-origin: left;
  animation: load-bar-run 1.1s ease-in-out infinite;
}
.load-bar.done .load-bar-fill { animation: none; transform: none; transition: transform 0.3s ease; }
.load-bar.done { opacity: 0; transition: opacity 0.35s ease 0.1s; }

/* Platzhalter beim Laden */
.skeleton-wrap { display: flex; flex-direction: column; gap: 12px; padding: 6px 0; }
.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, #e9eef5 0%, #f5f8fb 50%, #e9eef5 100%);
  background-size: 640px 100%;
  animation: shimmer 1.2s linear infinite;
}
.skeleton-title { height: 22px; width: 45%; margin-bottom: 6px; }
.skeleton-line { height: 14px; }

/* Seiteninhalt blendet beim Seitenwechsel ein, Karten leicht zeitversetzt */
.content > * { animation: rise-in 0.42s var(--ease-out) both; }
.content > *:nth-child(2) { animation-delay: 0.04s; }
.content > *:nth-child(3) { animation-delay: 0.08s; }
.content > *:nth-child(4) { animation-delay: 0.12s; }
.content > *:nth-child(n + 5) { animation-delay: 0.16s; }
.content.no-enter > * { animation: none; }
.kpi-grid > .kpi { animation: rise-in 0.45s var(--ease-out) both; }
.kpi-grid > .kpi:nth-child(2) { animation-delay: 0.05s; }
.kpi-grid > .kpi:nth-child(3) { animation-delay: 0.1s; }
.kpi-grid > .kpi:nth-child(4) { animation-delay: 0.15s; }
tbody tr { animation: fade-in 0.35s ease both; }
tbody tr:nth-child(2) { animation-delay: 0.02s; }
tbody tr:nth-child(3) { animation-delay: 0.04s; }
tbody tr:nth-child(4) { animation-delay: 0.06s; }
tbody tr:nth-child(5) { animation-delay: 0.08s; }
tbody tr:nth-child(n + 6) { animation-delay: 0.1s; }

/* Rechte Seitenleiste gleitet herein und wieder hinaus */
.drawer-overlay { animation: fade-in 0.22s ease both; }
.drawer { animation: slide-in-right 0.34s var(--ease-out) both; }
.drawer-overlay.closing { animation: fade-out 0.22s ease both; }
.drawer-overlay.closing .drawer { animation: slide-out-right 0.22s var(--ease-in) both; }
.drawer > * { animation: rise-in 0.36s var(--ease-out) both; animation-delay: 0.08s; }

/* Dialoge */
.modal-overlay { animation: fade-in 0.18s ease both; }
.modal { animation: pop-in 0.26s var(--ease-out) both; }
.modal-overlay.closing { animation: fade-out 0.18s ease both; }

/* Dropdown am Avatar */
.dropdown.open { animation: pop-in 0.18s var(--ease-out) both; transform-origin: top right; }

/* Interaktion */
.btn, .tab, .nav-item, .nav-subitem, .chip, .filter-chip, .menu-btn, .avatar, .bell-btn, .drawer-close {
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease, border-color 0.2s ease;
}
.btn:active, .menu-btn:active, .avatar:active, .bell-btn:active, .drawer-close:active { transform: scale(0.97); }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(11, 143, 214, 0.32); }
.kpi { transition: transform 0.2s var(--ease-out), box-shadow 0.2s ease; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(15, 35, 70, 0.04), 0 12px 30px rgba(15, 35, 70, 0.09); }
tr.row-link td { transition: background 0.15s ease; }
.toggle, .toggle .knob { transition: background 0.2s ease, transform 0.2s var(--ease-out); }

@media (max-width: 860px) {
  .sidebar { transition: transform 0.3s var(--ease-out); }
  .sidebar-backdrop.open { animation: fade-in 0.2s ease both; }
  .modal { animation: sheet-in 0.3s var(--ease-out) both; }
}

/* Wer im Betriebssystem "Bewegung reduzieren" eingestellt hat, bekommt keine Animationen */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
  }
  .load-bar-fill { animation: none; }
}
/* Liste nach dem Schliessen einer Seitenleiste wiederhergestellt: nichts erneut einblenden */
.content.no-enter tbody tr, .content.no-enter .kpi { animation: none; }

/* Segmentierte Auswahl, z.B. Sturzempfindlichkeit Niedrig / Mittel / Hoch */
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  max-width: 100%;
}
.segmented-item {
  border: none;
  background: transparent;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.field .segmented { align-self: flex-start; }
.segmented-item:hover { color: var(--text); }
.segmented-item.active { background: var(--surface); color: var(--primary); box-shadow: 0 2px 8px rgba(15, 35, 70, 0.08); }
@media (max-width: 860px) {
  .segmented, .field .segmented { display: flex; align-self: stretch; }
  .segmented-item { flex: 1; min-height: 40px; }
}

/* Messfenster fuer aktive Vitalmessung (2026-10-25) */
.measure { display: flex; flex-direction: column; gap: 14px; }
.measure-status { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px 10px; font-weight: 600; }
.measure-status > .spinner { margin-top: 3px; flex-shrink: 0; }
.measure-status > span:nth-child(2) { flex: 1; min-width: 0; }
.measure-elapsed { margin-left: auto; width: 100%; text-align: right; font-weight: 500; font-size: 12.5px; color: #8d99ab; font-variant-numeric: tabular-nums; }
.measure-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #e8f4fc;
  color: #0a4f7a;
  font-size: 13.5px;
  line-height: 1.5;
}
.measure-tips { margin: 0; padding-left: 18px; color: #56657a; font-size: 13px; line-height: 1.6; }
.measure-result { text-align: center; padding: 10px 0 4px; animation: measure-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }
.measure-result-label { font-size: 13px; font-weight: 600; color: #56657a; }
.measure-result-value { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 4px; }
@keyframes measure-pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* Ausstehende Messung, Hinweis auf neuen Messwert, neue Version (2026-10-25) */
.pending-measure {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: #e8f4fc;
  color: #0a4f7a;
  font-size: 13.5px;
  line-height: 1.5;
  animation: measure-pop 0.3s ease both;
}
.pending-measure .spinner { margin-top: 3px; flex-shrink: 0; }
.notice-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1500;
  max-width: calc(100vw - 40px);
  padding: 12px 16px;
  border-radius: 14px;
  background: #0f1b2d;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(15, 27, 45, 0.25);
  animation: measure-pop 0.3s ease both;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.notice-toast.out { opacity: 0; transform: translateY(6px); }
.update-banner {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 1600;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border-radius: 999px;
  background: #0f1b2d;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(15, 27, 45, 0.3);
  max-width: calc(100vw - 32px);
}
.update-banner button {
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  background: #0b8fd6;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* Letzte Messwerte im Reiter Vital (Org Portal) */
.latest-vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.latest-vital { padding: 14px 16px; border-radius: 16px; background: var(--bg); }
.latest-vital-label { font-size: 12px; font-weight: 600; color: var(--text-3); }
.latest-vital-value { font-size: 20px; font-weight: 800; margin: 4px 0 2px; letter-spacing: -0.01em; }
.latest-vital-time { font-size: 12px; color: var(--text-3); }
@media (max-width: 1100px) { .latest-vitals { grid-template-columns: repeat(2, 1fr); } }

/* Admin Dashboard: eine grosse Kennzahl (2026-10-26) */
.dashboard-hero { max-width: 560px; padding: 28px 30px; }
.dashboard-hero-label { font-size: 13px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.dashboard-hero-value { display: flex; align-items: baseline; gap: 6px; margin: 8px 0 18px; }
.dashboard-hero-value .kpi-value { font-size: 64px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin: 0; color: var(--primary); }
.dashboard-hero-total { font-size: 20px; font-weight: 700; color: var(--text-3); }
.dashboard-hero .bar-track { height: 10px; border-radius: 999px; margin-bottom: 10px; }
.dashboard-hero .bar-fill { border-radius: 999px; background: linear-gradient(90deg, #5cc0f7, #0b8fd6); transition: width 0.6s var(--ease-out); }

/* Org Portal Meldungen (2026-10-26): Kennzahlen springen zur passenden Liste. */
.kpi-link { cursor: pointer; transition: transform 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out); }
.kpi-link:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(15, 40, 70, 0.08); }
.kpi-value.kpi-warn { color: #c2410c; }

/* Admin Geraeteliste (2026-10-29): Auswahl per Haken, Organisation direkt in der Zeile. */
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: 14px; background: rgba(31, 147, 224, 0.08); animation: rise-in 0.25s var(--ease-out) both; }
.bulk-bar[hidden] { display: none; }
.bulk-bar .select { width: auto; min-width: 220px; }
.device-table .cell-check { width: 36px; }
.device-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: #1f93e0; cursor: pointer; }
.device-table .select-sm { padding: 6px 30px 6px 10px; font-size: 13px; min-width: 170px; height: auto; }
.device-table tr.row-selected td { background: rgba(31, 147, 224, 0.06); }
@media (max-width: 760px) {
  .bulk-bar .select { min-width: 0; flex: 1 1 100%; }
  .device-table .select-sm { min-width: 0; width: 100%; }
}
.card > .filters > .input:first-child { flex: 1 1 320px; max-width: 420px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.inline-form .input { flex: 1 1 220px; }

/* SMS an die Uhr (2026-11-01): Vorlagen, Eingabe und Verlauf in den Geraetedetails. */
.sms-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sms-text { width: 100%; resize: vertical; font-size: 13px; color: var(--text); }
.sms-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.sms-history-title { margin: 18px 0 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.sms-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.sms-item { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); }
.sms-item.sms-in { background: var(--primary-light); border-color: transparent; }
.sms-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.sms-body { color: var(--text); word-break: break-all; white-space: pre-wrap; }
