/* ═══════════════════════════════════════════════════════════════
   EASYBILL — Design System v3
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&display=swap');

/* ────────────────────────────────────────────────────────────────
   TOKENS — unveränderlich
   ──────────────────────────────────────────────────────────────── */
:root {
  --brand:       #2563eb;
  --brand-hover: #1d4ed8;
  --brand-deep:  #1e3a8a;
  --brand-deeper: var(--brand-deep);
  --brand-active: #1d4ed8;

  --font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  --nav-h:     60px;
  --sidebar-w: 252px;
  --bot-h:     66px;

  --r-xs: 5px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 17px;
  --r-xl: 22px;
  --r-2xl: 30px;
  --r: var(--r-lg);

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 130ms cubic-bezier(0.16,1,0.3,1);
  --t-base: 200ms cubic-bezier(0.16,1,0.3,1);
  --t-slow: 360ms cubic-bezier(0.34,1.56,0.64,1);

  /* legacy compat */
  --trans-fast: var(--t-fast);
  --trans-base: var(--t-base);
  --trans-slow: var(--t-slow);
}

/* ────────────────────────────────────────────────────────────────
   ☀️  HELL-MODUS
   Hintergrund: leicht getöntes Neutralweiß — kein hartes Weiß
   Karten heben sich subtil durch Schatten ab, nicht durch Farbe
   ──────────────────────────────────────────────────────────────── */
:root, [data-theme="light"] {
  color-scheme: light;

  /* Surfaces - Mehr Kontrast! */
  --bg-app:     #e8ebf0;
  --bg-card:    #ffffff;
  --bg-modal:   #ffffff;
  --bg-input:   #f5f7fa;
  --bg-hover:   #eff2f7;
  --bg-overlay: rgba(10,16,38,.44);

  /* Brand tints */
  --brand-wash:  rgba(37,99,235,.08);
  --brand-tint:  rgba(37,99,235,.12);
  --brand-glow:  rgba(37,99,235,.20);
  --brand-ring:  rgba(37,99,235,.35);

  /* Text — sorgfältige Kontrasthierarchie */
  --t1: #0f172a;
  --t2: #334155;
  --t3: #64748b;
  --t4: #94a3b8;
  --t-inv: #ffffff;

  /* Borders - Stärkere Borders */
  --b1: rgba(0,0,0,.10);
  --b2: rgba(0,0,0,.15);
  --b3: rgba(0,0,0,.25);

  /* Schattensystem — stärkere Schatten */
  --s-xs: 0 1px 3px rgba(10,16,38,.10);
  --s-sm: 0 2px 4px rgba(10,16,38,.10), 0 1px 2px rgba(10,16,38,.06);
  --s-md: 0 4px 16px rgba(10,16,38,.10), 0 2px 6px rgba(10,16,38,.06);
  --s-lg: 0 10px 32px rgba(10,16,38,.12), 0 4px 12px rgba(10,16,38,.08);
  --s-xl: 0 20px 60px rgba(10,16,38,.14), 0 8px 20px rgba(10,16,38,.10);

  /* Sidebar */
  --sb-bg:    #ffffff;
  --sb-line:  rgba(0,0,0,.10);

  /* Bars */
  --bar-bg:   rgba(255,255,255,.95);
  --bar-line: rgba(0,0,0,.10);

  /* Semantic */
  --ok:      #059669; --ok-bg:  #ecfdf5;
  --warn:    #d97706; --warn-bg: #fffbeb;
  --err:     #dc2626; --err-bg:  #fef2f2;
  --info:    #7c3aed; --info-bg: #f5f3ff;

  /* legacy aliases — alle JS-Referenzen abdecken */
  --white: #ffffff;
  --g100: #f7f8fa; --g200: rgba(0,0,0,.07); --g300: rgba(0,0,0,.12);
  --g400: #94a3b8; --g500: #64748b; --g600: #64748b;
  --g700: #334155; --g800: #0f172a; --g900: #0f172a;
  --bg-primary: var(--bg-card);
  --bg-secondary: var(--bg-app);
  --bg-tertiary: var(--bg-input);
  --bg-elevated: var(--bg-modal);
  --text-primary: var(--t1);
  --text-secondary: var(--t2);
  --text-tertiary: var(--t3);
  --text-inverse: var(--t-inv);
  --border-primary: var(--b1);
  --border-secondary: var(--b2);
  --border-hover: var(--b3);
  --glass-bg: var(--bar-bg);
  --glass-border: var(--bar-line);
  --brand-bg-subtle: var(--brand-wash);
  --brand-bg-hover: var(--brand-tint);
  --brand-xlight: var(--brand-wash);
  --brand-light: var(--brand-tint);
  --sh: var(--s-sm); --sh-md: var(--s-md); --sh-lg: var(--s-lg);
  --shadow-sm: var(--s-sm); --shadow-md: var(--s-md);
  --shadow-lg: var(--s-lg); --shadow-xl: var(--s-xl);
  --green: var(--ok); --green-bg: var(--ok-bg); --green-dark: #047857;
  --orange: var(--warn); --orange-bg: var(--warn-bg); --orange-dark: #b45309;
  --red: var(--err); --red-bg: var(--err-bg); --red-dark: #b91c1c;
  --purple: var(--info); --purple-bg: var(--info-bg); --purple-dark: #6d28d9;
}

/* ────────────────────────────────────────────────────────────────
   🌙  DUNKEL-MODUS
   Gestaffeltes Blaugrau-System — keine langweiligen Grautöne.
   Jede Ebene ist erkennbar verschieden.
   ──────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces - Mehr Kontrast! */
  --bg-app:     #0a0d14;
  --bg-card:    #161b2e;
  --bg-modal:   #1c2333;
  --bg-input:   #111623;
  --bg-hover:   #1e2538;
  --bg-overlay: rgba(0,0,0,.75);

  /* Brand tints */
  --brand-wash:  rgba(96,165,250,.10);
  --brand-tint:  rgba(96,165,250,.16);
  --brand-glow:  rgba(96,165,250,.28);
  --brand-ring:  rgba(96,165,250,.42);

  /* Text */
  --t1: #e8edf8;
  --t2: #a0aec8;
  --t3: #5e6f8f;
  --t4: #3a4563;
  --t-inv: #0a0d14;

  /* Borders - Stärker */
  --b1: rgba(255,255,255,.08);
  --b2: rgba(255,255,255,.14);
  --b3: rgba(255,255,255,.24);

  /* Schatten - Stärker */
  --s-xs: 0 1px 3px rgba(0,0,0,.45);
  --s-sm: 0 2px 5px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.35);
  --s-md: 0 4px 20px rgba(0,0,0,.50), 0 2px 8px rgba(0,0,0,.35);
  --s-lg: 0 10px 40px rgba(0,0,0,.58), 0 4px 14px rgba(0,0,0,.38);
  --s-xl: 0 24px 72px rgba(0,0,0,.65), 0 8px 24px rgba(0,0,0,.42);

  /* Sidebar */
  --sb-bg:   #0d1018;
  --sb-line: rgba(255,255,255,.08);

  /* Bars */
  --bar-bg:   rgba(13,16,24,.96);
  --bar-line: rgba(255,255,255,.09);

  /* Semantic im Dark-Mode — sattere, leuchtendere Töne */
  --ok:      #34d399; --ok-bg:  rgba(52,211,153,.13);
  --warn:    #fbbf24; --warn-bg: rgba(251,191,36,.11);
  --err:     #f87171; --err-bg:  rgba(248,113,113,.12);
  --info:    #a78bfa; --info-bg: rgba(167,139,250,.13);

  --white: var(--bg-card);
  --g100: var(--bg-input); --g200: var(--b1); --g300: var(--b2);
  --g400: var(--t4); --g500: var(--t3); --g600: var(--t3);
  --g700: var(--t2); --g800: var(--t1); --g900: var(--t1);
  --bg-primary: var(--bg-card);
  --bg-secondary: var(--bg-app);
  --bg-tertiary: var(--bg-input);
  --bg-elevated: var(--bg-modal);
  --text-primary: var(--t1);
  --text-secondary: var(--t2);
  --text-tertiary: var(--t3);
  --text-inverse: var(--t-inv);
  --border-primary: var(--b1);
  --border-secondary: var(--b2);
  --border-hover: var(--b3);
  --glass-bg: var(--bar-bg);
  --glass-border: var(--bar-line);
  --brand-bg-subtle: var(--brand-wash);
  --brand-bg-hover: var(--brand-tint);
  --brand-xlight: var(--brand-wash);
  --brand-light: var(--brand-tint);
  --sh: var(--s-sm); --sh-md: var(--s-md); --sh-lg: var(--s-lg);
  --shadow-sm: var(--s-sm); --shadow-md: var(--s-md);
  --shadow-lg: var(--s-lg); --shadow-xl: var(--s-xl);
  --green: var(--ok); --green-bg: var(--ok-bg); --green-dark: var(--ok);
  --orange: var(--warn); --orange-bg: var(--warn-bg); --orange-dark: var(--warn);
  --red: var(--err); --red-bg: var(--err-bg); --red-dark: var(--err);
  --purple: var(--info); --purple-bg: var(--info-bg); --purple-dark: var(--info);
}

/* ════════════════════════════════════════════════════════════════
   BASE
   ════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg-app);
  color: var(--t1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent accidental horizontal overflow on mobile */
body { overflow-x: hidden; }

img, svg, canvas {
  max-width: 100%;
}

/* ════════════════════════════════════════════════════════════════
   APP SHELL
   ════════════════════════════════════════════════════════════════ */
#app {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: var(--app-h, 100vh);
  height: 100dvh;
  display: none;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.92) translateY(30px);
  filter: blur(8px);
  transition: opacity 620ms var(--smooth), transform 620ms var(--smooth), filter 620ms var(--smooth);
}
#app.show {
  display: flex;
  opacity: 1;
  transform: scale(1) translateY(0);
  filter: blur(0);
}

@media (min-width: 1024px) {
  #app.show { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-areas: "sidebar content"; }
  .sidebar { grid-area: sidebar; }
  .content { grid-area: content; }
}

/* ════════════════════════════════════════════════════════════════
   TOPBAR — Mobil
   ════════════════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
  padding: env(safe-area-inset-top) 14px 0;
  background: var(--bar-bg); border-bottom: 1px solid var(--bar-line);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
  flex-shrink: 0; z-index: 100;
}
.tb-logo {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  user-select: none;
}
.tb-title {
  display: none;
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}
.tb-title.swap {
  animation: tbTitleSwap 220ms var(--smooth) both;
}
@keyframes tbTitleSwap {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.full-logo-mobile { max-width: 150px; }
.topbar.has-title .tb-logo { flex: 0 0 auto; }
.topbar.has-title .tb-title { display: block; }
@media (min-width: 1024px) { .topbar { display: none; } }

.tb-btn, .theme-toggle {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; color: var(--t3);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}
.tb-btn:hover, .theme-toggle:hover { background: var(--bg-hover); color: var(--t1); }
.tb-btn:active, .theme-toggle:active { transform: scale(0.87); }
.tb-btn svg, .theme-toggle svg { width: 18px; height: 18px; stroke-width: 2; }

/* ════════════════════════════════════════════════════════════════
   MOBILE MENU (Burger Drawer)
   ════════════════════════════════════════════════════════════════ */
.mnav {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: block;
  visibility: hidden;
  pointer-events: none;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 180ms ease;
}
.mnav.show {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}
.mnav.show.closing {
  opacity: 0;
}

.mnav-drawer {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(340px, 86vw);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-left: 1px solid var(--b1);
  box-shadow: var(--s-xl);
  transform: translateX(100%);
  transition: transform 220ms var(--spring);
  display: flex;
  flex-direction: column;
  border-radius: var(--r-xl) 0 0 var(--r-xl);
  will-change: transform;
  touch-action: pan-y;
}
.mnav.open .mnav-drawer {
  transform: translateX(0);
}

.mnav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 14px) 14px 10px;
  border-bottom: 1px solid var(--b1);
}
.mnav-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--t2);
}
.mnav-body {
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR — Desktop
   ════════════════════════════════════════════════════════════════ */
.sidebar {
  display: none; flex-direction: column;
  background: var(--glass-bg);
  border-right: 1px solid var(--glass-border);
  box-shadow: var(--s-lg);
  position: relative;
  z-index: 12;
  height: 100vh; overflow: hidden;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
@media (min-width: 1024px) { .sidebar { display: flex; } }

.sidebar-header {
  height: var(--nav-h); display: flex; align-items: center; padding: 0 16px;
  border-bottom: 1px solid var(--sb-line); flex-shrink: 0;
}
.sidebar-logo { display: flex; align-items: center; color: var(--brand); }

/* Sidebar brand/header (clickable home) */
.sidebar-brand {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--r-md);
  color: var(--brand);
  transition: background var(--t-fast), transform var(--t-fast);
}
.sidebar-brand:hover { background: var(--bg-hover); }
.sidebar-brand:active { transform: scale(0.99); }
.sidebar-brand svg {
  width: 24px; height: 24px; stroke-width: 2.2; flex-shrink: 0;
}
.sidebar-brand-text {
  font-size: 16px; font-weight: 800; color: var(--brand);
  letter-spacing: .3px; line-height: 1.1;
}

.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section {
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 8px;
  margin-bottom: 12px;
  box-shadow: var(--s-xs);
}
.nav-section-label {
  font-size: 10px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase;
  color: var(--t3); padding: 8px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: var(--r-sm);
  color: var(--t2);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  font-weight: 600;
  position: relative;
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast), transform var(--t-fast);
  margin-bottom: 3px;
}
.nav-item:last-child { margin-bottom: 0; }
.nav-item svg { width: 17px; height: 17px; stroke-width: 2.05; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--t1); box-shadow: var(--s-xs); }
.nav-item:active { transform: scale(0.98); }
.nav-item:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: -2px;
}
.nav-item.active {
  background: var(--brand-wash);
  border-color: var(--brand-ring);
  box-shadow: var(--s-xs);
  color: var(--brand);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-hover) 100%);
  opacity: 0.9;
  pointer-events: none;
  animation: navActiveBar 240ms var(--spring) both;
}
@keyframes navActiveBar {
  from { transform: scaleY(0.25); opacity: 0; }
  to { transform: scaleY(1); opacity: 0.9; }
}
.nav-item.active:hover { background: var(--brand-tint); }

/* Mobile: Titel in der Topbar – Page-Header auf Unterseiten ausblenden (keine doppelten Titles) */
@media (max-width: 1023px) {
  .topbar.has-title ~ .content .page-header { display: none; }
}

.sidebar-footer { padding: 8px; border-top: 1px solid var(--sb-line); flex-shrink: 0; }
.user-card {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
}
.user-card:hover { background: var(--bg-hover); }
.user-card:active { transform: scale(0.99); }
.user-avatar {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-wash); color: var(--brand);
  font-weight: 800; font-size: 12.5px; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--t1); line-height: 1.2; }
.user-email { font-size: 11px; color: var(--t3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-logout {
  width: 32px; height: 32px; border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--b1);
  color: var(--t3); cursor: pointer; flex-shrink: 0;
  transition: all var(--t-fast);
  opacity: 0;
}
.user-card:hover .user-logout { opacity: 1; }
.user-logout:hover {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
  transform: scale(1.05);
}
.user-logout:active { transform: scale(0.95); }
.user-logout svg { width: 16px; height: 16px; }

/* ════════════════════════════════════════════════════════════════
   CONTENT
   ════════════════════════════════════════════════════════════════ */
.content {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  padding: 16px 14px;
  padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 16px);
  padding-bottom: calc(var(--bot-h) + env(safe-area-inset-bottom) + 16px);
  background:
    radial-gradient(900px 420px at 12% 0%, var(--brand-wash) 0%, transparent 55%),
    radial-gradient(700px 360px at 92% 18%, var(--brand-tint) 0%, transparent 60%),
    var(--bg-app);
  -webkit-overflow-scrolling: touch;
  position: relative;
}

@media (min-width: 1024px) {
  .content {
    padding: 24px 36px;
    padding-top: 24px;
    padding-bottom: 24px;
  }
}

/* Extra safety: prevent horizontal overflow on mobile */
@media (max-width: 1023px) {
  #app, .topbar, .content, .bot-nav { max-width: 100vw; width: 100%; }
  .page { width: 100%; max-width: 100%; }
  * { max-width: 100%; word-wrap: break-word; }
  html { overflow-x: hidden; }
  body { overflow-x: hidden; }
}

/* Einspaltiges Layout für sehr kleine Bildschirme */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .qgrid { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════════════════════════════
   BOTTOM NAV
   ════════════════════════════════════════════════════════════════ */
.bot-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  width: 100%;
  height: calc(var(--bot-h) + env(safe-area-inset-bottom));
  display: flex; background: var(--bar-bg); border-top: 1px solid var(--bar-line);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  box-shadow: 0 -10px 26px rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom); z-index: 100;
}
@media (min-width: 1024px) { .bot-nav { display: none; } }

.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border: none; background: none; font-size: 10px; font-weight: 500;
  color: var(--t4); cursor: pointer; font-family: var(--font);
  transition: color var(--t-fast); padding: 0 2px 2px;
  min-width: 0;
  position: relative;
}
.nav-btn .nav-label {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-btn svg { width: 20px; height: 20px; stroke-width: 1.8; transition: transform var(--t-fast); }
.nav-btn.active { color: var(--brand); font-weight: 700; }
.nav-btn.active svg { stroke-width: 2.3; }
.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--brand);
  opacity: 0.9;
  pointer-events: none;
  animation: navDotIn 240ms var(--spring) both;
}
@keyframes navDotIn {
  from { transform: translateX(-50%) scale(0.7); opacity: 0; }
  to { transform: translateX(-50%) scale(1); opacity: 0.9; }
}

/* ════════════════════════════════════════════════════════════════
   LOGOS
   ════════════════════════════════════════════════════════════════ */
.full-logo, .full-logo-mobile { height: 32px; width: auto; display: block; }
.full-logo-login, .full-logo-splash { width: min(280px, 75vw); height: auto; display: block; }

/* ════════════════════════════════════════════════════════════════
   SPLASH — Professioneller Business Startbildschirm
   ════════════════════════════════════════════════════════════════ */
#splash {
  position: fixed; inset: 0; z-index: 300;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-deep) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden;
  text-align: center;
  padding: 24px;
  transition: opacity 520ms var(--smooth), transform 520ms var(--smooth);
  pointer-events: none;
}

/* Animierter Gradient-Overlay */
#splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 50% -20%, rgba(255,255,255,.15) 0%, transparent 50%),
    radial-gradient(ellipse 600px 400px at 20% 80%, rgba(255,255,255,.08) 0%, transparent 60%),
    radial-gradient(ellipse 500px 500px at 80% 20%, rgba(255,255,255,.06) 0%, transparent 55%);
  animation: gradientShift 8s ease-in-out infinite alternate;
  pointer-events: none;
}

/* Partikel/Dots Hintergrund */
#splash::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.06) 1px, transparent 1px),
    radial-gradient(circle at 85% 30%, rgba(255,255,255,.05) 1px, transparent 1px),
    radial-gradient(circle at 50% 70%, rgba(255,255,255,.04) 1px, transparent 1px),
    radial-gradient(circle at 25% 85%, rgba(255,255,255,.05) 1px, transparent 1px),
    radial-gradient(circle at 75% 75%, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 100% 100%;
  animation: particleFloat 20s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

#splash > * { position: relative; z-index: 1; }
#splash.out {
  opacity: 0;
  transform: scale(0.85) rotate(-2deg);
  pointer-events: none;
  filter: blur(10px);
}

/* Logo Container mit Glow */
.sp-logo {
  animation: zoomInRotateBounce 880ms 80ms var(--spring) both;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sp-logo::before {
  content: '';
  position: absolute;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,.22) 0%, transparent 70%);
  border-radius: 50%;
  animation: pulseGlow 3s ease-in-out infinite;
  z-index: -1;
}

/* Untertitel mit eleganter Typografie */
.sp-sub {
  margin-top: 18px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255,255,255,.85);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  animation: fromBelow 520ms 140ms var(--spring) both;
}

/* Premium Spinner */
.sp-spin-wrap {
  margin-top: 42px;
  animation: fromBelow 520ms 220ms var(--spring) both;
  position: relative;
  width: 48px;
  height: 48px;
}
.sp-spin-wrap::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37,99,235,.15) 0%, transparent 70%);
  animation: pulseRing 2s ease-in-out infinite;
}
.sp-spin {
  width: 48px; height: 48px;
  border: 3px solid rgba(255,255,255,.12);
  border-top-color: rgba(37,99,235,1);
  border-right-color: rgba(59,130,246,.8);
  border-radius: 50%;
  animation: splashSpin 900ms cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  box-shadow: 0 0 20px rgba(37,99,235,.3), inset 0 0 10px rgba(37,99,235,.1);
}

/* Status Text */
.sp-status {
  margin-top: 22px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.55);
  letter-spacing: .3px;
  animation: fromBelow 520ms 320ms var(--spring) both;
}

/* Premium Animationen */
@keyframes fromBelow { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes zoomInRotate {
  from { opacity: 0; transform: scale(0.5) rotate(-5deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes zoomInRotateBounce {
  0% { opacity: 0; transform: scale(0.3) rotate(-8deg); }
  60% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes splashSpin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.15); opacity: 0.5; }
}
@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  50% { transform: scale(1.2); opacity: 0.6; }
}
@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 0.2; }
  50% { transform: scale(1.4); opacity: 0; }
}
@keyframes gradientShift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-5%, 5%) scale(1.1); }
}
@keyframes particleFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-20px); }
}

/* ════════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════════ */
body.login-mode {
  background:
    linear-gradient(180deg, var(--brand-wash) 0%, transparent 42%),
    linear-gradient(180deg, var(--bg-card) 0%, var(--bg-app) 100%);
}

#login {
  position: fixed; inset: 0; z-index: 200;
  background:
    linear-gradient(180deg, var(--brand-wash) 0%, transparent 42%),
    linear-gradient(180deg, var(--bg-card) 0%, var(--bg-app) 100%);
  overflow: hidden;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
  transition: opacity 520ms var(--smooth), transform 520ms var(--smooth), filter 520ms var(--smooth);
}
#login.entering {
  animation: loginFadeIn 520ms var(--smooth) both;
}
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Login: Inputs etwas ruhiger & klarer als im App-UI */
#login .field input,
#login .field select {
  border-color: var(--b2);
}
#login .field input:focus,
#login .field select:focus {
  box-shadow: 0 0 0 3px var(--brand-glow);
}
#login::before {
  content: '';
  display: none;
}

/* Entfernt das helle Artefakt („Dynamic Island“) auf Desktop-Browsern */
@media (min-width: 1024px) {
  #login::before { display: none; }
}
#login > * { position: relative; z-index: 1; }

/* Important: .login-loading must stay overlayed and must NOT take layout space */
#login > .login-loading { position: absolute; z-index: 2; }

#login.show { display: flex; }
#login.entering .login-logo { animation: fromBelow 480ms 30ms var(--spring) both; }
#login.entering .login-card { animation: cardIn 500ms 120ms var(--spring) both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(30px) scale(0.97); } to { opacity: 1; transform: none; } }

.login-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.login-tagline {
  font-size: 13px;
  font-weight: 600;
  color: var(--t2);
  letter-spacing: .1px;
  text-align: center;
  margin-bottom: 18px;
  max-width: 520px;
}
.login-card {
  background: var(--bg-modal); border-radius: var(--r-xl);
  padding: 28px 22px 22px; width: 100%; max-width: 400px;
  box-shadow: var(--s-xl);
  border: 1px solid var(--b1);
}
.login-card.mode-swap {
  animation: loginModeSwap 220ms var(--smooth) both;
}
@keyframes loginModeSwap {
  from { opacity: 0.78; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

.login-card.login-shake {
  animation: loginShake 420ms cubic-bezier(.2,.8,.2,1) both;
}
@keyframes loginShake {
  0% { transform: translateX(0); }
  16% { transform: translateX(-10px); }
  32% { transform: translateX(9px); }
  48% { transform: translateX(-7px); }
  64% { transform: translateX(5px); }
  80% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}
.login-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.login-head h2 { margin: 0; }
.login-info-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1.5px solid var(--b1);
  background: transparent;
  color: var(--t2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.login-info-btn svg { width: 18px; height: 18px; }
.login-info-btn:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--t1); }
.login-info-btn:active { transform: scale(0.97); }
.login-info-btn:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }
.login-card h2 { font-size: 20px; font-weight: 700; color: var(--t1); margin-bottom: 4px; letter-spacing: -.025em; }
.lc-sub { font-size: 13.5px; color: var(--t3); margin-bottom: 20px; }

.login-info {
  margin: -4px 0 16px;
  padding: 12px 12px;
  border-radius: var(--r-md);
  background: var(--bg-input);
  border: 1px solid var(--b1);
}
.li-row {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.45;
}
.li-row + .li-row { margin-top: 8px; }
.li-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--t4);
  margin-top: 7px;
  flex-shrink: 0;
}
.li-tip {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--t3);
}

/* Login-Übergang: „im Hintergrund lädt was Großes“ */
.login-loading {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  pointer-events: none;
}
#login.loading .login-loading { display: flex; }
#login.loading .login-card { opacity: 0.18; transform: translateY(8px) scale(0.985); }
#login.loading .login-tagline { opacity: 0.55; }

.ll-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 4px solid var(--b2);
  border-top-color: var(--brand);
  background: transparent;
  opacity: 1;
  animation: llSpin 0.8s linear infinite;
  filter: drop-shadow(0 0 18px var(--brand-glow));
}
.ll-title {
  margin-top: 14px;
  font-size: 16px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -.01em;
}
.ll-sub {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--t3);
}
.ll-bar {
  width: min(280px, 72vw);
  height: 4px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--b1);
  overflow: hidden;
}
.ll-bar-fill {
  height: 100%;
  width: 50%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-hover));
  transform: translateX(-120%);
  animation: llBar 1.1s var(--smooth) infinite;
}
@keyframes llSpin { to { transform: rotate(360deg); } }
@keyframes llBar {
  0% { transform: translateX(-120%); opacity: .55; }
  45% { opacity: .95; }
  100% { transform: translateX(220%); opacity: .55; }
}

.login-footer { margin-top: 14px; text-align: center; font-size: 13px; color: var(--t3); }
.login-footer a { color: var(--brand); text-decoration: none; font-weight: 600; transition: color var(--t-fast); }
.login-footer a:hover { color: var(--brand-hover); }

/* ════════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════════ */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 700; color: var(--t2);
  margin-bottom: 5px; letter-spacing: .1px;
}
.field input, .field select {
  width: 100%; border: 1.5px solid var(--b1); border-radius: var(--r-sm);
  padding: 11px 13px; font-family: var(--font); font-size: 14.5px;
  color: var(--t1); background: var(--bg-input); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  -webkit-appearance: none;
}
.field textarea {
  width: 100%; border: 1.5px solid var(--b1); border-radius: var(--r-sm);
  padding: 11px 13px; font-family: var(--font); font-size: 14.5px;
  color: var(--t1); background: var(--bg-input); outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  resize: vertical;
  min-height: 170px;
  line-height: 1.45;
}
.field input::placeholder { color: var(--t4); }
.field textarea::placeholder { color: var(--t4); }
.field input:hover, .field select:hover { border-color: var(--b2); }
.field textarea:hover { border-color: var(--b2); }
.field input:focus, .field select:focus {
  border-color: var(--brand); background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.field textarea:focus {
  border-color: var(--brand); background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* App-eigene Selects (Dropdowns): Native <select> bleibt für Value, UI läuft über Button + Picker-Sheet */
.eb-sel-wrap {
  position: relative;
}
.eb-sel-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.eb-sel-btn {
  width: 100%;
  border: 1.5px solid var(--b1);
  border-radius: var(--r-sm);
  padding: 11px 40px 11px 13px;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--t1);
  background: var(--bg-input);
  outline: none;
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast), transform var(--t-fast);
  position: relative;
}
.eb-sel-btn.placeholder {
  color: var(--t4);
  font-weight: 600;
}
.eb-sel-btn::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid var(--t4);
  transform: translateY(-35%);
  pointer-events: none;
}
.eb-sel-btn:hover {
  border-color: var(--b2);
}
.eb-sel-btn:hover::after {
  border-top-color: var(--t3);
}
.eb-sel-btn:active {
  transform: scale(0.995);
}
.eb-sel-btn:focus-visible {
  border-color: var(--brand);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.eb-sel-btn:focus-visible::after {
  border-top-color: var(--brand);
}
.eb-sel-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.field.has-error .eb-sel-btn {
  border-color: var(--err);
  background: var(--err-bg);
}
.field.has-error .eb-sel-btn:focus-visible {
  border-color: var(--err);
  box-shadow: 0 0 0 3px var(--err-bg);
}
.field.has-error .eb-sel-btn:focus-visible::after {
  border-top-color: var(--err);
}

#sel-modal .slist {
  margin-top: 10px;
}
#sel-modal .srow.sel-selected {
  border-color: var(--brand);
  background: var(--brand-wash);
}
#sel-modal .sr-arr {
  width: 18px;
  text-align: center;
  font-weight: 950;
  color: var(--t4);
}
#sel-modal .srow.sel-selected .sr-arr {
  color: var(--brand);
}
#sel-modal .srow:hover .sr-arr {
  transform: none;
  color: var(--brand);
}
#sel-modal .sel-cancel {
  margin-top: 10px;
}

/* Inline errors (Login/Auth) */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--err);
  background: var(--err-bg);
}
.field.has-error input:focus,
.field.has-error select:focus,
.field.has-error textarea:focus {
  border-color: var(--err);
  box-shadow: 0 0 0 3px var(--err-bg);
}
.field-error {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--err);
  line-height: 1.35;
}
.auth-alert {
  margin: -8px 0 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--err);
  background: var(--err-bg);
  color: var(--err);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.35;
}
.auth-alert:empty { display: none; }

/* Password visibility toggle (injected by JS) */
.inp-wrap {
  position: relative;
}
.inp-wrap input {
  padding-right: 102px;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: 1.5px solid var(--b1);
  background: transparent;
  color: var(--t3);
  border-radius: 999px;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.pw-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  color: var(--t1);
}
.pw-toggle:active {
  transform: translateY(-50%) scale(0.98);
}
.pw-toggle:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
}

/* Password strength + match UI */
.pw-ui {
  margin-top: 8px;
}
.pw-meter {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--b1);
  overflow: hidden;
}
.pw-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--err);
  transition: width var(--t-base), background var(--t-base);
}
.pw-ui.lvl-0 .pw-meter-fill { background: var(--err); }
.pw-ui.lvl-1 .pw-meter-fill { background: var(--warn); }
.pw-ui.lvl-2 .pw-meter-fill { background: var(--brand); }
.pw-ui.lvl-3 .pw-meter-fill { background: var(--ok); }
.pw-ui.lvl-4 .pw-meter-fill { background: var(--ok); }

.pw-row {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11.5px;
  color: var(--t3);
}
.pw-strength { font-weight: 700; color: var(--t2); }
.pw-match { font-weight: 800; }
.pw-match.ok { color: var(--ok); }
.pw-match.bad { color: var(--err); }
.pw-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--t4);
  line-height: 1.35;
}

/* Time Entry: Manual / Timer Mode */
.tt-mode-pill {
  width: 100%;
}
.tt-mode-pill .theme-pill-opt {
  flex: 1;
  text-align: center;
}
.tt-timer {
  padding: 12px 12px;
  border-radius: var(--r-md);
  background: var(--bg-input);
  border: 1px solid var(--b1);
}
.tt-timer.is-live {
  background: var(--bg-card);
  border-color: var(--brand-ring);
  box-shadow: var(--s-sm);
}
.tt-timer.is-live .tt-timer-time {
  color: var(--brand);
}
.tt-timer-time {
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 22px;
  font-weight: 950;
  color: var(--t1);
  letter-spacing: -.03em;
  padding: 8px 0 10px;
}
.tt-timer-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 2px 0 10px;
}
.tt-timer-meta-item {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-sm);
  padding: 8px 8px;
  text-align: center;
}
.tt-timer-meta-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--t4);
}
.tt-timer-meta-value {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 900;
  color: var(--t2);
  font-variant-numeric: tabular-nums;
}
.tt-timer-meta-value.is-live { color: var(--brand); }
.tt-timer-actions {
  display: flex;
  gap: 10px;
}
.tt-timer-actions .btn-brand,
.tt-timer-actions .btn-ghost {
  width: auto;
  flex: 1;
  margin-top: 0;
}
.tt-timer-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--t3);
  line-height: 1.35;
  text-align: center;
}

/* ════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════ */
.btn-brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; background: var(--brand); color: #fff; border: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--r-sm); padding: 12px 16px;
  font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; margin-top: 6px; letter-spacing: -.01em;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  box-shadow: 0 1px 4px rgba(37,99,235,.3), 0 4px 14px rgba(37,99,235,.2);
  position: relative; overflow: hidden;
}
.btn-brand:hover {
  background: var(--brand-hover); transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(37,99,235,.36), 0 6px 20px rgba(37,99,235,.24);
}
.btn-brand:active { transform: scale(0.97) translateY(0); box-shadow: none; }
.btn-brand:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
}
.btn-brand:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; background: transparent; color: var(--t2);
  border: 1.5px solid var(--b1); border-radius: var(--r-sm);
  -webkit-appearance: none;
  appearance: none;
  padding: 12px 16px; font-family: var(--font); font-size: 14px; font-weight: 700;
  cursor: pointer; margin-top: 6px; letter-spacing: -.01em;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--t1); }
.btn-ghost:active { transform: scale(0.97); }
.btn-ghost:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
}
.btn-ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-link {
  border: none;
  background: none;
  padding: 4px 0;
  margin-top: 0;
  color: var(--brand);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: color var(--t-fast);
}
.btn-link:hover { color: var(--brand-hover); }
.btn-link:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.btn-ghost.btn-danger {
  border-color: var(--err);
  color: var(--err);
}
.btn-ghost.btn-danger:hover {
  background: var(--err-bg);
  border-color: var(--err);
}

/* Loading State für Buttons */
.btn-brand.loading, .btn-ghost.loading, button.loading {
  pointer-events: none !important;
  position: relative;
  color: transparent !important;
}
.btn-brand.loading > *, .btn-ghost.loading > *, button.loading > * {
  visibility: hidden !important;
}
.btn-brand.loading::after, .btn-ghost.loading::after, button.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: btnSpin 0.7s linear infinite;
  opacity: 1;
  z-index: 10;
  visibility: visible !important;
}
.btn-ghost.loading::after {
  border-color: var(--brand);
  border-top-color: transparent;
}
@-webkit-keyframes btnSpin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@keyframes btnSpin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

@-webkit-keyframes spin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}
@keyframes spin {
  to { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════════
   FAB SPEED-DIAL — Neue Optik mit Backdrop & größeren Buttons
   ════════════════════════════════════════════════════════════════ */
.fab-wrap {
  position: fixed;
  bottom: calc(var(--bot-h) + env(safe-area-inset-bottom) + 14px);
  right: 14px; z-index: 20;
  --fab-size: 54px;
  pointer-events: none;
}
/* Desktop: FAB rechts unten, außerhalb der Sidebar */
@media (min-width: 1024px) { 
  .fab-wrap { 
    bottom: 22px;
    right: 22px;
  } 
}

.fab-actions { 
  position: absolute;
  right: 0;
  bottom: calc(var(--fab-size) + 12px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px; 
  pointer-events: none; 
}
@media (max-width: 640px) {
  /* Wenn Butler + FAB gestapelt sind, Aktionen darüber platzieren */
  .fab-actions {
    bottom: calc(var(--fab-size) + var(--fab-size) + 24px);
  }
}
.fab-action {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  opacity: 0; transform: translateY(8px) scale(0.9);
  transition: opacity 200ms, transform 200ms;
}
.fab-actions.open .fab-action { 
  opacity: 1; transform: none; pointer-events: all; 
}
.fab-actions.open .fab-action:nth-child(1) { transition-delay: 0ms; }
.fab-actions.open .fab-action:nth-child(2) { transition-delay: 40ms; }
.fab-actions.open .fab-action:nth-child(3) { transition-delay: 80ms; }

.fab-action-label {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255,255,255,.94);
  opacity: 0.92;
  line-height: 1.2;
  text-align: right;
  white-space: normal;
  max-width: min(280px, calc(100vw - 120px));
  user-select: none;
  text-shadow: 0 2px 10px rgba(0,0,0,.45);
}

@media (hover: hover) {
  .fab-action:hover .fab-action-label {
    opacity: 1;
  }
}
.fab-action-btn {
  width: var(--fab-size); height: var(--fab-size); border-radius: 17px;
  background: var(--bg-modal); border: 1px solid var(--b1);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--brand); box-shadow: var(--s-md);
  transition: all var(--t-fast);
  position: relative; overflow: hidden;
  flex-shrink: 0;
}
.fab-action-btn::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(37,99,235,.04); opacity: 0; transition: opacity var(--t-fast);
}
.fab-action-btn:hover::before { opacity: 1; }
.fab-action-btn:hover { 
  background: var(--bg-hover);
  border-color: var(--b2);
  box-shadow: var(--s-lg); 
  transform: translateY(-3px);
}
.fab-action-btn:active { transform: scale(0.92); }
.fab-action-btn svg { width: 24px; height: 24px; stroke-width: 1.8; }

/* Time Entry: Floating Timer (bottom-left, like FAB) */
.tt-float {
  position: fixed;
  bottom: calc(var(--bot-h) + env(safe-area-inset-bottom) + 14px);
  left: 14px;
  z-index: 20;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 20px;
  background: var(--bg-modal);
  border: 1.5px solid var(--b2);
  box-shadow: var(--s-xl);
  color: var(--t1);
  cursor: pointer;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast);
  overflow: hidden;
}
.tt-float::before {
  content: '';
  width: 6px;
  height: 26px;
  border-radius: 999px;
  background: var(--brand);
  opacity: 0.9;
  flex-shrink: 0;
}
.tt-float.show { display: flex; }
.tt-float:hover { background: var(--bg-hover); border-color: var(--b2); }
.tt-float:active { transform: scale(0.98); }
.tt-float:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }
.tt-float svg { width: 20px; height: 20px; color: var(--brand); }
.tt-float-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--warn);
  color: var(--t-inv);
  font-size: 12px;
  font-weight: 950;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  box-shadow: var(--s-sm);
}
.tt-float.is-live { background: var(--bg-modal); border-color: var(--brand-ring); box-shadow: var(--s-xl); }
.tt-float.is-live .tt-float-sub { color: var(--brand); }

.tt-float.is-pending { background: var(--bg-modal); border-color: var(--warn); box-shadow: var(--s-xl); }
.tt-float.is-pending::before { background: var(--warn); }
.tt-float.is-pending svg { color: var(--warn); }
.tt-float.is-pending .tt-float-sub { color: var(--warn); }
.tt-float.is-pending .tt-float-meta { color: var(--t2); }
.tt-float.is-pending .tt-float-badge { display: flex; animation: ttBadgePulse 1.25s var(--smooth) infinite; }

@keyframes ttBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
  .tt-float.is-pending .tt-float-badge { animation: none; }
}
.tt-float-main { display: flex; flex-direction: column; gap: 1px; align-items: flex-start; }
.tt-float-time {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: -.02em;
  color: var(--t1);
  line-height: 1.05;
}
.tt-float-range {
  font-size: 12px;
  font-weight: 900;
  color: var(--t3);
  letter-spacing: -.01em;
}
.tt-float.is-pending .tt-float-range { color: var(--warn); }
.tt-float-range:empty { display: none; }
.tt-float-sub {
  font-size: 11.5px;
  color: var(--t3);
  font-weight: 800;
  line-height: 1.1;
}
.tt-float-meta {
  font-size: 11px;
  color: var(--t3);
  font-weight: 800;
  line-height: 1.1;
}
.tt-float-meta:empty { display: none; }

#tt-save.is-pending {
  background: var(--warn);
  box-shadow: var(--s-lg);
  color: var(--t-inv);
}
#tt-save.is-pending:hover { background: var(--orange-dark); }

@media (min-width: 1024px) {
  .tt-float {
    bottom: 22px;
    left: calc(var(--sidebar-w) + 22px);
  }
}

.fab-main {
  width: var(--fab-size); height: var(--fab-size); background: var(--brand); color: #fff; border: none;
  border-radius: 17px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 18px rgba(37,99,235,.45), 0 1px 5px rgba(37,99,235,.25);
  cursor: pointer; position: relative; overflow: hidden;
  touch-action: none;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
  pointer-events: auto;
}
.fab-main::before {
  content: ''; position: absolute; inset: 0;
  background: rgba(255,255,255,.08); opacity: 0; transition: opacity var(--t-fast);
}
.fab-main:hover::before { opacity: 1; }
.fab-main:hover { 
  box-shadow: 0 6px 24px rgba(37,99,235,.55), 0 2px 8px rgba(37,99,235,.3); 
  transform: scale(1.08);
}
.fab-main:active { transform: scale(0.92); }
.fab-main:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 3px;
}
.fab-main svg { width: 24px; height: 24px; stroke-width: 2; transition: transform var(--t-slow); }
.fab-main.open svg { transform: rotate(45deg); }

/* Butler-FAB (eigener Button neben dem FAB) */
.fab-butler {
  position: absolute;
  right: calc(var(--fab-size) + 12px);
  bottom: 0;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 17px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--brand);
  box-shadow: var(--s-md);
  transition: all var(--t-fast);
  overflow: hidden;
  pointer-events: auto;
}
.fab-butler::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(37,99,235,.04);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.fab-butler:hover::before { opacity: 1; }
.fab-butler:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  box-shadow: var(--s-lg);
  transform: translateY(-3px);
}
.fab-butler:active { transform: scale(0.92); }
.fab-butler:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 3px;
}
.fab-butler svg { width: 24px; height: 24px; stroke-width: 1.8; }

.fab-butler svg .butler-sparkle {
  animation: sparkleGlimmer 2.5s ease-in-out infinite;
  transform-origin: center;
}

.fab-butler.disabled {
  opacity: 0.55;
  color: var(--t3);
  background: var(--bg-modal);
  border-color: var(--b1);
  box-shadow: var(--s-xs);
}
.fab-butler.disabled::before { opacity: 0 !important; }
.fab-butler.disabled:hover {
  transform: none;
  background: var(--bg-modal);
  border-color: var(--b1);
  box-shadow: var(--s-xs);
}
.fab-butler.disabled:active { transform: none; }

@media (max-width: 640px) {
  /* Mobile: Buttons lieber übereinander */
  .fab-butler {
    right: 0;
    bottom: calc(var(--fab-size) + 12px);
  }
}

/* FAB Overlay mit Backdrop-Blur & Abdunkelung */
.fab-overlay { 
  position: fixed; inset: 0; z-index: 19; display: none;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: all var(--t-fast);
}
.fab-overlay.show { 
  display: block;
  background: var(--bg-overlay);
  opacity: 0.90;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Dark-Mode: gleiche Blur-Stärke, nur leicht weniger Opacity */
[data-theme="dark"] .fab-overlay.show {
  opacity: 0.75;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Desktop: etwas mehr Blur für beide Modi */
@media (min-width: 1024px) {
  .fab-overlay.show {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  [data-theme="dark"] .fab-overlay.show {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* ════════════════════════════════════════════════════════════════
   PAGES
   ════════════════════════════════════════════════════════════════ */
.page {
  display: none;
}
.page.active { 
  display: block;
  animation: pageReveal 200ms ease-out both;
}

.page.exiting {
  display: block;
  pointer-events: none;
}
.page.active.exiting {
  animation: pageExit 160ms var(--smooth) both;
}

@keyframes pageReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes pageExit {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateY(-6px); }
}

.anim-card { animation: cardReveal 320ms var(--spring) both; }
.anim-card:nth-child(1) { animation-delay: 0ms; }
.anim-card:nth-child(2) { animation-delay: 55ms; }
.anim-card:nth-child(3) { animation-delay: 110ms; }
.anim-card:nth-child(4) { animation-delay: 165ms; }
@keyframes cardReveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ════════════════════════════════════════════════════════════════
   PAGE HEADER — Standardisiert für alle View/Pages
   ════════════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: transparent;
  border-bottom: 1px solid var(--b1);
  padding: 0 0 24px;
  margin: 0 0 32px;
}

.page-header-content {
  flex: 1;
  min-width: 0;
}

.page-title {
  font-size: 32px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -.06em;
  margin: 0;
  line-height: 1.1;
}

.page-description {
  font-size: 14px;
  color: var(--t3);
  margin: 6px 0 0;
  line-height: 1.4;
  font-weight: 400;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0;
}

.page-header-actions .btn-brand,
.page-header-actions .btn-ghost {
  width: auto;
  padding: 9px 16px;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Desktop */
@media (min-width: 1024px) {
  .page-header {
    padding: 0 0 24px;
    margin: 0 0 32px;
  }
  .page-title {
    font-size: 32px;
  }
}

/* Mobile: Header noch zeigen aber schlanker */
@media (max-width: 1023px) {
  .page-header {
    padding: 0 0 20px;
    margin: 0 0 24px;
  }
  .page-title {
    font-size: 24px;
  }
  .page-description {
    font-size: 13px;
  }
}

/* Page Content Wrapper */
.page-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Projects: primary action on mobile */
.proj-mobile-actions {
  display: none;
}
.proj-mobile-actions .btn-brand {
  margin-top: 0;
}
@media (max-width: 1023px) {
  .proj-mobile-actions {
    display: flex;
  }
  #btn-project-new {
    display: none;
  }
}

/* Settings: gleichmäßige Abstände + mehr Luft */
#page-settings .page-content {
  gap: 18px;
}
#page-settings .sec-lbl {
  margin: 0;
}
#page-settings .slist {
  gap: 8px;
}

.sec-lbl {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase;
  color: var(--t3); margin: 20px 0 10px;
}
.sec-sub {
  margin-top: -24px;
  margin-bottom: -12px;
  font-size: 12px;
  color: var(--t4);
  text-align: right;
}
.sec-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1.5px solid var(--b1); background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
  line-height: 1;
  box-sizing: border-box;
  cursor: pointer; color: var(--t3);
  box-shadow: var(--s-xs);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.sec-btn svg { width: 18px; height: 18px; display: block; }
.sec-btn.loading {
  pointer-events: none;
  position: relative;
  color: transparent;
}
.sec-btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--brand);
  border-top-color: transparent;
  border-radius: 50%;
  animation: btnSpin 0.6s linear infinite;
}
.sec-btn.loading svg { opacity: 0; }
.sec-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.sec-btn:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--s-sm);
}
.sec-btn:active { transform: scale(0.96); box-shadow: var(--s-xs); }
.sec-btn:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
}

/* Section header action buttons (e.g. in sec-lbl) */
.sec-lbl .btn-ghost,
.sec-lbl .btn-brand {
  width: auto;
  margin-top: 0;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: var(--r-xs);
  text-transform: none;
  letter-spacing: -.01em;
}
.sec-lbl .btn-ghost svg,
.sec-lbl .btn-brand svg {
  width: 16px;
  height: 16px;
}

/* Searchbar + Chips (Dashboard/Listen, Butler Quick Actions) */
.searchbar {
  background: var(--bg-card);
  border: 1.5px solid var(--b1);
  border-radius: var(--r-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--s-xs);
}
.searchbar svg {
  width: 18px;
  height: 18px;
  color: var(--t3);
  flex-shrink: 0;
}
.searchbar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font);
  font-size: 14px;
  color: var(--t1);
}
.searchbar input::placeholder { color: var(--t4); }
.searchbar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.chips {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding: 2px 2px;
  -webkit-overflow-scrolling: touch;
}
.chip {
  border: 1px solid var(--b1);
  background: var(--bg-card);
  color: var(--t2);
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.chip:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--t1); }
.chip:active { transform: scale(0.97); }
.chip:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
}

/* Chips as action buttons (Admin, inline actions) */
.chip.danger {
  border-color: var(--err);
  color: var(--err);
}
.chip.danger:hover {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
}
.chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#admin-section #admin-users {
  margin-top: 10px;
}

.butler-chips {
  padding: 10px 12px;
  border-bottom: 1px solid var(--b1);
  background: var(--bg-modal);
}

/* Invoice Draft Editor */
#inv-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-paper {
  width: 100%;
}

/* Hide classic form fields in document mode (paper handles interactions) */
.moverlay.inv-overlay.inv-mode-doc #inv-form-fields,
.inv-sheet.inv-mode-doc #inv-form-fields {
  display: none;
}
.moverlay.inv-overlay.inv-mode-doc #inv-add-free,
.inv-sheet.inv-mode-doc #inv-add-free {
  display: none;
}

/* Document: add position row inside paper */
.inv-doc-addrow {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--b1);
}
.inv-doc-add {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid var(--b1);
  background: var(--bg-card);
  color: var(--t2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.inv-doc-add svg { width: 18px; height: 18px; }
.inv-doc-add:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--brand); }
.inv-doc-add:active { transform: scale(0.98); }
.inv-doc-add:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }

/* In-sheet picker panel (customer list / item add) */
.inv-sheet { position: relative; }
.inv-doc-panel {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: flex-end;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.inv-doc-panel.show { display: flex; animation: fadeIn 180ms ease; }
.inv-doc-panel-sheet {
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
}
.inv-doc-panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.inv-doc-panel-title {
  font-size: 14px;
  font-weight: 900;
  letter-spacing: -.02em;
  color: var(--t1);
}
.inv-doc-panel-body .slist { gap: 8px; }
.inv-doc-panel-body .srow { box-shadow: var(--s-xs); }
@media (min-width: 768px) {
  .inv-doc-panel {
    align-items: center;
    justify-content: center;
    padding: 14px;
  }
  .inv-doc-panel-sheet {
    width: min(720px, calc(100% - 28px));
    border-radius: var(--r-xl);
  }
}

.inv-doc-customer {
  margin-bottom: 16px;
}
.inv-doc-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}
.inv-doc-meta {
  text-align: right;
  min-width: 180px;
}
.inv-doc-meta-title {
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.03em;
  color: var(--t1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.beta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-wash);
  border: 1px solid var(--brand-ring);
  color: var(--brand);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .9px;
  text-transform: uppercase;
  white-space: nowrap;
}
.inv-doc-meta-line {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--t3);
  line-height: 1.25;
}

.inv-doc-cust-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--t4);
  margin-bottom: 4px;
}
.inv-doc-cust-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--t1);
  letter-spacing: -.02em;
}
.inv-doc-cust-lines {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--t3);
  line-height: 1.35;
}

.inv-doc-cust-actions {
  margin-top: 10px;
}
.inv-doc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1.5px solid var(--b1);
  background: var(--bg-card);
  color: var(--t2);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), color var(--t-fast);
}
.inv-doc-btn:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--brand); }
.inv-doc-btn:active { transform: scale(0.98); }
.inv-doc-btn:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }

@media (max-width: 639px) {
  .inv-doc-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .inv-doc-meta {
    text-align: left;
    min-width: 0;
  }
  .inv-doc-meta-title {
    justify-content: flex-start;
  }
}

.inv-tools {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: var(--s-xs);
}
.inv-tools .field { margin-bottom: 0; }
.inv-tools-actions {
  display: flex;
  gap: 10px;
}
.inv-tools-actions .btn-ghost {
  margin-top: 0;
  width: 100%;
}
@media (min-width: 640px) {
  .inv-tools {
    flex-direction: row;
    align-items: flex-end;
  }
  .inv-tools > .field { flex: 1; }
  .inv-tools-actions { flex-shrink: 0; }
  .inv-tools-actions .btn-ghost { width: auto; }
}

.inv-item {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 12px;
  box-shadow: var(--s-xs);
}
.inv-row-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.inv-done {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--brand-ring);
  background: var(--brand-wash);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.inv-done:hover { background: var(--brand-tint); border-color: var(--brand); }
.inv-done:active { transform: scale(0.95); }
.inv-done svg { width: 18px; height: 18px; stroke-width: 2.2; }

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-stepper input {
  flex: 1;
  text-align: center;
  padding-left: 10px;
  padding-right: 10px;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-stepper input {
  -moz-appearance: textfield;
}
.qty-unit {
  font-size: 12px;
  font-weight: 800;
  color: var(--t3);
  white-space: nowrap;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--b1);
}
.moverlay.inv-overlay:not(.inv-mode-doc) .qty-unit { display: none; }
.qty-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--b1);
  background: var(--bg-card);
  color: var(--t2);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.qty-btn:hover { background: var(--bg-hover); border-color: var(--b2); color: var(--brand); }
.qty-btn:active { transform: scale(0.94); }
.qty-btn:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; }
.inv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (max-width: 639px) {
  .inv-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .inv-grid .field:first-child {
    grid-column: 1 / -1;
  }
  .inv-grid .field.inv-qty-field {
    grid-column: 1 / -1;
  }
  .inv-row-actions {
    grid-column: 2;
    justify-self: end;
  }
}
@media (min-width: 640px) {
  .inv-grid {
    grid-template-columns: 1.4fr .55fr .8fr auto;
    align-items: end;
  }
}
.inv-grid .field { margin-bottom: 0; }

  /* Help-FAB (Desktop): Kontext-Hilfe Picker */
  .fab-help {
    display: none;
    position: absolute;
    right: calc(var(--fab-size) + var(--fab-size) + 24px);
    bottom: 0;
    width: var(--fab-size);
    height: var(--fab-size);
    border-radius: 17px;
    background: var(--bg-modal);
    border: 1px solid var(--b1);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--brand);
    box-shadow: var(--s-md);
    transition: all var(--t-fast);
    overflow: hidden;
    pointer-events: auto;
  }
  .fab-help::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(37,99,235,.04);
    opacity: 0;
    transition: opacity var(--t-fast);
  }
  .fab-help:hover::before { opacity: 1; }
  .fab-help:hover {
    background: var(--bg-hover);
    border-color: var(--b2);
    box-shadow: var(--s-lg);
    transform: translateY(-3px);
  }
  .fab-help:active { transform: scale(0.92); }
  .fab-help:focus-visible {
    outline: 3px solid var(--brand-ring);
    outline-offset: 3px;
  }
  .fab-help svg { width: 24px; height: 24px; stroke-width: 2; }

  @media (min-width: 1024px) {
    .fab-help { display: flex; }
  }
.inv-remove {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--b1);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--err);
  transition: background var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.inv-remove:hover { background: var(--err-bg); border-color: rgba(220,38,38,.30); }
.inv-remove:active { transform: scale(0.95); }
.inv-remove svg { width: 18px; height: 18px; stroke-width: 2; }

/* Document rows (readable invoice-like list) */
.inv-doc-row { cursor: pointer; }
.inv-doc-row:hover { background: var(--bg-hover); }
.inv-doc-grid {
  display: grid;
  grid-template-columns: 1.4fr .55fr .8fr auto;
  gap: 10px;
  align-items: center;
}
.inv-doc-desc {
  font-weight: 800;
  color: var(--t1);
}
.inv-doc-empty { color: var(--t4); }
.inv-doc-qty {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--t2);
  font-weight: 700;
}
.inv-doc-price {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--t1);
  font-weight: 800;
}
@media (max-width: 639px) {
  .inv-doc-grid {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "desc del"
      "qty del"
      "price del";
    gap: 6px 10px;
    align-items: start;
  }
  .inv-doc-desc { grid-area: desc; }
  .inv-doc-qty { grid-area: qty; text-align: left; color: var(--t3); }
  .inv-doc-price { grid-area: price; text-align: left; }
  .inv-doc-grid .inv-remove { grid-area: del; align-self: start; justify-self: end; }
}

/* Invoice Editor: Dokument-Ansicht (Word-artig) */
.inv-doc-headrow { display: none; }

.moverlay.inv-overlay.inv-mode-doc .inv-sheet {
  background: var(--bg-app);
}
.inv-sheet.inv-mode-doc {
  background: var(--bg-app);
}
.moverlay.inv-overlay.inv-mode-doc .sh-title,
.moverlay.inv-overlay.inv-mode-doc .sh-desc,
.inv-sheet.inv-mode-doc .sh-title,
.inv-sheet.inv-mode-doc .sh-desc {
  display: none;
}

/* A4-like paper within the sheet */
.moverlay.inv-overlay.inv-mode-doc .inv-paper,
.inv-sheet.inv-mode-doc .inv-paper {
  max-width: 794px; /* A4 width at 96dpi */
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  padding: 22px 22px;
  box-shadow: var(--s-xl);
}
@media (min-width: 640px) {
  .moverlay.inv-overlay.inv-mode-doc .inv-paper,
  .inv-sheet.inv-mode-doc .inv-paper {
    min-height: 1123px; /* A4 height at 96dpi */
  }
}

/* Make the floating invoice panel wide enough for an A4 preview on desktop */
@media (min-width: 768px) {
  .moverlay.inv-overlay.inv-mode-doc .inv-sheet {
    width: min(940px, calc(100vw - 44px));
  }
}
.moverlay.inv-overlay.inv-mode-doc .inv-tools {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}
.inv-sheet.inv-mode-doc .inv-tools {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}
.moverlay.inv-overlay.inv-mode-doc #inv-items {
  gap: 0;
}
.inv-sheet.inv-mode-doc #inv-items {
  gap: 0;
}
.moverlay.inv-overlay.inv-mode-doc .inv-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--b1);
  border-radius: 0;
  padding: 12px 0;
  box-shadow: none;
}
.inv-sheet.inv-mode-doc .inv-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--b1);
  border-radius: 0;
  padding: 12px 0;
  box-shadow: none;
}
.moverlay.inv-overlay.inv-mode-doc .inv-item:first-child {
  border-top: 1px solid var(--b1);
}
.inv-sheet.inv-mode-doc .inv-item:first-child {
  border-top: 1px solid var(--b1);
}
.moverlay.inv-overlay.inv-mode-doc .field input,
.moverlay.inv-overlay.inv-mode-doc .field select {
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--b1);
  border-radius: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}
.inv-sheet.inv-mode-doc .field input,
.inv-sheet.inv-mode-doc .field select {
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--b1);
  border-radius: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}
.moverlay.inv-overlay.inv-mode-doc .field input:hover,
.moverlay.inv-overlay.inv-mode-doc .field select:hover {
  border-bottom-color: var(--b2);
}
.inv-sheet.inv-mode-doc .field input:hover,
.inv-sheet.inv-mode-doc .field select:hover {
  border-bottom-color: var(--b2);
}
.moverlay.inv-overlay.inv-mode-doc .field input:focus,
.moverlay.inv-overlay.inv-mode-doc .field select:focus {
  border-bottom-color: var(--brand);
  box-shadow: 0 4px 0 -2px var(--brand);
}
.inv-sheet.inv-mode-doc .field input:focus,
.inv-sheet.inv-mode-doc .field select:focus {
  border-bottom-color: var(--brand);
  box-shadow: 0 4px 0 -2px var(--brand);
}

.moverlay.inv-overlay.inv-mode-doc .qty-stepper input {
  padding-left: 10px;
  padding-right: 10px;
}
.inv-sheet.inv-mode-doc .qty-stepper input {
  padding-left: 10px;
  padding-right: 10px;
}

@media (min-width: 640px) {
  .moverlay.inv-overlay.inv-mode-doc .inv-grid .field label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .moverlay.inv-overlay.inv-mode-doc .inv-doc-headrow {
    display: grid;
    grid-template-columns: 1.4fr .55fr .8fr auto;
    align-items: end;
    gap: 10px;
    padding: 0 0 8px;
    margin: 14px 0 2px;
    border-bottom: 1px solid var(--b1);
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--t3);
  }
  .inv-sheet.inv-mode-doc .inv-doc-headrow {
    display: grid;
    grid-template-columns: 1.4fr .55fr .8fr auto;
    align-items: end;
    gap: 10px;
    padding: 0 0 8px;
    margin: 14px 0 2px;
    border-bottom: 1px solid var(--b1);
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: var(--t3);
  }
}

/* Butler/Dashboard Pulse Highlight */
.butler-pulse {
  position: relative;
  z-index: 30;
  animation: butlerPulse 1.15s var(--smooth) 2;
}
@keyframes butlerPulse {
  0% { box-shadow: 0 0 0 0 var(--brand-ring), var(--s-xs); }
  40% { box-shadow: 0 0 0 6px var(--brand-ring), var(--s-md); }
  100% { box-shadow: 0 0 0 0 var(--brand-ring), var(--s-xs); }
}

/* ════════════════════════════════════════════════════════════════
   WELCOME HERO CARD
   Starker Blau-Gradient mit lebendigem Glanz-Overlay
   ════════════════════════════════════════════════════════════════ */
.welcome {
  background: linear-gradient(140deg, var(--brand) 0%, var(--brand-hover) 55%, var(--brand-deep) 100%);
  border-radius: var(--r-lg); padding: 20px 18px 17px; margin-bottom: 14px;
  position: relative; overflow: hidden;
  box-shadow: 0 10px 28px var(--brand-glow), var(--s-md);
}
/* Dezentes Mesh-Muster */
.welcome::before {
  content: ''; position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 85% 20%, rgba(255,255,255,.12) 0%, transparent 60%),
              radial-gradient(ellipse at 10% 90%, rgba(255,255,255,.07) 0%, transparent 50%);
  pointer-events: none;
}
.welcome::after {
  content: ''; position: absolute;
  bottom: -20px; right: 20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  pointer-events: none;
}
.welcome h2 { font-size: 18px; font-weight: 700; color: #fff; margin-bottom: 3px; letter-spacing: -.025em; position: relative; }
.welcome p { font-size: 13px; color: rgba(255,255,255,.65); position: relative; }
.conn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.14); border-radius: 100px;
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: rgba(255,255,255,.9); margin-top: 11px; position: relative;
  backdrop-filter: blur(4px);
}
.cdot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* Dashboard: Quick-Setup Buttons in Welcome Card */
.conn-actions {
  margin-top: 10px;
  flex-wrap: wrap;
  overflow: visible;
}

.welcome .conn-actions .chip {
  background: rgba(255,255,255,.14);
  border-color: rgba(255,255,255,.22);
  color: rgba(255,255,255,.92);
}
.welcome .conn-actions .chip:hover {
  background: rgba(255,255,255,.20);
  border-color: rgba(255,255,255,.32);
  color: rgba(255,255,255,.98);
}

/* ════════════════════════════════════════════════════════════════
   HELP — Overview Article
   ════════════════════════════════════════════════════════════════ */
.help-article {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  padding: 16px 14px;
  box-shadow: var(--s-xs);
  margin-bottom: 14px;
}
.help-article h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--t1);
  margin-bottom: 6px;
  letter-spacing: -.02em;
}
.help-article p {
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.45;
  margin-bottom: 10px;
}
.help-article ul {
  margin: 0 0 10px;
  padding-left: 18px;
}
.help-article li {
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.45;
  margin: 6px 0;
}
.help-article .muted {
  color: var(--t3);
  margin-bottom: 0;
}

.help-article a,
.sh-desc a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Test page: Login-look preview (light + dark) */
.lp-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 768px) {
  .lp-grid { grid-template-columns: 1fr 1fr; }
}
.lp {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--s-xs);
}
.lp-head {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--b1);
  color: var(--t2);
}
.lp-stage {
  padding: 18px 14px;
  background: linear-gradient(145deg, var(--brand-deep) 0%, var(--bg-app) 100%);
}
.lp-stage.entering {
  animation: zoomInBlur 720ms var(--spring) both;
  transform-origin: center;
}
.lp-card {
  max-width: 360px;
  margin: 0 auto;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  padding: 18px 16px 14px;
  box-shadow: var(--s-lg);
}
.lp-card .field { margin-bottom: 12px; }
.lp-card .btn-brand { margin-top: 12px; }

/* ════════════════════════════════════════════════════════════════
   STAT CARDS
   ════════════════════════════════════════════════════════════════ */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.stat-card {
  background: var(--bg-card); border-radius: var(--r-md); padding: 14px;
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--b1); box-shadow: var(--s-xs); cursor: pointer;
  transition: transform 160ms var(--smooth), box-shadow 160ms, border-color 160ms;
  min-width: 0;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--s-md); border-color: var(--brand); }
.stat-card:active { transform: translateY(-1px); box-shadow: var(--s-xs); }
.stat-icon { width: 40px; height: 40px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 18px; height: 18px; stroke-width: 1.8; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--t1); line-height: 1; letter-spacing: -.04em; }
.stat-label { font-size: 11px; color: var(--t3); margin-top: 3px; line-height: 1.3; word-break: break-word; }

/* ════════════════════════════════════════════════════════════════
   DASHBOARD — Accordions (Belege / Diskussion)
   ════════════════════════════════════════════════════════════════ */
.dash-acc {
  margin-top: 12px;
}
.dash-acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  box-shadow: var(--s-xs);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.dash-acc > summary::-webkit-details-marker { display: none; }
.dash-acc > summary:hover {
  background: var(--brand-wash);
  border-color: var(--brand);
  box-shadow: var(--s-sm);
}
.dash-acc > summary:active { transform: scale(0.998); }
.dash-acc[open] > summary {
  border-color: var(--b2);
  box-shadow: var(--s-sm);
}
.dash-acc-left { min-width: 0; }
.dash-acc-title {
  font-size: 12.5px;
  font-weight: 950;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--t2);
}
.dash-acc-sub {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--t3);
  letter-spacing: -0.01em;
  text-transform: none;
}
.dash-acc-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--t3);
  flex-shrink: 0;
}
.dash-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--b1);
  font-size: 12px;
  font-weight: 900;
  color: var(--t2);
}
.dash-acc-chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--t-fast), color var(--t-fast);
}
.dash-acc[open] > summary .dash-acc-chevron {
  transform: rotate(180deg);
  color: var(--brand);
}
.dash-acc-body {
  padding: 10px 2px 0;
}
.dash-acc-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
.dash-acc-actions .btn-ghost,
.dash-acc-actions .btn-brand {
  width: auto;
  margin-top: 0;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: var(--r-xs);
}

.dash-subhdr {
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--t3);
  text-align: left;
}

/* Dashboard discussion rows */
.dash-msg {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dash-msg-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.dash-msg-who {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--t1);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-msg-time {
  font-size: 12px;
  font-weight: 700;
  color: var(--t4);
  flex-shrink: 0;
}
.dash-msg-snippet {
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

/* Upload queue bulk selection */
.qbulk {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  box-shadow: var(--s-xs);
}
.qbulk.show { display: flex; }
.qbulk-left {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--t2);
}
.qbulk-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.qbulk-actions .btn-ghost {
  width: auto;
  margin-top: 0;
  padding: 7px 10px;
  font-size: 12px;
  border-radius: var(--r-xs);
}

.qi.bulk {
  cursor: pointer;
}
.qi.bulk .qi-action {
  display: none;
}
.qi-bulk {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1.5px solid var(--b1);
  background: var(--bg-modal);
  color: var(--t4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 950;
  box-shadow: var(--s-xs);
  flex-shrink: 0;
}
.qi.selected {
  border-color: var(--brand);
  background: var(--brand-wash);
}
.qi.selected .qi-bulk {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--t-inv);
}

/* Discussion: admin delete */
.dvbtn.del {
  background: var(--err-bg);
  border-color: rgba(220,38,38,.22);
  color: var(--err);
}
.dvbtn.del:hover {
  border-color: rgba(220,38,38,.38);
  box-shadow: var(--s-sm);
}

/* ════════════════════════════════════════════════════════════════
   QUICK GRID (qcard)
   ════════════════════════════════════════════════════════════════ */
.qgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.qcard {
  background: var(--bg-card); border-radius: var(--r-md); padding: 14px;
  display: flex; gap: 11px; border: 1px solid var(--b1);
  box-shadow: var(--s-xs); cursor: pointer;
  transition: transform 160ms var(--smooth), box-shadow 160ms, border-color 160ms;
  min-width: 0;
}
.qcard:hover { transform: translateY(-3px); box-shadow: var(--s-md); border-color: var(--brand); }
.qcard:active { transform: translateY(-1px); box-shadow: var(--s-xs); }
.qcard.dim { opacity: 0.35; pointer-events: none; }
.ic { width: 35px; height: 35px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic svg { width: 15px; height: 15px; stroke-width: 1.8; }
.qc-name { font-size: 13px; font-weight: 700; color: var(--t1); letter-spacing: -.01em; word-break: break-word; }
.qc-sub { font-size: 11px; color: var(--t3); margin-top: 2px; word-break: break-word; }

/* ════════════════════════════════════════════════════════════════
   ACTIVITY ROWS
   ════════════════════════════════════════════════════════════════ */
.a-list { display: flex; flex-direction: column; gap: 8px; }
.a-row {
  background: var(--bg-card); border-radius: var(--r-md); padding: 14px 15px;
  display: flex; align-items: center; gap: 13px;
  border: 1.5px solid var(--b1); cursor: pointer; box-shadow: var(--s-sm);
  transition: all var(--t-fast);
  position: relative;
  overflow: hidden;
}
.a-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.a-row:hover::before { opacity: 1; }
.a-row:hover { 
  border-color: var(--brand-ring); 
  background: var(--brand-wash); 
  box-shadow: var(--s-md); 
  transform: translateY(-1px);
}
.a-row .ic { 
  width: 40px; 
  height: 40px; 
  border-radius: var(--r-sm); 
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.a-row .ic svg { width: 18px; height: 18px; stroke-width: 1.8; }
.a-info { flex: 1; min-width: 0; }
.a-name { 
  font-size: 14px; 
  font-weight: 600; 
  color: var(--t1); 
  margin-bottom: 4px;
  line-height: 1.3;
}
.a-meta { 
  font-size: 12px; 
  color: var(--t3); 
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.a-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.a-right { 
  text-align: right; 
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.a-val { 
  font-size: 15px; 
  font-weight: 700; 
  color: var(--t1);
  letter-spacing: -0.01em;
}
.badge { 
  display: inline-block; 
  font-size: 10px; 
  font-weight: 700; 
  padding: 4px 9px; 
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.net-badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  user-select: none;
  flex-shrink: 0;
}
.sidebar-brand .net-badge { margin-left: auto; }
.b-green { background: var(--ok-bg); color: var(--ok); }
.b-orange { background: var(--warn-bg); color: var(--warn); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-red { background: var(--err-bg); color: var(--err); }
.b-blue { background: var(--info-bg); color: var(--info); }

@media (max-width: 640px) {
  /* Admin user list: keep badges, but avoid cramped rows on mobile */
  #admin-users .a-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  #admin-users .a-right {
    flex-basis: 100%;
    width: 100%;
    text-align: left;
    align-items: flex-start;
    margin-top: 10px;
    /* align actions under the text (icon width + gap) */
    padding-left: calc(40px + 13px);
  }
  #admin-users .admin-actions {
    justify-content: flex-start;
  }
  #admin-users .a-meta {
    gap: 6px;
  }
  #admin-users .a-meta .a-email {
    word-break: break-all;
  }
  #admin-users .a-meta .a-badges {
    flex-basis: 100%;
  }
  #admin-users .badge {
    font-size: 9px;
    padding: 3px 8px;
  }
}

/* ════════════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════════════ */
.empty { text-align: center; padding: 38px 14px; }
.empty .ei {
  width: 48px; height: 48px; background: var(--bg-hover); border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; color: var(--t4);
  transition: transform var(--t-fast);
}
.empty:hover .ei { transform: scale(1.08) rotate(-4deg); }
.empty .ei svg { width: 22px; height: 22px; stroke-width: 1.4; }
.empty h3 { font-size: 14px; font-weight: 600; color: var(--t2); margin-bottom: 4px; }
.empty p { font-size: 12.5px; color: var(--t3); line-height: 1.6; }
.empty-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.empty-actions .btn-brand,
.empty-actions .btn-ghost {
  width: auto;
  margin-top: 0;
}

/* ════════════════════════════════════════════════════════════════
   UPLOAD PAGE
   ════════════════════════════════════════════════════════════════ */
.email-strip {
  background: var(--bg-card); border: 1.5px solid var(--ok-bg); border-radius: var(--r-md);
  padding: 10px 13px; display: flex; align-items: center; gap: 11px; margin-bottom: 12px;
}
.email-strip .ic { background: var(--ok-bg); color: var(--ok); }
.es-lbl { font-size: 10px; color: var(--t3); font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.es-val { font-size: 13px; font-weight: 700; color: var(--t1); word-break: break-all; }
.warn {
  background: var(--warn-bg); border: 1.5px solid rgba(217,119,6,.2);
  border-radius: var(--r-md); padding: 10px 13px; margin-bottom: 12px;
  font-size: 13px; color: var(--warn); line-height: 1.55;
}
.cam-btn {
  width: 100%; background: var(--bg-card); border: 1.5px solid var(--b1);
  border-radius: var(--r-md); padding: 13px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: 13.5px; font-weight: 700; color: var(--brand);
  cursor: pointer; margin-bottom: 10px; box-shadow: var(--s-xs);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.cam-btn:hover { background: var(--brand-wash); border-color: var(--brand); }
.cam-btn:active { transform: scale(0.98); }
.cam-btn svg { width: 18px; height: 18px; stroke-width: 2; }

.dz {
  border: 2px dashed var(--b2); border-radius: var(--r-md); padding: 28px 14px;
  text-align: center; background: var(--bg-card); cursor: pointer;
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-fast);
  margin-bottom: 12px;
}
.dz:hover, .dz.over, .dz.dragover { border-color: var(--brand); background: var(--brand-wash); transform: scale(1.01); }
.dz-ic {
  width: 44px; height: 44px; margin: 0 auto 10px;
  background: var(--brand-wash); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; color: var(--brand);
  transition: transform var(--t-fast);
}
.dz:hover .dz-ic, .dz.dragover .dz-ic { transform: translateY(-5px) scale(1.12); }
.dz-ic svg { width: 20px; height: 20px; stroke-width: 1.6; }
.dz h3 { font-size: 13.5px; font-weight: 700; color: var(--t1); margin-bottom: 3px; }
.dz p { font-size: 12px; color: var(--t3); }
.dz-hint {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--t4);
  letter-spacing: 0.2px;
}
.type-chips { margin-top: 10px; display: flex; justify-content: center; gap: 5px; flex-wrap: wrap; }
.tc { padding: 2px 7px; border-radius: var(--r-xs); font-size: 10px; font-weight: 700; background: var(--bg-hover); color: var(--t3); }

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

@media (max-width: 640px) {
  /* Make room for FAB so queue action buttons remain tappable */
  .uq { padding-bottom: 110px; }
}
.qi {
  background: var(--bg-card); border-radius: var(--r-sm); padding: 11px 12px;
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--b1); animation: cardReveal 280ms var(--spring) both;
  box-shadow: var(--s-xs);
}
.qi .ic {
  width: 50px;
  height: 50px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
}
.qi .ic svg { width: 20px; height: 20px; stroke-width: 1.8; }
.qi-preview {
  width: 50px; height: 50px; border-radius: var(--r-sm);
  background-size: cover; background-position: center; flex-shrink: 0; border: 1px solid var(--b1);
}
.qi-info { flex: 1; min-width: 0; }
.qi-name { font-size: 13px; font-weight: 600; color: var(--t1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qi-meta { font-size: 11px; color: var(--t3); margin-top: 2px; }
.qi-action {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--b1);
  background: var(--bg-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t2);
  flex-shrink: 0;
  box-shadow: var(--s-xs);
  transition: background var(--t-fast), transform var(--t-fast), color var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.qi-action:hover { background: var(--bg-hover); }
.qi-action:active { transform: scale(0.92); }
.qi-action svg { width: 18px; height: 18px; stroke-width: 2; }
.qi-send { color: var(--brand); }
.qi-del { color: var(--err); }

/* Deutlichere States für Queue Buttons */
.qi-action.qi-send {
  background: var(--brand-wash);
  border-color: var(--brand-ring);
  color: var(--brand);
}
.qi-action.qi-send:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
  box-shadow: var(--s-sm);
}

.qi-action.qi-del {
  background: var(--err-bg);
  border-color: rgba(220,38,38,.22);
  color: var(--err);
}
.qi-action.qi-del:hover {
  border-color: rgba(220,38,38,.38);
  box-shadow: var(--s-sm);
}
.prog { height: 2px; background: var(--b1); border-radius: 2px; margin-top: 7px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--brand); border-radius: 2px; transition: width 280ms ease; }
.prog-fill.uploading {
  width: 45%;
  animation: progIndet 1.05s var(--smooth) infinite;
}
@keyframes progIndet {
  0% { transform: translateX(-150%); }
  100% { transform: translateX(350%); }
}
@media (prefers-reduced-motion: reduce) {
  .prog-fill.uploading { animation: none; width: 60%; transform: none; }
}

/* ════════════════════════════════════════════════════════════════
   SETTINGS — Cards & Lists (standardisiert)
   ════════════════════════════════════════════════════════════════ */
.slist { display: flex; flex-direction: column; gap: 3px; }
.srow {
  background: var(--bg-card); border-radius: var(--r-sm); padding: 11px 12px;
  display: flex; align-items: center; gap: 11px;
  border: 1px solid var(--b1); cursor: pointer; box-shadow: var(--s-xs);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.srow:hover { border-color: var(--brand); background: var(--brand-wash); box-shadow: var(--s-sm); }
.srow:active { transform: scale(0.998); }
.srow .ic { width: 30px; height: 30px; border-radius: var(--r-xs); flex-shrink: 0; }
.srow .ic svg { width: 14px; height: 14px; stroke-width: 1.8; }
.sr-lbl { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--t1); }
.sr-val { font-size: 12px; color: var(--t3); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.sr-arr { color: var(--t4); flex-shrink: 0; transition: transform var(--t-fast), color var(--t-fast); }
.srow:hover .sr-arr { transform: translateX(2px); color: var(--brand); }
.sr-arr svg { width: 13px; height: 13px; stroke-width: 2.2; }
.srow.dim { opacity: 0.35; pointer-events: none; }
.srow.disabled { opacity: 0.55; }
.srow.disabled:hover { border-color: var(--b1); background: var(--bg-card); box-shadow: var(--s-xs); }
.srow.danger { border-color: rgba(220,38,38,.18); }
.srow.danger:hover { background: var(--err-bg); border-color: rgba(220,38,38,.38); }
.srow.danger .sr-lbl { color: var(--err); }

/* Settings: Update/Changelog box */
.update-box {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 12px 13px;
  box-shadow: var(--s-xs);
}
.update-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.update-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--t1);
  letter-spacing: -.01em;
}
.update-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--t3);
  font-weight: 600;
}
.update-body {
  margin-top: 10px;
  font-size: 13px;
  color: var(--t2);
  line-height: 1.55;
  word-break: break-word;
}

/* Theme-Toggle Pill in der Settings-Row */
.theme-pill {
  display: flex; align-items: center;
  background: var(--bg-hover); border-radius: 100px;
  border: 1px solid var(--b1); overflow: hidden; flex-shrink: 0;
}
.theme-pill-opt {
  padding: 5px 10px; font-size: 11.5px; font-weight: 600; color: var(--t3);
  cursor: pointer; border: none; background: none; font-family: var(--font);
  transition: all var(--t-fast); border-radius: 100px;
}
.theme-pill-opt.active { background: var(--bg-card); color: var(--t1); box-shadow: var(--s-sm); }

/* ════════════════════════════════════════════════════════════════
   MODALS / BOTTOM SHEETS
   ════════════════════════════════════════════════════════════════ */
.moverlay {
  position: fixed; inset: 0; z-index: 400; background: var(--bg-overlay);
  display: none; align-items: flex-end;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.moverlay.show { display: flex; animation: fadeIn 180ms ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  background: var(--bg-modal); border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%; padding: 20px 18px calc(24px + env(safe-area-inset-bottom));
  animation: sheetUp 260ms var(--spring);
  max-height: 82vh; overflow-y: auto; box-shadow: var(--s-xl);
  border-top: 1px solid var(--b1);
}

/* Rechnungs‑Tetris (Highlight) */
.moverlay.tetris-overlay {
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.sheet.tetris-sheet {
  width: min(560px, calc(100vw - 28px));
  height: calc(100vh - 28px);
  height: calc(100dvh - 28px);
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  border-radius: var(--r-xl);
  border: 1px solid var(--b1);
  padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tetris-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 0 12px;
  border-bottom: 1px solid var(--b1);
}

.tetris-title {
  font-size: 16px;
  font-weight: 950;
  color: var(--t1);
  letter-spacing: -.02em;
  line-height: 1.15;
}

.tetris-scoreline {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--t3);
  line-height: 1.45;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.tetris-body {
  flex: 1;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tetris-ui {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.tetris-ui.show {
  display: flex;
}

.tetris-card {
  width: min(420px, 100%);
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-lg);
  padding: 16px 14px;
  text-align: center;
}

.tetris-card-title {
  font-size: 16px;
  font-weight: 950;
  color: var(--t1);
  letter-spacing: -.02em;
  line-height: 1.15;
}

.tetris-card-sub {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--t3);
  line-height: 1.45;
  font-weight: 800;
}

.tetris-card-meta {
  margin-top: 10px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 900;
  color: var(--t2);
  font-variant-numeric: tabular-nums;
}

.tetris-card .btn-brand,
.tetris-card .btn-ghost {
  width: 100%;
  justify-content: center;
}

#tetris-canvas {
  background: var(--brand-wash);
  border: 1.5px solid var(--b2);
  border-radius: 0;
  box-shadow: var(--s-md);
  touch-action: none;
  display: block;
}

@media (min-width: 768px) {
  .moverlay.tetris-overlay .sheet.tetris-sheet {
    height: min(760px, calc(100vh - 28px));
    padding: 20px 20px 22px;
  }
}

/* Stopwatch (Premium Timer View) */
.sw-sheet {
  background: var(--bg-modal);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  width: 100%;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  animation: sheetUp 260ms var(--spring);
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--s-xl);
  border-top: 1px solid var(--b1);
}
.sw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 2px 0 16px;
  border-bottom: 1px solid var(--b1);
}
.sw-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--t1);
  letter-spacing: -.02em;
  line-height: 1.15;
}
.sw-desc {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--t3);
  line-height: 1.45;
}
.sw-body {
  padding-top: 16px;
}
.sw-display {
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-sm);
  padding: 18px 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 44px;
  font-weight: 950;
  letter-spacing: -.06em;
  color: var(--t1);
}
.sw-sub {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--t3);
  font-weight: 800;
}
.sw-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}
.sw-actions .btn-brand,
.sw-actions .btn-ghost {
  flex: 1;
  justify-content: center;
  padding: 12px 16px;
  font-size: 14px;
}

@media (min-width: 768px) {
  .moverlay.sw-overlay {
    align-items: center;
    justify-content: center;
    padding: 14px;
  }
  .sw-sheet {
    width: min(560px, calc(100vw - 28px));
    border-radius: var(--r-xl);
    border: 1px solid var(--b1);
    padding: 22px 22px 24px;
  }
  .sw-display {
    font-size: 54px;
    padding: 22px 18px;
  }
}

/* Login Info Overlay: desktop as centered dialog */
@media (min-width: 768px) {
  .moverlay.li-info-overlay {
    align-items: center;
    justify-content: center;
    padding: 14px;
  }
  .moverlay.li-info-overlay .li-info-sheet {
    width: min(560px, calc(100vw - 28px));
    border-radius: var(--r-xl);
    border: 1px solid var(--b1);
  }
}

/* Invoice Draft: Desktop als „über dem FAB“ schwebendes Panel */
.moverlay.inv-overlay {
  justify-content: flex-end;
  padding: 14px;
}
.moverlay.inv-overlay .inv-sheet {
  width: min(560px, calc(100vw - 28px));
  border-radius: var(--r-xl);
  border: 1px solid var(--b1);
}
@media (max-width: 640px) {
  .moverlay.inv-overlay {
    /* Mobile: Abstand zu allen Screen-Rändern + Safe-Area */
    padding: 14px 16px;
    padding: calc(14px + env(safe-area-inset-top))
             calc(16px + env(safe-area-inset-right))
             calc(14px + env(safe-area-inset-bottom))
             calc(16px + env(safe-area-inset-left));
  }
  .moverlay.inv-overlay .inv-sheet {
    width: 100%;
    /* etwas weniger Höhe -> mehr Luft oben */
    max-height: 78vh;
    border-radius: var(--r-xl);
    border: 1px solid var(--b1);
  }
}
@media (min-width: 1024px) {
  .moverlay.inv-overlay {
    padding: 22px;
  }
  .moverlay.inv-overlay .inv-sheet {
    margin-bottom: 76px;
  }
}

/* Butler chat (floating chat window) */
.moverlay.butler-overlay {
  align-items: flex-end;
  justify-content: flex-end;
  padding: 14px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.moverlay.butler-overlay.closing {
  animation: fadeOut 220ms var(--smooth) forwards;
}
.moverlay.butler-overlay.closing .butler-panel {
  animation: butlerOut 220ms var(--smooth) forwards;
}
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes butlerOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(0.99); } }
@media (max-width: 640px) {
  .moverlay.butler-overlay {
    padding: 14px 16px;
    padding: calc(14px + env(safe-area-inset-top))
             calc(16px + env(safe-area-inset-right))
             calc(14px + env(safe-area-inset-bottom))
             calc(16px + env(safe-area-inset-left));
    background: var(--bg-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

.butler-panel {
  width: min(440px, calc(100vw - 28px));
  height: min(660px, calc(100vh - var(--bot-h) - env(safe-area-inset-bottom) - 28px));
  background: linear-gradient(135deg, rgba(10, 113, 179, 0.08), rgba(91, 33, 182, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--r-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  will-change: transform, opacity;
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
}
.moverlay.butler-overlay.show .butler-panel {
  animation: butlerPop 220ms var(--smooth);
}
@keyframes butlerPop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 640px) {
  .butler-panel {
    width: 100%;
    height: min(720px, 82vh);
    border-radius: var(--r-xl);
    border: 1px solid var(--b1);
    box-shadow: var(--s-xl);
  }
  .moverlay.butler-overlay.show .butler-panel {
    animation: sheetUp 220ms var(--smooth);
  }
}

.butler-head {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--b1);
  background: linear-gradient(135deg, var(--bg-modal), var(--brand-wash));
  position: relative;
}

@media (min-width: 641px) {
  .butler-head { cursor: grab; }
  .butler-head:active { cursor: grabbing; }
}

@media (max-width: 640px) {
  /* Swipe-down to close: drag handle hint + allow gesture capture */
  .butler-head { touch-action: none; padding-top: 16px; }
  .butler-head::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
  }
}

.butler-head::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--b2), transparent);
}

.butler-head > div:first-child {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.butler-head .sh-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--t1);
  margin: 0;
  line-height: 1.2;
}

.butler-head .sh-desc {
  font-size: 13px;
  color: var(--t2);
  margin: 0;
  line-height: 1.4;
  font-weight: 500;
}

.butler-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

.butler-actions .tb-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--b1);
  border-radius: 10px;
  background: var(--bg-modal);
  color: var(--t2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--s-xs);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.butler-actions .tb-btn:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  color: var(--t1);
  box-shadow: var(--s-sm);
  transform: translateY(-1px);
}

.butler-actions .tb-btn:active {
  transform: scale(0.96);
}

.butler-actions .tb-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.butler-log {
  flex: 1;
  padding: 14px;
  overflow: auto;
  background: linear-gradient(180deg, var(--bg-app), var(--bg-card));
}

.bmsg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 9px 0;
  animation: bmsgIn 200ms var(--spring);
}
@keyframes bmsgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.bmsg.user { justify-content: flex-end; }

.bavatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  background: var(--bg-modal);
  box-shadow: var(--s-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--t3);
}
.bavatar svg { width: 16px; height: 16px; stroke-width: 2; }
.bavatar.assistant {
  background: var(--brand-wash);
  border-color: var(--brand-ring);
  color: var(--brand);
}
.bavatar.user {
  background: var(--bg-hover);
  border-color: var(--b1);
  color: var(--t2);
}

.bubble {
  max-width: min(560px, 92%);
  padding: 10px 12px;
  border-radius: var(--r-2xl);
  border: 1px solid var(--b1);
  background: var(--bg-card);
  color: var(--t1);
  font-size: 13.5px;
  line-height: 1.52;
  white-space: normal;
  word-break: break-word;
  box-shadow: var(--s-xs);
}
.bmsg.assistant .bubble { border-bottom-left-radius: var(--r-sm); }
.bmsg.user .bubble { border-bottom-right-radius: var(--r-sm); }
.bmsg.user .bubble {
  background: linear-gradient(135deg, var(--brand-tint), var(--brand-wash));
  border-color: var(--brand-ring);
}

.bubble.typing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 54px;
  color: var(--t3);
}
.bubble.typing .tdot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
  animation: butlerDot 1s ease-in-out infinite;
}
.bubble.typing .tdot:nth-child(2) { animation-delay: 120ms; }
.bubble.typing .tdot:nth-child(3) { animation-delay: 240ms; }
@keyframes butlerDot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.30; }
  40% { transform: translateY(-3px); opacity: 0.65; }
}

/* Markdown/HTML Content in Bubbles */
.bubble p { margin: 0; }
.bubble p + p { margin-top: 10px; }
.bubble ol, .bubble ul {
  margin: 8px 0 8px 18px;
  padding: 0;
}
.bubble li { margin: 4px 0; }
.bubble code {
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--b1);
  background: var(--bg-card);
}
.bubble pre {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--b1);
  background: var(--bg-card);
  overflow: auto;
}
.bubble pre code {
  padding: 0;
  border: none;
  background: transparent;
}
.bubble a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.butler-input {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--b1);
  background: linear-gradient(0deg, var(--glass-bg), var(--bg-modal));
}
.butler-input input {
  flex: 1;
  border: 1.5px solid var(--b1);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--t1);
  background: var(--bg-input);
  outline: none;
}
.butler-input input:focus {
  border-color: var(--brand);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.butler-input .btn-brand {
  width: auto;
  margin-top: 0;
  padding: 11px 14px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   DISCUSSION (Global Chat)
   ════════════════════════════════════════════════════════════════ */
.disc-panel {
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--s-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  height: min(680px, calc(100dvh - var(--nav-h) - var(--bot-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 110px));
}

.disc-conn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--b1);
  background: linear-gradient(0deg, var(--bg-modal), var(--glass-bg));
}
.disc-conn .badge {
  font-size: 9px;
  padding: 3px 8px;
}

.disc-highlights {
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  background: var(--bg-card);
  box-shadow: var(--s-sm);
  overflow: hidden;
}

.disc-highlights-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--b1);
  background: linear-gradient(0deg, var(--bg-modal), var(--glass-bg));
}

.disc-highlights-title {
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.02em;
  color: var(--t1);
}

.disc-highlights-sub {
  font-size: 12px;
  font-weight: 800;
  color: var(--t3);
  white-space: nowrap;
}

.disc-highlights-list {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.disc-hl {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 10px;
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  background: var(--bg-modal);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.disc-hl:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  box-shadow: var(--s-xs);
  transform: translateY(-1px);
}

.disc-hl:active {
  transform: scale(0.99);
}

.disc-hl-ini {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  background: linear-gradient(135deg, var(--brand-wash), var(--brand-tint));
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.disc-hl-main {
  flex: 1;
  min-width: 0;
}

.disc-hl-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--t3);
}

.disc-hl-who {
  font-weight: 900;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.disc-hl-time {
  font-weight: 800;
  color: var(--t4);
  white-space: nowrap;
}

.disc-hl-text {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--t2);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Desktop layout polish: show highlights beside the chat when present */
@media (min-width: 1024px) {
  #page-discussion.has-highlights .page-content {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 14px;
    align-items: start;
  }
  #page-discussion.has-highlights #disc-highlights { grid-column: 1; }
  #page-discussion.has-highlights #disc-panel { grid-column: 2; }
  #page-discussion.has-highlights .page-content > .sec-sub { grid-column: 1 / -1; }
}

@media (min-width: 1024px) {
  .disc-panel {
    height: min(720px, calc(100vh - 260px));
  }
}

.disc-log {
  flex: 1;
  padding: 14px;
  overflow: auto;
  background: linear-gradient(180deg, var(--bg-app), var(--bg-card));
}

/* Jump-to-latest button (shown when scrolled up) */
.disc-jump {
  position: absolute;
  right: 12px;
  bottom: 86px; /* JS will adjust to sit above input/reply */
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  background: var(--bar-bg);
  color: var(--t1);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 900;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: var(--s-lg);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
  z-index: 4;
}
.disc-jump.show {
  display: inline-flex;
}
.disc-jump:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  transform: translateY(-1px);
}
.disc-jump:active {
  transform: scale(0.98);
}
.disc-jump:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 2px;
}
.disc-jump .dj-count {
  background: var(--brand-wash);
  color: var(--brand);
  border: 1px solid var(--brand-ring);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 950;
  line-height: 1.2;
}

/* Pinned message highlight inside the log */
.disc-log .bmsg.pinned .bubble {
  border-color: var(--brand-ring);
  box-shadow: 0 0 0 2px var(--brand-wash), var(--s-sm);
}

/* Subtle hover polish */
.disc-log .bubble {
  transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.disc-log .bmsg:hover .bubble {
  transform: translateY(-1px);
  box-shadow: var(--s-md);
}

/* Discussion: WhatsApp-like alignment + "tail" towards initials */
.disc-log .bmsg {
  gap: 7px;
}
.disc-log .bmsg.user {
  flex-direction: row-reverse;
  /* row-reverse flips flex-start/end; keep own messages on the right */
  justify-content: flex-start;
}

.disc-log .bmsg:not(.user) .bubble {
  border-bottom-left-radius: var(--r-sm);
  background: var(--bg-modal);
}
.disc-log .bmsg.user .bubble {
  /* keep the small tail corner (base: border-bottom-right-radius) */
  box-shadow: var(--s-sm);
}

.disc-log .bubble {
  box-shadow: var(--s-sm);
  position: relative;
  --d-bub-border: var(--b1);
}
.disc-log .bmsg.user .bubble { --d-bub-border: var(--brand-ring); }

/* Bubble "tail" disabled: looked like a stray triangle between initials + bubble */
.disc-log .bmsg:not(.user) .bubble::before,
.disc-log .bmsg.user .bubble::after {
  content: none;
}

.disc-log .bavatar {
  width: 30px;
  height: 30px;
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--t2);
  background: linear-gradient(135deg, var(--bg-modal), var(--bg-input));
  border-color: var(--b2);
}
.disc-log .bavatar.user {
  background: linear-gradient(135deg, var(--brand-wash), var(--brand-tint));
  border-color: var(--brand-ring);
  color: var(--brand);
}

/* Reply preview bar (shown above input) */
.disc-reply {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--b1);
  background: linear-gradient(0deg, var(--glass-bg), var(--bg-modal));
}
.disc-reply-main {
  flex: 1;
  min-width: 0;
}
.disc-reply-title {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--t3);
}
.disc-reply-snippet {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#disc-panel.has-reply .disc-input,
#disc-panel.has-quote .disc-input {
  border-top: 0;
}

.disc-input {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--b1);
  background: linear-gradient(0deg, var(--glass-bg), var(--bg-modal));
}

.disc-input textarea {
  flex: 1;
  border: 1.5px solid var(--b1);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--t1);
  background: var(--bg-input);
  outline: none;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  line-height: 1.35;
}

.disc-input textarea:focus {
  border-color: var(--brand);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.disc-input .btn-brand {
  width: auto;
  margin-top: 0;
  padding: 11px 14px;
  flex-shrink: 0;
}

.disc-empty {
  color: var(--t3);
  font-size: 13px;
  padding: 12px 6px;
  text-align: center;
}

.dmeta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--t3);
}

.dwho {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.dmeta-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dmeta-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--t4);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}

.dmeta-btn:hover {
  background: var(--bg-hover);
  color: var(--t2);
}

.dmeta-btn:active {
  transform: scale(0.92);
}

.dmeta-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.dmeta-btn.pin.active {
  color: var(--brand);
}

.dmeta-btn.del {
  color: var(--err);
}

.dname {
  font-weight: 800;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duser, .dtime {
  font-weight: 700;
  color: var(--t4);
  white-space: nowrap;
}

.dtext {
  white-space: normal;
}

.dquote {
  border: 1px solid var(--b1);
  border-left: 3px solid var(--brand);
  background: var(--brand-wash);
  border-radius: var(--r-md);
  padding: 7px 9px;
  margin: 0 0 8px;
  color: var(--t2);
  font-size: 12.5px;
  line-height: 1.45;
}
.dquote[data-reply-to] {
  cursor: pointer;
  transition: transform var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.dquote[data-reply-to]:hover {
  border-color: var(--brand-ring);
  background: var(--brand-tint);
}
.dquote[data-reply-to]:active {
  transform: scale(0.99);
}
.bmsg.user .dquote {
  background: var(--bg-card);
  border-color: var(--brand-ring);
}
.dbody:empty { display: none; }

.dvotes {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.dvbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  background: var(--bg-input);
  color: var(--t3);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}

.dvbtn.icononly {
  padding: 6px 8px;
  gap: 0;
}

.dvbtn svg { width: 16px; height: 16px; stroke-width: 1.9; }

.dvbtn:hover {
  background: var(--bg-hover);
  border-color: var(--b2);
  color: var(--t1);
  box-shadow: var(--s-xs);
}

.dvbtn:active { transform: scale(0.97); }

.dvbtn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

.dvbtn.up.active {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

.dvbtn.down.active {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
}

.dvbtn.pin.active {
  background: var(--brand-wash);
  border-color: var(--brand);
  color: var(--brand);
}

.dvbtn .dvlabel {
  font-weight: 900;
}

@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
.sh-title { font-size: 16px; font-weight: 700; color: var(--t1); margin-bottom: 4px; letter-spacing: -.015em; }
.sh-desc { font-size: 13px; color: var(--t3); margin-bottom: 16px; line-height: 1.55; }

/* ════════════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: -96px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(0.985);
  background: var(--bar-bg); color: var(--t1);
  font-size: 13.5px; font-weight: 750; padding: 10px 18px;
  border-radius: 100px; z-index: 500;
  transition: top 320ms var(--spring), opacity 180ms ease, transform 320ms var(--spring), box-shadow var(--t-fast);
  pointer-events: none; opacity: 0;
  box-shadow: var(--s-xl);
  border: 1px solid var(--bar-line);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(560px, calc(100vw - 28px));
  overflow: hidden;
}
.toast .toast-msg {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toast.err .toast-msg {
  white-space: normal;
  text-overflow: clip;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.35;
}
.toast::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
  opacity: 0.92;
}
.toast.loading::before {
  display: inline-block;
  width: 16px;
  height: 16px;
  background: transparent;
  box-shadow: none;
  border: 3px solid var(--brand);
  border-top-color: transparent;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
  opacity: 1;
}
.toast.ok::before {
  display: inline-flex;
  width: 16px;
  height: 16px;
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-content: center;
  content: '✓';
  color: var(--green);
  font-size: 15px;
  font-weight: 950;
}
.toast.err::before {
  display: inline-flex;
  width: 16px;
  height: 16px;
  background: transparent;
  box-shadow: none;
  align-items: center;
  justify-content: center;
  content: '✕';
  color: var(--err);
  font-size: 15px;
  font-weight: 950;
}
.toast.show {
  top: calc(var(--nav-h) + 12px);
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ════════════════════════════════════════════════════════════════
   LOADING OVERLAY (zentral, Progressbar)
   ════════════════════════════════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.loading-overlay.show {
  display: flex;
  opacity: 1;
}

.loading-card {
  background: var(--bg-modal);
  border-radius: var(--r-lg);
  padding: 32px 40px;
  border: 1px solid var(--b1);
  box-shadow: var(--s-xl);
  min-width: 320px;
  max-width: 90vw;
  text-align: center;
}

.loading-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.progress-container {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-hover));
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  -webkit-animation: shimmer 1.5s infinite;
  animation: shimmer 1.5s infinite;
}

@-webkit-keyframes shimmer {
  0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
  100% { -webkit-transform: translateX(100%); transform: translateX(100%); }
}

@keyframes shimmer {
  0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
  100% { -webkit-transform: translateX(100%); transform: translateX(100%); }
}

@keyframes sparkleGlimmer {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

@media (max-width: 480px) {
  .loading-card {
    min-width: 280px;
    padding: 24px 28px;
  }
  
  .loading-text {
    font-size: 15px;
  }
}

/* ════════════════════════════════════════════════════════════════
   CONFIRM DIALOG
   ════════════════════════════════════════════════════════════════ */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 460; background: var(--bg-overlay);
  display: none; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.confirm-overlay.show { display: flex; animation: fadeIn 180ms ease; }
.confirm-dialog {
  width: 100%; max-width: 355px;
  background: var(--bg-modal); border-radius: var(--r-xl);
  padding: 20px; border: 1px solid var(--b1); box-shadow: var(--s-xl);
  animation: popIn 200ms var(--spring);
}
@keyframes popIn { from { opacity: 0; transform: scale(0.93) translateY(8px); } to { opacity: 1; transform: none; } }
.confirm-icon {
  width: 44px; height: 44px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--warn-bg); color: var(--warn); font-size: 20px; margin-bottom: 11px;
}
.confirm-dialog h3 { font-size: 15px; font-weight: 700; color: var(--t1); margin-bottom: 5px; letter-spacing: -.015em; }
.confirm-dialog p { font-size: 13px; color: var(--t2); line-height: 1.5; margin-bottom: 14px; }
.confirm-actions { display: flex; gap: 8px; }
.confirm-actions .btn-brand, .confirm-actions .btn-ghost { margin-top: 0; flex: 1; width: auto; }

/* ════════════════════════════════════════════════════════════════
   PREVIEW OVERLAY
   ════════════════════════════════════════════════════════════════ */
.preview-overlay {
  position: fixed; inset: 0; z-index: 450; background: var(--bg-overlay);
  display: none; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.preview-overlay.show { display: flex; animation: fadeIn 180ms ease; }
.preview-sheet {
  width: 100%; max-width: 720px; background: var(--bg-modal);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow: auto; box-shadow: var(--s-xl);
  border-top: 1px solid var(--b1); position: relative;
  animation: sheetUp 260ms var(--spring);
}
.preview-close {
  position: absolute; top: 13px; right: 14px;
  width: 34px; height: 34px; border-radius: var(--r-xs);
  border: 1px solid var(--b1); background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--t3);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.preview-close:hover { background: var(--bg-card); color: var(--t1); }
.preview-close:active { transform: scale(0.9); }
.preview-close svg { width: 16px; height: 16px; stroke-width: 2; }
.preview-sheet h2 { font-size: 15px; font-weight: 700; color: var(--t1); padding-right: 48px; margin-bottom: 12px; word-break: break-word; letter-spacing: -.015em; }
.preview-actions { display: flex; gap: 8px; margin-top: 12px; }
.preview-actions .btn-brand, .preview-actions .btn-ghost { margin-top: 0; flex: 1; width: auto; }
.preview-pdf-icon {
  border: 2px dashed var(--b2); border-radius: var(--r-md);
  padding: 24px 12px; background: var(--bg-input); text-align: center;
}
.preview-pdf-icon .icon-wrapper {
  width: 66px; height: 66px; border-radius: var(--r-md);
  background: var(--brand-wash); color: var(--brand);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 10px;
}
.preview-pdf-icon .icon-wrapper svg { width: 32px; height: 32px; }
.preview-pdf-icon .file-name { font-size: 13px; font-weight: 700; color: var(--t1); word-break: break-word; }
.preview-pdf-icon .file-meta { font-size: 11px; color: var(--t3); margin-top: 7px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.preview-pdf-icon .file-type { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 100px; background: var(--bg-hover); color: var(--t2); border: 1px solid var(--b1); }

/* ════════════════════════════════════════════════════════════════
   RECHNUNGSLISTEN MODAL
   ════════════════════════════════════════════════════════════════ */
.inv-list-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 280ms ease, visibility 0s 280ms;
}
.inv-list-modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 280ms ease, visibility 0s 0s;
}
.inv-modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-xl);
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform 420ms cubic-bezier(0.34, 1.2, 0.64, 1), opacity 280ms ease;
}
.inv-list-modal.show .inv-modal-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.inv-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.inv-modal-header h2 {
  font-size: 18px;
  font-weight: 750;
  color: var(--t1);
  letter-spacing: -0.025em;
  margin: 0;
}
.inv-modal-header .close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--b1);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}
.inv-modal-header .close-btn:hover {
  background: var(--bg-card);
  color: var(--t1);
}
.inv-modal-header .close-btn:active {
  transform: scale(0.92);
}
.inv-modal-header .close-btn svg {
  width: 18px;
  height: 18px;
}
.inv-modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.inv-modal-body .searchbar {
  margin-bottom: 16px;
}
.inv-modal-body .chips {
  margin-bottom: 14px;
}
@media (max-width: 639px) {
  .inv-modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    margin-top: auto;
  }
  .inv-modal-header {
    padding: 16px 18px 14px;
  }
  .inv-modal-header h2 {
    font-size: 16px;
  }
  .inv-modal-body {
    padding: 16px 18px 20px;
  }
}

/* ════════════════════════════════════════════════════════════════
   INVOICE DETAIL MODAL (mit sanften Animationen)
   ════════════════════════════════════════════════════════════════ */
.inv-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 280ms ease, visibility 0s 280ms;
}

.inv-detail-modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 280ms ease, visibility 0s 0s;
}

.inv-detail-content {
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-xl);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  transform: translateY(24px) scale(0.94);
  opacity: 0;
  transition: transform 450ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 280ms ease;
}

.inv-detail-modal.show .inv-detail-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.inv-detail-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--b1);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.inv-detail-header h2 {
  font-size: 19px;
  font-weight: 750;
  color: var(--t1);
  letter-spacing: -0.025em;
  margin: 0;
}
.inv-detail-subtitle {
  font-size: 13px;
  color: var(--t3);
  margin-top: 4px;
  font-weight: 500;
}
.inv-detail-header .close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  border: 1px solid var(--b1);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--t3);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  flex-shrink: 0;
}
.inv-detail-header .close-btn:hover {
  background: var(--bg-card);
  color: var(--t1);
}
.inv-detail-header .close-btn:active {
  transform: scale(0.92);
}
.inv-detail-header .close-btn svg {
  width: 18px;
  height: 18px;
}
.inv-detail-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.inv-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.inv-detail-field {
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.inv-detail-field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--t3);
  font-weight: 700;
  margin-bottom: 6px;
}
.inv-detail-field-value {
  font-size: 15px;
  color: var(--t1);
  font-weight: 600;
}
.inv-detail-field.full {
  grid-column: 1 / -1;
}
.inv-detail-field.highlight {
  background: var(--brand-wash);
  border-color: var(--brand-ring);
}
.inv-detail-field.highlight .inv-detail-field-value {
  color: var(--brand);
  font-size: 20px;
  font-weight: 800;
}
.inv-detail-section {
  margin-bottom: 20px;
}
.inv-detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
@media (max-width: 639px) {
  .inv-detail-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    margin-top: auto;
  }
  .inv-detail-header {
    padding: 16px 18px 14px;
  }
  .inv-detail-header h2 {
    font-size: 17px;
  }
  .inv-detail-body {
    padding: 16px 18px 20px;
  }
  .inv-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ════════════════════════════════════════════════════════════════
   ONBOARDING TOUR
   ════════════════════════════════════════════════════════════════ */
.onb-welcome {
  --onb-cycle: 20s;
  position: fixed;
  inset: 0;
  z-index: 395;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.onb-welcome.show {
  display: flex;
  animation: fadeIn 180ms ease;
}

.onb-welcome-card {
  width: 100%;
  max-width: 880px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-xl);
  padding: 18px 18px 16px;
  max-height: min(86vh, 760px);
  overflow: auto;
}

.onb-hero {
  height: clamp(300px, 50vh, 500px);
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.onb-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  z-index: 6;
  pointer-events: none;
}

.onb-pill {
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t3);
  opacity: 0.75;
  transform: translateY(-1px);
}

.onb-pill.receipts { animation: onbPillReceipts var(--onb-cycle) var(--smooth) 1 both; }
.onb-pill.time { animation: onbPillTime var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbPillReceipts {
  0%, 54% {
    opacity: 1;
    background: var(--brand-wash);
    border-color: var(--brand-ring);
    color: var(--brand);
    transform: none;
  }
  58%, 100% {
    opacity: 0.72;
    background: var(--bg-modal);
    border-color: var(--b1);
    color: var(--t3);
    transform: translateY(-1px);
  }
}

@keyframes onbPillTime {
  0%, 54% {
    opacity: 0.72;
    background: var(--bg-modal);
    border-color: var(--b1);
    color: var(--t3);
    transform: translateY(-1px);
  }
  58%, 100% {
    opacity: 1;
    background: var(--brand-wash);
    border-color: var(--brand-ring);
    color: var(--brand);
    transform: none;
  }
}

/* Mini Mock im App-Stil (Belege + Zeiteinträge) */
.onb-flow {
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: 1fr clamp(34px, 6vw, 56px) clamp(120px, 26vw, 190px);
  gap: 12px;
  align-items: center;
  padding: 10px;
  position: relative;
  height: 100%;
  min-height: 0;
}

.onb-flow-left {
  position: relative;
  height: 100%;
  min-height: 0;
}

/* Legacy wrapper used in some HTML versions – keep it from affecting layout */
.onb-preview-flow-header {
  display: none;
}

.onb-conn {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.onb-conn-line {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
  position: relative;
  overflow: hidden;
}

.onb-conn-line::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--brand-glow) 45%, transparent 70%);
  transform: translateX(-120%);
  opacity: 0.35;
  animation: onbConnShine var(--onb-cycle) var(--smooth) 1;
}

@keyframes onbConnShine {
  /* 2 pulses: once for receipts, once for time entries */
  0%, 18% { transform: translateX(-120%); opacity: 0; }
  20% { transform: translateX(-120%); opacity: 0.35; }
  34% { transform: translateX(120%); opacity: 0.35; }
  38% { transform: translateX(120%); opacity: 0; }
  78% { transform: translateX(-120%); opacity: 0; }
  82% { transform: translateX(-120%); opacity: 0.35; }
  96% { transform: translateX(120%); opacity: 0.35; }
  100% { transform: translateX(120%); opacity: 0; }
}

.onb-conn-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 6px var(--brand-ring), var(--s-sm);
  opacity: 0;
  transform: translateX(calc(-50% + 2px)) scale(0.92);
  will-change: transform, opacity;
  animation: onbConnDot var(--onb-cycle) var(--smooth) 1;
}

@keyframes onbConnDot {
  0%, 20% { opacity: 0; transform: translateX(calc(-50% + 2px)) scale(0.92); }
  22% { opacity: 1; transform: translateX(calc(-50% + 2px)) scale(1); }
  34% { opacity: 1; transform: translateX(calc(50% - 2px)) scale(1); }
  38% { opacity: 0; transform: translateX(calc(50% - 2px)) scale(0.92); }
  82% { opacity: 0; transform: translateX(calc(-50% + 2px)) scale(0.92); }
  84% { opacity: 1; transform: translateX(calc(-50% + 2px)) scale(1); }
  96% { opacity: 1; transform: translateX(calc(50% - 2px)) scale(1); }
  100% { opacity: 0; transform: translateX(calc(50% - 2px)) scale(0.92); }
}

.onb-stage {
  position: relative;
  height: 100%;
  min-height: 0;
}

/* If the new scene-based preview is present, hide the legacy storyboard frames */
.onb-stage.onb-stage-scenes .onb-frame {
  display: none;
}

/* Storyboard frames: 8 klare Schritte (läuft einmal, bleibt am Ende stehen) */
.onb-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  will-change: transform, opacity;
  animation-duration: var(--onb-cycle);
  animation-timing-function: var(--smooth);
  animation-fill-mode: both;
  animation-iteration-count: 1;
}

.onb-frame.f1 { animation-name: onbF1; }
.onb-frame.f2 { animation-name: onbF2; }
.onb-frame.f3 { animation-name: onbF3; }
.onb-frame.f4 { animation-name: onbF4; }
.onb-frame.f5 { animation-name: onbF5; }
.onb-frame.f6 { animation-name: onbF6; }
.onb-frame.f7 { animation-name: onbF7; }
.onb-frame.f8 { animation-name: onbF8; }

@keyframes onbF1 {
  0%, 10.5% { opacity: 1; transform: none; }
  12.5%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF2 {
  0%, 12.5% { opacity: 0; transform: translateY(10px) scale(0.985); }
  14.5%, 23% { opacity: 1; transform: none; }
  25%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF3 {
  0%, 25% { opacity: 0; transform: translateY(10px) scale(0.985); }
  27%, 35.5% { opacity: 1; transform: none; }
  37.5%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF4 {
  0%, 37.5% { opacity: 0; transform: translateY(10px) scale(0.985); }
  39.5%, 48% { opacity: 1; transform: none; }
  50%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF5 {
  0%, 50% { opacity: 0; transform: translateY(10px) scale(0.985); }
  52%, 60.5% { opacity: 1; transform: none; }
  62.5%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF6 {
  0%, 62.5% { opacity: 0; transform: translateY(10px) scale(0.985); }
  64.5%, 73% { opacity: 1; transform: none; }
  75%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF7 {
  0%, 75% { opacity: 0; transform: translateY(10px) scale(0.985); }
  77%, 85.5% { opacity: 1; transform: none; }
  87.5%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbF8 {
  0%, 87.5% { opacity: 0; transform: translateY(10px) scale(0.985); }
  89.5%, 97% { opacity: 1; transform: none; }
  100% { opacity: 1; transform: none; }
}

.onb-scene {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  opacity: 0;
  transform: translateY(10px) scale(0.985);
  will-change: transform, opacity;
}

.onb-scene.s1 { animation: onbScene1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 { animation: onbScene2 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbScene1 {
  0%, 48% { opacity: 1; transform: none; }
  54%, 100% { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@keyframes onbScene2 {
  0%, 52% { opacity: 0; transform: translateY(10px) scale(0.985); }
  58%, 100% { opacity: 1; transform: none; }
}

.onb-flow-card {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  box-shadow: var(--s-sm);
  padding: 10px 10px 10px;
  position: relative;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Guided step captions (deliberate, readable) */
.onb-stepcap {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-sm);
  color: var(--t2);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  pointer-events: none;
  z-index: 2;
}

.onb-stepcap .s {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  opacity: 0;
}

/* Scene 1 captions */
.onb-scene.s1 .onb-stepcap .s1 { animation: onbCapBeleg1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s1 .onb-stepcap .s2 { animation: onbCapBeleg2 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s1 .onb-stepcap .s3 { animation: onbCapBeleg3 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbCapBeleg1 {
  0%, 10% { opacity: 0; }
  12%, 22% { opacity: 1; }
  26%, 100% { opacity: 0; }
}

@keyframes onbCapBeleg2 {
  0%, 22% { opacity: 0; }
  26%, 34% { opacity: 1; }
  38%, 100% { opacity: 0; }
}

@keyframes onbCapBeleg3 {
  0%, 34% { opacity: 0; }
  38%, 50% { opacity: 1; }
  54%, 100% { opacity: 0; }
}

/* Scene 2 captions */
.onb-scene.s2 .onb-stepcap .s1 { animation: onbCapTime1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-stepcap .s2 { animation: onbCapTime2 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-stepcap .s3 { animation: onbCapTime3 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-stepcap .s4 { animation: onbCapTime4 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbCapTime1 {
  0%, 58% { opacity: 0; }
  60%, 68% { opacity: 1; }
  72%, 100% { opacity: 0; }
}

@keyframes onbCapTime2 {
  0%, 68% { opacity: 0; }
  72%, 80% { opacity: 1; }
  84%, 100% { opacity: 0; }
}

@keyframes onbCapTime3 {
  0%, 80% { opacity: 0; }
  84%, 90% { opacity: 1; }
  94%, 100% { opacity: 0; }
}

@keyframes onbCapTime4 {
  0%, 90% { opacity: 0; }
  94%, 97% { opacity: 1; }
  100% { opacity: 1; }
}

.onb-flow-card::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid var(--brand-ring);
  opacity: 0;
  pointer-events: none;
}

.onb-flow-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.onb-flow-ic {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--b1);
  background: var(--brand-wash);
  color: var(--brand);
}
.onb-flow-ic.up { background: var(--green-bg); color: var(--green); }
.onb-flow-ic.time { background: var(--warn-bg); color: var(--warn); }
.onb-flow-ic svg { width: 22px; height: 22px; stroke-width: 1.9; }

.onb-flow-title {
  font-size: 13px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t1);
  line-height: 1.15;
}
.onb-flow-sub {
  margin-top: 2px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--t3);
  line-height: 1.35;
}

/* Mini Preview / Mini Time Entry */
.onb-mini {
  margin-top: 9px;
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 9px;
  box-shadow: var(--s-xs);
  position: relative;
  flex: 1;
  min-height: 0;
}

/* Mini-UI im echten App-Look (für das Storyboard) */
.onb-mini.onb-miniapp {
  padding: 9px;
}

.onb-ui {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 14px;
  background:
    radial-gradient(240px 160px at 12% 0%, var(--brand-wash) 0%, transparent 55%),
    radial-gradient(210px 140px at 92% 18%, var(--brand-tint) 0%, transparent 60%),
    var(--bg-app);
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.onb-ui-top {
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--bar-line);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.onb-ui-brand {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--brand);
}

.onb-ui-title {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--t2);
}

.onb-ui-body {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.onb-ui-bot {
  height: 36px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bar-bg);
  border-top: 1px solid var(--bar-line);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}

.onb-ui-nav {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t3);
  opacity: 0.9;
}

.onb-ui-nav svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.onb-ui-nav.active {
  color: var(--brand);
  opacity: 1;
  background: var(--brand-wash);
  border: 1px solid var(--brand-ring);
}

.onb-ui-fab {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--s-md);
  border: 1px solid transparent;
}

.onb-ui-fab svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
  transition: transform var(--t-slow);
}

.onb-ui-fab.open svg {
  transform: rotate(45deg);
}

.onb-ui-actions {
  position: absolute;
  right: 10px;
  bottom: 54px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.onb-ui-action {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.onb-ui-action-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: -.01em;
  color: var(--t2);
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: 999px;
  padding: 5px 8px;
  box-shadow: var(--s-xs);
  white-space: nowrap;
}

.onb-ui-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}

.onb-ui-action-btn svg {
  width: 18px;
  height: 18px;
}

.onb-ui-card {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--s-xs);
}

.onb-ui-card-title {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
}

.onb-ui-card-lines {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onb-ui-hint {
  font-size: 12px;
  font-weight: 850;
  color: var(--t3);
  line-height: 1.35;
}

.onb-ui-section-title {
  font-size: 10.5px;
  font-weight: 950;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 8px;
}

.onb-uq-mini {
  gap: 6px;
  padding-bottom: 0 !important;
}

.onb-welcome .onb-uq-mini .qi {
  padding: 9px 10px;
  gap: 9px;
}

.onb-welcome .onb-uq-mini .qi .ic {
  width: 40px;
  height: 40px;
}

.onb-welcome .onb-uq-mini .qi-name {
  font-size: 12px;
}

.onb-welcome .onb-uq-mini .qi-action {
  width: 34px;
  height: 34px;
}

.onb-ui-preview {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 10px;
  background: var(--bg-overlay);
}

.onb-ui-sheet {
  width: 100%;
  border-radius: 16px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-lg);
  padding: 10px;
  position: relative;
}

.onb-ui-sheet-title {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t1);
}

.onb-ui-doc {
  height: 48px;
  margin-top: 8px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-input) 40%, var(--bg-hover) 100%);
  border: 1px solid var(--b1);
  opacity: 0.95;
}

.onb-ui-sheet-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.onb-ui-btn {
  flex: 1;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: -.01em;
  user-select: none;
}

.onb-ui-btn.primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--s-sm);
}

.onb-ui-btn.ghost {
  background: var(--bg-card);
  color: var(--t2);
}

.onb-ui-sheet-sub {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 850;
  color: var(--t3);
}

.onb-ui-toast {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-sm);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t1);
  pointer-events: none;
}

.onb-ui-toast.ok { color: var(--green); }

.onb-ui-sw {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: 14px;
  padding: 10px;
  box-shadow: var(--s-xs);
}

.onb-ui-sw-time {
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -.04em;
  color: var(--t1);
  line-height: 1;
}

.onb-ui-sw-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.onb-ui-link {
  margin-top: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid var(--b1);
  background: var(--bg-modal);
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: -.01em;
}

.onb-ui-chip {
  align-self: flex-start;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--warn-bg);
  border: 1px solid var(--b1);
  color: var(--warn);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -.01em;
}

/* Sprechblasen mit Pointer (deutlich + bewusst) */
.onb-bubble {
  position: absolute;
  z-index: 40;
  max-width: min(280px, calc(100% - 20px));
  padding: 10px 11px;
  border-radius: 16px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-lg);
  color: var(--t1);
  pointer-events: none;
}

.onb-bubble-title {
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--t3);
}

.onb-bubble-text {
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 850;
  letter-spacing: -.01em;
  color: var(--t1);
  line-height: 1.32;
}

.onb-bubble::before,
.onb-bubble::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
}

/* Arrow: down */
.onb-bubble.arr-down::before {
  left: var(--ax, 26px);
  bottom: -11px;
  border-style: solid;
  border-width: 11px 10px 0 10px;
  border-color: var(--b1) transparent transparent transparent;
}
.onb-bubble.arr-down::after {
  left: var(--ax, 26px);
  bottom: -10px;
  border-style: solid;
  border-width: 10px 9px 0 9px;
  border-color: var(--bg-modal) transparent transparent transparent;
}

/* Arrow: right */
.onb-bubble.arr-right::before {
  top: var(--ay, 16px);
  right: -11px;
  border-style: solid;
  border-width: 10px 0 10px 11px;
  border-color: transparent transparent transparent var(--b1);
}
.onb-bubble.arr-right::after {
  top: var(--ay, 16px);
  right: -10px;
  border-style: solid;
  border-width: 9px 0 9px 10px;
  border-color: transparent transparent transparent var(--bg-modal);
}

/* Arrow: up */
.onb-bubble.arr-up::before {
  left: var(--ax, 26px);
  top: -11px;
  border-style: solid;
  border-width: 0 10px 11px 10px;
  border-color: transparent transparent var(--b1) transparent;
}
.onb-bubble.arr-up::after {
  left: var(--ax, 26px);
  top: -10px;
  border-style: solid;
  border-width: 0 9px 10px 9px;
  border-color: transparent transparent var(--bg-modal) transparent;
}

/* Arrow: left */
.onb-bubble.arr-left::before {
  top: var(--ay, 16px);
  left: -11px;
  border-style: solid;
  border-width: 10px 11px 10px 0;
  border-color: transparent var(--b1) transparent transparent;
}
.onb-bubble.arr-left::after {
  top: var(--ay, 16px);
  left: -10px;
  border-style: solid;
  border-width: 9px 10px 9px 0;
  border-color: transparent var(--bg-modal) transparent transparent;
}

/* Bubble positioning per frame */
.onb-frame.f1 .onb-bubble {
  right: 54px;
  bottom: 64px;
  --ax: calc(100% - 34px);
}

.onb-frame.f2 .onb-bubble {
  right: 74px;
  bottom: 92px;
  --ay: 14px;
}

.onb-frame.f3 .onb-bubble {
  left: 12px;
  top: 44px;
  --ax: 64px;
}

.onb-frame.f4 .onb-bubble {
  left: 12px;
  top: 44px;
  --ax: 74px;
}

.onb-frame.f5 .onb-bubble {
  left: 12px;
  bottom: 78px;
  --ax: 92px;
}

.onb-frame.f6 .onb-bubble {
  right: 74px;
  bottom: 92px;
  --ay: 14px;
}

.onb-frame.f7 .onb-bubble {
  left: 12px;
  top: 44px;
  --ax: 92px;
}

.onb-frame.f8 .onb-bubble {
  left: 12px;
  top: 44px;
  --ax: 70px;
}

/* Highlight: klarer Fokuspunkt (Tap/Ripple) */
.onb-hot {
  position: relative;
  box-shadow: 0 0 0 6px var(--brand-ring), var(--s-md) !important;
  border-color: var(--brand) !important;
}

.onb-hot::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid var(--brand);
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0;
  pointer-events: none;
  animation: onbHotPulse 2.4s var(--smooth) infinite;
}

@keyframes onbHotPulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  38% { opacity: 0.9; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.65); }
}

/* Belege: Quelle (Beleg‑Foto / Upload) */
.onb-src-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.onb-src {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 14px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
  color: var(--t2);
  min-width: 0;
}

.onb-src-ic {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--brand);
}

.onb-src.s-photo .onb-src-ic { background: var(--green-bg); color: var(--green); }
.onb-src.s-upload .onb-src-ic { background: var(--brand-wash); color: var(--brand); }

.onb-src-ic svg { width: 16px; height: 16px; }

.onb-src-lbl {
  font-size: 11.5px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.onb-scene.s1 .onb-src.s-photo { animation: onbSrcPhoto var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s1 .onb-src.s-upload { animation: onbSrcUpload var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbSrcPhoto {
  0%, 10% { transform: none; box-shadow: var(--s-xs); }
  14%, 18% { transform: translateY(-1px) scale(1.01); box-shadow: 0 0 0 6px var(--brand-ring), var(--s-md); }
  24%, 100% { transform: none; box-shadow: var(--s-xs); }
}

@keyframes onbSrcUpload {
  0%, 18% { transform: none; box-shadow: var(--s-xs); }
  22%, 26% { transform: translateY(-1px) scale(1.01); box-shadow: 0 0 0 6px var(--brand-ring), var(--s-md); }
  32%, 100% { transform: none; box-shadow: var(--s-xs); }
}

.onb-mini-detail { display: none; }

.onb-mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.onb-mini-head-title {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--t3);
}

.onb-mini-head-meta {
  font-size: 11px;
  font-weight: 900;
  color: var(--t3);
}

.onb-queue-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 8px;
  border-radius: 14px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
}

.onb-queue-thumb {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: var(--brand-wash);
  border: 1px solid var(--b1);
}

.onb-queue-name {
  font-size: 12px;
  font-weight: 950;
  color: var(--t1);
  line-height: 1.1;
}

.onb-queue-sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
  color: var(--t3);
  line-height: 1.2;
}

.onb-queue-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand-wash);
  border: 1px solid var(--b1);
  color: var(--brand);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  white-space: nowrap;
}

.onb-preview-head {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.onb-preview-title {
  font-size: 12px;
  font-weight: 950;
  color: var(--t1);
  letter-spacing: -.01em;
}

.onb-preview-meta {
  font-size: 11px;
  font-weight: 900;
  color: var(--t3);
  white-space: nowrap;
}

.onb-mini-toast {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-sm);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t1);
  opacity: 0;
  transform: translateY(-6px) scale(0.99);
  pointer-events: none;
}

.onb-mini-toast.ok { color: var(--green); }

.onb-scene.s1 .onb-mini.prev .onb-mini-toast { animation: onbToast1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-mini.time .onb-mini-toast { animation: onbToast2 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbToast1 {
  0%, 20% { opacity: 0; transform: translateY(-6px) scale(0.99); }
  30%, 44% { opacity: 1; transform: none; }
  52%, 100% { opacity: 0; transform: translateY(-6px) scale(0.99); }
}

@keyframes onbToast2 {
  0%, 86% { opacity: 0; transform: translateY(-6px) scale(0.99); }
  92%, 100% { opacity: 1; transform: none; }
}

.onb-mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.onb-mini-pill {
  background: var(--bg-hover);
  border: 1px solid var(--b1);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 162px;
}

.onb-mini-chip {
  background: var(--brand-wash);
  color: var(--brand);
  border: 1px solid var(--b1);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: -.01em;
  flex-shrink: 0;
}

.onb-mini-doc {
  height: 40px;
  margin-top: 8px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-input) 40%, var(--bg-hover) 100%);
  border: 1px solid var(--b1);
  opacity: 0.95;
  position: relative;
  overflow: hidden;
}

.onb-mini-lines {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.onb-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-input) 40%, var(--bg-hover) 100%);
  border: 1px solid var(--b1);
  opacity: 0.9;
}

.onb-line.w1 { width: 86%; }
.onb-line.w2 { width: 72%; }
.onb-line.w3 { width: 58%; }

.onb-mini-doc::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--brand-glow) 45%, transparent 70%);
  transform: translateX(-120%);
  opacity: 0.35;
}

.onb-scene.s1 .onb-mini-doc::after { animation: onbShine var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbShine {
  0%, 10% { transform: translateX(-120%); }
  34% { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

.onb-mini-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.onb-mini-sendbar {
  height: 6px;
  margin-top: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--b1);
  border-radius: 999px;
  overflow: hidden;
}

.onb-mini-sendfill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  opacity: 0.92;
}

.onb-mini-sendfill.f1 { background: var(--green); }
.onb-mini-sendfill.f2 { background: var(--warn); }

.onb-scene.s1 .onb-mini.prev .onb-mini-sendfill.f1 { animation: onbSendFill1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-mini.time .onb-mini-sendfill.f2 { animation: onbSendFill2 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbSendFill1 {
  0%, 18% { width: 0%; opacity: 0.92; }
  24% { width: 14%; }
  34% { width: 100%; }
  44%, 100% { width: 100%; opacity: 0.92; }
}

@keyframes onbSendFill2 {
  0%, 78% { width: 0%; opacity: 0.92; }
  84% { width: 14%; }
  92%, 100% { width: 100%; opacity: 0.92; }
}

.onb-mini-btn {
  flex: 1;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 900;
  letter-spacing: -.01em;
  border: 1px solid var(--b1);
  user-select: none;
}

.onb-mini-btn.primary {
  background: var(--brand);
  border-color: transparent;
  color: var(--t-inv);
  position: relative;
  overflow: hidden;
  box-shadow: var(--s-sm);
}

.onb-mini-btn.primary .lbl,
.onb-mini-btn.primary .ok {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.onb-mini-btn.primary .ok {
  opacity: 0;
}


.onb-scene.s1 .onb-mini.prev .onb-mini-btn.primary .lbl { animation: onbLbl1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s1 .onb-mini.prev .onb-mini-btn.primary .ok { animation: onbOk1 var(--onb-cycle) var(--smooth) 1 both; }

.onb-scene.s2 .onb-mini.time .onb-mini-btn.primary .lbl { animation: onbLbl2 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-mini.time .onb-mini-btn.primary .ok { animation: onbOk2 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbLbl1 {
  0%, 18% { opacity: 1; }
  28%, 100% { opacity: 0; }
}

@keyframes onbOk1 {
  0%, 24% { opacity: 0; }
  34%, 48% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

@keyframes onbLbl2 {
  0%, 80% { opacity: 1; }
  88%, 100% { opacity: 0; }
}

@keyframes onbOk2 {
  0%, 84% { opacity: 0; }
  92%, 97% { opacity: 1; }
  100% { opacity: 0; }
}

.onb-mini-btn.primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--brand-glow) 45%, transparent 70%);
  transform: translateX(-120%);
  opacity: 0.35;
}

.onb-scene.s1 .onb-mini-btn.primary { animation: onbBtnPulse1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s1 .onb-mini-btn.primary::after { animation: onbBtnShine1 var(--onb-cycle) var(--smooth) 1 both; }

.onb-scene.s2 .onb-mini-btn.primary { animation: onbBtnPulse2 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-mini-btn.primary::after { animation: onbBtnShine2 var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbBtnPulse1 {
  0%, 14% { transform: none; box-shadow: var(--s-sm); }
  22%, 34% { transform: translateY(-1px) scale(1.02); box-shadow: 0 0 0 6px var(--brand-ring), var(--s-lg); }
  42%, 100% { transform: none; box-shadow: var(--s-sm); }
}

@keyframes onbBtnShine1 {
  0%, 16% { transform: translateX(-120%); }
  34% { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

@keyframes onbBtnPulse2 {
  0%, 80% { transform: none; box-shadow: var(--s-sm); }
  86%, 94% { transform: translateY(-1px) scale(1.02); box-shadow: 0 0 0 6px var(--brand-ring), var(--s-lg); }
  100% { transform: none; box-shadow: var(--s-sm); }
}

@keyframes onbBtnShine2 {
  0%, 82% { transform: translateX(-120%); }
  94% { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

.onb-mini-btn.ghost {
  background: var(--bg-card);
  color: var(--t2);
}

.onb-mini-time {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.onb-mini-time-label {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--t3);
}

.onb-mini-time-val {
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: -.03em;
  color: var(--t1);
}

/* Zeiteinträge: Stopuhr Mini (Start/Stop → Zum Zeiteintrag) */
.onb-sw-mini {
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  box-shadow: var(--s-xs);
  padding: 9px;
  margin-top: 6px;
  margin-bottom: 8px;
}

.onb-sw-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.onb-sw-title {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--t3);
}

.onb-sw-state {
  position: relative;
  min-width: 80px;
  height: 14px;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--t3);
}

.onb-sw-state .st0,
.onb-sw-state .st1,
.onb-sw-state .st2 {
  position: absolute;
  right: 0;
  top: 0;
  opacity: 0;
}

.onb-sw-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.onb-sw-time {
  position: relative;
  height: 18px;
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -.04em;
  color: var(--t1);
  line-height: 1;
}

.onb-sw-time .t0,
.onb-sw-time .t1 {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
}

.onb-sw-btn {
  height: 30px;
  min-width: 86px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 950;
  letter-spacing: -.01em;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.onb-sw-btn.primary {
  background: var(--brand);
  border-color: transparent;
  color: var(--t-inv);
  box-shadow: var(--s-sm);
}

.onb-sw-btn .lbl,
.onb-sw-btn .ok {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onb-sw-btn .ok { opacity: 0; }

.onb-sw-next {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 950;
  color: var(--brand);
  letter-spacing: -.01em;
  opacity: 0;
  transform: translateY(4px);
}


.onb-scene.s2 .onb-sw-time .t0 { animation: onbSwTime0 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-sw-time .t1 { animation: onbSwTime1 var(--onb-cycle) var(--smooth) 1 both; }

.onb-scene.s2 .onb-sw-state .st0 { animation: onbSwSt0 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-sw-state .st1 { animation: onbSwSt1 var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-sw-state .st2 { animation: onbSwSt2 var(--onb-cycle) var(--smooth) 1 both; }

.onb-scene.s2 .onb-sw-btn.primary .lbl { animation: onbSwLbl var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-sw-btn.primary .ok { animation: onbSwOk var(--onb-cycle) var(--smooth) 1 both; }
.onb-scene.s2 .onb-sw-btn.primary { animation: onbSwPulse var(--onb-cycle) var(--smooth) 1 both; }

.onb-scene.s2 .onb-sw-next { animation: onbSwNext var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbSwTime0 {
  0%, 58% { opacity: 1; }
  64%, 100% { opacity: 0; }
}

@keyframes onbSwTime1 {
  0%, 62% { opacity: 0; }
  68%, 92% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes onbSwSt0 {
  0%, 58% { opacity: 1; }
  64%, 100% { opacity: 0; }
}

@keyframes onbSwSt1 {
  0%, 60% { opacity: 0; }
  64%, 74% { opacity: 1; }
  78%, 100% { opacity: 0; }
}

@keyframes onbSwSt2 {
  0%, 72% { opacity: 0; }
  78%, 92% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes onbSwLbl {
  0%, 60% { opacity: 1; }
  66%, 100% { opacity: 0; }
}

@keyframes onbSwOk {
  0%, 64% { opacity: 0; }
  70%, 84% { opacity: 1; }
  92%, 100% { opacity: 0; }
}

@keyframes onbSwPulse {
  0%, 60% { transform: none; box-shadow: var(--s-sm); }
  64%, 72% { transform: translateY(-1px) scale(1.02); box-shadow: 0 0 0 6px var(--brand-ring), var(--s-lg); }
  80%, 100% { transform: none; box-shadow: var(--s-sm); }
}

@keyframes onbSwNext {
  0%, 72% { opacity: 0; transform: translateY(4px); }
  78%, 90% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(4px); }
}

.onb-mini-fields {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Make real form fields compact inside welcome overlay */
.onb-welcome .onb-tt-field label {
  font-size: 10.5px;
  letter-spacing: .08em;
  font-weight: 900;
}

.onb-welcome .onb-tt-field input,
.onb-welcome .onb-tt-field select {
  padding: 9px 10px;
  font-size: 12px;
}

.onb-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 14px;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  box-shadow: var(--s-xs);
}

.onb-field-lbl {
  font-size: 11px;
  font-weight: 950;
  color: var(--t3);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.onb-field-val {
  font-size: 12px;
  font-weight: 950;
  color: var(--t1);
  letter-spacing: -.01em;
}

.onb-field-val.dim { color: var(--t3); font-weight: 900; }

.onb-scene.s2 .onb-tt-field.proj { animation: onbProjPulse var(--onb-cycle) var(--smooth) 1 both; }

@keyframes onbProjPulse {
  0%, 76% { box-shadow: var(--s-xs); }
  80%, 86% { box-shadow: 0 0 0 6px var(--brand-ring), var(--s-md); }
  94%, 100% { box-shadow: var(--s-xs); }
}

.onb-flow-right {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
}

.onb-flow-target {
  width: 100%;
  max-width: 190px;
  min-height: 86px;
  border-radius: var(--r-xl);
  background: var(--bg-card);
  border: 1px solid var(--b1);
  box-shadow: var(--s-sm);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  overflow: hidden;
}

.onb-flow-target::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid var(--brand-ring);
  opacity: 0.25;
  transform: scale(1);
  animation: onbTargetPulse var(--onb-cycle) var(--smooth) 1;
  pointer-events: none;
}

.onb-flow-target-label {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: -.01em;
  color: var(--brand);
  line-height: 1.1;
}

.onb-flow-target-sub {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--t3);
  line-height: 1.2;
}

.onb-welcome-status {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Onboarding Welcome: make the status blocks more card-like and readable */
.onb-welcome-status .onb-field {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 10px 10px;
  gap: 6px;
}

.onb-welcome-status .onb-field-val {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.onb-welcome-status .onb-status-hint {
  flex-basis: 100%;
  color: var(--t2);
  overflow-wrap: anywhere;
}

.onb-welcome-status .onb-field.is-ok {
  background: var(--ok-bg);
  border-color: var(--ok);
}

.onb-welcome-status .onb-field.is-missing {
  background: var(--err-bg);
  border-color: var(--err);
}

.onb-welcome-status .onb-field.is-ok .onb-field-lbl {
  color: var(--ok);
}

.onb-welcome-status .onb-field.is-missing .onb-field-lbl {
  color: var(--err);
}

.onb-welcome-status .onb-field-val {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.onb-status-hint {
  font-size: 12px;
  font-weight: 900;
  color: var(--t3);
}

@keyframes onbTargetPulse {
  0%, 18% { opacity: 0.22; transform: scale(1); }
  22%, 34% { opacity: 0.95; transform: scale(1.06); }
  40%, 78% { opacity: 0.22; transform: scale(1); }
  84%, 100% { opacity: 0.95; transform: scale(1.06); }
}

/* Hide real app FAB/timer behind the Welcome overlay (prevents “random” FAB in the background) */
.onb-welcome-open .fab-wrap,
.onb-welcome-open #tt-float,
.onb-welcome-open .fab-overlay {
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (min-width: 920px) {
  .onb-welcome-card {
    max-width: 1100px;
    padding: 22px 22px 18px;
    max-height: min(88vh, 860px);
  }
  .onb-hero { height: clamp(260px, 44vh, 460px); }
  .onb-flow { max-width: 860px; }
  .onb-stage { height: clamp(220px, 34vh, 360px); }
  .onb-welcome-title { font-size: 22px; }
  .onb-welcome-text { font-size: 13.5px; }
  .onb-mini-doc { height: 58px; }
  .onb-mini-btn { height: 32px; }
  .onb-mini-time-val { font-size: 18px; }

  /* Desktop: zeige die Detailblöcke statt der kompakten 1‑Zeile */
  .onb-mini-detail { display: block; }
  .onb-mini-row.compact { display: none; }
}

.onb-welcome-title {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.02em;
  color: var(--t1);
}

.onb-welcome-text {
  margin-top: 8px;
  font-size: 13px;
  color: var(--t2);
  line-height: 1.55;
}

.onb-welcome-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.onb-welcome-li {
  position: relative;
  padding-left: 16px;
}

.onb-welcome-li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  opacity: 0.85;
}

.onb-welcome-small {
  margin-top: 10px;
  font-size: 12px;
  color: var(--t3);
  line-height: 1.45;
}

.onb-welcome-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}
.onb-welcome-actions .btn-brand,
.onb-welcome-actions .btn-ghost {
  flex: 1;
  width: auto;
  margin-top: 0;
}

.onb-welcome-laptop {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  background: var(--bg-input);
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  box-shadow: var(--s-xs);
}

.onb-welcome-laptop-text {
  font-size: 12px;
  font-weight: 800;
  color: var(--t3);
  line-height: 1.35;
}

.onb-welcome-foot {
  margin-top: 10px;
  font-size: 12px;
  color: var(--t3);
  line-height: 1.4;
}

@media (max-width: 639px) {
  .onb-welcome { padding: 14px; align-items: flex-end; }
  .onb-welcome-card {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 16px 16px 14px;
    max-height: calc(var(--app-h, 100vh) - env(safe-area-inset-top) - 10px);
  }
  .onb-hero { height: 168px; }
  .onb-welcome-title { font-size: 18px; }
  .onb-welcome-text { font-size: 12.5px; }
  .onb-welcome-list { gap: 7px; }
  .onb-welcome-status { grid-template-columns: 1fr; }

  /* Mobile: Mini-UI vereinfachen */
  .onb-ui-bot { display: none; }
  .onb-ui-action-label { display: none; }
  .onb-ui-doc { height: 40px; }
  .onb-ui-sw-time { font-size: 18px; }

  .onb-bubble {
    padding: 9px 10px;
  }
  .onb-bubble-text {
    font-size: 12px;
  }

  /* Mobile: Details ausblenden, damit die Hero-Animation nicht überfrachtet wirkt */
  .onb-mini-detail { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  /* Reduced motion: zeige ein statisches Bild statt leerer Hero-Fläche */
  .onb-frame {
    animation: none !important;
    opacity: 0 !important;
    transform: none !important;
  }
  .onb-frame.f1 {
    opacity: 1 !important;
  }

  .onb-stage.onb-stage-scenes .onb-scene {
    animation: none !important;
    opacity: 0 !important;
    transform: none !important;
  }
  .onb-stage.onb-stage-scenes .onb-scene.s1 {
    opacity: 1 !important;
  }
  .onb-hot::after {
    animation: none !important;
    opacity: 0 !important;
  }

  .onb-scene.s1,
  .onb-scene.s2,
  .onb-flow-target::after,
  .onb-scene.s1 .onb-mini-doc::after,
  .onb-mini-btn.primary,
  .onb-mini-btn.primary::after,
  .onb-mini-toast,
  .onb-mini-btn.primary .lbl,
  .onb-mini-btn.primary .ok,
  .onb-mini-sendfill,
  .onb-conn-line::after,
  .onb-conn-dot,
  .onb-src,
  .onb-sw-time .t0,
  .onb-sw-time .t1,
  .onb-sw-state .st0,
  .onb-sw-state .st1,
  .onb-sw-state .st2,
  .onb-sw-btn.primary,
  .onb-sw-btn.primary .lbl,
  .onb-sw-btn.primary .ok,
  .onb-sw-next,
  .onb-tt-field.proj,
  .onb-stepcap .s {
    animation: none !important;
  }
}

.tour {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: none;
  pointer-events: none;
}
.tour.show { display: block; }

/* Final step: render like the Onboarding Welcome modal (more space + recognition) */
.tour.show.tour-final {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: auto;
}

.tour.show.tour-final .tour-spot {
  display: none;
}

/* Help-Picker cursor: sichtbar machen, dass ein UI-Element gewählt wird */
body.help-pick-active,
body.help-pick-active * {
  cursor: help !important;
}
body.help-pick-active #tour-pop,
body.help-pick-active #tour-pop * {
  cursor: default !important;
}
body.help-pick-active #tour-pop button {
  cursor: pointer !important;
}

.tour-spot {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 280px;
  height: 120px;
  transform: none;
  border-radius: var(--r-xl);
  box-shadow: 0 0 0 200vmax rgba(0,0,0,.62);
  border: 1px solid rgba(255,255,255,.12);
  pointer-events: none;
  transition: left 360ms var(--smooth), top 360ms var(--smooth), width 360ms var(--smooth), height 360ms var(--smooth);
  will-change: left, top, width, height;
}

.tour-spot::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid var(--brand-ring);
  opacity: 0.85;
  animation: tourPulse 1.4s var(--smooth) infinite;
}

@keyframes tourPulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.03); opacity: 0.95; }
}

.tour-pop {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  width: auto;
  background: var(--bg-modal);
  border: 1px solid var(--b1);
  border-radius: var(--r-xl);
  box-shadow: var(--s-xl);
  padding: 14px 14px 12px;
  pointer-events: auto;
  will-change: transform, opacity;
}

.tour-pop.tour-pop-final {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 100%;
  max-width: 880px;
  padding: 18px 18px 16px;
  max-height: min(86vh, 760px);
  overflow: auto;
  transform: none;
}

.tour-pop.tour-pop-final .tour-title {
  margin-top: 14px;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.02em;
}

.tour-pop.tour-pop-final .tour-text {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
}

.tour-pop.tour-pop-final .tour-qa-log {
  max-height: min(46vh, 460px);
}

@media (min-width: 920px) {
  .tour-pop.tour-pop-final {
    max-width: 1100px;
    padding: 22px 22px 18px;
    max-height: min(88vh, 860px);
  }
  .tour-pop.tour-pop-final .tour-title { font-size: 22px; }
  .tour-pop.tour-pop-final .tour-text { font-size: 13.5px; }
}

@media (max-width: 639px) {
  .tour.show.tour-final {
    padding: 14px;
    align-items: flex-end;
  }
  .tour-pop.tour-pop-final {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding: 16px 16px 14px;
    max-height: calc(var(--app-h, 100vh) - env(safe-area-inset-top) - 10px);
  }
  .tour-pop.tour-pop-final .tour-title { font-size: 18px; }
  .tour-pop.tour-pop-final .tour-text { font-size: 12.5px; }
}

.tour-track {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.tour-seg {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  border: 1px solid var(--b1);
  background: var(--bg-hover);
  padding: 0;
  cursor: pointer;
  opacity: 0.85;
}

.tour-seg.done {
  background: var(--brand-wash);
  border-color: var(--brand-ring);
  opacity: 1;
}

.tour-seg.active {
  background: var(--brand);
  border-color: transparent;
  opacity: 1;
}

.tour-seg:focus-visible {
  outline: 2px solid var(--brand-ring);
  outline-offset: 3px;
}

.tour.show .tour-pop {
  animation: popIn 200ms var(--spring);
}

.tour-pop.step-anim {
  animation: tourStepIn 240ms var(--spring);
}

@keyframes tourStepIn {
  from { opacity: 0.72; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .tour-spot {
    transition: none;
  }
  .tour-spot::after {
    animation: none;
  }
  .tour.show .tour-pop,
  .tour-pop.step-anim {
    animation: none;
  }
}

@media (max-width: 639px) {
  .tour-pop {
    bottom: calc(var(--bot-h) + env(safe-area-inset-bottom) + 12px);
  }
}

@media (min-width: 640px) {
  .tour-pop {
    width: 360px;
    left: auto;
    right: 18px;
    bottom: 18px;
  }
}

.tour-step {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 6px;
}
.tour-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.015em;
  color: var(--t1);
  margin-bottom: 6px;
}
.tour-text {
  font-size: 13px;
  color: var(--t2);
  line-height: 1.55;
}

.tour-cta { margin-top: 12px; }
.tour-cta .btn-brand,
.tour-cta .btn-ghost {
  width: 100%;
  margin-top: 0;
}

.tour-qa {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  background: var(--bg-card);
}

.tour-qa-q {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--t1);
}

.tour-qa-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tour-qa-actions .btn-brand,
.tour-qa-actions .btn-ghost {
  flex: 1;
  width: auto;
}

.tour-qa-dialog {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tour-qa-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tour-qa-row input {
  flex: 1;
  border: 1.5px solid var(--b1);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  font-family: var(--font);
  font-size: 14.5px;
  color: var(--t1);
  background: var(--bg-input);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.tour-qa-row input:focus {
  border-color: var(--brand);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.tour-qa-row .btn-brand {
  width: auto;
  margin-top: 0;
  flex-shrink: 0;
}

.tour-qa-log {
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--bg-app), var(--bg-card));
  padding: 10px;
  overflow: auto;
  max-height: min(36vh, 280px);
}

.tour-qa-log .bmsg { margin: 8px 0; }

.tour-qa-log .bubble {
  max-width: 100%;
}

.tour-qa-resolve {
  border: 1px solid var(--b1);
  border-radius: var(--r-lg);
  background: var(--bg-modal);
  padding: 10px;
}

.tour-qa-resolve-q {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--t2);
}

.tour-qa-resolve-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tour-qa-resolve-actions .btn-brand,
.tour-qa-resolve-actions .btn-ghost {
  flex: 1;
  width: auto;
}

.tour-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.tour-actions .btn-brand,
.tour-actions .btn-ghost {
  flex: 1;
  width: auto;
  margin-top: 0;
}

.tour-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
}
.tour-link {
  border: none;
  background: none;
  padding: 4px 0;
  color: var(--t3);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color var(--t-fast);
}
.tour-link:hover { color: var(--t2); }

/* ════════════════════════════════════════════════════════════════
   SKELETON LOADER (für bessere Perceived Performance)
   ════════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-input) 0%,
    var(--bg-hover) 50%,
    var(--bg-input) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--b1);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 9px;
}

.skeleton-line {
  height: 12px;
  background: var(--bg-input);
  border-radius: 6px;
  margin-bottom: 8px;
}

.skeleton-line:last-child { margin-bottom: 0; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

/* ════════════════════════════════════════════════════════════════
   LOADING INDICATOR
   ════════════════════════════════════════════════════════════════ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--t3);
  font-size: 13px;
  gap: 8px;
}

.loading::before {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid var(--b2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ════════════════════════════════════════════════════════════════
   IMPROVED FOCUS STYLES (Accessibility)
   ════════════════════════════════════════════════════════════════ */
*:focus {
  outline: none;
}

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

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: var(--brand);
}

/* Mobile Safari: prevent auto-zoom on focus (requires >= 16px font-size on inputs) */
@media (max-width: 640px) {
  .field input,
  .field textarea,
  .field select,
  .searchbar input,
  .butler-input input {
    font-size: 16px;
  }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
