/* ==========================================================================
   AsasHub Design-System
   Dunkles Interface, System-Schrift, Linien-Icons, ruhige Flächen mit feinen Rändern.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  --bg: #07090f;
  --bg-2: #0b0f17;
  --surface: #10151f;
  --surface-2: #161c29;
  --surface-3: #1d2535;

  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);

  --text: #eef1f6;
  --text-2: #a5afc2;
  --text-3: #707b90;

  --brand: #6d8dff;
  --brand-soft: #9db4ff;
  --brand-grad: linear-gradient(135deg, #5b83ff 0%, #8b5cf6 100%);

  --ok: #3ddc97;
  --warn: #f5b942;
  --danger: #ff6b6b;

  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.035) inset, 0 12px 32px -16px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 30px 80px -30px rgba(0, 0, 0, 0.85);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --page: 1040px;
}

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Weiches Licht im Hintergrund */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 50% -12%, rgba(91, 131, 255, 0.17), transparent 62%),
    radial-gradient(560px 380px at 105% 4%, rgba(139, 92, 246, 0.11), transparent 60%),
    radial-gradient(500px 360px at -8% 30%, rgba(61, 220, 151, 0.04), transparent 60%);
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }

a { color: inherit; }
button, input { font: inherit; color: inherit; }
::selection { background: rgba(109, 141, 255, 0.35); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

[hidden], .hidden { display: none !important; }

.icon { width: 20px; height: 20px; flex: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  --h: 42px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: 600 15px/1 var(--font);
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease), background-color 0.15s, border-color 0.15s, box-shadow 0.15s, filter 0.15s, color 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 10px 26px -10px rgba(99, 102, 241, 0.8);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost { color: var(--text-2); background: transparent; }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.btn-danger { color: var(--danger); background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.26); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.17); }
.btn-danger-solid { color: #fff; background: #e5484d; }
.btn-danger-solid:hover { filter: brightness(1.1); }

.btn-sm { --h: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { --h: 52px; padding: 0 22px; font-size: 16px; border-radius: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h); padding: 0; }

/* Ladezustand: Text/Icons ausblenden, Spinner zeigen */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.link-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px; margin: -6px -8px;
  background: none; border: 0; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.link-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 8px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px; /* mind. 16px, sonst zoomt iOS beim Fokus */
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: rgba(255, 255, 255, 0.2); }
.input:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(109, 141, 255, 0.18); }
.input-mono { font-family: var(--mono); font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.input-mono::placeholder { text-transform: none; letter-spacing: 0.02em; }

.input-wrap { position: relative; }
.input-wrap > .icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.input-wrap > .input { padding-left: 44px; }

/* Segmented Control (statt Dropdown) */
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 14px;
}
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line-2);
}
.segmented input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Chips, Avatare ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-size: 12px; font-weight: 600; letter-spacing: 0;
  white-space: nowrap;
}
.chip .icon { width: 12px; height: 12px; }
.chip-brand { background: rgba(109, 141, 255, 0.15); color: var(--brand-soft); }
.chip-ok { background: rgba(61, 220, 151, 0.12); color: var(--ok); }
.chip-warn { background: rgba(245, 185, 66, 0.13); color: var(--warn); }
.chip-danger { background: rgba(255, 107, 107, 0.13); color: var(--danger); }

.avatar {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  background: var(--brand-grad);
  color: #fff;
  font-size: 13px; font-weight: 650; letter-spacing: 0.01em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top);
  background: rgba(7, 9, 15, 0.72);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: var(--page); height: 60px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 650; font-size: 16px; letter-spacing: -0.02em; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: var(--brand-grad); color: #fff;
  box-shadow: 0 6px 16px -6px rgba(99, 102, 241, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.brand-mark .icon { width: 18px; height: 18px; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; transition: transform 0.12s var(--ease), box-shadow 0.15s; }
.avatar-btn:hover { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08); }
.avatar-btn:active { transform: scale(0.94); }

/* ---------- Seitenlayout ---------- */
.page { max-width: var(--page); margin: 0 auto; padding: 32px 20px 72px; display: grid; gap: 28px; }

.page-head { display: grid; gap: 8px; }
.page-title { font-size: 30px; line-height: 1.12; letter-spacing: -0.03em; }
.page-sub { color: var(--text-2); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; width: fit-content; color: var(--text-2); font-size: 14px; font-weight: 500; text-decoration: none; margin-bottom: 6px; }
.back-link:hover { color: var(--text); }

.section-label { margin-bottom: 12px; color: var(--text-3); font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 20px 16px; }
.card-title { font-size: 17px; }
.card-desc { margin-top: 3px; color: var(--text-2); font-size: 14px; }
.card-pad { padding: 20px; }
.card-body { padding: 0 20px 20px; display: grid; gap: 16px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Kacheln (Apps) ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 16px; min-height: 142px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.18s var(--ease), border-color 0.18s, background-color 0.18s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--line-2); background: var(--surface-2); }
.tile:active { transform: scale(0.97); }
.tile-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 20px -8px var(--tone-glow, rgba(99, 102, 241, 0.7));
  background: var(--tone, var(--brand-grad));
}
.tone-blue { --tone: linear-gradient(135deg, #4f8bff, #6366f1); --tone-glow: rgba(79, 139, 255, 0.8); }
.tone-emerald { --tone: linear-gradient(135deg, #2dd4a0, #14b8a6); --tone-glow: rgba(45, 212, 160, 0.7); }
.tone-violet { --tone: linear-gradient(135deg, #a78bfa, #8b5cf6); --tone-glow: rgba(139, 92, 246, 0.8); }
.tone-amber { --tone: linear-gradient(135deg, #fbbf24, #f59e0b); --tone-glow: rgba(245, 158, 11, 0.7); }
.tile-body { display: grid; gap: 3px; }
.tile-title { font-size: 16px; font-weight: 650; letter-spacing: -0.015em; }
.tile-desc { color: var(--text-2); font-size: 13px; line-height: 1.4; }
.tile-arrow { position: absolute; top: 16px; right: 16px; color: var(--text-3); transition: color 0.18s, transform 0.18s var(--ease); }
.tile:hover .tile-arrow { color: var(--brand-soft); transform: translate(2px, -2px); }

/* ---------- Listenzeilen ---------- */
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
a.row, button.row { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; text-decoration: none; cursor: pointer; transition: background-color 0.15s; }
a.row:hover, button.row:hover { background: rgba(255, 255, 255, 0.03); }
.row-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
}
.row-icon.ok { color: var(--ok); background: rgba(61, 220, 151, 0.1); border-color: rgba(61, 220, 151, 0.2); }
.row-icon.warn { color: var(--warn); background: rgba(245, 185, 66, 0.1); border-color: rgba(245, 185, 66, 0.22); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.row-meta { margin-top: 2px; color: var(--text-3); font-size: 13px; }
.row-end { display: flex; align-items: center; gap: 6px; flex: none; }

/* ---------- Sicherheitsstatus (Dashboard) ---------- */
.status-head { display: flex; align-items: center; gap: 14px; padding: 18px 20px; }
.status-head .row-icon { width: 44px; height: 44px; border-radius: 13px; }

/* ---------- Tabs / Seitenleiste (Einstellungen) ---------- */
.settings-layout { display: grid; gap: 20px; }
.side-nav { display: flex; gap: 6px; margin: 0 -20px; padding: 0 20px 2px; overflow-x: auto; scrollbar-width: none; }
.side-nav::-webkit-scrollbar { display: none; }
.nav-item {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  height: 40px; padding: 0 14px;
  background: none; border: 1px solid transparent; border-radius: 12px;
  color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.nav-item[aria-selected="true"] { color: var(--text); background: var(--surface-2); border-color: var(--line-2); }
.nav-item[aria-selected="true"] .icon { color: var(--brand); }
.tab-panel { display: grid; gap: 16px; align-content: start; min-width: 0; }

/* ---------- Banner, Hinweise ---------- */
.banner { display: flex; gap: 12px; padding: 13px 15px; border: 1px solid; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.banner .icon { margin-top: 1px; }
.banner-warn { color: #f7d489; background: rgba(245, 185, 66, 0.08); border-color: rgba(245, 185, 66, 0.24); }
.banner-info { color: #b9c8ff; background: rgba(109, 141, 255, 0.09); border-color: rgba(109, 141, 255, 0.24); }

/* Geheimnisse, die nur einmal angezeigt werden (Einladungslink, Notfall-Schlüssel) */
.reveal { padding: 1px; border-radius: 19px; background: linear-gradient(135deg, rgba(91, 131, 255, 0.65), rgba(139, 92, 246, 0.38) 55%, rgba(255, 255, 255, 0.07)); }
.reveal-inner { display: grid; gap: 14px; padding: 18px; background: var(--surface); border-radius: 18px; }
.reveal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reveal-title { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.reveal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secret-link {
  padding: 12px 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  color: #cfd8ff; font: 13px/1.5 var(--mono); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.key-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.key {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  font: 14px/1.4 var(--mono); letter-spacing: 0.04em; user-select: all; -webkit-user-select: all;
}
.key-n { color: var(--text-3); font-size: 11px; user-select: none; -webkit-user-select: none; }

.invite-form { display: grid; gap: 16px; }

/* ---------- Leere Zustände, Skeleton ---------- */
.empty { display: grid; justify-items: center; gap: 6px; padding: 36px 20px; text-align: center; color: var(--text-3); font-size: 14px; }
.empty .icon { width: 28px; height: 28px; margin-bottom: 4px; opacity: 0.75; }
.empty strong { color: var(--text-2); font-weight: 600; }

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.09) 37%, rgba(255, 255, 255, 0.04) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.sk-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: 0; }
.sk-icon { width: 40px; height: 40px; border-radius: 12px; flex: none; }
.sk-lines { flex: 1; display: grid; gap: 8px; }
.sk-line { height: 12px; width: 55%; }
.sk-line.short { height: 10px; width: 35%; }

/* ---------- Auth-Seiten ---------- */
.auth-shell {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}
.auth-card {
  width: min(404px, 100%); display: grid; gap: 24px; padding: 34px 28px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012)), var(--surface);
  border: 1px solid var(--line-2); border-radius: 26px; box-shadow: var(--shadow-lg);
}
.logo-mark {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; color: #fff;
  background: var(--brand-grad);
  box-shadow: 0 14px 34px -10px rgba(99, 102, 241, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}
.logo-mark .icon { width: 30px; height: 30px; }
.auth-head { display: grid; justify-items: center; gap: 10px; text-align: center; }
.auth-head .logo-mark { margin-bottom: 8px; }
.auth-title { font-size: 25px; letter-spacing: -0.03em; }
.auth-sub { max-width: 32ch; color: var(--text-2); font-size: 14.5px; line-height: 1.5; }
.auth-actions { display: grid; gap: 12px; }
.auth-form { display: grid; gap: 16px; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--text-3); font-size: 12.5px; }
.auth-foot .icon { width: 14px; height: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.hint-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.hint-list li { display: flex; align-items: flex-start; gap: 12px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.hint-list .icon { margin-top: 1px; color: var(--brand-soft); }

/* ---------- Overlays: Menü, Dialog, Toasts ---------- */
.menu {
  position: fixed; z-index: 80; min-width: 212px; max-width: min(320px, calc(100vw - 24px)); padding: 6px;
  background: rgba(22, 28, 41, 0.97);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.75);
  transform-origin: var(--origin, top right);
  animation: pop 0.14s var(--ease);
}
.menu-label { padding: 8px 10px 6px; color: var(--text-3); font-size: 12px; }
.menu-label strong { display: block; color: var(--text); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  background: none; border: 0; border-radius: 9px;
  color: var(--text); font-size: 14px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item .icon { width: 17px; height: 17px; color: var(--text-2); }
.menu-item:hover, .menu-item:focus-visible { background: rgba(255, 255, 255, 0.07); outline: 0; }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item.danger:hover { background: rgba(255, 107, 107, 0.12); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }

dialog.dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: dialog-in 0.22s var(--ease);
}
dialog.dialog::backdrop { background: rgba(3, 5, 10, 0.66); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade 0.2s ease; }
.dialog-body { display: grid; gap: 10px; padding: 24px 24px 6px; }
.dialog-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 13px; color: var(--brand-soft); background: rgba(109, 141, 255, 0.14); }
.dialog-icon.danger { color: var(--danger); background: rgba(255, 107, 107, 0.13); }
.dialog-title { font-size: 19px; letter-spacing: -0.02em; }
.dialog-text { color: var(--text-2); font-size: 14.5px; line-height: 1.5; overflow-wrap: anywhere; }
.dialog-body .field { margin-top: 8px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px 24px; }
.dialog-actions .btn { min-width: 104px; }

.toasts {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 100;
  display: grid; gap: 10px; width: min(420px, calc(100vw - 24px)); transform: translateX(-50%); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 15px; pointer-events: auto; cursor: pointer;
  background: rgba(24, 31, 46, 0.97);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, 0.75);
  font-size: 14px; line-height: 1.45;
  animation: toast-in 0.28s var(--ease);
}
.toast .icon { margin-top: 1px; }
.toast-ok .icon { color: var(--ok); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--brand-soft); }
.toast.leaving { animation: toast-out 0.2s ease forwards; }


/* ---------- Aufklappbare, ruhige Karte (Sicherheit) ---------- */
.card-quiet { background: rgba(255, 255, 255, 0.025); box-shadow: none; overflow: hidden; }
.collapse-head {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 16px;
  background: none; border: 0; color: inherit; text-align: left; cursor: pointer;
  transition: background-color 0.15s;
}
.collapse-head:hover { background: rgba(255, 255, 255, 0.03); }
.collapse-head .row-icon { width: 34px; height: 34px; border-radius: 10px; }
.collapse-head .row-icon .icon { width: 17px; height: 17px; }
.collapse-head .row-title { font-size: 14.5px; color: var(--text-2); }
.collapse-head .chevron { color: var(--text-3); transition: transform 0.2s var(--ease); }
.collapse-head[aria-expanded="true"] .chevron { transform: rotate(180deg); }

/* ---------- Sprachumschalter (Seiten ohne Anmeldung) ---------- */
.lang-switch {
  position: fixed; z-index: 40; top: max(14px, env(safe-area-inset-top)); right: 16px;
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: color 0.15s, background-color 0.15s;
}
.lang-switch:hover { color: var(--text); background: rgba(255, 255, 255, 0.09); }

/* ---------- Animationen ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.97); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.rise { animation: rise 0.45s var(--ease) both; }
.rise:nth-child(2) { animation-delay: 0.05s; }
.rise:nth-child(3) { animation-delay: 0.1s; }
.rise:nth-child(4) { animation-delay: 0.15s; }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .key-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invite-form { grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; }
}

@media (min-width: 860px) {
  .page { padding-top: 40px; }
  .settings-layout { grid-template-columns: 224px minmax(0, 1fr); gap: 36px; align-items: start; }
  .side-nav { position: sticky; top: 92px; flex-direction: column; margin: 0; padding: 0; overflow: visible; }
  .nav-item { width: 100%; height: 42px; }
}

@media (max-width: 719px) {
  .invite-form .btn { width: 100%; }
  .invite-form .segmented { width: 100%; }
}

@media (max-width: 560px) {
  .key-grid { grid-template-columns: 1fr; }
  .page { padding: 22px 16px 64px; gap: 24px; }
  .header-inner { padding: 0 16px; }
  .page-title { font-size: 26px; }
  .card-head { padding: 18px 16px 14px; }
  .card-pad, .status-head { padding: 16px; }
  .card-body { padding: 0 16px 16px; }
  .row, .sk-row { padding: 13px 16px; gap: 12px; }
  .side-nav { margin: 0 -16px; padding: 0 16px 2px; }
  .auth-card { padding: 30px 22px 24px; border-radius: 24px; }

  /* Dialoge werden zu Bottom Sheets */
  dialog.dialog {
    width: 100%; max-width: none; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom); animation: sheet-in 0.28s var(--ease);
  }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}

/* ---------- Drucken (Notfall-Schlüssel) ---------- */
.print-only { display: none; }

@media print {
  body { background: #fff; color: #000; }
  body::before { display: none; }
  .app-header, .side-nav, .page-head, .no-print, .lang-switch, .toasts, .menu, dialog, .banner { display: none !important; }
  .page, .settings-layout { display: block; padding: 0; max-width: none; }
  .tab-panel[hidden] { display: none !important; }
  .print-only { display: block !important; margin-bottom: 18px; color: #000; }
  .print-only h2 { font-size: 20px; margin-bottom: 4px; }
  .print-only p { font-size: 12px; color: #333; }
  .reveal { background: none; padding: 0; }
  .reveal-inner { background: none; padding: 0; }
  .key { background: #fff; color: #000; border: 1px solid #000; font-size: 14px; }
  .key-n { color: #555; }
  .card { background: none; border: 0; box-shadow: none; }
}

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