*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Crewmate-Brand: Dunkelrot/Maroon (#8B1538) aus dem Logo – einheitlich für beide Themes */
:root, [data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a26;
  --bg-card-hover: #22222e;
  --bg-input: #14141e;
  --border: #2a2a3a;
  --border-focus: #a31e34;
  --text-primary: #f0f0f5;
  --text-secondary: #9494ae;
  --text-muted: #737390;
  --accent: #8B1538;
  --accent-hover: #a31e34;
  --accent-glow: rgba(139, 21, 56, 0.2);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --warning: #eab308;
  --tag-blue: #3b82f6;
  --tag-purple: #a855f7;
  --tag-teal: #14b8a6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
[data-theme="light"] {
  --bg-primary: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f0f2;
  --bg-input: #f8f8fa;
  --border: #e0e0e6;
  --border-focus: #8B1538;
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a65;
  --text-muted: #6e6e86;
  --accent: #8B1538;
  --accent-hover: #a31e34;
  --accent-glow: rgba(139, 21, 56, 0.12);
  --success: #16a34a;
  --success-bg: rgba(22, 163, 74, 0.08);
  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.06);
  --warning: #ca8a04;
  --tag-blue: #2563eb;
  --tag-purple: #9333ea;
  --tag-teal: #0d9488;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
}
[data-theme="club"] {
  --bg-primary: #06060e;
  --bg-secondary: #0c0c1a;
  --bg-card: #111128;
  --bg-card-hover: #1a1a38;
  --bg-input: #0e0e22;
  --border: #2a1a4a;
  --border-focus: #e040fb;
  --text-primary: #f0e8ff;
  --text-secondary: #b8a0d8;
  --text-muted: #8070a0;
  --accent: #e040fb;
  --accent-hover: #ea60ff;
  --accent-glow: rgba(224, 64, 251, 0.25);
  --success: #39ff14;
  --success-bg: rgba(57, 255, 20, 0.1);
  --error: #ff2060;
  --error-bg: rgba(255, 32, 96, 0.12);
  --warning: #ffe030;
  --tag-blue: #00e5ff;
  --tag-purple: #bf40ff;
  --tag-teal: #00ffcc;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 30px rgba(224, 64, 251, 0.15), 0 0 60px rgba(0, 229, 255, 0.05);
  --club-gradient: linear-gradient(135deg, #e040fb 0%, #7c4dff 50%, #00e5ff 100%);
  --club-glow-pink: 0 0 12px rgba(224, 64, 251, 0.4);
  --club-glow-cyan: 0 0 12px rgba(0, 229, 255, 0.4);
}

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* User dropdown */
#userDropdown { display: none !important; }
#userDropdown.active { display: block !important; }
#userDropdown button:hover { background: var(--bg-card-hover); }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.app { max-width: 1240px; margin: 0 auto; padding: 24px; }

.request-command-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 1.05fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(96, 165, 250, 0.18);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, rgba(96, 165, 250, 0.16), transparent 30%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(10, 10, 15, 0.98));
}

.request-command-stage::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 12px;
}

.request-stage-copy,
.request-stage-map {
  position: relative;
  z-index: 1;
}

.request-stage-copy {
  display: grid;
  align-content: center;
  gap: 12px;
}

.request-stage-copy span {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.request-stage-copy h3 {
  max-width: 16ch;
  margin: 0;
  color: #f8fafc;
  font-size: clamp(24px, 3.6vw, 40px);
  line-height: 1;
}

.request-stage-copy p {
  max-width: 54ch;
  margin: 0;
  color: #aab6c8;
  font-size: 14px;
  line-height: 1.6;
}

.request-stage-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.request-step-card {
  min-height: 94px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  background: rgba(255,255,255,0.045);
}

.request-step-card strong {
  display: block;
  margin-bottom: 5px;
  color: #f8fafc;
  font-size: 14px;
}

.request-step-card small {
  color: #8b96aa;
  font-size: 12px;
  line-height: 1.45;
}

.request-stage-map {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.018)),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.032) 0 1px, transparent 1px 42px);
}

.request-stage-map svg {
  display: block;
  width: 100%;
  min-height: 150px;
}

.request-system-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  min-height: 150px;
  align-items: stretch;
}

.request-system-map::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #8b5cf6, #22c55e);
  opacity: 0.72;
  transform: translateY(-50%);
}

.request-map-card {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 126px;
  padding: 14px;
  border: 1px solid rgba(147,197,253,0.18);
  border-radius: 14px;
  background: rgba(15,23,42,0.78);
}

.request-map-card--core {
  border-color: rgba(196,181,253,0.34);
  background:
    radial-gradient(circle at 50% 0%, rgba(139,92,246,0.22), transparent 58%),
    rgba(15,23,42,0.84);
}

.request-map-card span {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
}

.request-map-card strong {
  color: #9aa8bd;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.request-map-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.request-map-legend span {
  min-height: 56px;
  padding: 10px;
  border: 1px solid rgba(147, 197, 253, 0.14);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.58);
}

.request-map-legend strong,
.request-map-legend small {
  display: block;
}

.request-map-legend strong {
  color: #f8fafc;
  font-size: 13px;
}

.request-map-legend small {
  margin-top: 3px;
  color: #9aa8bd;
  font-size: 12px;
  line-height: 1.35;
}

.request-confidence-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.request-confidence-strip span {
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(10, 10, 15, 0.44);
  font-size: 12px;
  line-height: 1.4;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px;
}

#themeToggle,
#userMenuBtn,
#langSelect,
.nav-burger {
  min-height: 44px;
}

#themeToggle,
.nav-burger {
  min-width: 44px;
  justify-content: center;
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-app { height: 44px; width: auto; display: block; }
.logo-app-dark { display: block; }
.logo-app-light { display: none; }
[data-theme="light"] .logo-app-dark { display: none; }
[data-theme="light"] .logo-app-light { display: block; }
.auth-logo-light { display: none !important; }
[data-theme="light"] .auth-logo-dark { display: none !important; }
[data-theme="light"] .auth-logo-light { display: block !important; }

/* Club theme – neon glow & gradient effects */
[data-theme="club"] .logo h1 { background: var(--club-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
[data-theme="club"] header { border-bottom-color: transparent; border-image: var(--club-gradient) 1; }
[data-theme="club"] .nav-grouped { border-color: #2a1a4a; background: linear-gradient(180deg, #0c0c1a 0%, #111128 100%); }
[data-theme="club"] .nav-group-toggle:hover,
[data-theme="club"] .nav-group-toggle.active { background: rgba(224, 64, 251, 0.12); color: #e040fb; }
[data-theme="club"] .tab-btn.active,
[data-theme="club"] .nav-sub-item.active { background: linear-gradient(135deg, rgba(224, 64, 251, 0.18), rgba(0, 229, 255, 0.10)); color: #f0e8ff; box-shadow: var(--club-glow-pink); }
[data-theme="club"] .btn-primary { background: var(--club-gradient); box-shadow: var(--club-glow-pink); }
[data-theme="club"] .btn-primary:hover { box-shadow: 0 0 24px rgba(224, 64, 251, 0.5), 0 0 48px rgba(0, 229, 255, 0.2); }
[data-theme="club"] .btn-copy:hover, [data-theme="club"] .btn-delete:hover { border-color: #e040fb; color: #e040fb; }
[data-theme="club"] .btn-success { background: linear-gradient(135deg, #39ff14, #00e5a0); box-shadow: 0 0 12px rgba(57, 255, 20, 0.3); }
[data-theme="club"] .card,
[data-theme="club"] .modal-content { border: 1px solid #2a1a4a; box-shadow: 0 4px 30px rgba(124, 77, 255, 0.1); }
[data-theme="club"] input:focus, [data-theme="club"] textarea:focus, [data-theme="club"] select:focus { box-shadow: 0 0 0 2px rgba(224, 64, 251, 0.3); border-color: #e040fb; }
[data-theme="club"] .health-badge { border-color: rgba(57, 255, 20, 0.3); box-shadow: 0 0 10px rgba(57, 255, 20, 0.15); }
[data-theme="club"] ::-webkit-scrollbar-thumb { background: #3a2060; }
[data-theme="club"] ::-webkit-scrollbar-thumb:hover { background: #e040fb; }
.logo h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--text-primary); }
.logo span { display: block; font-size: 12px; color: var(--text-muted); font-weight: 400; letter-spacing: 0.5px; text-transform: uppercase; }

.health-badge {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--success-bg); border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 20px; font-size: 13px; color: var(--success);
}
.health-badge .dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Burger (mobile only) */
.nav-burger {
  display: none; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer;
  flex-direction: column; gap: 4px; margin-bottom: 12px;
}
.nav-burger span {
  display: block; width: 20px; height: 2px; background: var(--text-primary);
  border-radius: 1px; transition: all 0.2s;
}

/* Grouped Navigation */
.nav-grouped {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 32px;
  background: var(--bg-secondary); padding: 6px;
  border-radius: var(--radius); border: 1px solid var(--border);
}

.nav-group { position: relative; flex: 1; min-width: 0; }

.nav-group-toggle {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px;
  background: none; border: none; color: var(--text-secondary);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; border-radius: var(--radius-sm); transition: all 0.2s;
  white-space: nowrap; width: 100%;
}
.nav-group-icon { font-size: 15px; display: flex; align-items: center; }
.nav-group-icon svg, .tab-icon svg { width: 16px; height: 16px; stroke-width: 1.75; }
.input-method-label svg { width: 16px; height: 16px; stroke-width: 1.75; vertical-align: -3px; }
.btn svg, .modal-actions .btn svg, button[data-icon] svg { width: 14px; height: 14px; stroke-width: 1.75; vertical-align: -2px; }
.drop-zone-icon { display: flex; justify-content: center; }
.empty-state-icon svg { width: 32px; height: 32px; stroke-width: 1.5; }
.nav-chevron {
  display: inline-block; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 4px solid currentColor; margin-left: 2px;
  transition: transform 0.2s;
}
.nav-group-toggle:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-group-toggle.active {
  color: var(--text-primary); background: var(--bg-card);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.nav-group-toggle.nav-group-expanded .nav-chevron { transform: rotate(180deg); }

/* Dropdown panel */
.nav-group-items {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 200px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50;
  padding: 4px; flex-direction: column;
}
.nav-group-items.nav-group-open {
  display: flex;
  position: static;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  box-shadow: none;
}

/* Tab items inside dropdowns */
.tab {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: none; border: none; color: var(--text-secondary);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; border-radius: var(--radius-sm); transition: all 0.2s;
  white-space: nowrap; width: 100%; text-align: left;
}
.tab .tab-icon { font-size: 15px; flex-shrink: 0; display: flex; align-items: center; }
.tab .tab-label { display: inline; }
.tab:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.tab.active {
  color: var(--text-primary); background: var(--accent-glow);
  border-left: 3px solid var(--accent); font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Embedded modules and Mail external launcher */
.mail-iframe-wrap {
  position: relative; width: 100%; height: calc(100vh - 120px);
  min-height: 500px; border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  background: var(--bg-card);
}
/* Mail-Tab: volle Breite ohne max-width Beschraenkung */
#tab-mail .mail-iframe-wrap {
  margin: -24px; margin-top: 0; width: calc(100% + 48px);
  height: calc(100vh - 100px); border-radius: 0; border: none;
}
.mail-external-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 28px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-card); min-height: 180px;
}
.mail-iframe {
  width: 100%; height: 100%; border: none; display: block;
  background: var(--bg-primary);
}
a.tab.mail-external-link {
  text-decoration: none; color: var(--text-muted); font-size: 12px;
  border-top: 1px solid var(--border); margin-top: 2px; padding-top: 8px;
}
a.tab.mail-external-link:hover { color: var(--text-primary); background: var(--bg-card-hover); }

/* Cards */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card-title {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 16px;
  opacity: 0.85;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: all 0.3s; position: relative; overflow: hidden;
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-glow); }
.drop-zone.has-image { padding: 16px; border-style: solid; border-color: var(--accent); }
.drop-zone-icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone-text { color: var(--text-secondary); font-size: 15px; }
.drop-zone-text strong { color: var(--accent); }
.drop-zone-hint { color: var(--text-muted); font-size: 12px; margin-top: 8px; }
#audioDropContent,
#audioDropContent > div {
  max-width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: manual;
}
#audioDropContent > div:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
#audioDropContent #audioLangHint {
  margin-left: 0 !important;
  max-width: 100%;
  word-break: normal;
  overflow-wrap: normal;
}
.preview-image { max-width: 100%; max-height: 300px; border-radius: var(--radius-sm); object-fit: contain; }
.remove-image {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  background: var(--error); border: none; border-radius: 50%;
  color: white; font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}

/* Inputs */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.form-grid.three-col { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 12.5px; font-weight: 600; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.75; }

select, input, textarea {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: var(--text-primary); font-family: inherit; font-size: 14px;
  transition: border-color 0.2s; width: 100%;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }

/* Checkbox */
/* Eingabeart: nur eine wählen */
.input-method-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.input-method-option {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
}
.input-method-option:hover { border-color: var(--accent); background: var(--bg-card); }
.input-method-option input[type="radio"] { accent-color: var(--accent); cursor: pointer; }
.input-method-option input[type="radio"]:checked + .input-method-label { font-weight: 600; color: var(--accent); }
.input-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.input-block.inactive { opacity: 0.6; pointer-events: none; }

.checkbox-row {
  display: flex; align-items: center; gap: 10px; margin-top: 16px;
  padding: 12px 16px; background: var(--bg-secondary); border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer;
}
.checkbox-row label { cursor: pointer; text-transform: none; font-size: 14px; color: var(--text-primary); font-weight: 500; }
.checkbox-row .hint { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* Divider */
.divider {
  display: flex; align-items: center; gap: 16px; margin: 24px 0;
  color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Buttons */
.btn {
  padding: 12px 24px; border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ea580c);
  color: white; box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--bg-secondary); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-card); }
.btn-copy { background: var(--bg-secondary); color: var(--text-secondary); border: 1px solid var(--border); padding: 8px 16px; font-size: 13px; }
.btn-copy:hover { color: var(--accent); border-color: var(--accent); }
.btn-delete { background: none; border: 1px solid var(--border); color: var(--text-muted); padding: 6px 12px; font-size: 12px; }
.btn-delete:hover { color: var(--error); border-color: var(--error); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #16a34a; }

/* Pipeline */
.pipeline-progress { display: none; margin-top: 24px; }
.pipeline-progress.active { display: block; }
.pipeline-steps { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; }
.pipeline-step {
  flex: 1; min-width: 80px; padding: 10px 8px; text-align: center;
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 500;
  background: var(--bg-secondary); color: var(--text-muted);
  border: 1px solid var(--border); transition: all 0.3s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.pipeline-step svg { width: 14px; height: 14px; stroke-width: 1.75; }
.pipeline-step.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }
.pipeline-step.done { background: var(--success-bg); color: var(--success); border-color: rgba(34, 197, 94, 0.3); }
.pipeline-status {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  color: var(--text-secondary); padding: 12px 16px;
  background: var(--bg-secondary); border-radius: var(--radius-sm);
  margin-bottom: 16px; border-left: 3px solid var(--accent);
}

/* Result */
.result-area { display: none; margin-top: 24px; }
.result-area.active { display: block; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 24px; }
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.result-meta { display: flex; gap: 12px; font-size: 12px; color: var(--text-muted); }
.result-body {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; font-size: 14px;
  line-height: 1.7; white-space: pre-wrap; position: relative;
}
.extracted-msg {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
  font-size: 13px; color: var(--text-secondary); border-left: 3px solid var(--tag-blue);
}
.extracted-msg strong { color: var(--text-primary); }

.score-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; }
.score-badge.high { background: var(--success-bg); color: var(--success); }
.score-badge.mid { background: rgba(234, 179, 8, 0.1); color: var(--warning); }
.score-badge.low { background: var(--error-bg); color: var(--error); }

.details-toggle {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  padding: 8px 16px; border-radius: var(--radius-sm); font-family: inherit;
  font-size: 13px; cursor: pointer; margin-top: 16px; width: 100%; text-align: left;
}
.details-toggle:hover { color: var(--text-secondary); border-color: var(--text-muted); }
.pipeline-details {
  display: none; margin-top: 12px; padding: 16px;
  background: var(--bg-secondary); border-radius: var(--radius);
  border: 1px solid var(--border); font-family: 'JetBrains Mono', monospace;
  font-size: 12px; line-height: 1.6; color: var(--text-secondary);
  max-height: 400px; overflow-y: auto;
}
.pipeline-details.active { display: block; }

/* Tags */
.tag { padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.tag-channel { background: rgba(59, 130, 246, 0.15); color: var(--tag-blue); }
.tag-lang { background: rgba(168, 85, 247, 0.15); color: var(--tag-purple); }
.tag-scenario, .tag-teal { background: rgba(20, 184, 166, 0.15); color: var(--tag-teal); }
.tag-agency { background: var(--accent-glow); color: var(--accent); }
.tag-blue { background: rgba(59, 130, 246, 0.15); color: var(--tag-blue); }
.tag-purple { background: rgba(168, 85, 247, 0.15); color: var(--tag-purple); }

/* Examples */
.examples-list { display: flex; flex-direction: column; gap: 12px; }
.example-card {
  display: flex; gap: 16px; padding: 16px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius); transition: border-color 0.2s;
}
.example-card:hover { border-color: var(--text-muted); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.history-card:hover { border-color: var(--accent) !important; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.example-body { flex: 1; min-width: 0; }
.example-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.example-preview { font-size: 13px; color: var(--text-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.example-actions { display: flex; align-items: flex-start; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); border: 2px dashed var(--border); border-radius: var(--radius); background: var(--bg-secondary); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.7; }
.empty-state div:last-child { font-size: 14px; line-height: 1.5; }
.examples-count { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.qa-form { margin-top: 24px; }

/* Customer Cards */
.customer-card {
  display: flex; gap: 16px; padding: 16px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.2s; align-items: center;
}
.customer-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.customer-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white; flex-shrink: 0;
}
.customer-info { flex: 1; min-width: 0; }
.customer-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.customer-detail { font-size: 12px; color: var(--text-secondary); }
.customer-meta { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.customer-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Agency Cards */
.agency-card {
  padding: 20px; background: var(--bg-secondary);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.2s;
}
.agency-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.agency-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.agency-name { font-weight: 700; font-size: 16px; }
.agency-market { font-size: 12px; color: var(--text-secondary); }
.agency-details { display: flex; gap: 16px; font-size: 13px; color: var(--text-secondary); flex-wrap: wrap; }

/* Search Bar */
.search-bar {
  display: flex; gap: 12px; margin-bottom: 20px; align-items: center;
}
.search-bar input { flex: 1; }
.search-bar select { width: 200px; }

/* Modal */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; max-width: 600px; width: 90%;
  max-height: 85vh; overflow-y: auto;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }
#authModal input,
#authModal select {
  min-height: 48px;
  font-size: 16px !important;
}
#authModal .btn {
  min-height: 48px;
}
#authRegister {
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
#authRegister button[onclick^="togglePwField"] {
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 10px !important;
  right: 4px !important;
}

#loginOverlay {
  background:
    radial-gradient(circle at 12% 0%, rgba(139,21,56,0.22), transparent 34%),
    radial-gradient(circle at 84% 20%, rgba(255,255,255,0.06), transparent 24%),
    linear-gradient(180deg, #050506, #0b0b10) !important;
  align-items: flex-start;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

#authModal {
  position: relative;
  overflow: hidden;
  margin-top: clamp(18px, 4vh, 42px);
  background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.04)) !important;
  border: 1px solid rgba(255,255,255,0.13) !important;
  box-shadow: 0 26px 90px rgba(0,0,0,0.58) !important;
}

#authModal::before {
  content: none;
  display: none;
}

#paywallBlock::before {
  content: "";
  display: block;
  width: min(260px, 70%);
  height: 64px;
  margin: 0 auto 18px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(139,21,56,0.28), transparent 35%),
    linear-gradient(90deg, rgba(216,197,173,0.10), rgba(139,21,56,0.34), rgba(216,197,173,0.10));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 22px 62px rgba(0,0,0,0.34);
}

#paywallBlock {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.04)) !important;
  box-shadow: 0 24px 84px rgba(0,0,0,0.42);
}

[data-theme="light"] .request-command-stage::before {
  border-color: rgba(139,21,56,0.08);
}

[data-theme="light"] .request-stage-copy h3,
[data-theme="light"] .request-step-card strong,
[data-theme="light"] .request-map-legend strong,
[data-theme="light"] .request-map-card span {
  color: #1a1a2e;
}

[data-theme="light"] .request-stage-copy p,
[data-theme="light"] .request-step-card small,
[data-theme="light"] .request-map-legend small,
[data-theme="light"] .request-map-card strong,
[data-theme="light"] .request-confidence-strip span {
  color: #596078;
}

[data-theme="light"] .request-stage-map {
  border-color: rgba(139,21,56,0.12);
  background:
    linear-gradient(180deg, rgba(139,21,56,0.035), rgba(255,255,255,0.74)),
    repeating-linear-gradient(90deg, rgba(139,21,56,0.045) 0 1px, transparent 1px 56px);
}

[data-theme="light"] .request-step-card,
[data-theme="light"] .request-map-legend span,
[data-theme="light"] .request-map-card,
[data-theme="light"] .request-confidence-strip span {
  border-color: rgba(139,21,56,0.11);
  background: rgba(255,255,255,0.78);
}

[data-theme="light"] .request-map-card--core {
  border-color: rgba(139,21,56,0.2);
  background:
    radial-gradient(circle at 50% 0%, rgba(139,21,56,0.12), transparent 60%),
    rgba(255,255,255,0.9);
}

[data-theme="light"] .request-command-stage {
  border-color: rgba(96,165,250,0.16);
  background:
    radial-gradient(circle at 0% 0%, rgba(96,165,250,0.08), transparent 30%),
    linear-gradient(135deg, #ffffff, #f5f7fb);
}

[data-theme="light"] .request-stage-copy span {
  color: #8B1538;
}

[data-theme="light"] #loginOverlay {
  background:
    radial-gradient(circle at 12% 0%, rgba(139,21,56,0.12), transparent 34%),
    radial-gradient(circle at 84% 20%, rgba(37,99,235,0.08), transparent 24%),
    linear-gradient(180deg, #f7f4f5, #ffffff) !important;
}

[data-theme="light"] #authModal,
[data-theme="light"] #paywallBlock {
  background: rgba(255,255,255,0.94) !important;
  border-color: rgba(139,21,56,0.12) !important;
  box-shadow: 0 24px 72px rgba(41,24,32,0.16) !important;
}

[data-theme="light"] #authModal::before {
  content: none;
  display: none;
}

[data-theme="light"] #paywallBlock::before {
  border-color: rgba(139,21,56,0.12);
  background:
    radial-gradient(circle at 50% 50%, rgba(139,21,56,0.13), transparent 36%),
    linear-gradient(90deg, rgba(139,21,56,0.05), rgba(139,21,56,0.16), rgba(37,99,235,0.05));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.68), 0 18px 44px rgba(41,24,32,0.10);
}

.empty-state {
  border-style: solid;
  background:
    radial-gradient(circle at 50% 0%, rgba(139,21,56,0.12), transparent 34%),
    rgba(255,255,255,0.035);
}

.empty-state-icon {
  color: var(--accent);
  opacity: 0.86;
}

/* Stammkunde Badge */
.returning-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  background: rgba(168, 85, 247, 0.15); border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 20px; font-size: 13px; color: var(--tag-purple); margin-bottom: 12px;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 96px; padding: 12px 20px;
  max-width: min(380px, calc(100vw - 136px));
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  word-break: normal; overflow-wrap: break-word;
  z-index: 2000; transform: translateY(100px); opacity: 0; transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); color: white; }
.toast.error { background: var(--error); color: white; }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Analytics Grid */
.analytics-grid { grid-template-columns: repeat(4, 1fr); }

/* FAQ */
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item[open] summary span:first-child { transform: rotate(90deg); display: inline-block; }
.faq-item summary:hover { background: var(--bg-card-hover); }
.faq-item[open] { border-color: var(--accent) !important; }

/* ── Tablet ─────────────────────────── */
@media (max-width: 1024px) {
  .nav-group-toggle { font-size: 12px; padding: 8px 12px; }
}

/* ── Mobile ─────────────────────────── */
@media (max-width: 768px) {
  .app { padding: 10px; }
  .request-command-stage { grid-template-columns: 1fr; padding: 16px; }
  .request-stage-steps, .request-confidence-strip, .request-map-legend { grid-template-columns: 1fr; }
  .request-system-map { grid-template-columns: 1fr; min-height: auto; }
  .request-system-map::before { top: 8%; bottom: 8%; left: 50%; right: auto; width: 3px; height: auto; transform: translateX(-50%); }
  .request-map-card { min-height: 92px; }

  /* Header – single row, compact */
  header {
    flex-direction: row; flex-wrap: wrap; gap: 8px;
    align-items: center; justify-content: space-between;
    padding: 10px 12px;
  }
  .logo { gap: 8px; }
  .logo img { height: 32px !important; }
  .logo h1 { font-size: 16px; }
  .logo span[data-i18n="subtitle"] { display: none; }
  header > div:last-child { gap: 6px; flex-wrap: nowrap; }
  header > div:last-child .health-badge { display: none; }

  /* Navigation → vertical accordion on mobile */
  .nav-burger { display: flex; }
  .nav-grouped {
    display: none; flex-direction: column; gap: 2px;
    margin-bottom: 16px; padding: 4px;
  }
  .nav-grouped.nav-open { display: flex; }
  .nav-group-items {
    position: static; box-shadow: none; border: none;
    background: var(--bg-input); border-radius: var(--radius-sm);
    margin-top: 2px;
  }
  .nav-group-items.nav-group-open { display: flex; }
  .nav-group-toggle { width: 100%; justify-content: flex-start; }
  .tab { padding: 10px 14px; font-size: 13px; }
  .tab .tab-icon { font-size: 16px; }
  .tab .tab-label { font-size: 13px; }

  /* Embedded modules and Mail external launcher mobile */
  .mail-iframe-wrap { height: calc(100vh - 100px); min-height: 400px; }
  #tab-mail .mail-iframe-wrap { margin: -16px; margin-top: 0; width: calc(100% + 32px); height: calc(100vh - 80px); }

  /* Cards */
  .card { padding: 14px; margin-bottom: 12px; }
  .card-title { font-size: 12px; margin-bottom: 12px; }

  /* Forms – stack to 1 col, bigger touch targets */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid.three-col { grid-template-columns: 1fr; }
  select, input, textarea { font-size: 16px !important; padding: 12px; -webkit-appearance: none; }
  select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
  label { font-size: 12px; }
  .form-group { margin-bottom: 10px; }

  /* Buttons – larger touch targets */
  .btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }
  .btn-sm { padding: 10px 14px; font-size: 13px; min-height: 40px; }
  .btn-delete { padding: 10px 14px; font-size: 14px; min-height: 40px; }
  .btn-copy { min-height: 40px; }

  /* Pipeline */
  .pipeline-steps { flex-wrap: wrap; gap: 3px; }
  .pipeline-step { min-width: 60px; padding: 8px 4px; font-size: 11px; }

  /* Results */
  .result-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .result-meta { flex-wrap: wrap; }
  .result-body { padding: 14px; font-size: 13px; }

  /* Customer cards */
  .customer-card { flex-wrap: wrap; padding: 14px; gap: 10px; }
  .customer-avatar { width: 38px; height: 38px; font-size: 15px; }
  .customer-actions { width: 100%; justify-content: flex-end; }
  .customer-detail { font-size: 12px; }

  /* Search bar */
  .search-bar { flex-direction: column; gap: 8px; }
  .search-bar select { width: 100%; }
  .search-bar input { width: 100%; }

  /* Price list cards */
  .example-card { flex-direction: column; gap: 10px; }
  .example-card > div { flex-wrap: wrap; gap: 8px; }

  /* Modals – full-width, safe area aware */
  .modal-overlay { padding: 8px; align-items: flex-start; padding-top: env(safe-area-inset-top, 8px); }
  .modal { padding: 18px; width: calc(100vw - 16px); max-width: calc(100vw - 16px); max-height: 92vh; border-radius: 12px; margin: 0; }
  #authModal.modal { width: min(360px, calc(100vw - 24px)) !important; max-width: min(360px, calc(100vw - 24px)) !important; }
  #authRegister { max-height: calc(100dvh - 132px) !important; padding-right: 2px; }
  .modal-title { font-size: 16px; margin-bottom: 14px; }
  .modal-actions { flex-direction: column; gap: 8px; }
  .modal-actions .btn { width: 100%; justify-content: center; }

  /* Analytics – stack cards */
  .analytics-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Offer items – stack on mobile with labels */
  .oItem-row {
    grid-template-columns: 1fr 1fr !important; gap: 8px !important;
    padding: 12px !important; background: var(--bg-input);
    border-radius: var(--radius-sm); border: 1px solid var(--border) !important;
    border-bottom: none !important;
  }
  .oItem-row > div:first-child { grid-column: 1 / -1; }
  .oItem-row .oItem-label { display: block !important; }
  .oItem-row .oItem-total { text-align: left !important; padding: 10px 0; }

  /* Feedback buttons */
  #feedbackButtons { flex-wrap: wrap; }
  #feedbackButtons .btn { flex: 1; min-width: 60px; justify-content: center; }

  /* Drop zone */
  .drop-zone { padding: 28px 14px; }
  .drop-zone-icon { font-size: 32px; }
  .drop-zone-text { font-size: 14px; }

  /* FAQ */
  .faq-item summary { padding: 14px; font-size: 14px; }

  /* Footer */
  footer { padding: 16px 0 !important; }

  /* Checkbox row */
  .checkbox-row { flex-wrap: wrap; }
  .checkbox-row .hint { margin-left: 0; width: 100%; margin-top: 4px; }

  /* Divider */
  .divider { margin: 16px 0; }

  /* Toast – bottom safe area with reserved chat-button lane */
  .toast {
    left: 8px;
    right: 76px;
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    max-width: none;
    text-align: center;
    font-size: 13px;
  }

  /* Agency / company cards */
  .agency-header { flex-direction: column; gap: 8px; }
  .agency-details { flex-direction: column; gap: 4px; }

  /* Preisliste header buttons */
  .price-header-actions { flex-direction: column; gap: 6px; }
  .price-header-actions .btn { width: 100%; justify-content: center; }

  /* Input method row – stack vertically */
  .input-method-row { flex-direction: column; gap: 8px; }
  .input-method-option { min-width: unset; }

  /* User dropdown fix */
  #userDropdown { max-width: calc(100vw - 24px); }
}

/* ── Very small phones ──────────────── */
@media (max-width: 380px) {
  .nav-group-toggle { font-size: 12px; padding: 8px 10px; }
  .tab { font-size: 12px; padding: 8px 12px; }
  .tab .tab-icon { font-size: 14px; }
  .tab .tab-label { font-size: 12px; }
  .analytics-grid { grid-template-columns: 1fr !important; }
  .form-grid { gap: 10px; }
  .modal { padding: 12px; }
  header { padding: 8px 10px; }
  .logo img { height: 28px !important; }
  .logo h1 { font-size: 14px; }
}
