/* ═══════════════════════════════════════════════════════════════
   FSM Frequenz Plugin – Frontend Styles v2.1.0
   Luxxamed GmbH
   Explizite Farben – kein Theme-Erbe – Dark-Mode sicher
   ═══════════════════════════════════════════════════════════════ */

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

/* Scoped Reset */
.fsm-wrap, .fsm-wrap *, .fsm-wrap *::before, .fsm-wrap *::after {
  box-sizing: border-box;
}

.fsm-wrap {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-size: 16px;
  line-height: 1.65;
  color: #111827 !important;
  background: transparent;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px 64px;
  -webkit-font-smoothing: antialiased;
  /* Channel colors */
  --ch-a: #1d4ed8;
  --ch-b: #0d9488;
  --ch-c: #7c3aed;
  --ch-d: #b45309;
  --fsm-radius-sm: 8px;
  --fsm-radius: 14px;
  --fsm-radius-xl: 22px;
}

/* ── Hero ── */
.fsm-hero { text-align: center; padding: 56px 24px 48px; }

.fsm-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #dbeafe; color: #1e40af;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 5px 16px; border-radius: 100px; border: 1px solid #bfdbfe; margin-bottom: 20px;
}

.fsm-hero-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 400; line-height: 1.15;
  margin: 0 0 16px; color: #111827 !important; letter-spacing: -.01em;
}
.fsm-hero-title span { color: #2563eb !important; font-style: italic; }
.fsm-hero-sub { color: #4b5563 !important; font-size: 15px; margin: 0; }

/* ── Cards – weißer Hintergrund erzwungen ── */
.fsm-card {
  background: #ffffff !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: var(--fsm-radius-xl);
  padding: 32px 36px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 28px rgba(0,0,0,.08);
  margin-bottom: 20px;
  color: #111827 !important;
}
@media (max-width: 640px) { .fsm-card { padding: 20px 18px; } }

/* ── Patientenkontext (NEU) ── */
.fsm-context-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 12px;
  margin-bottom: 24px; padding: 16px 20px;
  background: #f9fafb !important; border: 1px solid #e5e7eb; border-radius: var(--fsm-radius);
}
@media (max-width: 640px) { .fsm-context-grid { grid-template-columns: 1fr 1fr; } }

.fsm-context-title {
  grid-column: 1 / -1; font-size: 11px; font-weight: 700;
  color: #6b7280 !important; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 4px;
}
.fsm-context-field label {
  display: block; font-size: 11px; font-weight: 600;
  color: #6b7280 !important; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .06em;
}
.fsm-context-field select,
.fsm-context-field input[type=number] {
  width: 100%; padding: 7px 10px; border: 1.5px solid #d1d5db;
  border-radius: 6px; background: #ffffff !important; color: #111827 !important;
  font-family: inherit; font-size: 13px; transition: border-color .2s;
  -webkit-appearance: none; appearance: none;
}
.fsm-context-field select:focus,
.fsm-context-field input:focus {
  outline: none; border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* ── Global button reset against theme overrides ── */
.fsm-wrap button {
  display: inline-flex !important;
  width: auto !important;
  margin: 0;
}

/* ── Mode Switcher (overridden below with .fsm-wrap scope + !important) ── */
.fsm-mode-switcher { display: inline-flex; background: #f3f4f6; border: 1.5px solid #e5e7eb; border-radius: 100px; padding: 4px; gap: 3px; margin-bottom: 28px; }
.fsm-mode-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 20px; border: none; background: transparent; color: #6b7280; font-family: inherit; font-size: 14px; font-weight: 500; border-radius: 100px; cursor: pointer; }
.fsm-mode-btn.active { background: #ffffff; color: #1d4ed8; box-shadow: 0 1px 4px rgba(0,0,0,.14); }

/* ── Input Grid ── */
.fsm-inputs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media (max-width: 640px) { .fsm-inputs-grid { grid-template-columns: 1fr; } }

.fsm-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.fsm-field:last-child, .fsm-inputs-grid .fsm-field { margin-bottom: 0; }

.fsm-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: #4b5563 !important;
  text-transform: uppercase; letter-spacing: .08em;
}
.fsm-label-tag {
  padding: 2px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 700; color: #ffffff !important;
}
.fsm-tag-a { background: var(--ch-a) !important; }
.fsm-tag-b { background: var(--ch-b) !important; }

.fsm-input, .fsm-textarea {
  width: 100%; border: 1.5px solid #d1d5db !important;
  background: #f9fafb !important; border-radius: var(--fsm-radius-sm);
  padding: 12px 16px; font-family: inherit; font-size: 15px; line-height: 1.5;
  color: #111827 !important; transition: border-color .2s, box-shadow .2s, background .2s;
}
.fsm-input:focus, .fsm-textarea:focus {
  outline: none !important; border-color: #3b82f6 !important;
  background: #ffffff !important; box-shadow: 0 0 0 3px rgba(59,130,246,.18) !important;
}
.fsm-input::placeholder, .fsm-textarea::placeholder { color: #9ca3af !important; }
.fsm-textarea { resize: vertical; min-height: 160px; }

/* ── Chips ── */
/* ── Chips – CRITICAL: theme often sets button{display:block;width:100%} ── */
.fsm-wrap .fsm-chips {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin-top: 8px;
}
.fsm-wrap .fsm-chip {
  display: inline-flex !important;
  width: auto !important;
  padding: 4px 13px !important;
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  color: #1d4ed8 !important;
  border-radius: 100px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  font-family: inherit !important;
  line-height: 1.4 !important;
  white-space: nowrap !important;
  transition: background .15s, transform .1s;
  box-shadow: none !important;
  text-align: center !important;
}
.fsm-wrap .fsm-chip:hover {
  background: #dbeafe !important;
  transform: translateY(-1px) !important;
  color: #1d4ed8 !important;
}

/* ── Mode Switcher ── */
.fsm-wrap .fsm-mode-switcher {
  display: inline-flex !important;
  background: #f3f4f6 !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 100px !important;
  padding: 4px !important;
  gap: 3px !important;
  margin-bottom: 28px !important;
  width: auto !important;
}
.fsm-wrap .fsm-mode-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 8px 20px !important;
  border: none !important;
  background: transparent !important;
  color: #6b7280 !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border-radius: 100px !important;
  cursor: pointer !important;
  width: auto !important;
  box-shadow: none !important;
  transition: background .2s, color .2s, box-shadow .2s;
}
.fsm-wrap .fsm-mode-btn.active {
  background: #ffffff !important;
  color: #1d4ed8 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,.14) !important;
}
.fsm-consent-area { margin: 8px 0 24px; }

.fsm-disclaimer-box {
  background: #fafafa !important;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #f59e0b;
  border-radius: var(--fsm-radius-sm);
  padding: 18px 22px;
  font-size: 13px;
  line-height: 1.7;
  color: #374151 !important;
  margin-bottom: 16px;
}
.fsm-disclaimer-box strong {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #92400e !important;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
}
.fsm-disclaimer-box ul {
  margin: 0;
  padding-left: 18px;
}
.fsm-disclaimer-box li {
  margin-bottom: 7px;
  color: #4b5563 !important;
}
.fsm-disclaimer-box li strong {
  display: inline;
  font-size: inherit;
  color: #374151 !important;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0;
}
.fsm-disclaimer-extra {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #d1d5db;
  font-size: 13px;
  color: #4b5563 !important;
}

/* ── Checkbox ── */
.fsm-checkbox-label {
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; margin-bottom: 14px;
}
.fsm-checkbox-label input[type=checkbox] { display: none; }
.fsm-checkbox-custom {
  flex-shrink: 0; width: 20px; height: 20px;
  border: 2px solid #d1d5db; border-radius: 5px;
  background: #ffffff !important; margin-top: 2px;
  transition: all .2s; position: relative;
}
.fsm-checkbox-label input:checked ~ .fsm-checkbox-custom {
  background: #2563eb !important; border-color: #2563eb !important;
}
.fsm-checkbox-label input:checked ~ .fsm-checkbox-custom::after {
  content: ''; position: absolute; left: 4px; top: 0;
  width: 8px; height: 13px; border: 2.5px solid #ffffff;
  border-top: none; border-left: none; transform: rotate(45deg);
}
.fsm-checkbox-label span:last-child {
  font-size: 13.5px; line-height: 1.55; color: #374151 !important;
}

/* ── Buttons ── */
.fsm-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.fsm-btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  background: #2563eb !important; color: #ffffff !important;
  border: none; padding: 13px 28px; border-radius: var(--fsm-radius-sm);
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform .15s, box-shadow .2s, background .15s;
  box-shadow: 0 2px 8px rgba(37,99,235,.35); text-decoration: none !important;
}
.fsm-btn-primary:hover {
  background: #1d4ed8 !important; color: #ffffff !important;
  transform: translateY(-1px); box-shadow: 0 4px 16px rgba(37,99,235,.45);
}
.fsm-btn-primary[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

@keyframes fsm-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.fsm-spinner { display: flex; animation: fsm-spin 700ms linear infinite; }

.fsm-export-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.fsm-btn-export {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border: 1.5px solid #e5e7eb !important;
  background: #ffffff !important; color: #374151 !important;
  border-radius: var(--fsm-radius-sm); font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color .2s, color .2s, background .2s;
}
.fsm-btn-export:hover {
  border-color: #2563eb !important; color: #1d4ed8 !important; background: #eff6ff !important;
}
.fsm-btn-export-pdf {
  border-color: #fecaca !important; color: #991b1b !important; background: #fff5f5 !important;
}
.fsm-btn-export-pdf:hover {
  border-color: #dc2626 !important; background: #fee2e2 !important;
}

/* ── Result Meta ── */
.fsm-result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 10px; flex-wrap: wrap; gap: 8px;
}
.fsm-result-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.fsm-result-meta span {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f3f4f6; padding: 3px 10px; border-radius: 100px;
  color: #374151 !important; font-size: 12px; font-weight: 500;
}
.fsm-result { min-height: 40px; }

/* ── Output Content ─────────────────────────────────────────────────────── */
.fsm-output {
  color: #111827 !important;
  background: #ffffff !important;
  font-size: 15px;
  line-height: 1.7;
}

/* ── Protokoll-Titel (H1) ── */
.fsm-output .fsm-h1 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  color: #0f172a !important;
  margin: 0 0 6px;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.fsm-output .fsm-h1::before {
  content: '';
  display: block;
  height: 4px;
  width: 48px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 2px;
  margin-bottom: 14px;
}

/* ── Abschnitts-Header (H2) ── */
.fsm-output .fsm-h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #1e40af !important;
  margin: 32px 0 14px;
  padding: 12px 18px;
  background: #eff6ff !important;
  border-left: 4px solid #2563eb;
  border-radius: 0 8px 8px 0;
  letter-spacing: .01em;
  text-transform: none;
  font-family: 'DM Sans', sans-serif;
}
.fsm-output .fsm-h2 .fsm-section-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: #2563eb !important;
  color: #ffffff !important;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Sub-Header (H3) ── */
.fsm-output .fsm-h3 {
  font-size: .85rem;
  font-weight: 700;
  color: #374151 !important;
  text-transform: uppercase;
  letter-spacing: .09em;
  margin: 20px 0 8px;
}

/* ── Absatz ── */
.fsm-output .fsm-p {
  margin: 0 0 13px;
  color: #374151 !important;
  line-height: 1.75;
}

/* ── Abschnitt-Trenner ── */
.fsm-output .fsm-divider {
  margin: 28px 0 0;
  height: 0;
  border: none;
}

/* ── Listen ── */
.fsm-output .fsm-list {
  margin: 4px 0 16px;
  padding-left: 22px;
  color: #374151 !important;
}
.fsm-output .fsm-list li {
  margin-bottom: 7px;
  line-height: 1.65;
  color: #374151 !important;
}

/* ── Checkliste ── */
.fsm-output .fsm-checklist {
  list-style: none;
  padding: 14px 18px;
  margin: 4px 0 16px;
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}
.fsm-output .fsm-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 0;
  color: #166534 !important;
  line-height: 1.5;
  margin: 0;
  font-size: 14px;
}
.fsm-output .fsm-checklist li + li {
  border-top: 1px solid #d1fae5;
}
.fsm-output .fsm-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  background: #16a34a !important;
  color: #ffffff !important;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  margin-top: 1px;
}

/* ── Inline Code ── */
.fsm-output .fsm-code {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 1px 7px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: #2563eb !important;
}

/* ═══════════════════════════════════════════════
   PROTOKOLL-TABELLE – modernes Channel-Design
   ═══════════════════════════════════════════════ */
.fsm-output table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 6px 0 24px;
  font-size: 13.5px;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 2px 12px rgba(0,0,0,.07);
  background: #ffffff !important;
}

/* Header-Zeile */
.fsm-output thead tr {
  background: #0f172a !important;
}
.fsm-output thead th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #94a3b8 !important;
  white-space: nowrap;
  border-bottom: none;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
/* Spalten-Labels in Kanal-Farbe */
.fsm-output thead th:nth-child(1) { color: #cbd5e1 !important; }  /* Phase */
.fsm-output thead th:nth-child(2) {                                /* Kanal A */
  color: #93c5fd !important;
  background: rgba(37,99,235,.35) !important;
  border-top-left-radius: 0;
}
.fsm-output thead th:nth-child(3) { color: #5eead4 !important; background: rgba(13,148,136,.3) !important; } /* B */
.fsm-output thead th:nth-child(4) { color: #c4b5fd !important; background: rgba(124,58,237,.3) !important; } /* C */
.fsm-output thead th:nth-child(5) { color: #fcd34d !important; background: rgba(180,83,9,.3) !important;  } /* D */
.fsm-output thead th:nth-child(6) { color: #94a3b8 !important; }  /* Min */

/* Kanal-Header-Badges */
.fsm-output thead th:nth-child(2)::before { content: 'A · '; opacity: .7; }
.fsm-output thead th:nth-child(3)::before { content: 'B · '; opacity: .7; }
.fsm-output thead th:nth-child(4)::before { content: 'C · '; opacity: .7; }
.fsm-output thead th:nth-child(5)::before { content: 'D · '; opacity: .7; }

/* Zeilen */
.fsm-output tbody tr {
  border-bottom: 1px solid #f1f5f9;
  background: #ffffff !important;
  transition: background .12s;
}
.fsm-output tbody tr:nth-child(even) { background: #f8fafc !important; }
.fsm-output tbody tr:last-child { border-bottom: none; }
.fsm-output tbody tr:hover { background: #f0f7ff !important; }

/* Zellen */
.fsm-output tbody td {
  padding: 13px 16px;
  vertical-align: middle;
  color: #374151 !important;
  border: none;
}
.fsm-output tbody td:first-child {
  font-weight: 700;
  color: #0f172a !important;
  font-size: 12.5px;
  white-space: nowrap;
}

/* Frequenz-Werte in Kanal-Farben */
.fsm-output tbody td:nth-child(2) {
  color: #1d4ed8 !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.fsm-output tbody td:nth-child(3) {
  color: #0d9488 !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.fsm-output tbody td:nth-child(4) {
  color: #7c3aed !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.fsm-output tbody td:nth-child(5) {
  color: #b45309 !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.fsm-output tbody td:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #4b5563 !important;
  text-align: center;
  white-space: nowrap;
}

/* ── Frequenz-Liste (Markdown-Tabelle) ── */
.fsm-output .fsm-md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 20px;
  font-size: 13.5px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #e5e7eb;
  background: #ffffff !important;
}
.fsm-output .fsm-md-table th {
  background: #f8fafc !important;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6b7280 !important;
  border-bottom: 1.5px solid #e5e7eb;
}
.fsm-output .fsm-md-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151 !important;
  vertical-align: top;
  line-height: 1.6;
}
.fsm-output .fsm-md-table td:first-child {
  font-weight: 700;
  color: #1d4ed8 !important;
  white-space: nowrap;
  width: 120px;
}
.fsm-output .fsm-md-table tr:last-child td { border-bottom: none; }
.fsm-output .fsm-md-table tr:hover td { background: #f9fafb !important; }

/* ── Feedback ── */
.fsm-feedback {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 24px; padding: 14px 18px;
  background: #f9fafb !important; border: 1px solid #e5e7eb;
  border-radius: var(--fsm-radius-sm);
}
.fsm-feedback-label { font-size: 13px; font-weight: 600; color: #374151 !important; white-space: nowrap; }
.fsm-feedback-stars { display: flex; gap: 4px; }
.fsm-star {
  background: none; border: none; font-size: 22px; cursor: pointer;
  padding: 0 2px; color: #d1d5db; transition: color .15s, transform .1s; line-height: 1;
}
.fsm-star:hover, .fsm-star.active { color: #f59e0b; transform: scale(1.2); }
.fsm-feedback-note {
  flex: 1; min-width: 160px; padding: 7px 12px; border: 1.5px solid #d1d5db;
  border-radius: 6px; font-family: inherit; font-size: 13px;
  color: #111827 !important; background: #ffffff !important;
}
.fsm-feedback-note:focus { outline: none; border-color: #3b82f6; }
.fsm-feedback-save {
  padding: 7px 16px; background: #2563eb !important; color: #ffffff !important;
  border: none; border-radius: 6px; font-family: inherit; font-size: 13px;
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .15s;
}
.fsm-feedback-save:hover { background: #1d4ed8 !important; }
.fsm-feedback-saved { font-size: 12px; color: #16a34a !important; font-weight: 600; }

/* ── Loading / Error ── */
.fsm-loading-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 56px 24px; gap: 20px; color: #6b7280 !important; background: #ffffff !important;
}
.fsm-loading-state p { margin: 0; color: #6b7280 !important; }
.fsm-loading-dots { display: flex; gap: 8px; }
.fsm-loading-dots span {
  width: 11px; height: 11px; background: #2563eb; border-radius: 50%;
  animation: fsm-bounce 1.2s ease-in-out infinite; opacity: .3;
}
.fsm-loading-dots span:nth-child(2) { animation-delay: .2s; }
.fsm-loading-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes fsm-bounce {
  0%,80%,100% { transform: scale(.7); opacity: .3; }
  40% { transform: scale(1); opacity: 1; }
}

.fsm-error {
  padding: 16px 20px; background: #fef2f2 !important;
  border: 1.5px solid #fecaca; border-radius: var(--fsm-radius-sm);
  color: #991b1b !important; font-size: 14px;
}
.fsm-error strong { color: #7f1d1d !important; }

@keyframes fsm-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}
.fsm-shake { animation: fsm-shake .5s ease; }

/* ════════════════════════════════════
   PRINT/PDF – wird nicht mehr genutzt
   (PDF via Popup-Fenster, s. JS)
   ════════════════════════════════════ */
@media print {
  body > *:not(#fsm-print-frame) { display: none !important; }
}

/* ── Language switcher ── */
.fsm-lang-bar {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 12px;
}
.fsm-lang-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 5px 14px !important;
  border: 1.5px solid #e5e7eb !important;
  border-radius: 100px !important;
  background: #ffffff !important;
  color: #6b7280 !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all .15s;
  width: auto !important;
  box-shadow: none !important;
}
.fsm-lang-btn.active {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  color: #1d4ed8 !important;
}
.fsm-lang-btn:hover {
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
}

/* ── Banner-System (Warnings, Komplexpatient, Block) ──────────────────────── */
.fsm-banner {
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.55;
  border: 1.5px solid;
}
.fsm-banner strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
}
.fsm-banner p, .fsm-banner ul {
  margin: 0;
  padding: 0;
}
.fsm-banner ul {
  list-style: none;
  margin-top: 6px;
}
.fsm-banner ul li {
  padding: 6px 0 6px 22px;
  position: relative;
  border-top: 1px solid rgba(0,0,0,.06);
  color: #4b5563;
}
.fsm-banner ul li:first-child { border-top: none; }
.fsm-banner ul li::before {
  content: '⚠';
  position: absolute;
  left: 0;
  top: 6px;
  font-size: 14px;
}

/* Komplexpatient — blau / informativ */
.fsm-banner-info {
  background: #eff6ff !important;
  border-color: #bfdbfe;
  color: #1e40af !important;
}
.fsm-banner-info strong { color: #1e3a8a !important; }
.fsm-banner-info p { color: #1e40af !important; }

/* Klinische Warnungen — amber */
.fsm-banner-warn {
  background: #fffbeb !important;
  border-color: #fde68a;
  color: #78350f !important;
}
.fsm-banner-warn strong { color: #78350f !important; }
.fsm-banner-warn ul li { color: #78350f !important; }
.fsm-banner-warn ul li::before { color: #d97706; }

/* Block — rot, kritisch */
.fsm-banner-block {
  background: #fef2f2 !important;
  border-color: #fecaca;
  color: #7f1d1d !important;
  padding: 22px 26px;
}
.fsm-banner-block strong {
  color: #7f1d1d !important;
  font-size: 16px !important;
}
.fsm-banner-block pre {
  margin: 12px 0 0;
  padding: 14px 16px;
  background: #ffffff;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #7f1d1d !important;
}
.fsm-blocked {
  padding: 22px 26px;
  background: #fef2f2 !important;
  border: 1.5px solid #fecaca;
  border-radius: 10px;
  color: #7f1d1d !important;
}

/* ── Game-Changer #1: Patient Journey ─────────────────────────────────────── */
.fsm-journey-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px 18px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%) !important;
  border: 1.5px solid #dbeafe;
  border-radius: 12px;
  margin-bottom: 18px;
}
.fsm-journey-title {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 700;
  color: #1e40af !important;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 2px;
}
.fsm-help {
  display: block;
  margin-top: 5px;
  font-size: 11.5px;
  color: #6b7280 !important;
  line-height: 1.45;
  font-style: italic;
}

/* NRS-Slider */
.fsm-nrs-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fsm-nrs-row input[type=range] {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, #16a34a 0%, #fbbf24 50%, #dc2626 100%);
  border-radius: 100px;
  outline: none;
  cursor: pointer;
}
.fsm-nrs-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  background: #ffffff;
  border: 2.5px solid #2563eb;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.fsm-nrs-row input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: #ffffff;
  border: 2.5px solid #2563eb;
  border-radius: 50%;
  cursor: pointer;
}
.fsm-nrs-out {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 30px;
  padding: 0 8px;
  background: #ffffff !important;
  border: 1.5px solid #e5e7eb;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  color: #374151 !important;
  font-variant-numeric: tabular-nums;
}
.fsm-nrs-out.fsm-nrs-low  { color: #166534 !important; border-color: #bbf7d0; background: #f0fdf4 !important; }
.fsm-nrs-out.fsm-nrs-mid  { color: #92400e !important; border-color: #fde68a; background: #fffbeb !important; }
.fsm-nrs-out.fsm-nrs-high { color: #991b1b !important; border-color: #fecaca; background: #fef2f2 !important; }

/* History-Panel */
.fsm-journey-panel {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 14px 16px;
  background: #ffffff !important;
  border: 1.5px solid #bfdbfe;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(37,99,235,.08);
}
.fsm-journey-empty {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: #2563eb !important;
  font-weight: 600;
}
.fsm-journey-icon {
  font-size: 18px;
}
.fsm-journey-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}
.fsm-journey-header strong {
  font-size: 13px;
  color: #1e3a8a !important;
}
.fsm-journey-badge {
  font-size: 11px;
  font-weight: 700;
  background: #2563eb !important;
  color: #ffffff !important;
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: .05em;
}
.fsm-journey-trend {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: #f8fafc !important;
  border-radius: 6px;
}
.fsm-journey-trend-label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280 !important;
  text-transform: uppercase;
  letter-spacing: .07em;
  white-space: nowrap;
}
.fsm-sparkline {
  width: 100%;
  max-width: 240px;
  height: 40px;
}
.fsm-journey-sessions {
  display: grid;
  gap: 8px;
}
.fsm-journey-session {
  padding: 9px 12px;
  background: #f8fafc !important;
  border-left: 3px solid #93c5fd;
  border-radius: 6px;
  font-size: 12.5px;
}
.fsm-journey-row1 {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 3px;
}
.fsm-journey-sn {
  font-weight: 700;
  color: #1e3a8a !important;
}
.fsm-journey-date {
  color: #6b7280 !important;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
}
.fsm-journey-rating {
  margin-left: auto;
  color: #f59e0b;
  font-size: 12px;
  letter-spacing: 1px;
}
.fsm-journey-row2 {
  display: flex; align-items: center; gap: 10px;
  color: #374151 !important;
}
.fsm-journey-indication {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fsm-nrs-delta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
}
.fsm-nrs-delta.fsm-nrs-good { background: #dcfce7; color: #166534; }
.fsm-nrs-delta.fsm-nrs-bad  { background: #fee2e2; color: #991b1b; }
.fsm-nrs-delta.fsm-nrs-flat { background: #f1f5f9; color: #475569; }
.fsm-journey-freqs {
  margin-top: 6px;
  display: flex; flex-wrap: wrap; gap: 4px;
}
.fsm-mini-freq {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  border-radius: 100px;
  font-variant-numeric: tabular-nums;
}

/* Responsive */
@media (max-width: 720px) {
  .fsm-journey-grid {
    grid-template-columns: 1fr;
  }
}
