/* ============================================================
   Elektro-Anmeldung — design tokens matched to reference UI
   ============================================================ */
:root {
  --primary:      #DC2626;   /* red 600 — buttons, active states */
  --primary-2:    #B91C1C;   /* red 700 — hover */
  --primary-soft: #FEE2E2;   /* red 100 — info panel bg */
  --primary-line: #FCA5A5;   /* red 300 — info panel border */

  --ink:          #111827;
  --ink-soft:     #374151;
  --muted:        #6B7280;
  --line:         #E5E7EB;
  --line-soft:    #F3F4F6;

  --bg:           #FFFFFF;
  --surface:      #FFFFFF;
  --card:         #FFFFFF;

  --radius:       12px;
  --radius-sm:    8px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --shadow-sm: 0 1px 2px rgba(17,24,39,.05);
  --shadow-md: 0 4px 12px rgba(17,24,39,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 14px; padding-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
}
.header-contact { font-size: 14px; color: var(--muted); display: flex; gap: 8px; }
.header-contact a { color: var(--ink); text-decoration: none; font-weight: 600; }
.header-contact a:hover { color: var(--primary); }
.muted { color: var(--muted); }
@media (max-width: 520px) { .header-contact .muted { display: none; } }

/* ---------- Page ---------- */
.page-title {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 40px 0 8px;
  line-height: 1.15;
}
.page-sub {
  color: var(--ink-soft);
  margin: 0 0 24px;
  max-width: 68ch;
}

/* ---------- Alerts ---------- */
.alert {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 14.5px;
}
.alert-info {
  background: var(--primary-soft);
  color: var(--ink-soft);
  border: 1px solid var(--primary-line);
}

/* ---------- Anlagen selection cards ---------- */
.anlagen-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 8px 0 32px;
}
@media (max-width: 640px) { .anlagen-cards { grid-template-columns: 1fr; } }

.anlage-card { position: relative; display: block; cursor: pointer; }
.anlage-card input {
  position: absolute; opacity: 0; pointer-events: none;
}
.anlage-card-inner {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .15s, background .15s, transform .1s;
  height: 100%;
}
.anlage-card:hover .anlage-card-inner { border-color: var(--primary); }
.anlage-card input:checked + .anlage-card-inner {
  border-color: var(--primary);
  background: linear-gradient(180deg, var(--primary-soft) 0%, #fff 60%);
}
.anlage-icon {
  width: 44px; height: 44px;
  background: var(--line-soft);
  border-radius: 10px;
  display: grid; place-items: center;
  color: var(--ink-soft);
  margin-bottom: 14px;
  transition: background .15s, color .15s;
}
.anlage-icon svg { width: 22px; height: 22px; }
.anlage-card input:checked + .anlage-card-inner .anlage-icon {
  background: var(--primary); color: #fff;
}
.anlage-title { font-weight: 600; font-size: 15.5px; margin-bottom: 4px; }
.anlage-desc { font-size: 13px; color: var(--muted); }

/* ---------- Progress stepper ---------- */
.progress-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  margin-bottom: 20px;
  background: var(--surface);
}
.progress-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
  font-size: 14px;
}
.progress-eyebrow { color: var(--primary); font-weight: 600; }
.progress-title { color: var(--ink-soft); font-weight: 500; }

.progress-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  list-style: none;
  padding: 0; margin: 0;
}
@media (max-width: 720px) { .progress-steps { grid-template-columns: repeat(2, 1fr); } }
.progress-steps li {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 14px;
  color: var(--muted);
  background: var(--surface);
  transition: all .15s;
}
.progress-steps li.active {
  border-color: var(--primary);
  color: var(--ink);
  background: #fff;
}
.progress-steps li.done {
  color: var(--ink);
}
.progress-steps .step-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.progress-steps li.active .step-num { background: var(--primary); color: #fff; }
.progress-steps li.done .step-num { background: var(--primary); color: #fff; }
.progress-steps li.done .step-num::before {
  content: "";
  width: 12px; height: 12px;
  background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
}
.progress-steps li.done .step-num { color: transparent; font-size: 0; }

/* ---------- Context bar ---------- */
.context-bar {
  display: flex; justify-content: space-between; align-items: center;
  margin: 8px 4px 14px;
  font-size: 14px;
  color: var(--muted);
  flex-wrap: wrap; gap: 8px;
}
.context-bar strong { color: var(--ink); }
.context-links { display: flex; gap: 18px; }
.linklike {
  background: none; border: 0; padding: 4px 0;
  font: inherit; color: var(--ink-soft); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.linklike:hover { color: var(--primary); }
.linklike svg { width: 15px; height: 15px; }

/* ---------- Form card ---------- */
.form-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.form-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 20px;
  letter-spacing: -0.01em;
}
.form-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 20px 0 12px;
}
.step-desc { color: var(--muted); font-size: 14px; margin: -12px 0 20px; }
@media (max-width: 520px) { .form-card { padding: 20px; } }

.stage[hidden] { display: none !important; }
.step-panel[hidden] { display: none !important; }

/* ---------- Grid + Fields ---------- */
.grid-1 { display: grid; grid-template-columns: 1fr; gap: 16px 20px; margin-bottom: 4px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; margin-bottom: 4px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.field .req { color: var(--primary); margin-left: 2px; }
.field .hint { font-size: 12.5px; color: var(--muted); }

.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field input[readonly] { background: var(--line-soft); color: var(--ink-soft); }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.field.invalid input,
.field.invalid select {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field.invalid::after {
  content: attr(data-error);
  font-size: 12.5px;
  color: var(--primary);
  margin-top: 2px;
}

/* ---------- Upload fields ---------- */
.upload {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 16px;
  transition: border-color .15s, background .15s;
}
.upload:hover { border-color: var(--primary); background: #FEFCFC; }
.upload-label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.upload input[type="file"] { display: block; margin-bottom: 6px; font: inherit; font-size: 14px; }

/* ---------- Vollmacht ---------- */
.vollmacht-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 20px;
  max-height: 260px;
  overflow: auto;
  background: var(--line-soft);
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.vollmacht-box p:first-child { margin-top: 0; }
.vollmacht-box p:last-child { margin-bottom: 0; }
.vollmacht-box ul { margin: 8px 0 12px 20px; padding: 0; }
.vollmacht-box li { margin: 4px 0; }
.vollmacht-title {
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ---------- Signature ---------- */
.sig-wrap {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  aspect-ratio: 4 / 1;
  overflow: hidden;
}
#sig-pad {
  display: block;
  width: 100%; height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.sig-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px;
}
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit; font-size: 13.5px;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost svg { width: 14px; height: 14px; }

/* ---------- Consent rows ---------- */
.consent-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 10px 0;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.consent-row:hover { border-color: var(--primary); }
.consent-row input[type="checkbox"] {
  appearance: none;
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s;
}
.consent-row input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
.consent-row input[type="checkbox"]:checked::after {
  content: "";
  width: 12px; height: 12px;
  background: no-repeat center/contain url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
}
.consent-row span { font-size: 14px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font: inherit; font-weight: 600; font-size: 14.5px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-2); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary svg { width: 15px; height: 15px; }
.btn-secondary {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }
.btn .arrow { font-size: 16px; line-height: 1; }

.form-actions,
.stage-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  gap: 12px;
}

/* ---------- Summary ---------- */
.summary-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 16px 0;
}
.summary-block h3 { margin: 0 0 12px; font-size: 16px; }
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  gap: 20px;
}
.summary-row:first-of-type { border-top: 0; padding-top: 0; }
.summary-row span { color: var(--muted); }
.summary-row strong { color: var(--ink); text-align: right; }

/* ---------- Account tabs ---------- */
.account-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--line-soft);
  padding: 6px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.account-tab {
  background: transparent; border: 0;
  padding: 10px 14px;
  font: inherit; font-weight: 600; font-size: 14px;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.account-tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.account-tab svg { width: 15px; height: 15px; }
.account-tab:disabled { cursor: not-allowed; opacity: .6; }

/* Password strength */
.pw-strength { display: flex; gap: 4px; margin-top: 6px; }
.pw-strength span {
  height: 4px; flex: 1;
  background: var(--line);
  border-radius: 2px;
  transition: background .15s;
}
.pw-strength[data-score="1"] span:nth-child(-n+1),
.pw-strength[data-score="2"] span:nth-child(-n+2),
.pw-strength[data-score="3"] span:nth-child(-n+3),
.pw-strength[data-score="4"] span:nth-child(-n+4),
.pw-strength[data-score="5"] span { background: var(--primary); }

/* ---------- Success ---------- */
.form-card.success { text-align: center; padding: 48px 32px; }
.success-badge {
  width: 64px; height: 64px; border-radius: 50%;
  background: #16A34A; color: #fff;
  display: grid; place-items: center;
  margin: 0 auto 20px;
}
.success-badge svg { width: 32px; height: 32px; }
.form-card.success h2 { font-size: 22px; margin-bottom: 12px; }
.fine { font-size: 13px; color: var(--muted); margin-top: 20px; }
.error-text { color: var(--primary); margin-bottom: 16px; }

.vorgang-display {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 28px auto 4px;
  padding: 20px 40px;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.vorgang-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.vorgang-number {
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.vorgang-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
@media (max-width: 520px) {
  .vorgang-display { padding: 18px 24px; display: flex; }
  .vorgang-number { font-size: 22px; }
}

/* ---------- Honeypot ---------- */
.honeypot {
  position: absolute !important;
  left: -9999px !important;
  top: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  margin-top: 60px;
  font-size: 13px;
  color: var(--muted);
}
.site-footer .wrap {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.site-footer a { color: var(--ink-soft); text-decoration: none; margin-right: 14px; }
.site-footer a:hover { color: var(--primary); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
