/* ╔══════════════════════════════════════════════════════════════╗
   ║  CIVILINK — global.css                                       ║
   ║  Design-System: Variablen, Typografie, Shared Components     ║
   ║  Alle Seiten importieren diese Datei via <link>.             ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ═══════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600;700;900&family=Sora:wght@600;700;800&family=Syne:wght@600;700;800&display=swap');

:root {
  /* Farben - Dark Theme mit Equilion-Gold-Akzent */
  --ink:       #eef1f8;
  --white:     #0f1524;
  --warm:      #070a12;
  --rule:      rgba(148,163,196,.16);
  --muted:     #94a0b8;
  --muted-l:   #5b6579;
  --accent:    #f2b23e;
  --accent2:   #6ea8ff;
  --grad:      linear-gradient(115deg,#f2b23e 0%,#ffcf7d 38%,#8fb8ff 100%);
  --shadow:    0 20px 55px -18px rgba(0,0,0,.6);

  /* Status - dunkel-taugliche Varianten */
  --success:     #7ef0a5;
  --success-bg:  rgba(74,222,128,.14);
  --warning:     #fcd34d;
  --warning-bg:  rgba(251,191,36,.14);
  --error:       #fda4a4;
  --error-bg:    rgba(248,113,113,.16);

  /* Typografie */
  --display: 'Sora', 'IBM Plex Sans', system-ui, sans-serif;
  --mono:    'IBM Plex Mono', 'SF Mono', 'Menlo', monospace;

  /* Layout */
  --radius:  12px;
  --max-w:   1040px;
}

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--warm);
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════ */
.cl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 2rem;
  background: var(--white);
  border-bottom: 1.5px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 100;
}

.cl-logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.04em;
  color: var(--ink);
  text-decoration: none;
  /* M15: Logo nie quetschen - sonst bricht es ab 641px zweizeilig um */
  flex: 0 0 auto;
  white-space: nowrap;
}
.cl-header-right { min-width: 0; }
/* Zusatz erst ab 900px: zwischen 641-900px ist die Kopfzeile sonst zu voll */
@media (max-width: 900px) {
  .cl-logo-sub { display: none; }
}
.cl-logo-dot {
  display: inline-block;
  width: .54em; height: .54em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: .1em;
  overflow: hidden;
  text-indent: -100em;
  margin: 0 .06em;
}
.cl-logo-sub {
  font-family: var(--mono);
  font-size: .55rem;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: .5rem;
}

.cl-header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.cl-back-btn {
  font-family: var(--mono);
  font-size: .68rem;
  text-decoration: none;
  color: var(--muted);
  transition: color .2s;
}
.cl-back-btn:hover { color: var(--accent); }

.cl-status {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--mono);
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.cl-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ═══════════════════════════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════════════════════════ */
.cl-hero {
  padding: 2rem 2rem 1.25rem;
}
.cl-hero h1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 2.5rem;
  letter-spacing: -.04em;
  line-height: 1.1;
  color: var(--ink);
}
.cl-hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.cl-hero p {
  font-size: .92rem;
  font-weight: 300;
  color: var(--muted);
  margin-top: .5rem;
  max-width: 600px;
  line-height: 1.6;
}
.cl-hero h1.fade {
  opacity: 0;
  transition: opacity .5s;
}
.cl-hero-label {
  font-family: var(--mono);
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: .35rem;
}

/* ═══════════════════════════════════════════════════════════════
   SECTIONS & LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.cl-section {
  padding: 1.25rem 2rem;
}
.cl-section-label {
  font-family: var(--mono);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .85rem;
}
.cl-divider {
  height: 1px;
  background: var(--rule);
  margin: 0 2rem;
}

/* ═══════════════════════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════════════════════ */
.cl-tabs {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
}
.cl-tab {
  flex: 1;
  padding: .6rem .85rem;
  background: var(--white);
  border: none;
  border-right: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  text-align: center;
}
.cl-tab:last-child { border-right: none; }
.cl-tab:hover { background: var(--warm); }
.cl-tab.active {
  background: var(--ink);
  color: var(--white);
}

.cl-tab-pane { display: none; }
.cl-tab-pane.active { display: block; }

/* ═══════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════ */
.cl-form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.cl-form-group {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.cl-form-group label,
.cl-label {
  font-family: var(--mono);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
select,
textarea {
  font-family: var(--display);
  font-size: .88rem;
  font-weight: 300;
  padding: .6rem .85rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  transition: border-color .2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
}
textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.cl-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .6rem 1.25rem;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  background: var(--white);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.cl-btn:hover { border-color: var(--accent); }
.cl-btn:disabled { opacity: .5; cursor: not-allowed; }

.cl-btn-primary {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}
.cl-btn-primary:hover { border-color: var(--accent); }

.cl-btn-accent {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
}

.cl-btn-secondary {
  background: var(--white);
  color: var(--ink);
}

.cl-btn-sm {
  padding: .35rem .75rem;
  font-size: .72rem;
}

/* Loading spinner */
.cl-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.cl-btn.loading .cl-spinner { display: inline-block; }
.cl-btn.loading .cl-btn-label { opacity: .6; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   UPLOAD ZONE
   ═══════════════════════════════════════════════════════════════ */
.cl-upload-zone {
  position: relative;
  border: 2px dashed var(--rule);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.cl-upload-zone:hover,
.cl-upload-zone.drag-over {
  border-color: var(--accent);
  background: rgba(200,75,47,.03);
}
.cl-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.cl-upload-icon { font-size: 2rem; margin-bottom: .5rem; }
.cl-upload-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: .9rem;
}
.cl-upload-sub {
  font-size: .82rem;
  color: var(--muted);
  font-weight: 300;
}
.cl-upload-types {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--muted-l);
  margin-top: .4rem;
  letter-spacing: .06em;
}

/* ═══════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════ */
.cl-badge {
  font-family: var(--mono);
  font-size: .58rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 2px;
}
.cl-badge.success { background: var(--success-bg); color: var(--success); }
.cl-badge.error   { background: var(--error-bg);   color: var(--error); }

/* ═══════════════════════════════════════════════════════════════
   RESULT / ERROR PANEL
   ═══════════════════════════════════════════════════════════════ */
.cl-result {
  display: none;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
.cl-result.visible { display: block; }
.cl-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  background: var(--warm);
  border-bottom: 1px solid var(--rule);
}
.cl-result-header.error { background: var(--error-bg); }
.cl-result-badge {
  font-family: var(--mono);
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.cl-result-badge.error { color: var(--error); }
.cl-result-meta {
  font-family: var(--mono);
  font-size: .58rem;
  color: var(--muted);
}
.cl-result-body { padding: 1rem; }
.cl-result-text {
  font-size: .88rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-wrap;
}

/* ═══════════════════════════════════════════════════════════════
   TTS BAR
   ═══════════════════════════════════════════════════════════════ */
.cl-tts-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  background: var(--warm);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--muted);
}
.cl-tts-waves {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 18px;
}
.cl-tts-waves span {
  display: block;
  width: 3px;
  background: var(--accent);
  border-radius: 1px;
  animation: wave 1.2s ease infinite;
}
.cl-tts-waves span:nth-child(1) { height: 8px;  animation-delay: 0s; }
.cl-tts-waves span:nth-child(2) { height: 14px; animation-delay: .15s; }
.cl-tts-waves span:nth-child(3) { height: 10px; animation-delay: .3s; }
.cl-tts-waves span:nth-child(4) { height: 16px; animation-delay: .45s; }
@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(.4); }
}

/* ═══════════════════════════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════════════════════════ */
.cl-progress-bar {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.cl-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width .3s ease;
}

/* ═══════════════════════════════════════════════════════════════
   DATABASE LIST
   ═══════════════════════════════════════════════════════════════ */
.cl-db-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.cl-db-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  background: var(--white);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color .2s;
}
.cl-db-item:hover { border-color: var(--ink); }
.cl-db-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.cl-db-item-info { flex: 1; min-width: 0; }
.cl-db-item-title {
  font-weight: 500;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-db-item-meta {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--muted);
  margin-top: .15rem;
}
.cl-db-item-actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   CARD
   ═══════════════════════════════════════════════════════════════ */
.cl-card {
  background: var(--white);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   CONFIRM CARD — Phase 1.5 Session C
   Bestätigungs-Karte vor dem Erklärungs-Start.
   Modes: 'normal' (Preis + CTA), 'cap' (Aufteil-Hinweis, rote Border).
   ═══════════════════════════════════════════════════════════════ */
.cl-confirm-card {
  background: var(--white);
  border: 1.5px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  max-width: 50rem;
}

.cl-confirm-card.cl-confirm-cap {
  border-color: var(--error);
  border-left-color: var(--error);
  background: var(--error-bg);
}

.cl-confirm-price {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.5;
}
.cl-confirm-price strong {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent);
}

.cl-confirm-clause {
  font-family: var(--display);
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: .6rem;
  padding-top: .5rem;
  border-top: 1px dashed var(--rule);
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.cl-confirm-message {
  font-family: var(--display);
  font-size: .92rem;
  font-weight: 400;
  color: var(--error);
  line-height: 1.6;
}

/* Action-Row Klasse als Reserve — aktuell hat das HTML inline-styles
   für display:flex, gap und margin-top. Klasse existiert hier, falls
   die inline-styles später raus sollen. */
.cl-confirm-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST CONTAINER
   ═══════════════════════════════════════════════════════════════ */
.cl-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.cl-toast {
  padding: .65rem 1.1rem;
  border-radius: var(--radius);
  font-family: var(--display);
  font-size: .82rem;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: .5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  transform: translateX(120%);
  transition: transform .35s ease;
  pointer-events: auto;
}
.cl-toast.visible { transform: translateX(0); }
.cl-toast-icon {
  font-weight: 700;
  font-size: .9rem;
}
.cl-toast-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }
.cl-toast-error   { background: var(--error-bg);   color: var(--error);   border: 1px solid #fca5a5; }
.cl-toast-info    { background: #eff6ff;           color: #1d4ed8;       border: 1px solid #93c5fd; }

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */
.cl-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--rule);
}
.cl-footer-text {
  font-family: var(--mono);
  font-size: .55rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted-l);
}
.cl-footer-links {
  display: flex;
  gap: 1rem;
}
.cl-footer-links a {
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--muted);
  text-decoration: none;
}
.cl-footer-links a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .cl-hero h1 { font-size: 1.75rem; }
  .cl-section { padding: 1rem 1rem; }
  /* M1: Header umbrechen statt quetschen (Mobile) */
  .cl-header { padding: .65rem 1rem; flex-wrap: wrap; gap: .5rem .75rem; }
  .cl-header-right { flex-wrap: wrap; gap: .5rem .9rem; width: 100%; justify-content: flex-start; }
  .cl-logo-sub { display: none; }
  .cl-footer { flex-direction: column; gap: .5rem; text-align: center; }
  .cl-form-row { flex-direction: column; }
  .cl-tabs { flex-wrap: wrap; }
}


/* S19 M3: Modus-Badge ausgeblendet (Infrastruktur-Label, kundenirrelevant) */
#modeIndicator { display: none !important; }


/* S19 M10: Coming-Soon-Karten (freie Module, noch nicht freigegeben) */
.dash-card-soon { position: relative; cursor: default; opacity: .72; }
.dash-card-soon:hover { opacity: .82; }
.dash-card-soon .dash-card-arrow { display: none; }
.dash-card-soon .dash-card-count { visibility: hidden; }
.dash-card-soon-badge {
  position: absolute; top: .7rem; right: .7rem;
  font-family: var(--mono); font-size: .58rem; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 4px;
  background: var(--accent); color: #fff; font-weight: 600;
}


/* S19: Hover-Lift fuer Buttons (Desktop) - nur Geraete mit echtem Hover */
@media (hover: hover) {
  .cl-btn-secondary { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
  .cl-btn-secondary:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.08); border-color: var(--accent); }
  .cl-btn-secondary:active { transform: translateY(0); box-shadow: none; }
}


/* ============================================================
   S19 M12a: Sprach-Switcher (zentralisiert aus doc_explain)
   Wirkt auf allen Seiten mit #langSwitcher-Mount.
   ============================================================ */
.cl-lang-switcher { position: relative; font-family: var(--mono); }
.cl-lang-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .25rem .55rem;
  background: var(--warm); color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: inherit; font-size: .7rem;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.cl-lang-btn:hover { border-color: var(--ink); }
.cl-lang-flag { font-size: .95rem; line-height: 1; }
.cl-lang-code { font-weight: 700; }
.cl-lang-caret { font-size: .65rem; opacity: .55; transform: translateY(-1px); }
.cl-lang-menu {
  position: absolute; top: calc(100% + 4px); right: 0;
  min-width: 180px;
  max-height: 320px; overflow-y: auto;
  margin: 0; padding: 4px;
  list-style: none;
  background: var(--white); border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(0,0,0,.5);
  z-index: 600;
}
.cl-lang-opt {
  display: flex; align-items: center; gap: .55rem;
  padding: .4rem .65rem; border-radius: 3px;
  font-size: .78rem; color: var(--ink);
  cursor: pointer;
}
.cl-lang-opt:hover { background: rgba(242,178,62,.12); }
.cl-lang-opt.is-active { background: var(--accent); color: #1a1204; font-weight: 700; }
.cl-lang-full { font-family: var(--display); letter-spacing: .01em; }
html[dir="rtl"] .cl-lang-menu { left: 0; right: auto; }
/* M14b: Menue vom Viewport positionieren (Handy) */
@media (max-width: 640px) {
  .cl-lang-menu {
    position: fixed; top: auto;
    left: 1rem; right: 1rem;
    width: auto; min-width: 0; max-width: none;
    max-height: 60vh;
  }
}
