/* ============================================================
   Vertexx Hub — Design-System (1:1 aus dem Klick-Prototyp uebernommen)
   Fonts werden self-hosted via fonts.css geladen (keine CDN).
   ============================================================ */
/* ============================================================
   Vertexx Hub — Design System
   Richtung: Modern minimal (Linear/Vercel). Ruhig, präzise,
   vertrauenswürdig. Ein Blau-Akzent. Light + Dark.
   ============================================================ */

:root {
  /* Light theme (default) */
  --bg:        oklch(98.5% 0.003 250);
  --surface:   oklch(100% 0 0);
  --surface-2: oklch(97% 0.004 250);
  --fg:        oklch(20% 0.012 260);
  --muted:     oklch(52% 0.014 260);
  --faint:     oklch(60% 0.013 260);
  --border:    oklch(91% 0.006 260);
  --border-2:  oklch(86% 0.008 260);

  --accent:      oklch(56% 0.15 256);
  --accent-fg:   oklch(99% 0.01 256);
  --accent-soft: oklch(95% 0.03 256);
  --accent-line: oklch(80% 0.08 256);

  --success:  oklch(58% 0.13 155);
  --success-soft: oklch(95% 0.04 155);
  --warn:     oklch(70% 0.14 70);
  --warn-soft: oklch(96% 0.05 75);
  --danger:   oklch(58% 0.19 25);

  --shadow-sm: 0 1px 2px oklch(30% 0.02 260 / 0.06), 0 1px 1px oklch(30% 0.02 260 / 0.04);
  --shadow-md: 0 4px 14px oklch(30% 0.02 260 / 0.08), 0 2px 4px oklch(30% 0.02 260 / 0.05);
  --shadow-lg: 0 18px 50px oklch(28% 0.03 260 / 0.16), 0 6px 16px oklch(28% 0.03 260 / 0.08);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --sidebar-w: 264px;
  --maxw: 1160px;
}

[data-theme="dark"] {
  --bg:        oklch(16% 0.012 260);
  --surface:   oklch(20% 0.014 260);
  --surface-2: oklch(23.5% 0.015 260);
  --fg:        oklch(95% 0.006 260);
  --muted:     oklch(70% 0.014 260);
  --faint:     oklch(62% 0.014 260);
  --border:    oklch(30% 0.014 260);
  --border-2:  oklch(36% 0.016 260);

  --accent:      oklch(68% 0.15 256);
  --accent-fg:   oklch(16% 0.02 256);
  --accent-soft: oklch(30% 0.06 256);
  --accent-line: oklch(45% 0.09 256);

  --success:  oklch(70% 0.14 158);
  --success-soft: oklch(30% 0.05 158);
  --warn:     oklch(78% 0.13 75);
  --warn-soft: oklch(32% 0.06 75);
  --danger:   oklch(66% 0.17 25);

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / 0.3);
  --shadow-md: 0 6px 18px oklch(0% 0 0 / 0.36);
  --shadow-lg: 0 24px 60px oklch(0% 0 0 / 0.5);
}

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

/* A11y: sichtbarer Fokus-Ring bei Tastaturnavigation (zero-specificity via :where) */
:where(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tile:focus-visible { outline-offset: 3px; }
:focus:not(:focus-visible) { outline: none; }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .3s ease, color .3s ease;
}

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 640; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; letter-spacing: -0.01em; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--fg);
  font-size: 14px; font-weight: 550; letter-spacing: 0.01em;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; }
.btn-danger { color: var(--danger); border-color: var(--border-2); }
.btn-danger:hover { background: color-mix(in oklab, var(--danger) 8%, transparent); border-color: var(--danger); }
/* Ergebnis-Zustände für den „API testen"-Button */
.btn.ok  { background: var(--success); border-color: var(--success); color: #fff; }
.btn.ok:hover  { filter: brightness(1.05); border-color: var(--success); }
.btn.bad { color: var(--danger); border-color: var(--danger); background: color-mix(in oklab, var(--danger) 8%, transparent); }

/* ---------- Badges / pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 560; letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.pill svg { width: 13px; height: 13px; }
.pill-ok   { background: var(--success-soft); color: var(--success); }
.pill-lock { background: var(--surface-2); color: var(--faint); border-color: var(--border); }
.pill-warn { background: var(--warn-soft); color: color-mix(in oklab, var(--warn) 70%, var(--fg)); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-soft { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 13px; font-weight: 550; color: var(--fg); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input {
  height: 44px; padding: 0 13px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--faint); }
.input-group { position: relative; }
.input-group .adorn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: inline-flex; gap: 4px;
}

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--border-2); transition: background .18s;
}
.switch .track::before {
  content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: var(--shadow-sm);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============================================================
   App shell
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(150deg, var(--accent), color-mix(in oklab, var(--accent) 55%, oklch(60% 0.18 300)));
  display: grid; place-items: center; color: #fff;
  box-shadow: var(--shadow-sm);
}
.brand .logo svg { width: 19px; height: 19px; }
.brand .name { font-family: var(--font-display); font-weight: 680; font-size: 16px; letter-spacing: -0.02em; }
.brand .name small { display: block; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav .nav-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-sm);
  color: var(--muted); font-size: 14px; font-weight: 530;
  transition: background .14s, color .14s;
}
.nav a svg { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: var(--surface-2); color: var(--fg); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a.active svg { opacity: 1; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.usercard {
  display: flex; align-items: center; gap: 10px;
  padding: 9px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface-2);
}
.usercard .meta { min-width: 0; }
.usercard .meta .n { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usercard .meta .r { font-size: 11.5px; color: var(--muted); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 650; color: #fff;
  font-family: var(--font-display);
}

/* ---------- Main / topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 40;
}
.topbar .brand { padding: 0; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg { width: 19px; height: 19px; }

.content { padding: 40px clamp(20px, 4vw, 52px) 80px; width: 100%; max-width: var(--maxw); margin: 0 auto; }
.page-head { margin-bottom: 30px; }
.page-head .greet { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 60ch; }

/* ============================================================
   Login
   ============================================================ */
.auth {
  position: relative; min-height: 100vh; overflow: hidden;
  display: grid; place-items: center; padding: 40px 20px;
  color: oklch(93% 0.006 260);
  /* Dunkler Graphit-Canvas — modern, technologisch, nicht kalt */
  background:
    radial-gradient(80% 55% at 50% -6%, oklch(27% 0.03 250), transparent 62%),
    oklch(15% 0.008 265);
  --accent: oklch(70% 0.14 235);       /* modernes Azure */
  --accent-fg: oklch(15% 0.03 235);
}
/* weicher Akzent-Aura hinter der Karte */
.auth-aura {
  position: absolute; z-index: 0; pointer-events: none;
  width: min(760px, 96vw); aspect-ratio: 1.5/1; left: 50%; top: 42%; transform: translate(-50%,-50%);
  background:
    radial-gradient(closest-side, oklch(60% 0.18 250 / 0.24), transparent 72%),
    radial-gradient(closest-side, oklch(66% 0.15 190 / 0.14), transparent 70%);
  filter: blur(12px); animation: auraPulse 10s ease-in-out infinite;
}
@keyframes auraPulse { 0%,100% { opacity: .85; transform: translate(-50%,-50%) scale(1); } 50% { opacity: 1; transform: translate(-50%,-50%) scale(1.06); } }
/* feiner Grain für Tiefe */
.auth::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}
.auth-stage {
  position: relative; z-index: 1; width: 100%; max-width: 420px;
  display: flex; flex-direction: column; align-items: stretch;
  animation: routeIn .45s cubic-bezier(.2,.7,.3,1) both;
}
.auth-card {
  position: relative;
  background: linear-gradient(180deg, oklch(23% 0.012 265), oklch(20% 0.01 265));
  border: 1px solid oklch(100% 0 0 / 0.09);
  border-radius: 20px; padding: 30px 30px 28px;
  box-shadow: 0 30px 70px oklch(0% 0 0 / 0.5), inset 0 1px 0 oklch(100% 0 0 / 0.06);
}
.hub-mark { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 640; font-size: 15px; letter-spacing: -0.01em; color: oklch(94% 0.008 260); }
.hub-mark .logo { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 6px 18px oklch(60% 0.16 250 / 0.45); }
.hub-mark .logo svg { width: 17px; height: 17px; }
.auth-kicker { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase; color: oklch(72% 0.1 235); margin-top: 22px; }
.auth-h1 { font-family: var(--font-display); font-weight: 640; font-size: 1.7rem; letter-spacing: -0.02em; color: #fff; margin-top: 8px; }
.auth-sub { color: oklch(72% 0.012 260); font-size: 14px; line-height: 1.5; margin-top: 6px; margin-bottom: 22px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; margin-bottom: 18px; align-self: flex-start; }
.back-link svg { width: 15px; height: 15px; }
.auth-foot { text-align: center; margin-top: 20px; padding-top: 18px; border-top: 1px solid oklch(100% 0 0 / 0.07); font-size: 13px; color: oklch(72% 0.012 260); }
.auth-note { align-self: center; margin-top: 18px; font-size: 12px; color: oklch(62% 0.012 260); display: inline-flex; align-items: center; gap: 7px; }
.auth-note svg { width: 13px; height: 13px; opacity: .8; }
/* Fehlermeldung im Login (echte Server-Fehler statt Fake-Login) */
.auth-error {
  display: flex; align-items: center; gap: 8px; margin-top: 2px;
  background: oklch(32% 0.1 25 / 0.4); border: 1px solid oklch(60% 0.16 25 / 0.5);
  color: oklch(90% 0.05 25); border-radius: 10px; padding: 10px 13px; font-size: 13px; line-height: 1.4;
}
.auth-error[hidden] { display: none; }

/* Community-Leiste — „wer ist schon dabei" (skaliert: N Avatare + Zähler) */
.community { display: flex; align-items: center; gap: 12px; margin: 4px 0 22px; padding: 11px 13px; background: oklch(100% 0 0 / 0.035); border: 1px solid oklch(100% 0 0 / 0.07); border-radius: 12px; }
.avatar-stack { display: flex; flex: none; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px oklch(22% 0.012 265); }
.avatar-stack .avatar:not(:first-child) { margin-left: -10px; }
.avatar-stack .avatar.more { background: oklch(100% 0 0 / 0.12); color: oklch(86% 0.01 260); font-size: 11px; font-weight: 600; }
.community-text { font-size: 12.5px; line-height: 1.4; color: oklch(70% 0.012 260); }
.community-text b { color: oklch(93% 0.008 260); font-weight: 600; }

/* Formfelder & Buttons auf dunkler Karte */
.auth .field label { color: oklch(88% 0.01 260); font-size: 13px; }
.auth .row-between .link { font-size: 13px; font-weight: 550; }
.auth .input { background: oklch(100% 0 0 / 0.05); border-color: oklch(100% 0 0 / 0.14); color: #fff; height: 46px; }
.auth .input::placeholder { color: oklch(70% 0.01 260 / .5); }
.auth .input:focus { border-color: var(--accent); background: oklch(100% 0 0 / 0.08); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.auth .link { color: oklch(74% 0.11 235); font-weight: 550; }
.auth .link:hover { color: oklch(82% 0.12 235); }
/* „Vergessen?" & „Einladung annehmen" — exakt wie der Text daneben, keine Akzentfarbe */
.auth .row-between [data-forgot] { color: oklch(88% 0.01 260); font-weight: 550; }  /* identisch zum „Passwort"-Label */
.auth .auth-foot [data-onboard] { color: oklch(72% 0.012 260); font-weight: 450; font-size: 13px; text-decoration: underline; }  /* wie „Neu dabei?", aber unterstrichen */
.auth [data-forgot]:hover, .auth [data-onboard]:hover { text-decoration: underline; }
.auth .btn-primary {
  background: linear-gradient(180deg, oklch(72% 0.14 238), oklch(65% 0.15 246));
  color: #fff; border-color: transparent; height: 46px; font-weight: 600;
  box-shadow: 0 10px 26px oklch(60% 0.16 245 / 0.42), inset 0 1px 0 oklch(100% 0 0 / 0.22);
}
.auth .btn-primary:hover { filter: brightness(1.06); }

/* Onboarding-Elemente auf dunkler Karte */
.auth .invite-summary { background: oklch(100% 0 0 / 0.04); border-color: oklch(100% 0 0 / 0.1); margin-bottom: 20px; }
.auth .invite-summary .who .n { color: oklch(94% 0.008 260); }
.auth .invite-summary .who .s { color: oklch(72% 0.012 260); }
.auth .pill-soft { background: oklch(100% 0 0 / 0.07); color: oklch(86% 0.01 260); border-color: oklch(100% 0 0 / 0.12); }
.auth .pw-rules { color: oklch(68% 0.012 260); }
.auth .consent { color: oklch(82% 0.01 260); }
.auth .consent strong { color: #fff; }
.auth .pw-meter { background: oklch(100% 0 0 / 0.12); }

/* (Login-/Onboarding-Formstile leben jetzt in der Stuben-Sektion oben) */
.auth-form .invite-note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.auth-form form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .row-between { display: flex; align-items: center; justify-content: space-between; }
.link { color: var(--accent); font-weight: 550; font-size: 13px; }
/* .link auch auf <button> „nackt" — kein grauer Button-Kasten */
button.link { appearance: none; -webkit-appearance: none; background: none; border: 0; padding: 0; margin: 0; line-height: inherit; }
.link:hover { text-decoration: underline; }
/* Schnell-Login: Personenliste (Name + Rolle + Admin-Marker, keine App-Nutzungsinfos) */
.demo-switch { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.demo-switch .eyebrow { margin-bottom: 12px; display: block; }
.demo-users { display: flex; flex-direction: column; gap: 7px; }
.demo-user {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 9px 11px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface);
  transition: border-color .14s, background .14s;
}
.demo-user:hover { border-color: var(--accent-line); background: var(--surface-2); }
.demo-user .meta { flex: 1; min-width: 0; }
.demo-user .meta .n { font-size: 13.5px; font-weight: 600; }
.demo-user .meta .r { font-size: 11.5px; color: var(--muted); }

/* ============================================================
   Dashboard — app tiles
   ============================================================ */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 34px 0 16px; gap: 12px; }
.section-head:first-of-type { margin-top: 8px; }
.section-head h2 { font-size: 15px; letter-spacing: 0.01em; font-weight: 620; }
.section-head .count { font-size: 12.5px; color: var(--faint); font-family: var(--font-mono); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 16px; }

.tile {
  position: relative; text-align: left;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; min-height: 178px;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color .16s, box-shadow .16s, transform .12s;
}
.tile.available { cursor: pointer; }
.tile.available:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.tile.available:hover .tile-go { color: var(--accent); gap: 9px; }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; }
.tile-ic {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: grid; place-items: center; color: #fff;
  box-shadow: var(--shadow-sm);
}
.tile-ic svg { width: 24px; height: 24px; }
.tile h3 { font-size: 16.5px; }
.tile .desc { font-size: 13px; color: var(--muted); line-height: 1.5; flex: 1; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.tile-go { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 560; color: var(--faint); transition: color .16s, gap .16s; }
.tile-go svg { width: 15px; height: 15px; }

.tile.locked { opacity: .72; }
.tile.locked .tile-ic { filter: grayscale(1); opacity: .5; background: var(--surface-2) !important; color: var(--faint) !important; box-shadow: none; border: 1px solid var(--border); }
.tile.locked h3 { color: var(--muted); }
.tile.android { border-style: dashed; }

.tile-flag {
  position: absolute; top: 14px; right: 14px;
}

/* empty / info strip */
.info-strip {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--muted); margin-top: 8px;
}
.info-strip svg { width: 18px; height: 18px; flex: none; color: var(--faint); margin-top: 1px; }

/* ============================================================
   Account
   ============================================================ */
.stack { display: flex; flex-direction: column; gap: 22px; max-width: 720px; }
.panel { padding: 24px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h3 { margin-bottom: 3px; }
.panel-head p { font-size: 13px; color: var(--muted); max-width: 46ch; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.divider { height: 1px; background: var(--border); margin: 22px 0; }

.security-note {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--success-soft);
  border: 1px solid color-mix(in oklab, var(--success) 35%, transparent);
  border-radius: var(--r-md); padding: 13px 15px; font-size: 13px;
  color: color-mix(in oklab, var(--success) 55%, var(--fg));
}
.security-note svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--success); }
.security-note strong { font-weight: 620; }

.key-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.key-row:last-child { border-bottom: 0; }
.key-ic { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); }
.key-ic svg { width: 20px; height: 20px; color: var(--muted); }
.key-meta { flex: 1; min-width: 0; }
.key-meta .n { font-size: 14px; font-weight: 600; }
.key-meta .v { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.key-meta .unset { color: var(--faint); font-family: var(--font-body); font-style: italic; }

/* ============================================================
   Admin
   ============================================================ */
.admin-users { display: flex; flex-direction: column; }
.admin-user-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.admin-user-row:last-child { border-bottom: 0; }
.admin-user-row .meta { flex: 1; min-width: 0; }
.admin-user-row .meta .n { font-size: 14.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.admin-user-row .meta .e { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }

/* matrix */
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
table.matrix { border-collapse: collapse; width: 100%; min-width: 620px; }
table.matrix th, table.matrix td { padding: 0; text-align: center; }
table.matrix thead th {
  position: sticky; top: 0; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 13px 10px; font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.01em;
}
table.matrix thead th .th-app { display: flex; flex-direction: column; align-items: center; gap: 6px; }
table.matrix thead th .th-ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: #fff; }
table.matrix thead th .th-ic svg { width: 15px; height: 15px; }
table.matrix thead th.usr { text-align: left; padding-left: 18px; min-width: 190px; }
table.matrix tbody td { border-bottom: 1px solid var(--border); padding: 12px 10px; }
table.matrix tbody tr:last-child td { border-bottom: 0; }
table.matrix tbody tr:hover td { background: var(--surface-2); }
table.matrix td.usr { text-align: left; padding-left: 18px; }
.mx-user { display: flex; align-items: center; gap: 11px; }
.mx-user .meta .n { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.mx-user .meta .r { font-size: 11px; color: var(--muted); }
.mx-cell { display: grid; place-items: center; }
.mx-admin-lock { color: var(--faint); }
.mx-admin-lock svg { width: 15px; height: 15px; }

/* ============================================================
   Modal / overlay
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: oklch(15% 0.02 260 / 0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal {
  width: 100%; max-width: 460px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: pop .22s cubic-bezier(.2,.7,.3,1); overflow: hidden;
}
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 22px 0; }
.modal-body { padding: 18px 22px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 22px 22px; }
.modal-close { color: var(--faint); }

/* app-launch modal */
.launch { text-align: center; padding: 30px 26px 26px; }
.launch .tile-ic { margin: 0 auto 18px; width: 60px; height: 60px; border-radius: 17px; }
.launch .tile-ic svg { width: 30px; height: 30px; }
.launch h3 { font-size: 19px; margin-bottom: 6px; }
.launch p { color: var(--muted); font-size: 13.5px; max-width: 34ch; margin: 0 auto 8px; }
.launch .fakebar {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--faint);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px; margin: 16px auto 22px; width: fit-content;
}
.launch .fakebar svg { width: 13px; height: 13px; color: var(--success); }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--accent); animation: spin .7s linear infinite; margin: 4px auto 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast */
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: oklch(22% 0.02 260); color: oklch(96% 0.01 260);
  padding: 11px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: pop .25s ease;
}
.toast svg { width: 16px; height: 16px; color: var(--success); }
[data-theme="dark"] .toast { background: oklch(30% 0.02 260); }

/* invite chip list in modal */
.perm-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.perm-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 530;
  border: 1px solid var(--border-2); background: var(--surface); color: var(--muted);
  transition: all .14s;
}
.perm-chip .ic { width: 16px; height: 16px; display: grid; place-items: center; }
.perm-chip .ic svg { width: 14px; height: 14px; }
.perm-chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 600; }

/* ============================================================
   Motion & Mikro-Interaktionen (ruhig, nicht wackelig)
   ============================================================ */
@keyframes routeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes tileIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.content { animation: routeIn .34s cubic-bezier(.2,.7,.3,1) both; }

.tile {
  /* backwards (nicht both): Eintritt spielt ab, danach greifen Hover-/Press-Transforms
     wieder — mit "both" würde der retained transform:none sie überschreiben. */
  animation: tileIn .44s cubic-bezier(.2,.7,.3,1) backwards;
  animation-delay: calc(var(--stagger, 0) * 55ms);
}
/* Press-Feedback: Kachel gibt beim Klick spürbar nach */
.tile.available:active { transform: translateY(0) scale(.985); transition: transform .06s; }

.countup { font-variant-numeric: tabular-nums; }

/* Auth-Screens sanft einblenden */

/* ============================================================
   Onboarding — Einladung annehmen
   ============================================================ */
.invite-summary {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2); margin-bottom: 22px;
}
.invite-summary .who { min-width: 0; }
.invite-summary .who .n { font-size: 13.5px; font-weight: 600; }
.invite-summary .who .s { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); }
.invite-apps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.invite-apps .pill svg { width: 12px; height: 12px; }

.pw-meter { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin-top: 4px; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--danger); transition: width .28s ease, background .28s ease; }
.pw-rules { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--faint); margin-top: 2px; letter-spacing: 0.01em; }
.pw-rules span { display: inline-flex; align-items: center; gap: 5px; transition: color .18s; }
.pw-rules span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pw-rules span.ok { color: var(--success); font-weight: 550; }

.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); line-height: 1.5; cursor: pointer; }
.consent input { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; cursor: pointer; }
.consent strong { color: var(--fg); font-weight: 620; }

/* ============================================================
   Eingebettete Mini-Apps (In-Hub)
   ============================================================ */
.app-frame { display: flex; flex-direction: column; gap: 18px; }
.app-frame-bar {
  display: flex; align-items: center; gap: 14px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.app-frame-bar [data-app-back] { padding-left: 8px; }
.app-frame-id { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.app-frame-ic { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-sm); }
.app-frame-ic svg { width: 20px; height: 20px; }
.app-frame-id .meta { min-width: 0; }
.app-frame-id .meta .n { font-size: 15px; font-weight: 640; font-family: var(--font-display); letter-spacing: -0.01em; }
.app-frame-id .meta .u { font-size: 12px; color: var(--faint); }
.app-frame-body { animation: routeIn .3s cubic-bezier(.2,.7,.3,1) both; }
.miniapp-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; color: var(--muted); text-align: center; }
.miniapp-empty svg { width: 26px; height: 26px; color: var(--faint); }

/* Aether — Notizen */
.miniapp.aether { display: grid; grid-template-columns: 268px 1fr; gap: 18px; min-height: 460px; }
.notes-list { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; display: flex; flex-direction: column; }
.notes-list-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.notes-scroll { overflow-y: auto; max-height: 520px; }
.note-item { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; transition: background .13s; }
.note-item:hover { background: var(--surface-2); }
.note-item.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.note-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.note-item-title { font-size: 13.5px; font-weight: 560; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-lock { color: var(--faint); display: inline-flex; }
.note-lock svg { width: 13px; height: 13px; }
.note-item-snip { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-editor { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 22px 24px; }
.note-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.note-actions { display: flex; gap: 4px; }
.note-title { font-size: 22px; margin-bottom: 12px; }
.note-body { font-size: 14.5px; line-height: 1.7; color: var(--fg); white-space: normal; max-width: 62ch; }
.note-locked { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 20px; }
.note-locked-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.note-locked-ic svg { width: 22px; height: 22px; }
.note-locked p { color: var(--muted); font-size: 13.5px; max-width: 34ch; }

/* Healthy — Tracker */
.miniapp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.miniapp-head h2 { font-size: 20px; }
.miniapp-head p { font-size: 13px; margin-top: 2px; }
.hstat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.hstat { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 16px 18px; }
.hstat-label { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.hstat-value { font-size: 26px; font-weight: 660; font-family: var(--font-display); letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hstat-unit { font-size: 12.5px; color: var(--faint); font-weight: 500; margin-left: 6px; letter-spacing: 0; font-family: var(--font-body); }
.hstat-bar { height: 6px; border-radius: 999px; background: var(--border); margin-top: 12px; overflow: hidden; }
.hstat-bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.hcard { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 18px 20px; }
.hcard-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 13.5px; font-weight: 600; margin-bottom: 16px; }
.hchart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; align-items: end; height: 150px; }
.hbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; }
.hbar-fill { width: 100%; max-width: 34px; border-radius: 6px 6px 3px 3px; background: color-mix(in oklab, var(--accent) 78%, var(--surface)); transition: height .5s cubic-bezier(.2,.7,.3,1); min-height: 6px; }
.hbar:last-child .hbar-fill { background: var(--accent); }
.hbar-lbl { font-size: 11px; color: var(--muted); font-weight: 550; }

/* Open WebUI — Chat */
.miniapp.chat { display: flex; flex-direction: column; height: min(560px, 66vh); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.chat-top { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.chat-model { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 550; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.cmsg { display: flex; gap: 10px; max-width: 80%; }
.cmsg.user { align-self: flex-end; }
.cmsg-ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cmsg-ic svg { width: 16px; height: 16px; }
.cmsg-bubble { font-size: 14px; line-height: 1.55; padding: 10px 13px; border-radius: 14px; }
.cmsg.assistant .cmsg-bubble { background: var(--surface-2); border: 1px solid var(--border); border-top-left-radius: 4px; }
.cmsg.user .cmsg-bubble { background: var(--accent); color: var(--accent-fg); border-top-right-radius: 4px; }
.chat-input { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); }
.chat-input .btn { flex: none; width: 44px; padding: 0; }

@media (max-width: 720px) {
  .miniapp.aether { grid-template-columns: 1fr; }
  .notes-scroll { max-height: 220px; }
  .note-editor { min-height: 300px; }
}

/* ============================================================
   Responsive
   ============================================================ */
.mobile-only { display: none; }
.backdrop { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 280px; height: 100vh;
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.3,.7,.3,1);
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: oklch(15% 0.02 260 / .5); backdrop-filter: blur(2px); }
  .topbar { display: flex; }
  .content { padding: 26px 18px 90px; }
  .mobile-only { display: block; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .page-head .greet h1 { font-size: 1.5rem; }
  .key-row { flex-wrap: wrap; }
}

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

