/* ==========================================================================
   Escrow-Portal – Design-System (White-Label)
   Swiss Style / International Typographic Style
   Inter, Netz, Weissraum, keine Gradienten, keine Krypto-Dekoration.
   Enthält keine Firmenangaben: Farben und Typografie sind neutral, alle
   Marken-Daten kommen aus GET /api/config.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --accent: #004b87;
  --accent-dark: #003a69;
  --accent-soft: #f2f6fa;
  --ok: #16a34a;
  --ok-soft: #f0fdf4;
  --err: #dc2626;
  --err-soft: #fef2f2;
  --warn: #a16207;
  --warn-soft: #fefce8;

  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06);
  --card-width: 480px;

  --font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

/* Das hidden-Attribut MUSS gewinnen: eigene display-Regeln (z. B. .field
   { display: flex }) würden es sonst aushebeln und versteckte Blöcke
   sichtbar machen. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv05" 1, "ss03" 1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.011em; }

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

/* --------------------------------------------------------------- Kopfzeile */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.site-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.wordmark__suffix {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.lang__item {
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--muted);
}

.lang__item[aria-current="true"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.lang__sep { color: var(--line-strong); }

/* -------------------------------------------------------------------- Hero */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 72px;
}

.hero {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 0 32px;
  text-align: center;
}

.hero h1 {
  font-size: 27px;
  line-height: 1.25;
}

.hero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------------ Karten */

.card {
  width: 100%;
  max-width: var(--card-width);
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px;
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card__head h2 {
  font-size: 17px;
}

.card__sub {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.badge {
  flex: none;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.badge--ok { color: var(--ok); border-color: #bbe7c9; background: var(--ok-soft); }
.badge--bad { color: var(--err); border-color: #f5c9c9; background: var(--err-soft); }

/* ----------------------------------------------------------------- Stepper */

.steps {
  display: flex;
  align-items: flex-start;
  gap: 0;
  list-style: none;
  margin: 24px 0 20px;
  padding: 0;
}

.steps li {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-align: center;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}

/* Verbindungslinie zwischen den Knoten */
.steps li::before {
  content: "";
  position: absolute;
  top: 11px;
  right: 50%;
  width: 100%;
  height: 1px;
  background: var(--line);
}

.steps li:first-child::before { display: none; }
.steps li[data-state="done"]::before,
.steps li[data-state="active"]::before { background: var(--accent); }

.steps .mark {
  position: relative;
  z-index: 1;
  width: 23px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.steps li[data-state="active"] { color: var(--accent); font-weight: 600; }
.steps li[data-state="active"] .mark {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.steps li[data-state="done"] { color: var(--ink); }
.steps li[data-state="done"] .mark {
  border-color: var(--ok);
  background: var(--ok);
  color: #ffffff;
}

.steps li[data-state="error"] { color: var(--err); font-weight: 600; }
.steps li[data-state="error"] .mark {
  border-color: var(--err);
  background: var(--err);
  color: #ffffff;
}

/* Detailzeile unter einem Knoten (z. B. Netzwerk-Status) */
.steps__detail {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--muted);
}

.steps__detail[data-tone="error"] { color: var(--err); }
.steps__detail[data-tone="ok"] { color: var(--ok); }

/* ------------------------------------------------------- Status / Fortschritt */

.status {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 13.5px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.status[data-tone="ok"] { border-left-color: var(--ok); background: var(--ok-soft); }
.status[data-tone="error"] { border-left-color: var(--err); background: var(--err-soft); }
.status[data-tone="warn"] { border-left-color: var(--warn); background: var(--warn-soft); }

.progress {
  height: 4px;
  border-radius: 999px;
  background: #f3f4f6;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}

.progress__label {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

/* ------------------------------------------------------- Freigabe-Offenlegung */

.box {
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.box h3 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 16px;
  margin: 0;
  font-size: 12.5px;
}

.rows dt { color: var(--muted); }
.rows dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.amount {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.amount label { font-size: 12.5px; color: var(--muted); }

.amount input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.amount input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.amount span { font-size: 12.5px; font-weight: 600; }

.purpose {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
}

.note {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.note--amber { color: var(--warn); }

/* -------------------------------------------------------------- Meldungen */

.alert {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid #f5c9c9;
  border-radius: var(--radius-sm);
  background: var(--err-soft);
  color: #7f1d1d;
  font-size: 12.5px;
}

.alert--info { border-color: #cfe0f8; background: var(--accent-soft); color: #123a63; }
.alert--warn { border-color: #f0e0bf; background: var(--warn-soft); color: #6b4708; }

.alert strong {
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
}

.alert ul { margin: 7px 0 0; padding-left: 18px; }
.alert code,
.manual code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f3f4f6;
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
}

.manual { margin: 8px 0 0; font-size: 12px; }

.diag {
  margin: 12px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

.diag summary { cursor: pointer; }

.diag pre {
  margin: 8px 0 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafafa;
  overflow-x: auto;
  font: 11px/1.5 var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
}

/* --------------------------------------------------------------- Buttons */

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 22px;
}

.btn {
  flex: 1 1 auto;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn:disabled {
  background: #f3f4f6;
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}

.btn--ghost {
  flex: 0 0 auto;
  padding: 12px 16px;
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--ink);
  font-weight: 500;
}

.btn--ghost:hover:not(:disabled) {
  background: #f9fafb;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn--ghost:disabled { background: #ffffff; color: var(--muted); }

/* -------------------------------------------------------- So funktioniert's */

.howto {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  max-width: 880px;
  margin: 64px auto 0;
}

.howto__item { text-align: left; }

.howto__icon {
  display: block;
  width: 22px;
  height: 22px;
  margin-bottom: 14px;
  color: var(--accent);
}

.howto__item h3 {
  font-size: 14px;
  margin-bottom: 6px;
}

.howto__item p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

/* ------------------------------------------------------------ Vertrauensleiste */

.trustbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  max-width: 880px;
  margin: 56px auto 0;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
}

.trustbar__item { display: inline-flex; align-items: center; gap: 6px; }
.trustbar__sep { color: var(--line-strong); }
.trustbar svg { flex: none; width: 13px; height: 13px; }

/* ------------------------------------------------------------------ Footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.site-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 24px 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.site-footer h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.site-footer p { margin: 0; }
.site-footer address { font-style: normal; }
.site-footer__right { text-align: right; }
.site-footer__links { margin-bottom: 12px; }
.site-footer__links a { color: var(--muted); }
.site-footer__links a:hover { color: var(--accent); }
.site-footer__legal { margin-top: 12px; font-size: 11.5px; }

/* ------------------------------------------------- Wallet-Auswahl (Overlay) */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(17, 24, 39, 0.5);
}

.overlay[hidden] { display: none; }

.picker {
  width: 100%;
  max-width: 400px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: var(--radius-card);
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.24);
}

.picker h2 { font-size: 16px; }

.picker .hint {
  margin: 5px 0 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.wlist { display: flex; flex-direction: column; gap: 8px; }

.wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.wallet:hover { border-color: var(--accent); background: var(--accent-soft); }
.wallet:disabled { cursor: not-allowed; opacity: 0.55; }
.wallet img { flex: none; width: 26px; height: 26px; border-radius: 6px; }
.wallet .meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.wallet .name { font-size: 13.5px; font-weight: 600; }
.wallet .tag { font-size: 11.5px; color: var(--muted); }
.wallet .tag--ok { color: var(--ok); }

.picker__foot {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11.5px;
}

.picker .actions { margin-top: 16px; }

/* --------------------------------------------------------- Rechtstexte-Seiten */

.legal {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 0 24px;
}

.legal h1 { font-size: 24px; margin-bottom: 8px; }

.legal .legal__meta {
  margin: 0 0 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.legal h2 {
  margin: 32px 0 8px;
  font-size: 15px;
}

.legal h3 {
  margin: 20px 0 6px;
  font-size: 13.5px;
}

.legal p, .legal li { font-size: 13.5px; color: #1f2937; }
.legal p { margin: 0 0 12px; }
.legal ul, .legal ol { margin: 0 0 12px; padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal dl { margin: 0 0 12px; }
.legal dt { font-size: 13.5px; font-weight: 600; margin-top: 10px; }
.legal dd { margin: 0; font-size: 13.5px; color: #1f2937; }
.legal .placeholder {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--mono);
  font-size: 12px;
}

/* --------------------------------------------------------------- Responsiv */

@media (max-width: 720px) {
  .site-header__inner { padding: 14px 18px; }
  .page { padding: 0 18px 56px; }
  .hero { padding: 36px 0 24px; }
  .hero h1 { font-size: 22px; }
  .card { padding: 22px 18px; border-radius: var(--radius-card); }
  .steps li { font-size: 10px; }
  .howto {
    grid-template-columns: 1fr;
    gap: 28px;
    margin-top: 44px;
  }
  .trustbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 40px;
  }
  .trustbar__sep { display: none; }
  .site-footer__inner {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 32px 18px 40px;
  }
  .site-footer__right { text-align: left; }
  .legal { padding-top: 36px; }
  .legal h1 { font-size: 20px; }
}

@media (max-width: 380px) {
  .steps li { font-size: 9.5px; }
  .steps .mark { width: 20px; height: 20px; }
  .steps li::before { top: 9.5px; }
}

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

/* ==========================================================================
   Erweiterungen für Admin-Panel, Formulare, Tabellen und Wartezustand
   ========================================================================== */

/* ------------------------------------------------------------- Kopf / Breite */

.tagline {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.page--wide { max-width: 1180px; }

.hero--left {
  max-width: none;
  text-align: left;
  padding: 40px 0 24px;
}

.card--wide { max-width: none; }

/* --------------------------------------------------------- Wartezustand */

.wait {
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.wait[data-state="waiting"] { border-left-color: var(--accent); background: var(--accent-soft); }
.wait[data-state="done"] { border-left-color: var(--ok); background: var(--ok-soft); }

.wait__text {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
}

.wait__hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.wait .actions { margin-top: 16px; }

/* ------------------------------------------------------------- Formulare */

.form { margin-top: 4px; }

.form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-top: 16px;
}

.form__legend {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--full { grid-column: 1 / -1; }

.field label { font-size: 12px; color: var(--muted); }

.field input {
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field input:disabled { background: #f9fafb; color: var(--muted); }

.field .note { margin-top: 2px; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}

.check input { flex: none; margin-top: 2px; }

.inline-form {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 6px 14px;
  align-items: center;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.inline-form label { font-size: 12px; color: var(--muted); }

.inline-form input {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.inline-form .note { grid-column: 2; margin: 0; }

.note code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f3f4f6;
  font-family: var(--mono);
  font-size: 11px;
}

/* ------------------------------------------------------------------ Tabs */

.tabs {
  display: flex;
  gap: 4px;
  margin: 32px 0 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 10px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tabpanel { margin-top: 24px; }
.tabpanel .card { margin: 0; }

/* --------------------------------------------------------------- Tabellen */

.table-wrap {
  margin-top: 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.table th,
.table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table th {
  background: #fafafa;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fcfcfd; }

.cell--num { text-align: right; font-variant-numeric: tabular-nums; }
.cell--addr { font-family: var(--mono); font-size: 11.5px; }
.cell--actions { display: flex; gap: 6px; align-items: center; }
.cell--empty { color: var(--muted); text-align: center; padding: 22px 12px; }

.cell--state[data-state="1"] { color: var(--accent); font-weight: 600; }
.cell--state[data-state="2"] { color: var(--ok); font-weight: 600; }
.cell--state[data-state="3"] { color: var(--warn); font-weight: 600; }

.rows--meta {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fafafa;
  font-size: 12px;
}

.rows--meta dd { font-family: var(--mono); font-size: 11.5px; }

/* ---------------------------------------------------------- Buttons (klein) */

.btn--small {
  flex: 0 0 auto;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
}

.btn--ok {
  background: var(--ok);
  border-color: var(--ok);
}

.btn--ok:hover:not(:disabled) { background: #15803d; border-color: #15803d; }

/* --------------------------------------------------------- Rechtstexte */

.legal__loading { color: var(--muted); font-size: 13px; }

.site-footer__contact { margin-top: 10px !important; }

/* --------------------------------------------------------------- Responsiv */

@media (max-width: 720px) {
  .form__grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .inline-form .note { grid-column: 1; }
  .tabs { overflow-x: auto; }
  .table th, .table td { padding: 9px 10px; }
}
