/* =====================================================================
   Balmung Shop-Schnittstelle — Dashboard
   Balmung Look & Feel (Manual balmung_look_and_feel, docs/10-referenz-werte.md).
   KORRIGIERT = barrierefreie Ersatzwerte aus docs/09-barrierefreiheit.md.
   ===================================================================== */

@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/assets/fonts/inter-v18-latin_latin-ext-regular.woff2') format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/assets/fonts/inter-v18-latin_latin-ext-500.woff2') format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/assets/fonts/inter-v18-latin_latin-ext-600.woff2') format('woff2'); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/assets/fonts/inter-v18-latin_latin-ext-700.woff2') format('woff2'); }

:root {
  /* Marke — globals.sass:25 — die einzige Markenfarbe */
  --brand: #133C55;
  /* Primärrampe nach Element-Plus-Formel auf #133C55 (mix mit Weiß/Schwarz) */
  --brand-l3: #5a7788;
  --brand-l5: #899eaa;
  --brand-l7: #b8c5cc;
  --brand-l8: #d0d8dd;
  --brand-l9: #e7ecee;
  --brand-d2: #0f3044;

  /* Flächen */
  --surface: #ffffff;
  --surface-offset: #eeeeee;
  --fill-light: #f5f7fa;
  --fill: #f0f2f5;

  /* Text */
  --text: #303133;
  --text-regular: #606266;
  --text-secondary: #73767a;   /* KORRIGIERT: #909399 → 3.1:1; #73767a → 4.6:1 */
  --text-disabled: #8a8a8a;    /* KORRIGIERT */

  /* Zustände — Text / Akzent / Fläche */
  --ok-text: #295E10;   --ok: #67C23A;   --ok-bg: #E1F3D8;
  --warn-text: #996500; --warn: #f7ce02; --warn-bg: #FAF4D8;  /* KORRIGIERT */
  --err-text: #702C2C;  --err: #AF3F3F;  --err-bg: #FFDDDD;

  --border: #E2E2E2;
  --divider: #e9e9eb;

  --shadow-1: 10px 10px 30px rgba(0, 0, 0, .05);
  --shadow-content: 0 1px 20px 1px rgba(0, 0, 0, .5);
  --shadow-float: 3px 3px 10px 0 rgba(0, 0, 0, .2);

  --r-round: 100px;   /* Aktion */
  --r-container: 8px;
  --r-cell: 10px;
  --r-content: 14px;
  --r-card: 16px;
  --r-dialog: 18px;

  --space: 12px;
  --sidebar-w: 250px;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--brand);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }   /* KORRIGIERT */
.sidebar :focus-visible, .login :focus-visible { outline-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
}

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* ---------------------------------------------------------------------
   Login
   --------------------------------------------------------------------- */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(345deg, #386FA4 0%, #386FA4 25%, #133C55 85%, #133C55 100%);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--r-dialog);
  box-shadow: var(--shadow-content);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-card :focus-visible { outline-color: var(--brand); }
.login-logo { height: 36px; align-self: flex-start; margin-bottom: 8px; }
.login-card h1 { font-size: 20px; font-weight: 700; color: var(--brand); }
.login-card p { color: var(--text-regular); line-height: 1.5; }

/* ---------------------------------------------------------------------
   Silhouette: dunkle Sidebar + heller Inhaltsbereich als Karte
   --------------------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 var(--sidebar-w);
  width: var(--sidebar-w);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: var(--space);
  position: sticky;
  top: 0;
  height: 100vh;
  color: #fff;
}
.sidebar-logo { height: 30px; width: auto; margin: 4px 0 24px 4px; align-self: flex-start; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: var(--space);
  min-height: 40px; padding: 0 var(--space);
  border: 0; border-radius: var(--r-container);
  background: none; color: #fff;
  font-weight: 500; text-align: left; cursor: pointer;
  transition: background-color 200ms ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .08); }
.nav-item.is-active { background: rgba(255, 255, 255, .16); font-weight: 700; }
.nav-item svg { flex: 0 0 auto; }
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .16); padding-top: var(--space); display: flex; flex-direction: column; gap: 4px; }
.sidebar-user { font-size: 12px; font-weight: 500; text-transform: uppercase; opacity: .8; padding: 0 var(--space) 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border-radius: var(--r-content) 0 0 var(--r-content);
  box-shadow: var(--shadow-content);
  min-height: 100vh;
}
.page { max-width: 1120px; margin: 0 auto; padding: 32px 32px 96px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; color: var(--brand); line-height: 1.25; }
.page-head .sub { color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.page-head-title { display: flex; align-items: center; gap: var(--space); min-width: 0; }
.page-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.mobile-bar { display: none; }

/* ---------------------------------------------------------------------
   Buttons — rund = Aktion
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 20px;
  border-radius: var(--r-round);
  border: 1px solid transparent;
  font-weight: 500; white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
  text-decoration: none;
}
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-l3); }
.btn-primary:active:not(:disabled) { background: var(--brand-d2); }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--brand-l7); }
.btn-secondary:hover:not(:disabled) { background: var(--brand-l9); }
.btn-text { background: none; color: var(--brand); padding: 0 12px; }
.btn-text:hover:not(:disabled) { background: var(--fill); }
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--err-text); }
.btn-danger-text { background: none; color: var(--err); padding: 0 12px; }
.btn-danger-text:hover:not(:disabled) { background: var(--err-bg); }
.btn-sm { min-height: 32px; padding: 0 14px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }
.sidebar .btn-text { color: #fff; justify-content: flex-start; padding: 0 var(--space); border-radius: var(--r-container); }
.sidebar .btn-text:hover { background: rgba(255, 255, 255, .08); }

.spinner {
  width: 16px; height: 16px; flex: 0 0 auto;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------
   Karten, Zellen, Pills
   --------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space); margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 700; color: var(--brand); }
.card-sub { color: var(--text-secondary); margin-top: 4px; line-height: 1.45; }

.section-label { font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--brand); letter-spacing: .02em; margin: 28px 0 10px; }
.section-label:first-child { margin-top: 0; }

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

.stat { padding: 16px 20px; }
.stat-label { font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--brand); }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-hint { color: var(--text-secondary); font-size: 12px; margin-top: 4px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--r-round);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--fill); color: var(--text-regular);
}
.pill svg { flex: 0 0 auto; }
.pill-ok { background: var(--ok-bg); color: var(--ok-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-err { background: var(--err-bg); color: var(--err-text); }
.pill-brand { background: var(--brand-l9); color: var(--brand); }
.pill-live { background: var(--brand); color: #fff; }

.avatar {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-l9); color: var(--brand);
  font-weight: 700; font-size: 15px;
}

/* Verbindungsliste: jede Zeile eine Zelle */
.conn-list { display: flex; flex-direction: column; gap: 12px; }
.conn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.conn:hover { border-color: var(--brand-l7); box-shadow: 0 4px 24px rgba(19, 60, 85, .10); }
.conn-name { font-size: 15px; font-weight: 700; color: var(--brand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.conn-meta span { display: inline-flex; align-items: center; gap: 5px; }
.conn-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.conn-flow { display: inline-flex; align-items: center; gap: 6px; }

/* Leerer Zustand */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px;
  padding: 56px 24px;
  border: 1px dashed var(--brand-l7);
  border-radius: var(--r-card);
  background: var(--fill-light);
}
.empty h2 { font-size: 18px; color: var(--brand); }
.empty p { color: var(--text-regular); max-width: 460px; line-height: 1.55; }
.empty-steps { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 4px 0 6px; }

/* ---------------------------------------------------------------------
   Formulare — rahmenlos im Balmung-Original; hier mit dezenter Fläche,
   damit leere Felder auch ohne Platzhalter sichtbar bleiben
   --------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.label { font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--brand); }
.label .req { color: var(--brand); margin-left: 2px; }
.hint { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-container);
  background: var(--fill);
  transition: border-color 150ms ease, background-color 150ms ease;
}
.input:hover, .select:hover { background: #e9ecf0; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); background: var(--surface); }
.input::placeholder { color: #a0a3a8; }
.input[readonly] { background: var(--fill-light); color: var(--text-regular); }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23133C55' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; }
.field.has-error .input { border-color: var(--err); }

.check-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--ok-text); font-weight: 500; }
.check-inline.err { color: var(--err-text); }

/* Schalter */
.switch { position: relative; display: inline-flex; flex: 0 0 auto; width: 44px; height: 24px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 12px; background: #c8c9cc; transition: background-color 200ms ease; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 200ms ease; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .5; }

/* Auswahlkarten (Abgleich-Bereiche) */
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--r-cell);
  background: var(--surface);
  cursor: pointer;
}
.option:hover { border-color: var(--brand-l7); }
.option.is-on { border-color: var(--brand-l5); background: #f7f9fa; }
.option-icon { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-l9); color: var(--brand); }
.option-title { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.option-desc { color: var(--text-secondary); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.direction { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--brand); background: var(--brand-l9); border-radius: var(--r-round); padding: 2px 8px; letter-spacing: .02em; }

/* Segmentierte Auswahl — BalmungRadioButtonGroup */
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 19px; background: var(--fill-light); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented button { border: 0; background: none; min-height: 32px; padding: 0 16px; border-radius: var(--r-round); font-weight: 500; color: var(--text-regular); cursor: pointer; transition: background-color 300ms ease-in-out, color 300ms ease-in-out; }
.segmented button:hover { color: var(--brand); }
.segmented button.is-active { background: var(--brand); color: #fff; }
.segmented button:disabled { opacity: .5; cursor: not-allowed; }

/* Hinweis-Banner */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-cell); line-height: 1.5; }
.banner svg { flex: 0 0 auto; margin-top: 1px; }
.banner-info { background: var(--brand-l9); color: var(--brand); }
.banner-ok { background: var(--ok-bg); color: var(--ok-text); }
.banner-warn { background: var(--warn-bg); color: var(--warn-text); }
.banner-err { background: var(--err-bg); color: var(--err-text); }
.banner b { font-weight: 700; }
.banner-body { flex: 1; min-width: 0; }
.banner-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

details.more { border-top: 1px solid var(--divider); padding-top: 12px; }
details.more summary { cursor: pointer; color: var(--brand); font-weight: 500; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: '›'; display: inline-block; transition: transform 150ms ease; font-size: 16px; }
details.more[open] summary::before { transform: rotate(90deg); }
details.more > .form { margin-top: 14px; }

ol.howto { padding-left: 20px; display: flex; flex-direction: column; gap: 4px; line-height: 1.5; }

/* ---------------------------------------------------------------------
   Assistent
   --------------------------------------------------------------------- */
.wizard { max-width: 720px; margin: 0 auto; }
.stepper { display: flex; gap: 8px; margin-bottom: 28px; list-style: none; }
.stepper li { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.stepper li::before { content: ''; height: 4px; border-radius: 2px; background: var(--divider); }
.stepper li.is-done::before, .stepper li.is-current::before { background: var(--brand); }
.stepper li.is-current { color: var(--brand); font-weight: 700; }
.stepper .step-no { text-transform: uppercase; }
.wizard-title { font-size: 22px; font-weight: 700; color: var(--brand); }
.wizard-lead { color: var(--text-regular); margin: 6px 0 22px; line-height: 1.55; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--divider); }

.summary { display: flex; flex-direction: column; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.summary-row:last-child { border-bottom: 0; }
.summary-row .k { font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--brand); }
.summary-row .v { text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------------
   Detail
   --------------------------------------------------------------------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); background: none; border: 0; cursor: pointer; font-weight: 500; margin-bottom: 14px; padding: 4px 0; }
.tabs { margin-bottom: 22px; }

.health { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--r-card); margin-bottom: 16px; }
.health-icon { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.7); }
.health-title { font-size: 16px; font-weight: 700; }
.health-text { margin-top: 3px; line-height: 1.45; }
.health-ok { background: var(--ok-bg); color: var(--ok-text); }
.health-warn { background: var(--warn-bg); color: var(--warn-text); }
.health-err { background: var(--err-bg); color: var(--err-text); }
.health-idle { background: var(--fill); color: var(--text-regular); }
.health-run { background: var(--brand-l9); color: var(--brand); }

.counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.counts > div { padding: 4px 16px; border-left: 1px solid var(--divider); }
.counts > div:first-child { border-left: 0; padding-left: 0; }
.counts .stat-value { font-size: 22px; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.feed-item:last-child { border-bottom: 0; }
.feed-dot { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-l9); color: var(--brand); }
.feed-dot.ok { background: var(--ok-bg); color: var(--ok-text); }
.feed-dot.err { background: var(--err-bg); color: var(--err-text); }
.feed-dot.warn { background: var(--warn-bg); color: var(--warn-text); }
.feed-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.feed-sub { color: var(--text-secondary); font-size: 12px; margin-top: 2px; }
.feed-time { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }

.run { border: 1px solid var(--border); border-radius: var(--r-cell); background: var(--surface); }
.run + .run { margin-top: 8px; }
.run-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; width: 100%; background: none; border: 0; cursor: pointer; text-align: left; border-radius: var(--r-cell); }
.run-head:hover { background: var(--fill-light); }
.run-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.run-body { border-top: 1px solid var(--divider); padding: 12px 14px; }
.log { display: grid; grid-template-columns: 70px 74px minmax(0, 1fr); gap: 10px; padding: 6px 0; font-size: 13px; border-bottom: 1px solid #f3f3f4; line-height: 1.45; }
.log:last-child { border-bottom: 0; }
.log-time { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.log-msg { overflow-wrap: anywhere; }
.log.err .log-msg { color: var(--err-text); }
.log.warn .log-msg { color: var(--warn-text); }

.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.settings-section { scroll-margin-top: 20px; }

.map-row { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 40px; gap: 8px; align-items: center; }
.map-row + .map-row { margin-top: 8px; }
.map-arrow { color: var(--brand-l5); text-align: center; }

.search-results { border: 1px solid var(--border); border-radius: var(--r-container); max-height: 240px; overflow: auto; background: var(--surface); box-shadow: var(--shadow-float); }
.search-results button { display: block; width: 100%; text-align: left; padding: 9px 14px; border: 0; background: none; cursor: pointer; }
.search-results button:hover, .search-results button:focus { background: var(--brand-l9); }

.savebar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 20px; padding: 12px 12px 12px 20px;
  background: var(--brand); color: #fff;
  border-radius: var(--r-round);
  box-shadow: var(--shadow-float);
}
.savebar .btn-secondary { border-color: transparent; }
.savebar .btn-text { color: #fff; }
.savebar .btn-text:hover { background: rgba(255,255,255,.12); }

.danger-zone { border-color: #f1c4c4; }

/* Tabelle-freie Benutzerliste */
.user-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--divider); }
.user-row:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------------
   Dialog + Toast
   --------------------------------------------------------------------- */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(19, 60, 85, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--r-dialog); box-shadow: var(--shadow-content); padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog h2 { font-size: 18px; color: var(--brand); }
.dialog p { color: var(--text-regular); line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; flex-wrap: wrap; }

.toasts { position: fixed; right: 16px; bottom: 84px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-cell); background: var(--brand); color: #fff; box-shadow: var(--shadow-float); line-height: 1.45; animation: toast-in 200ms ease; }
.toast.err { background: var(--err-text); }
.toast.ok { background: var(--ok-text); }
.toast svg { flex: 0 0 auto; margin-top: 1px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--text-secondary); }

/* ---------------------------------------------------------------------
   Mobil (< 768 px): Sidebar als Overlay, Inhalt ohne Radius
   --------------------------------------------------------------------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .counts { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .counts > div:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 767px) {
  .app { display: block; }
  .sidebar {
    position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; height: auto;
    background: var(--brand);
    transform: translateX(-100%); transition: transform 300ms ease;
  }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-content); }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .content { border-radius: 0; box-shadow: none; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--brand); position: sticky; top: 0; z-index: 20; }
  .mobile-bar img { height: 24px; }
  .mobile-bar button { background: none; border: 0; color: #fff; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-round); cursor: pointer; }
  .page { padding: 20px 16px 96px; }
  .grid-3, .grid-2, .field-row { grid-template-columns: minmax(0, 1fr); }
  .conn { grid-template-columns: auto minmax(0, 1fr); }
  .conn-side { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
  .map-row { grid-template-columns: minmax(0, 1fr) 40px; }
  .map-row .map-arrow { display: none; }
  .log { grid-template-columns: 60px minmax(0, 1fr); }
  .log .log-entity { display: none; }
  .savebar { border-radius: var(--r-card); flex-wrap: wrap; }
}
@media (pointer: coarse) {
  .btn, .nav-item, .segmented button { min-height: 44px; }
}

/* =====================================================================
   Bewegung — dezent, kurz, nur bei echten Zustandswechseln.
   Eingangsanimationen hängen an .page.enter, das nur bei Navigation
   gesetzt wird (nicht beim automatischen Aktualisieren alle 10 s).
   prefers-reduced-motion (oben) schaltet alles ab.
   ===================================================================== */
:root { --ease-out: cubic-bezier(.2, .7, .2, 1); }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes scale-in { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

/* Seitenwechsel: Blöcke erscheinen leicht gestaffelt */
.page.enter > * { animation: fade-up 320ms var(--ease-out) both; }
.page.enter > *:nth-child(2) { animation-delay: 30ms; }
.page.enter > *:nth-child(3) { animation-delay: 60ms; }
.page.enter > *:nth-child(4) { animation-delay: 90ms; }
.page.enter > *:nth-child(5) { animation-delay: 120ms; }
.page.enter > *:nth-child(n+6) { animation-delay: 150ms; }
.page.enter .conn-list > .conn,
.page.enter .grid > .card,
.page.enter .option-list > .option { animation: fade-up 340ms var(--ease-out) both; }
.page.enter .conn-list > .conn:nth-child(2), .page.enter .grid > .card:nth-child(2), .page.enter .option-list > .option:nth-child(2) { animation-delay: 60ms; }
.page.enter .conn-list > .conn:nth-child(3), .page.enter .grid > .card:nth-child(3), .page.enter .option-list > .option:nth-child(3) { animation-delay: 100ms; }
.page.enter .conn-list > .conn:nth-child(4), .page.enter .option-list > .option:nth-child(4) { animation-delay: 140ms; }
.page.enter .conn-list > .conn:nth-child(n+5), .page.enter .option-list > .option:nth-child(n+5) { animation-delay: 170ms; }

/* Tabwechsel: nur der Inhalt unter den Tabs */
.page.enter-tab > .tabs ~ * { animation: fade-up 260ms var(--ease-out) both; }
.page.enter-tab > .tabs ~ * + * { animation-delay: 40ms; }

/* Fortschrittsbalken im Assistenten füllt sich */
.stepper li::before { transform-origin: left center; }
.page.enter .stepper li.is-current::before { animation: grow-x 450ms var(--ease-out) both; }

/* Aktionen geben Rückmeldung */
.btn { transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 150ms ease; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(19, 60, 85, .22); }
.conn { transition: border-color 150ms ease, box-shadow 200ms ease, transform 200ms var(--ease-out); }
.conn:hover { transform: translateY(-1px); }
.conn:active { transform: translateY(0); }
.option { transition: border-color 150ms ease, background-color 200ms ease; }
.nav-item svg, .back svg { transition: transform 200ms var(--ease-out); }
.back:hover svg { transform: translateX(-3px); }
.btn:hover:not(:disabled) > svg:last-child:not(:first-child) { transform: translateX(2px); }
.btn > svg { transition: transform 200ms var(--ease-out); }

/* Laufender Abgleich dreht sich, Echtzeit „atmet“ */
.health-run .health-icon svg, .pill-running svg { animation: spin 1.6s linear infinite; }
.pill-live svg { animation: live-pulse 2.4s ease-in-out infinite; }

/* Verlauf: aufgeklappter Lauf */
.run-body-in { animation: fade-in 220ms ease both; }
.run-head svg { transition: transform 200ms var(--ease-out); }

/* Speicherleiste fährt ein, wenn die erste Änderung passiert */
.savebar-in { animation: slide-up 280ms var(--ease-out) both; }

/* Dialoge und Toasts */
.dialog-backdrop { animation: fade-in 160ms ease both; }
.dialog { animation: scale-in 220ms var(--ease-out) both; }
.toast.out { animation: toast-out 220ms ease forwards; }

/* Gesundheits-Banner wechselt die Farbe weich */
.health { transition: background-color 300ms ease, color 300ms ease; }
