/* Global reset and design tokens */
:root {
  color-scheme: light dark;

  --color-bg-light: #f8fafc;
  --color-bg-dark: #020617;
  --color-card-bg-light: #ffffff;
  --color-card-bg-dark: #0f172a;
  --color-card-border-light: #e2e8f0;
  --color-card-border-dark: #1e293b;
  --color-text-light: #0f172a;
  --color-text-dark: #f8fafc;
  --color-text-muted-light: #64748b;
  --color-text-muted-dark: #94a3b8;
  --color-primary-light: #0f4d65;
  --color-primary-dark: #38bdf8;
  --color-primary-hover-light: #0b394b;
  --color-primary-hover-dark: #7dd3fc;
  --color-primary-fg-light: #ffffff;
  --color-primary-fg-dark: #0f172a;
  --color-input-bg-light: #ffffff;
  --color-input-bg-dark: #020617;
  --color-input-border-light: #cbd5e1;
  --color-input-border-dark: #334155;
  --color-error-text-light: #dc2626;
  --color-error-text-dark: #f87171;
  --color-error-bg-light: #fef2f2;
  --color-error-bg-dark: #450a0a;

  /* Default light fallback */
  --bg: var(--color-bg-light);
  --card-bg: var(--color-card-bg-light);
  --card-border: var(--color-card-border-light);
  --text: var(--color-text-light);
  --text-muted: var(--color-text-muted-light);
  --primary: var(--color-primary-light);
  --primary-hover: var(--color-primary-hover-light);
  --primary-fg: var(--color-primary-fg-light);
  --input-bg: var(--color-input-bg-light);
  --input-border: var(--color-input-border-light);
  --error-text: var(--color-error-text-light);
  --error-bg: var(--color-error-bg-light);
}

/* Fallback for browsers without light-dark() support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--color-bg-dark);
    --card-bg: var(--color-card-bg-dark);
    --card-border: var(--color-card-border-dark);
    --text: var(--color-text-dark);
    --text-muted: var(--color-text-muted-dark);
    --primary: var(--color-primary-dark);
    --primary-hover: var(--color-primary-hover-dark);
    --primary-fg: var(--color-primary-fg-dark);
    --input-bg: var(--color-input-bg-dark);
    --input-border: var(--color-input-border-dark);
    --error-text: var(--color-error-text-dark);
    --error-bg: var(--color-error-bg-dark);
  }
}

/* Modern light-dark() color scheme adaptation */
@supports (color: light-dark(black, white)) {
  :root {
    --bg: light-dark(var(--color-bg-light), var(--color-bg-dark));
    --card-bg: light-dark(var(--color-card-bg-light), var(--color-card-bg-dark));
    --card-border: light-dark(var(--color-card-border-light), var(--color-card-border-dark));
    --text: light-dark(var(--color-text-light), var(--color-text-dark));
    --text-muted: light-dark(var(--color-text-muted-light), var(--color-text-muted-dark));
    --primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
    --primary-hover: light-dark(var(--color-primary-hover-light), var(--color-primary-hover-dark));
    --primary-fg: light-dark(var(--color-primary-fg-light), var(--color-primary-fg-dark));
    --input-bg: light-dark(var(--color-input-bg-light), var(--color-input-bg-dark));
    --input-border: light-dark(var(--color-input-border-light), var(--color-input-border-dark));
    --error-text: light-dark(var(--color-error-text-light), var(--color-error-text-dark));
    --error-bg: light-dark(var(--color-error-bg-light), var(--color-error-bg-dark));
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.center-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.login-card {
  width: 100%;
  max-width: 26rem;
  padding: 2rem;
}

.card-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 0.5rem;
}

.card-description {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.field-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  color: var(--text);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 0.5rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 77, 101, 0.2);
}

/* Validation after user interaction per modern-web-guidance */
.field-input:user-invalid {
  border-color: var(--error-text);
}

.error-msg {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--error-text);
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  width: 100%;
  background-color: var(--primary);
  color: var(--primary-fg);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text);
  border-color: var(--card-border);
}

.btn-secondary:hover {
  background-color: var(--card-border);
}

/* Dashboard view */
.dashboard-wrapper {
  max-width: 56rem;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--card-border);
}

.dashboard-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.badge-success {
  background-color: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

@media (prefers-color-scheme: dark) {
  .badge-success {
    background-color: rgba(34, 197, 94, 0.25);
    color: #4ade80;
  }
}

.dashboard-card {
  padding: 2rem;
}

.status-box {
  padding: 1rem;
  border-radius: 0.5rem;
  background-color: var(--bg);
  border: 1px solid var(--card-border);
  margin-top: 1rem;
}

.status-text {
  font-size: 0.9375rem;
  color: var(--text-muted);
}

/* Small button utility */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  gap: 0.375rem;
}

/* Dialog Translation Test Interface */
.dialog-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--card-border);
  background-color: var(--card-bg);
  flex-shrink: 0;
  z-index: 10;
  gap: 1rem;
}

.dialog-header-left,
.dialog-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Model provider selector in test page header */
.model-provider-selector {
  display: flex;
  align-items: center;
}

.provider-select {
  height: 2rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.provider-select:hover {
  border-color: var(--primary);
}

.provider-select:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 77, 101, 0.2);
}

/* Header cumulative statistics */
.dialog-header-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stats-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background-color: var(--card-bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stats-badge-cost {
  color: var(--primary);
  font-weight: 700;
}

.dialog-header-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

@media (max-width: 768px) {
  .dialog-header {
    flex-wrap: wrap;
  }
  .dialog-header-stats,
  .dialog-header-center {
    order: 3;
    width: 100%;
    justify-content: center;
  }
}

.nav-back-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.inline-logout-form {
  margin: 0;
}

.icon-svg {
  display: inline-block;
  vertical-align: middle;
}

.dialog-title {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dialog-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem 2rem;
  display: flex;
  justify-content: center;
  scroll-behavior: smooth;
}

.dialog-feed {
  width: 100%;
  max-width: 44rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
  color: var(--text-muted);
  border: 2px dashed var(--card-border);
  border-radius: 0.75rem;
  background-color: var(--card-bg);
}

.empty-state-text {
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Card Tiers (adapted from begleit-app-analyse dialog evaluation cards) */
.dialog-card {
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  transition: box-shadow 0.15s ease;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card-header-badges {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.card-role-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.card-content {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
}

/* 1. NutzerIn tier: White / Slate-300 border */
.card-user {
  background-color: var(--card-bg);
  border: 1px solid var(--input-border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* 2. GesprächspartnerIn tier: Slate-50 background / Slate-200 border */
.card-partner {
  background-color: light-dark(#f8fafc, #0f172a);
  border: 1px solid light-dark(#e2e8f0, #1e293b);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* 3. GesprächspartnerIn (Leichte Sprache) tier: Slate-100 background / Slate-300 border */
.card-partner-leichte {
  background-color: light-dark(#f1f5f9, #1e293b);
  border: 1px solid light-dark(#cbd5e1, #334155);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.card-partner-leichte .card-role-title {
  color: var(--primary);
}

/* Live Recording Dot */
.live-pulse-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-left: 0.5rem;
  border-radius: 50%;
  background-color: #ef4444;
  vertical-align: middle;
  animation: pulse-dot 1.2s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.6; }
}

/* Loading & Spinner */
.card-loading-state,
.error-retry-state {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Markdown rendered styles */
.md-rendered-content {
  line-height: 1.6;
}

.md-heading {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.75rem 0 0.375rem;
}

.md-ul, .md-ol {
  margin: 0.375rem 0;
  padding-left: 1.25rem;
}

.md-li, .md-oli {
  margin-bottom: 0.25rem;
}

/* Warning banners inside card */
.warning-box {
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
}

.warning-headline {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.warning-body {
  line-height: 1.5;
}

.warning-info {
  background-color: light-dark(#eff6ff, #172554);
  border: 1px solid light-dark(#bfdbfe, #1e3a8a);
  color: light-dark(#1e40af, #93c5fd);
}

.warning-warning {
  background-color: light-dark(#fffbeb, #451a03);
  border: 1px solid light-dark(#fde68a, #78350f);
  color: light-dark(#92400e, #fef08a);
}

.warning-danger {
  background-color: var(--error-bg);
  border: 1px solid var(--error-text);
  color: var(--error-text);
}

.reveal-btn {
  margin-top: 0.5rem;
}

/* Card Header Row and Actions */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
}

/* Card TTS Play / Stop Button */
.card-tts-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  min-height: 32px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  border: 1px solid light-dark(#cbd5e1, #475569);
  background-color: light-dark(#ffffff, #1e293b);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card-tts-play-btn:hover {
  background-color: light-dark(#f1f5f9, #334155);
  border-color: light-dark(#94a3b8, #64748b);
}

.card-tts-play-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.card-tts-play-btn.is-speaking {
  background-color: light-dark(#fee2e2, #7f1d1d);
  border-color: light-dark(#f87171, #ef4444);
  color: light-dark(#b91c1c, #fecaca);
}

.card-tts-play-btn.is-speaking:hover {
  background-color: light-dark(#fecaca, #991b1b);
}

.card-tts-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.card-tts-wave {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 12px;
  margin-left: 2px;
}

.card-tts-wave span {
  display: block;
  width: 2px;
  height: 100%;
  background-color: currentColor;
  border-radius: 1px;
  animation: ttsWave 1s ease-in-out infinite alternate;
}

.card-tts-wave span:nth-child(2) {
  animation-delay: 0.2s;
}

.card-tts-wave span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ttsWave {
  0% { transform: scaleY(0.25); }
  100% { transform: scaleY(1); }
}

/* Card highlight while active speech playback is ongoing */
.dialog-card.is-tts-playing {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* Debug Info and Token Metrics Styles */
body.hide-card-debug .card-header-badges,
body.hide-card-debug .debug-reasoning-details,
body.hide-card-debug .debug-response-tokens-row,
body.hide-card-debug .debug-prompt-details,
body.hide-card-debug .debug-classification-details {
  display: none !important;
}

.toggle-debug-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  transition: all 0.15s ease;
}

.toggle-debug-btn.is-active,
.toggle-debug-btn[aria-pressed="true"] {
  background-color: light-dark(#e2e8f0, #334155);
  color: var(--text);
  border-color: light-dark(#94a3b8, #64748b);
  font-weight: 600;
}

.toggle-debug-btn[aria-pressed="false"] {
  opacity: 0.7;
}

.toggle-debug-btn[aria-pressed="false"]:hover {
  opacity: 1;
}

.debug-pill-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid light-dark(#e2e8f0, #475569);
  background-color: light-dark(rgba(255, 255, 255, 0.9), rgba(15, 23, 42, 0.9));
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-tokens-badge {
  font-weight: 600;
}

.card-likelihood-badge {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.card-likelihood-user {
  background-color: light-dark(#eff6ff, rgba(30, 58, 138, 0.25));
  border-color: light-dark(#bfdbfe, #3b82f6);
  color: light-dark(#1d4ed8, #93c5fd);
}

.card-likelihood-partner {
  background-color: light-dark(#f8fafc, rgba(30, 41, 59, 0.5));
  border-color: light-dark(#e2e8f0, #475569);
  color: var(--text-muted);
}

.debug-reasoning-details {
  border-radius: 0.375rem;
  border: 1px solid light-dark(#e2e8f0, #334155);
  background-color: light-dark(rgba(255, 255, 255, 0.8), rgba(15, 23, 42, 0.8));
  font-size: 0.75rem;
  overflow: hidden;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
}

.debug-reasoning-summary {
  display: flex;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.625rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: background-color 0.15s ease;
}

.debug-reasoning-summary::-webkit-details-marker {
  display: none;
}

.debug-reasoning-summary:hover {
  background-color: light-dark(#f1f5f9, #1e293b);
}

.debug-reasoning-body {
  border-top: 1px solid light-dark(#e2e8f0, #334155);
  padding: 0.625rem;
  max-height: 12rem;
  overflow-y: auto;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--text);
}

.debug-response-tokens-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.75rem;
  margin-bottom: 0.375rem;
}

.debug-prompt-details {
  border-radius: 0.5rem;
  border: 1px solid light-dark(#e2e8f0, #334155);
  background-color: light-dark(rgba(255, 255, 255, 0.8), rgba(15, 23, 42, 0.8));
  font-size: 0.75rem;
  overflow: hidden;
  margin-top: 0.25rem;
}

.debug-prompt-summary {
  display: flex;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.75rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: background-color 0.15s ease;
}

.debug-prompt-summary::-webkit-details-marker {
  display: none;
}

.debug-prompt-summary:hover {
  background-color: light-dark(#f1f5f9, #1e293b);
}

.debug-prompt-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid light-dark(#e2e8f0, #334155);
  padding: 0.75rem;
}

.debug-subdetails {
  border-radius: 0.375rem;
  border: 1px solid light-dark(#e2e8f0, #334155);
  background-color: light-dark(rgba(255, 255, 255, 0.6), rgba(15, 23, 42, 0.6));
  overflow: hidden;
}

.debug-subsummary {
  display: flex;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  transition: background-color 0.15s ease;
}

.debug-subsummary::-webkit-details-marker {
  display: none;
}

.debug-subsummary:hover {
  background-color: light-dark(#f1f5f9, #1e293b);
}

.debug-subsummary-right {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.debug-subcontent {
  border-top: 1px solid light-dark(#e2e8f0, #334155);
  padding: 0.5rem 0.625rem;
  max-height: 12rem;
  overflow-y: auto;
  font-size: 0.75rem;
}

.debug-pre {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.chevron-svg {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

details[open] > summary .chevron-svg {
  transform: rotate(180deg);
}

/* Bottom Bar and Round Record Buttons */
.bottom-bar {
  flex-shrink: 0;
  background: light-dark(rgba(248, 250, 252, 0.95), rgba(2, 6, 23, 0.95));
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--card-border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 3.5rem;
  z-index: 10;
}

.record-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.record-btn {
  width: 4rem;
  height: 4rem;
  border-radius: 9999px;
  border: 2px solid var(--card-border);
  background-color: var(--card-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.record-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 10px -1px rgba(0, 0, 0, 0.12);
}

.record-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.record-btn.is-recording {
  background-color: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
  animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.record-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

/* Role text input trigger link & small input box */
.role-text-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.125rem;
  min-height: 2rem;
}

.role-text-link {
  background: none;
  border: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.role-text-link:hover {
  opacity: 0.85;
}

.role-text-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.role-text-box-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.role-text-input {
  width: 200px;
  max-width: 80vw;
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
  color: var(--text);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.role-text-input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 77, 101, 0.2);
}

/* Dashboard Action Links */
.dashboard-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
}

.dashboard-action-link {
  width: auto;
  text-decoration: none;
}

/* VAD + Speaker Diarization Page */
.engine-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--card-border);
  background-color: var(--card-bg);
  color: var(--text-muted);
}

.model-progress-bar-container {
  width: 60px;
  height: 6px;
  background-color: light-dark(#e2e8f0, #334155);
  border-radius: 9999px;
  overflow: hidden;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.model-progress-bar-fill {
  height: 100%;
  width: 0%;
  background-color: #f59e0b;
  border-radius: 9999px;
  transition: width 0.15s ease-out;
}

.engine-status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: #f59e0b;
}

.engine-status-pill.is-ready .engine-status-dot {
  background-color: #10b981;
}

.engine-status-pill.is-error .engine-status-dot {
  background-color: #ef4444;
}

.engine-status-pill.is-speaking {
  border-color: #10b981;
  color: light-dark(#047857, #34d399);
}

.record-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.record-btn.is-recording.is-voice-active {
  box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.35);
}

/* Distinct Speaker Card Accents */
.card-speaker {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left-width: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-speaker-pending {
  border-left-color: light-dark(#94a3b8, #64748b);
  opacity: 0.9;
}

.card-speaker-1 {
  border-left-color: light-dark(#0f4d65, #38bdf8);
}

.card-speaker-1 .card-role-title {
  color: light-dark(#0f4d65, #38bdf8);
}

.card-speaker-2 {
  border-left-color: light-dark(#0d9488, #2dd4bf);
}

.card-speaker-2 .card-role-title {
  color: light-dark(#0f766e, #2dd4bf);
}

.card-speaker-3 {
  border-left-color: light-dark(#7c3aed, #a78bfa);
}

.card-speaker-3 .card-role-title {
  color: light-dark(#6d28d9, #a78bfa);
}

.card-speaker-4 {
  border-left-color: light-dark(#d97706, #fbbf24);
}

.card-speaker-4 .card-role-title {
  color: light-dark(#b45309, #fbbf24);
}

.card-speaker-leichte {
  background-color: light-dark(#f1f5f9, #1e293b);
  border-top-color: light-dark(#cbd5e1, #334155);
  border-right-color: light-dark(#cbd5e1, #334155);
  border-bottom-color: light-dark(#cbd5e1, #334155);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.interim-text {
  color: var(--text-muted);
  font-style: italic;
}

/* Voice Calibration View */
.dialog-banner-container {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.dialog-banner-container .warning-box {
  margin-top: 0.75rem;
}

.calibration-container {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.calibration-card {
  text-align: center;
  padding: 2.5rem 1.75rem;
  color: var(--text-muted);
  border: 2px dashed var(--card-border);
  border-radius: 0.75rem;
  background-color: var(--card-bg);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.calibration-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.calibration-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.calibration-quote {
  background-color: light-dark(#f8fafc, #0f172a);
  border: 1px solid light-dark(#e2e8f0, #1e293b);
  border-left: 4px solid var(--primary);
  border-radius: 0.5rem;
  padding: 1.25rem;
  font-size: 1.0625rem;
  line-height: 1.6;
  font-style: italic;
  color: var(--text);
}

.calibration-progress-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calibration-progress-track {
  width: 100%;
  height: 0.625rem;
  background-color: light-dark(#e2e8f0, #334155);
  border-radius: 9999px;
  overflow: hidden;
}

.calibration-progress-fill {
  height: 100%;
  width: 0%;
  background-color: #10b981;
  border-radius: 9999px;
  transition: width 0.15s ease-out;
}

.calibration-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.calibration-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.recalibrate-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-decoration: underline;
  cursor: pointer;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  transition: color 0.15s ease;
}

.recalibrate-link:hover {
  color: var(--primary);
}

.calibration-cancel-btn {
  margin-top: 0.5rem;
}

/* ==========================================================================
   Analytics Dashboard ("Nutzungsanalyse")
   ========================================================================== */

.analytics-page {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem 1rem;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.analytics-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.analytics-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.analytics-header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.time-range-group {
  display: inline-flex;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  overflow: hidden;
}

.time-range-btn {
  background: transparent;
  border: none;
  padding: 0.4rem 0.8rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  border-right: 1px solid var(--card-border);
}

.time-range-btn:last-child {
  border-right: none;
}

.time-range-btn:hover {
  color: var(--text);
  background-color: var(--card-border);
}

.time-range-btn.active {
  background-color: var(--primary);
  color: var(--primary-fg);
}

.analytics-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kpi-label {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.analytics-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .analytics-charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chart-card-full {
  grid-column: 1 / -1;
}

.chart-card-header {
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.chart-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

.chart-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  .chart-loading-overlay {
    background-color: rgba(15, 23, 42, 0.6);
  }
}

.chart-loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
