:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #143d66;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --error: #dc2626;
  --success: #15803d;
  --warning: #d97706;
  --border: #d8dee6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.08);
}

.card h1 {
  font-size: 1.4rem;
  margin: 0 0 1.5rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.9rem 0 0.3rem;
}

input, select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
}

button.primary {
  background: var(--accent);
  color: white;
  width: 100%;
  margin-top: 1.3rem;
}

button.primary:hover { background: var(--accent-hover); }
button.primary:disabled { opacity: 0.6; cursor: not-allowed; }

button.secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.link-row {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.link-row a { color: var(--accent); text-decoration: none; }
.link-row a:hover { text-decoration: underline; }

.message {
  margin-top: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.message.error { background: rgba(220, 38, 38, 0.1); color: var(--error); }
.message.success { background: rgba(21, 128, 61, 0.1); color: var(--success); }

/* Dashboard layout */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: relative;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.2rem;
  flex-shrink: 0;
  transition: width 0.18s ease, padding 0.18s ease;
}

.sidebar.collapsed {
  width: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-color: transparent;
}

.sidebar.collapsed .sidebar-content { display: none; }

.sidebar-toggle {
  position: absolute;
  top: 1.2rem;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }

.sidebar h2 { font-size: 1.05rem; margin: 0 0 1.5rem; }
.sidebar .role-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  margin-bottom: 1rem;
}

.sidebar p { margin: 0.2rem 0; }
.sidebar a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.45rem 0.6rem;
  margin: 0 -0.6rem;
  border-radius: 6px;
}
.sidebar a:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.sidebar a.active {
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: calc(0.6rem - 3px);
}

.sidebar nav { margin-bottom: 0.8rem; display: block; }

.main {
  flex: 1;
  padding: 2rem;
  max-width: 1600px;
}

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.06);
}

.section h3, .section h4 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; }

td details summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; }
td details summary:hover { color: var(--accent-hover); }
td details ul { font-size: 0.85rem; list-style: disc; }
td details li { margin-bottom: 0.2rem; }

.inline-form { display: flex; gap: 0.6rem; align-items: end; flex-wrap: wrap; margin-top: 0.5rem; }
.inline-form > div { flex: 1; min-width: 140px; }
.inline-form label { margin-top: 0; }
.inline-form button { margin-top: 0; white-space: nowrap; }

.badge { padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.badge.active { background: rgba(21, 128, 61, 0.12); color: var(--success); }
.badge.inactive { background: rgba(220, 38, 38, 0.12); color: var(--error); }

/* Datenerfassung: klickbare Formularliste */
.form-list { display: flex; flex-direction: column; gap: 0.6rem; }

.form-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.form-card:hover { border-color: var(--accent); background: var(--surface); }
.form-card:disabled { opacity: 0.6; cursor: not-allowed; }

.form-card .form-card-main { flex: 1; min-width: 0; }
.form-card .form-card-title { font-weight: 600; font-size: 0.98rem; }
.form-card .form-card-meta { color: var(--text-muted); font-size: 0.78rem; margin-top: 0.15rem; }

.form-card .form-card-progress {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-card .progress-track {
  flex: 1;
  background: var(--bg);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}

.form-card .progress-fill { background: var(--accent); height: 100%; }
.form-card .progress-fill.complete { background: var(--success); }
.form-card .progress-pct { width: 38px; flex-shrink: 0; text-align: right; font-size: 0.78rem; color: var(--text-muted); }

.form-card .form-card-arrow { color: var(--text-muted); flex-shrink: 0; }

/* Analyse-Modul */
.field-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-top: 1rem;
}

.field-card h4 { margin: 0 0 0.2rem; font-size: 1rem; }
.field-card .field-meta { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.8rem; }

.stat-row { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.stat-row .stat { min-width: 90px; }
.stat .stat-value { font-size: 1.3rem; font-weight: 700; }
.stat .stat-label { color: var(--text-muted); font-size: 0.75rem; }

.bar-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.4rem; font-size: 0.85rem; }
.bar-row .bar-label { width: 130px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; background: var(--bg); border-radius: 4px; height: 10px; overflow: hidden; }
.bar-row .bar-fill { background: var(--accent); height: 100%; }
.bar-row .bar-count { width: 70px; flex-shrink: 0; text-align: right; color: var(--text-muted); }

/* Datensatz-Editor: Kategorien-Navigation */
.record-layout { display: flex; gap: 1.5rem; align-items: flex-start; }

.category-nav {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
  color: var(--text);
}

.category-item:hover { background: var(--surface-2); }

.category-item.active {
  border-color: var(--accent);
  background: var(--surface-2);
}

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-dot.green { background: var(--success); }
.category-dot.yellow { background: var(--warning); }

.category-item .category-label { flex: 1; }
.category-item .category-progress { font-size: 0.75rem; color: var(--text-muted); }

.category-icon-img {
  /* Icons sind bereits dunkle Linien auf transparentem Grund - auf hellem
     Theme braucht es keinen Invertierungs-Filter mehr (der war fürs
     vorherige dunkle Theme gedacht, um sie weiß einzufärben). */
}

.record-fields { flex: 1; min-width: 0; }

.field-divider {
  border: none;
  border-top: 3px solid var(--border);
  margin: 30px 0;
}

#fields-container .field-header {
  color: var(--text);
  margin: 1.2rem 0 0.7rem;
}
.record-fields label { font-size: 16px; color: var(--text); font-weight: 600; }

/* Likert-Skala als Segmented Control */
.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-width: 700px;
}

.segmented-option {
  flex: 1 1 120px;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
}

.segmented-control-narrow { max-width: 292px; }
.segmented-control-narrow .segmented-option { flex: 0 0 142px; }

.segmented-option:hover { background: var(--surface); border-color: var(--accent); }

.segmented-option.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}

.segmented-labels {
  display: flex;
  justify-content: space-between;
  max-width: 360px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* AEMP-Zwilling: klickbare Kategorie-Kacheln mit Detailansicht
   (Demo, siehe js/demo-analyse.js) */
.twin-layout {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.twin-grid {
  flex: 0 1 220px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
}

.twin-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font: inherit;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(11, 11, 11, 0.05);
}

.twin-card:hover { border-color: var(--accent); background: var(--surface); }

.twin-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.twin-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
}

.twin-card .twin-card-label { font-weight: 600; font-size: 0.92rem; line-height: 1.25; }

.twin-card-score {
  flex-shrink: 0;
  font-weight: 700;
  font-size: 1rem;
}

.twin-card-graph-placeholder {
  height: 70px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.twin-detail {
  flex: 1 1 500px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem;
  min-height: 200px;
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.06);
}

.twin-detail .placeholder { color: var(--text-muted); font-size: 0.9rem; }

.twin-detail-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.twin-detail-header h4 { margin: 0; font-size: 1.4rem; }

.twin-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.twin-chart-block + .twin-chart-block {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.twin-chart-block h5 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.twin-chart-body {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.twin-chart-graph { flex: 1 1 380px; min-width: 0; }

.stat-tile-grid {
  flex: 0 0 400px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  align-content: start;
}

.stat-tile {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04);
}

.stat-tile-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-tile-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-tile-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.qa-list {
  margin-top: 1.6rem;
  max-width: 1050px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.05);
}

.qa-row {
  display: grid;
  grid-template-columns: 1fr 130px 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 0.6rem 0.9rem;
  font-size: 0.92rem;
}

.qa-row-wrap:nth-child(odd) { background: var(--surface-2); }

.qa-row-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.qa-frage { color: var(--text); }

.qa-antwort-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qa-kommentar {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

.qa-antwort {
  font-weight: 600;
  color: var(--accent);
}

.qa-antwort-gut { color: var(--success); }
.qa-antwort-schlecht { color: var(--warning); }

.qa-info-btn {
  flex-shrink: 0;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 1px solid var(--text-muted);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.qa-info-btn:hover { border-color: var(--accent); color: var(--accent); }

.qa-explain {
  padding: 0.7rem 0.9rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
}

/* Vergleichsgruppen-Filterleiste (zeigt gegen wen "Durchschnitt"/"Bester
   Wert" verglichen werden - sonst bleiben diese Referenzwerte anonym) */
.peer-group-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.peer-group-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.peer-group-label { font-size: 0.82rem; color: var(--text-muted); margin-right: 0.2rem; }

.peer-group-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  color: var(--text);
}

#peer-group-adjust-btn { opacity: 0.8; }

/* Vereinfachte Kachel-Vorschau: Sparkline + große Zahl + Delta statt eines
   vollständigen Mini-Diagramms mit 3 Linien und Legende (siehe Absprache im
   Chat - wirkte auf Kachelgröße zu unruhig). */
.twin-card-kpi {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.twin-card-sparkline { flex-shrink: 0; }

.twin-card-kpi-text { min-width: 0; }

.twin-card-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
}

.twin-card-kpi-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.3rem;
}

.twin-card-kpi-delta {
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

/* Fingerabdruck-Vergleichstabelle (pro Diagramm): Dot-Plot + Einfluss-Balken */
.fp-block {
  margin-top: 1.5rem;
  padding: 1.2rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.06);
}

.fp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.fp-block h5 { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 700; color: var(--text); }
.fp-subtitle { margin: 0; font-size: 0.8rem; color: var(--text-muted); max-width: 100%; }

.fp-legend {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--text-muted);
  align-items: center;
}

.fp-legend span { display: inline-flex; align-items: center; gap: 0.3rem; white-space: nowrap; }
.fp-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.fp-tick { width: 0; height: 12px; border-left: 2px dashed var(--text-muted); display: inline-block; }
.fp-span { width: 20px; height: 7px; border-radius: 4px; background: #c5cfdb; display: inline-block; }

.fp-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.3fr) minmax(0, 1fr);
  align-items: center;
  gap: 1.2rem;
  padding: 0.6rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--surface-2);
}

.fp-row-header {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  align-items: end;
}

.fp-influence-head { font-weight: 700; color: var(--text); }
.fp-influence-head small { display: block; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-muted); font-size: 0.68rem; }

.fp-label { color: var(--text); }
.fp-influence { display: flex; align-items: center; gap: 0.7rem; }
.fp-influence-value { font-weight: 700; color: var(--accent); min-width: 2.4rem; font-variant-numeric: tabular-nums; }
.fp-bar-track { flex: 1; height: 12px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.fp-bar-fill { display: block; height: 100%; background: #5b7c99; border-radius: 3px; }

/* Tablet (z. B. iPad 1024x768): Graph und Kennzahl-Boxen nebeneinander halten */
@media (max-width: 1100px) {
  .main { padding: 1rem; }
  #demo-analyse-section { padding: 1rem; }
  .twin-layout { gap: 0.8rem; }
  .twin-grid { flex: 0 1 200px; }
  .twin-detail { padding: 1rem; }
  .twin-chart-body { gap: 0.8rem; }
  .twin-chart-graph { flex: 1 1 320px; }
  .stat-tile-grid { flex: 0 0 250px; gap: 0.5rem; }
  .stat-tile { padding: 0.55rem 0.7rem; }
  .stat-tile-label { font-size: 0.72rem; }
  .stat-tile-value { font-size: 1.35rem; }
  .stat-tile-sub { font-size: 0.72rem; }
}

/* Tabs für Kategorien mit mehreren Diagrammen */
.twin-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.twin-tab {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  line-height: 1.25;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: -1px;
}

.twin-tab:hover { color: var(--accent); background: var(--surface-2); }

.twin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* [D] Analyse: weniger Außenrand, mehr Platz für Inhalte */
.main:has(#demo-analyse-section) { padding: 0.5rem; max-width: none; }
.main:has(#demo-analyse-section) #demo-analyse-section { padding: 0.8rem; }

.twin-tab { padding: 0.5rem 0.4rem; overflow-wrap: anywhere; hyphens: auto; }
.twin-tabs { min-width: 0; }

.twin-tab-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

.twin-tab { overflow-wrap: break-word; font-size: 0.85rem; }

.chart-dot { cursor: pointer; }

/* iOS Safari: Flex-Kinder in <button> strecken sich nicht immer auf volle Breite */
.twin-card { width: 100%; align-items: stretch; }
.twin-card-header { width: 100%; }
.twin-card .twin-card-label { flex: 1 1 auto; min-width: 0; }
.twin-card-score { margin-left: auto; }

.fp-head > div:first-child { flex: 1 1 100%; }
.fp-legend { width: 100%; justify-content: flex-end; }

/* Fingerabdruck: Button -> Ladeanimation -> animiertes Einblenden */
.fp-slot { margin-top: 1.5rem; }
.fp-slot .fp-block { margin-top: 0; }

.fp-cta { display: flex; justify-content: center; padding: 0.4rem 0; }

.fp-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, var(--accent), #6d4de0);
  color: #fff;
  padding: 0.8rem 1.4rem;
  border-radius: 999px;
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fp-cta-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.38); }
.fp-cta-btn:active { transform: translateY(0); }
.fp-cta-btn svg { animation: fp-wand-wiggle 2.4s ease-in-out infinite; transform-origin: 20% 80%; }

@keyframes fp-wand-wiggle {
  0%, 70%, 100% { transform: rotate(0); }
  78% { transform: rotate(-14deg); }
  86% { transform: rotate(10deg); }
  94% { transform: rotate(-6deg); }
}

.fp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: 1.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(11, 11, 11, 0.06);
  animation: fp-fade-in 0.3s ease both;
}

.fp-spinner { display: flex; gap: 8px; height: 22px; align-items: center; }
.fp-spinner span {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  animation: fp-bounce 1s ease-in-out infinite;
}
.fp-spinner span:nth-child(2) { animation-delay: 0.15s; background: #6d4de0; }
.fp-spinner span:nth-child(3) { animation-delay: 0.3s; background: #0ca30c; }

@keyframes fp-bounce {
  0%, 80%, 100% { transform: translateY(0) scale(0.8); opacity: 0.5; }
  40% { transform: translateY(-9px) scale(1.1); opacity: 1; }
}

.fp-loading-text { font-size: 0.9rem; color: var(--text-muted); min-height: 1.3em; }

.fp-loading-bar { width: min(320px, 80%); height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.fp-loading-bar span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--accent), #6d4de0);
  border-radius: 2px;
  transform-origin: left;
  animation: fp-progress 2.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fp-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fp-fade-in { from { opacity: 0; } to { opacity: 1; } }

.fp-animate { animation: fp-reveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.fp-animate .fp-row:not(.fp-row-header) {
  animation: fp-row-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(0.25s + var(--i, 0) * 0.09s);
}
.fp-animate .fp-bar-fill {
  transform-origin: left;
  animation: fp-progress 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(0.4s + var(--i, 0) * 0.09s);
}
.fp-animate .fp-row:not(.fp-row-header) .fp-bar-fill { animation-delay: calc(0.4s + var(--i, 0) * 0.09s); }

@keyframes fp-reveal {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes fp-row-in {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fp-cta-btn svg, .fp-spinner span, .fp-loading-bar span,
  .fp-animate, .fp-animate .fp-row, .fp-animate .fp-bar-fill { animation: none !important; }
}

.fp-cta { padding-top: 1.2rem; }
