/* AI-SCCRM onboarding portal. Tokens from identity/designs/ai-sccrm.md.
   Member and public pages: light. Admin pages: dark. System sans only, no webfonts,
   no shadows, no gradients in content. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --max: 980px;
  --pad: 22px;
  --r-card: 14px;
  --r-row: 12px;
  --r-btn: 10px;
  --r-pill: 999px;

  /* light (member, public) */
  --surface: #ffffff;
  --surface-muted: #f3f6fa;
  --surface-2: #f3f6fa;
  --on-surface: #0b1220;
  --muted: #4b5a70;
  --accent: #27d3a2;
  --on-accent: #04231a;
  --accent-2: #3b82f6;
  --link: #1d4ed8;
  --border: #d8dfea;
  --success: #1a9a72;
  --warning: #b4762a;
  --danger: #a33b36;
  --info: #1d4ed8;
  --success-bg: #e6f6ef;
  --warning-bg: #fbf1e3;
  --danger-bg: #f9e8e7;
  --info-bg: #e8effc;
  --body-size: 17px;
}

body.theme-dark {
  --surface: #0b1220;
  --surface-muted: #121c30;
  --surface-2: #0f1829;
  --on-surface: #e8eef7;
  --muted: #9fb0c8;
  --accent: #27d3a2;
  --on-accent: #04231a;
  --accent-2: #3b82f6;
  --link: #27d3a2;
  --border: #22304a;
  --success: #27d3a2;
  --warning: #f0b35b;
  --danger: #f07a74;
  --info: #3b82f6;
  --success-bg: #10281f;
  --warning-bg: #2a2214;
  --danger-bg: #2d1716;
  --info-bg: #15213a;
  --body-size: 15px;
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--body-size);
  line-height: 1.6;
  color: var(--on-surface);
  background: var(--surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: 1.9em; font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: 1.3em; font-weight: 700; }
h3 { font-size: 1.05em; font-weight: 700; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
ul, ol { padding-left: 1.4em; margin: 0 0 1em; }
li { margin-bottom: 0.3em; }
strong { font-weight: 700; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
code, kbd { font-family: var(--mono); font-size: 0.92em; background: var(--surface-muted); padding: 0.1em 0.35em; border-radius: 6px; }
img, svg { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }

:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
.main { flex: 1 0 auto; padding-top: 28px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: 0.9em; }
.mono { font-family: var(--mono); }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 10;
  background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: var(--r-btn);
}
.skip-link:focus { left: 8px; }

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.wordmark { font-weight: 800; font-size: 1.15em; letter-spacing: 0.02em; color: var(--on-surface); text-decoration: none; }
.wordmark:hover { text-decoration: none; }
.badge {
  display: inline-block; font-size: 0.78em; font-weight: 700; letter-spacing: 0.03em;
  padding: 2px 10px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent);
}
.admin-nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a { color: var(--on-surface); text-decoration: none; padding: 6px 10px; border-radius: var(--r-btn); font-size: 0.95em; }
.admin-nav a:hover { background: var(--surface-muted); }

.inapp-banner { background: var(--warning-bg); color: var(--on-surface); border-bottom: 1px solid var(--border); padding: 10px 0; font-size: 0.95em; }
.inapp-banner .wrap::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--warning); margin-right: 10px; vertical-align: middle; }

/* ---------- progress bar ---------- */

.progress-wrap { padding-top: 20px; }
.progress-summary { margin: 0 0 8px; font-size: 0.9em; color: var(--muted); }
.progress-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.progress-step { flex: 1 1 0; min-width: 0; }
.progress-link {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; height: 100%;
  border: 1px solid var(--border); border-top: 4px solid var(--border); border-radius: var(--r-row);
  color: var(--on-surface); text-decoration: none; background: var(--surface);
}
.progress-link:hover { background: var(--surface-muted); text-decoration: none; }
.progress-index {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9em; background: var(--surface-muted); color: var(--muted); border: 2px solid var(--border);
}
.progress-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.progress-title { font-weight: 700; font-size: 0.95em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-meta { font-size: 0.8em; color: var(--muted); }

.progress-step.state-started .progress-link,
.progress-step.state-provisioned .progress-link { border-top-color: var(--warning); }
.progress-step.state-started .progress-index,
.progress-step.state-provisioned .progress-index { border-color: var(--warning); color: var(--warning); }
.progress-step.state-done .progress-link { border-top-color: var(--success); }
.progress-step.state-done .progress-index { background: var(--success); border-color: var(--success); color: #ffffff; }
.progress-step.state-blocked .progress-link { border-top-color: var(--danger); }
.progress-step.state-blocked .progress-index { border-color: var(--danger); color: var(--danger); }
.progress-step.state-unknown .progress-link { border-top-style: dashed; }
.progress-step.state-skipped .progress-link { opacity: 0.7; }
.progress-step.is-current .progress-link { background: var(--surface-muted); border-color: var(--on-surface); border-top-width: 4px; }
.progress-step.is-current .progress-title { text-decoration: underline; text-underline-offset: 0.2em; }
.progress-step.is-current.state-pending .progress-link { border-top-color: var(--accent-2); }

/* ---------- cards ---------- */

.card {
  border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface);
  padding: 20px 22px; margin: 0 0 18px;
}
.card-title { margin-bottom: 10px; }
.card-success { border-color: var(--success); background: var(--success-bg); }
.card-warning { border-color: var(--warning); background: var(--warning-bg); }
.card-danger { border-color: var(--danger); background: var(--danger-bg); }
.card-info { border-color: var(--info); background: var(--info-bg); }
.theme-dark .card { background: var(--surface-muted); }
.theme-dark .card-success, .theme-dark .card-warning, .theme-dark .card-danger, .theme-dark .card-info { background: var(--surface-2); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card-grid .card { margin: 0; }

.figure { margin: 14px 0; border: 1px solid var(--border); border-radius: var(--r-row); overflow: hidden; background: var(--surface-muted); }
.figure img { display: block; width: 100%; }
.figure figcaption { padding: 8px 12px; font-size: 0.9em; color: var(--muted); }

/* ---------- notices ---------- */

.notice {
  border-left: 5px solid var(--info); background: var(--info-bg); color: var(--on-surface);
  padding: 12px 16px; border-radius: var(--r-btn); margin: 0 0 16px;
}
.notice-success { border-left-color: var(--success); background: var(--success-bg); }
.notice-warning { border-left-color: var(--warning); background: var(--warning-bg); }
.notice-danger { border-left-color: var(--danger); background: var(--danger-bg); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border-radius: var(--r-btn);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; color: var(--on-surface); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-danger { background: var(--danger); color: #ffffff; border-color: var(--danger); }
.theme-dark .btn-danger { color: #0b1220; }
.btn-small { min-height: 36px; padding: 4px 12px; font-size: 0.9em; font-weight: 600; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-form { display: inline-block; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.actions .btn-form { margin: 0; }

/* ---------- forms ---------- */

.form { margin: 0 0 16px; }
.field { margin: 0 0 16px; }
.field label, .field legend { display: block; font-weight: 700; margin-bottom: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px;
  font: inherit; color: var(--on-surface); background: var(--surface);
  border: 2px solid var(--border); border-radius: var(--r-btn);
}
.theme-dark .field input:not([type="checkbox"]):not([type="radio"]),
.theme-dark .field select,
.theme-dark .field textarea { background: var(--surface-2); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-2); outline: none; }
.field input[name="code"] { font-family: var(--mono); font-size: 1.5em; letter-spacing: 0.3em; text-align: center; }
.field textarea { resize: vertical; }
.field-check label, .radio { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; margin-bottom: 8px; }
.field-check input, .radio input { width: 22px; height: 22px; accent-color: var(--accent); margin: 0; }
.field-radio { border: 0; padding: 0; margin: 0 0 16px; }
.hint { font-size: 0.88em; color: var(--muted); margin: 6px 0 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-grid .field-full { grid-column: 1 / -1; }

.suggest-result { display: inline-block; margin-top: 6px; font-size: 0.9em; font-weight: 700; padding: 2px 10px; border-radius: var(--r-pill); }
.suggest-result.is-free { background: var(--success-bg); color: var(--success); }
.suggest-result.is-taken { background: var(--warning-bg); color: var(--warning); }
.suggest-result.is-error { color: var(--muted); }

/* ---------- chips ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px;
  border-radius: var(--r-pill); font-size: 0.82em; font-weight: 700; white-space: nowrap;
  background: var(--surface-muted); color: var(--muted); border: 1px solid var(--border);
}
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-started, .chip-provisioned { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.chip-done { background: var(--success-bg); color: var(--success); border-color: transparent; }
.chip-blocked { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.chip-unknown { border-style: dashed; }
.chip-skipped { text-decoration: line-through; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- poll status ---------- */

.poll {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-row); background: var(--surface-muted); margin: 16px 0;
}
.poll-icon { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.poll-text { flex: 1 1 auto; }
.poll.is-done { border-color: var(--success); background: var(--success-bg); }
.poll.is-done .poll-icon { background: var(--success); width: 20px; height: 20px; border-radius: 50%; position: relative; }
.poll.is-done .poll-icon::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px;
  border: solid #ffffff; border-width: 0 3px 3px 0; transform: rotate(45deg);
}
.poll.is-done .poll-text { color: var(--success); font-weight: 700; }
.poll.is-done .poll-now { display: none; }
.poll.is-blocked { border-color: var(--danger); background: var(--danger-bg); }
.poll.is-blocked .poll-icon { background: var(--danger); }
.poll.is-blocked .poll-text { color: var(--danger); font-weight: 700; }
.poll.is-checking .poll-icon { background: var(--accent-2); }
.poll.is-error .poll-text { color: var(--muted); }

/* ---------- tables (admin) ---------- */

.table-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--r-row); margin: 0 0 18px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.93em; }
.table th, .table td { padding: 7px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-muted); font-weight: 700; white-space: nowrap; }
.theme-dark .table th { background: var(--surface-2); }
.table tbody tr:hover td { background: var(--surface-muted); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .btn-form { display: inline; }
.table .btn-small { min-height: 30px; padding: 2px 10px; }

.dl { margin: 0 0 16px; }
.dl-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 16px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dl dt { font-weight: 700; color: var(--muted); margin: 0; }
.dl dd { margin: 0; overflow-wrap: anywhere; }

.mail-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font: inherit; font-size: 0.93em; line-height: 1.5; margin: 0 0 16px; }
.timeline { list-style: none; margin: 0 0 16px; padding: 0; }
.timeline li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.93em; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }

.attention { list-style: none; padding: 0; margin: 0 0 18px; }
.attention li { border: 1px solid var(--warning); border-left-width: 5px; border-radius: var(--r-row); padding: 10px 14px; margin-bottom: 8px; }

/* ---------- quick access (links.json), access cards ---------- */

.links { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.links li { border: 1px solid var(--border); border-radius: var(--r-row); padding: 12px 14px; }
.links li a { font-weight: 700; }
.links li p { margin: 4px 0 0; font-size: 0.9em; color: var(--muted); }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--border); background: var(--surface-muted); padding: 28px 0 32px; font-size: 0.93em; margin-top: auto; }
.theme-dark .site-footer { background: var(--surface-2); }
.help { max-width: var(--max); margin: 0 auto 22px; padding: 0 var(--pad); }
.help h2 { font-size: 1.1em; }
.help-form textarea { min-height: 80px; }
.footer-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 14px; }
.footer-help-link { font-weight: 700; }
.contact { margin-bottom: 10px; }
.footer-links { display: flex; gap: 16px; margin-bottom: 10px; }
.footer-safety { font-weight: 700; margin: 0; }
.footer-env { margin: 0; font-size: 0.85em; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  :root { --pad: 16px; }
  h1 { font-size: 1.6em; }
  .progress-list { flex-direction: column; gap: 6px; }
  .progress-link { padding: 8px 12px; border-top-width: 1px; border-left-width: 5px; border-left-color: var(--border); }
  .progress-step.state-started .progress-link,
  .progress-step.state-provisioned .progress-link { border-left-color: var(--warning); border-top-color: var(--border); }
  .progress-step.state-done .progress-link { border-left-color: var(--success); border-top-color: var(--border); }
  .progress-step.state-blocked .progress-link { border-left-color: var(--danger); border-top-color: var(--border); }
  .progress-step.is-current .progress-link { border-top-width: 1px; }
  .progress-step.is-current.state-pending .progress-link { border-left-color: var(--accent-2); border-top-color: var(--on-surface); }
  .progress-title { white-space: normal; }
  .card { padding: 16px; }
  .btn { width: 100%; }
  .btn-small, .poll-now, .table .btn, [data-copy] { width: auto; }
  .btn-form { display: block; }
  .admin-nav { margin-left: 0; width: 100%; }
  .dl-row { grid-template-columns: 1fr; gap: 2px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .table { font-size: 0.88em; }
}

/* ---------- print (for "Als PDF speichern" on /start) ---------- */

@media print {
  body { background: #ffffff; color: #000000; font-size: 12pt; }
  .site-header .admin-nav, .inapp-banner, .skip-link,
  .help, .footer-actions, .btn-form, .pause-form, .poll-now, .poll, [data-copy],
  .form, .btn-ghost, .btn-danger { display: none !important; }
  .site-header, .site-footer { border-color: #999999; background: #ffffff; }
  .card, .progress-link, .links li, .notice { border-color: #999999; background: #ffffff; break-inside: avoid; }
  .badge, .btn-primary { background: #dddddd; color: #000000; }
  a { color: #000000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #444444; }
  .progress-list { flex-direction: row; }
}

.steps-list{list-style:none;margin:0 0 14px;padding:0}
.steps-list li{display:flex;gap:14px;align-items:center;margin:12px 0;font-size:18px}
.steps-list .step-num{font-size:40px;line-height:1;flex:0 0 auto;color:var(--on-surface)}
