/* ---------------------------------------------------------------------------
 * BW Sales-CRM — komplettes Stylesheet.
 *
 * Alles CSS steht hier und NICHT im HTML: die Content-Security-Policy erlaubt
 * nur `style-src 'self'`. Kein <style>-Block, kein style="…"-Attribut, nirgends.
 * Alles, was sonst eine Inline-Farbe waere (Vertriebler-Chip, Stufenfarbe),
 * laeuft ueber eine Klasse.
 * ------------------------------------------------------------------------- */

:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

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

/* ── Kopfzeile ───────────────────────────────────────────────────────────── */
header.top {
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 8px rgba(15, 23, 42, .2);
}
header.top .brand { font-weight: 700; font-size: 15px; padding: 13px 0; white-space: nowrap; }
header.top .brand a { color: #fff; }
header.top .brand a:hover { text-decoration: none; }
header.top .brand small { font-weight: 400; color: #94a3b8; font-size: 11px; margin-left: 3px; }
header.top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
header.top nav a {
  color: #cbd5e1; padding: 15px 14px; font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
header.top nav a:hover { color: #fff; text-decoration: none; }
header.top nav a.active { color: #fff; border-bottom-color: var(--brand); }
.userbox { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #cbd5e1; }
.userbox .uname { white-space: nowrap; }
.inline-form { display: inline; margin: 0; }
button.linkish {
  background: none; border: none; color: #94a3b8; font-size: 12px; cursor: pointer;
  padding: 4px 2px; font-family: inherit; text-decoration: underline;
}
/* Auf hellem Grund (Tabellenzelle, Verlaufsblase) waere Weiss beim Ueberfahren
   unsichtbar — die Schaltflaeche verschwindet genau dann, wenn man auf sie zeigt.
   Weiss gilt deshalb nur in der dunklen Kopfzeile. */
button.linkish:hover { color: var(--danger); }
header.top button.linkish:hover { color: #fff; }

main { padding: 18px 20px 70px; max-width: 1680px; }

h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
p { margin: 0 0 10px; }
.muted-text { color: var(--ink-soft); }
.subtitle { color: var(--ink-soft); font-size: 13px; margin: 0 0 16px; }

/* ── Formularelemente ────────────────────────────────────────────────────── */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=time],
input[type=search], input[type=url], input[type=tel], select, textarea {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 13px;
  background: #fff; font-family: inherit; color: var(--ink); width: 100%;
}
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
label { font-size: 11px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

button, .btn {
  padding: 8px 15px; background: var(--brand); color: #fff; border: none; border-radius: 7px;
  font-size: 13px; cursor: pointer; font-weight: 600; font-family: inherit;
  display: inline-block; text-align: center; min-height: 36px;
}
button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
button.secondary, .btn.secondary { background: #e2e8f0; color: #334155; }
button.secondary:hover, .btn.secondary:hover { background: #cbd5e1; color: #334155; }
button.danger, .btn.danger { background: var(--danger); }
button.danger:hover, .btn.danger:hover { background: #b91c1c; }
button.success, .btn.success { background: var(--ok); }
button.success:hover, .btn.success:hover { background: #047857; }
button.small, .btn.small { padding: 5px 10px; font-size: 12px; min-height: 30px; }
button[disabled] { opacity: .5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.field.check { flex-direction: row; align-items: center; gap: 7px; }
.field.check label { text-transform: none; font-size: 13px; color: #334155; font-weight: 500; }
.field.check input { width: auto; }
/* 140 px statt 220: in der Nebenspalte (rund 300 px Inhalt) klappte jedes Paar
   sonst untereinander und machte die Kaesten doppelt so hoch wie noetig.
   Vorname/Nachname nebeneinander sind auch bei 140 px lesbar. */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
/* Ohne das erbt jedes Feld die globale Breite 100 % — flex bricht dann VOR dem
   Schrumpfen um und legt Auswahl, Zeitpunkt und Knopf auf drei eigene Zeilen. */
.actions select, .actions input { width: auto; }

/* ── Karten und Kaesten ──────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 16px;
}
/* Fluss-Abstand: die direkten Kinder einer Karte (Ueberschrift, Liste, Formular,
   Klappbereich, Definitionsliste) standen sonst ohne jeden Abstand aufeinander —
   eine Liste klebte an dem Formular, das direkt darunter folgt. Nur DIREKTE
   Kinder, damit die Felder innerhalb eines Formulars ihren eigenen Abstand
   behalten und nicht doppelt gezaehlt wird.
   :not(form) ist noetig: die Neuanlage-Seite IST ein form.card, und
   dort tragen die .field-Kinder ihren Abstand schon selbst — sonst stuenden die
   Eingabefelder doppelt so weit auseinander wie ueberall sonst. */
.card:not(form) > * + * { margin-top: 14px; }
.card:not(form) > h2 { margin-bottom: 0; }
.card:not(form) > p { margin-bottom: 0; }
.card form > p { margin-top: 10px; margin-bottom: 0; }
.cards { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.cards > .card { flex: 1 1 340px; margin-bottom: 0; }
.kv { display: grid; grid-template-columns: 145px 1fr; gap: 5px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Steckbrief-Leiste ueber die volle Breite: so viele Angaben nebeneinander, wie
   hineinpassen. Jede Angabe ist ein eigenes <div>, sonst zerreisst das Raster
   Begriff und Wert in verschiedene Spalten. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px 20px; margin: 0; }
.facts dt {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); margin-bottom: 2px;
}
.facts dd { margin: 0; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }

/* Aufklappbereiche ("Hinzufügen", "Bearbeiten"). Ohne eigene Regeln war das ein
   nackter Dreiecks-Marker ohne Abstand mitten in der Karte. */
details.inline > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--brand); padding: 3px 0; user-select: none;
}
details.inline > summary::-webkit-details-marker { display: none; }
details.inline > summary::before {
  content: "+"; display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 5px; background: #e2e8f0; color: #475569;
  font-size: 13px; line-height: 1; font-weight: 700;
}
details.inline[open] > summary::before { content: "−"; }
details.inline > summary:hover { text-decoration: underline; }
details.inline > form {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}

.flash { padding: 11px 15px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.flash.ok { background: #d1fae5; color: #065f46; }
.flash.error { background: #fee2e2; color: #991b1b; }
.warnbox {
  background: #fef3c7; color: #92400e; border-radius: 8px; padding: 10px 14px;
  font-size: 12.5px; margin: 0 0 14px; line-height: 1.5;
}
.warnbox strong { font-weight: 700; }
.empty { text-align: center; color: var(--ink-soft); padding: 34px 12px; font-size: 13px; }

/* ── Abzeichen ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
  background: #e2e8f0; color: #334155;
}
.badge.ok { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.stage-prospect { background: #e2e8f0; color: #334155; }
.badge.stage-new_lead { background: #dbeafe; color: #1e40af; }
.badge.stage-opportunity { background: #ede9fe; color: #5b21b6; }
.badge.stage-closed_won { background: #d1fae5; color: #065f46; }
.badge.stage-closed_lost { background: #fee2e2; color: #991b1b; }

/* Farbchips der Vertriebsleute — acht feste Klassen statt freier Hex-Werte. */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; font-size: 10.5px; font-weight: 700;
  color: #fff; flex: 0 0 auto; letter-spacing: .02em;
}
.avatar.av-0 { background: #94a3b8; }
.avatar.av-1 { background: #2563eb; }
.avatar.av-2 { background: #059669; }
.avatar.av-3 { background: #d97706; }
.avatar.av-4 { background: #9333ea; }
.avatar.av-5 { background: #dc2626; }
.avatar.av-6 { background: #0891b2; }
.avatar.av-7 { background: #db2777; }
.avatar.av-8 { background: #4d7c0f; }

/* ── Filterleiste ────────────────────────────────────────────────────────── */
.toolbar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px;
}
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; flex: 1; }
.toolbar input[type=search] { flex: 1; min-width: 190px; width: auto; }
.toolbar select { width: auto; min-width: 130px; }
.spacer { flex: 1; }
.viewtoggle { display: flex; border: 1px solid #cbd5e1; border-radius: 7px; overflow: hidden; background: #fff; }
.viewtoggle a { padding: 7px 13px; font-size: 12.5px; color: #475569; font-weight: 600; }
.viewtoggle a:hover { background: #f8fafc; text-decoration: none; }
.viewtoggle a.active { background: var(--brand); color: #fff; }
.count { font-size: 12px; color: var(--ink-soft); margin: -6px 0 12px; }

/* ── Kanban ──────────────────────────────────────────────────────────────── */
/* Die Umschaltung Board/Tabelle laeuft ueber eine Klasse am <body>, gesetzt vom
   Server aus ?view= bzw. dem Cookie. Kein Inline-Script, also auch kein
   Aufblitzen der falschen Ansicht beim Laden. */
body.view-table .board { display: none; }
body.view-board .leadtable { display: none; }

.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(250px, 1fr));
  gap: 12px;
  align-items: start;
}
.col {
  background: #e8edf4; border-radius: var(--radius); padding: 10px;
  min-height: 160px; display: flex; flex-direction: column; gap: 8px;
}
.col.dragover { background: #dbeafe; outline: 2px dashed var(--brand); outline-offset: -3px; }
.col-head { display: flex; align-items: baseline; gap: 7px; padding: 0 3px 2px; }
.col-head .t { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #475569; }
.col-head .n { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.col-more { font-size: 12px; color: var(--ink-soft); text-align: center; padding: 4px; }

.lcard {
  background: #fff; border-radius: 8px; box-shadow: var(--shadow); padding: 10px 11px;
  position: relative; cursor: grab; border-left: 3px solid transparent;
}
.lcard:active { cursor: grabbing; }
.lcard.dragging { opacity: .4; }
.lcard.pending { opacity: .55; }
.lcard.stage-prospect { border-left-color: #94a3b8; }
.lcard.stage-new_lead { border-left-color: #3b82f6; }
.lcard.stage-opportunity { border-left-color: #8b5cf6; }
.lcard.stage-closed_won { border-left-color: #059669; }
.lcard.stage-closed_lost { border-left-color: #dc2626; }
.lcard .lname { font-weight: 600; font-size: 13.5px; display: block; margin-right: 26px; line-height: 1.35; }
.lcard .lname:hover { text-decoration: underline; }
.lcard .lmeta { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.lcard .lsub { font-size: 11.5px; color: var(--ink-soft); margin-top: 3px; }
.lcard .lhint {
  display: block; margin-top: 7px; font-size: 11px; font-weight: 600;
  background: #fef3c7; color: #92400e; border-radius: 5px; padding: 3px 7px;
}
.lcard .lhint.good { background: #d1fae5; color: #065f46; }
.lcard .ago { font-size: 11px; color: var(--ink-soft); margin-left: auto; }
.lcard .ago.stale { color: var(--danger); font-weight: 600; }
.lcard .lock { font-size: 11px; }

/* "⋯"-Menue. Auf dem Handy feuert HTML5-Drag&Drop gar nicht — dieses Menue ist
   dort der einzige Weg, eine Karte zu bewegen, und ruft denselben Endpunkt. */
.cardmenu { position: absolute; top: 6px; right: 6px; }
.cardmenu > summary {
  list-style: none; cursor: pointer; width: 24px; height: 24px; line-height: 22px;
  text-align: center; border-radius: 5px; color: var(--ink-soft); font-size: 15px;
}
.cardmenu > summary::-webkit-details-marker { display: none; }
.cardmenu > summary:hover { background: #f1f5f9; color: var(--ink); }
.cardmenu .menu {
  position: absolute; right: 0; top: 26px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 6px 20px rgba(15, 23, 42, .16); z-index: 15;
  min-width: 176px; padding: 5px; text-align: left;
}
.cardmenu .menu form { margin: 0; }
.cardmenu .menu button {
  display: block; width: 100%; text-align: left; background: none; color: #334155;
  font-weight: 500; padding: 7px 9px; border-radius: 5px; font-size: 12.5px; min-height: 0;
}
.cardmenu .menu button:hover { background: #f1f5f9; color: var(--ink); }
.cardmenu .menu button[disabled] { color: #94a3b8; }
.cardmenu .menu .sep { border-top: 1px solid var(--line); margin: 4px 0; }

/* ── Tabelle ─────────────────────────────────────────────────────────────── */
table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); font-size: 13px;
}
th {
  background: #1e293b; color: #fff; text-align: left; padding: 9px 11px; font-weight: 600;
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
th a { color: #fff; }
th a:hover { text-decoration: none; }
.sort-idle { opacity: .35; }
td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; line-height: 1.5; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Sonst klebt die naechste Karte an der Tabelle. */
.leadtable { margin-bottom: 16px; }

/* Ein Formular IN einer Tabellenzelle (Rolle setzen im Team). `inline-form` allein
   liess das 100 % breite Auswahlfeld und den Knopf ohne jeden Abstand
   untereinander fallen. */
.rowform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.rowform select, .rowform input { width: auto; min-width: 120px; }

.pagination { margin-top: 14px; display: flex; gap: 8px; align-items: center; font-size: 13px; }
.pagination a { padding: 6px 12px; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; color: #334155; }
.pagination a:hover { background: #f8fafc; text-decoration: none; }
.page-info { color: var(--ink-soft); }

/* ── Lead-Detail ─────────────────────────────────────────────────────────── */
/* Die Nebenspalte hielt acht Kaesten in EINEM Stapel — auf einem breiten Schirm
   eine meterlange Saeule neben viel Weissraum. Sie bekommt jetzt mehr Breite und
   bricht selbst in Spalten um: `column-width` entscheidet nach der tatsaechlich
   verfuegbaren Breite, ohne feste Bildschirmgrenzen. `break-inside: avoid` haelt
   jeden Kasten zusammen — ohne das zerreisst der Umbruch mitten im Formular. */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 46%); gap: 16px 18px; align-items: start; }
/* 270 px ist bewusst knapp gewaehlt: bei 330 px blieb ein 1440er Schirm
   einspaltig — also genau der Stapel, der weg soll. Nachgemessen bei 1440,
   1600 und 1920. */
.detail-side { column-width: 270px; column-gap: 16px; }
.detail-side > .card { break-inside: avoid; margin-bottom: 16px; }
.detail-side > .card:last-child { margin-bottom: 0; }
.backlink { font-size: 13px; margin-bottom: 10px; display: inline-block; }
.stagebar { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; }
.stagebar form { margin: 0; }
.stagebar button {
  background: #e2e8f0; color: #475569; font-size: 12px; padding: 6px 12px; font-weight: 600;
}
.stagebar button:hover { background: #cbd5e1; color: var(--ink); }
.stagebar button.cur { background: var(--brand); color: #fff; }
.stagebar button.cur:hover { background: var(--brand); }

/* Der Chatroom. */
.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.msg { display: flex; gap: 9px; align-items: flex-start; }
.msg .bubble {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 11px; flex: 1; min-width: 0;
}
.msg .mhead { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 3px; }
/* Der Loeschknopf ganz nach rechts, damit er nicht zwischen Name und Zeitpunkt sitzt. */
.msg .mhead .mdel { margin-left: auto; }
.msg .mwho { font-weight: 600; font-size: 12.5px; }
.msg .mwhen { font-size: 11px; color: var(--ink-soft); }
.msg .mbody { font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.msg.system .bubble { background: #f1f5f9; border-style: dashed; }
.msg.system .mbody { color: var(--ink-soft); font-size: 12.5px; }

.linklist { list-style: none; padding: 0; margin: 0; }
.linklist li { padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; line-height: 1.5; }
.linklist li:first-child { padding-top: 0; }
.linklist li:last-child { border-bottom: none; padding-bottom: 0; }
.linklist .inline-form { margin-left: 6px; }
code.mono {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: #f1f5f9;
  padding: 2px 6px; border-radius: 5px; overflow-wrap: anywhere;
}
.copyrow { display: flex; gap: 6px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.copyrow input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* Autocomplete der Firmensuche. */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(15, 23, 42, .14); z-index: 40;
  max-height: 290px; overflow-y: auto; margin-top: 3px;
}
.ac-list button {
  display: block; width: 100%; text-align: left; background: none; color: var(--ink);
  padding: 8px 11px; border-radius: 0; font-weight: 500; font-size: 13px; min-height: 0;
}
.ac-list button:hover, .ac-list button.sel { background: #eff6ff; color: var(--ink); }
.ac-list .ac-sub { display: block; font-size: 11.5px; color: var(--ink-soft); font-weight: 400; margin-top: 1px; }
.ac-empty { padding: 9px 11px; font-size: 12.5px; color: var(--ink-soft); }

/* ── Wettbewerb ──────────────────────────────────────────────────────────── */
.compgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.compcard { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px; }
.compcard h2 { margin-bottom: 3px; }
.compcard .site { font-size: 12px; margin-bottom: 10px; display: block; }
.wiki { font-size: 13px; line-height: 1.6; }
.wiki h3 { margin-top: 14px; }
.wiki h3:first-child { margin-top: 0; }
.wiki .they { color: #92400e; }
.wiki .we { color: #065f46; }

/* ── Unterlagen ──────────────────────────────────────────────────────────── */
.drop {
  border: 2px dashed #cbd5e1; border-radius: var(--radius); padding: 26px; text-align: center;
  color: var(--ink-soft); background: #fff; font-size: 13px; margin-bottom: 16px;
}
.drop.over { border-color: var(--brand); background: #eff6ff; color: var(--brand); }
.drop input[type=file] { display: none; }
.uprow { display: flex; align-items: center; gap: 9px; font-size: 12.5px; margin-top: 9px; }
.bar { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .15s linear; }
.filetype {
  display: inline-block; min-width: 34px; text-align: center; font-size: 10px; font-weight: 700;
  background: #e2e8f0; color: #475569; border-radius: 4px; padding: 2px 5px; letter-spacing: .04em;
}

/* ── Anmeldeseite ────────────────────────────────────────────────────────── */
body.auth-page { background: #0f172a; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { background: #fff; border-radius: 14px; padding: 30px 30px 26px; width: 100%; max-width: 390px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
.auth-brand { font-size: 17px; margin: 0 0 18px; font-weight: 700; }
.auth-brand span { color: var(--brand); font-weight: 500; }
.auth-card .field { margin-bottom: 14px; }
.auth-card button[type=submit] { width: 100%; padding: 11px; font-size: 14px; }
.auth-hint { font-size: 12px; color: var(--ink-soft); margin-top: 14px; line-height: 1.55; }
.auth-hint a { font-size: 12px; }
.otp { font-size: 22px !important; letter-spacing: .35em; text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; }
.qrbox { text-align: center; margin: 8px 0 14px; }
.qrbox svg { width: 190px; height: 190px; }
.secretline { text-align: center; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-spacing: .3em; background: #f1f5f9; padding: 9px; border-radius: 7px; overflow-wrap: anywhere; }

/* ── Dialog, Hinweisstreifen, Hilfsklassen ───────────────────────────────── */
dialog.modal {
  border: none; border-radius: 12px; padding: 22px 24px; max-width: 400px; width: calc(100% - 32px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, .35); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
dialog.modal h2 { margin-bottom: 2px; }
dialog.modal p { font-size: 13px; margin-bottom: 14px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 9px;
  font-size: 13px; z-index: 90; box-shadow: 0 8px 26px rgba(0, 0, 0, .3); max-width: 90vw;
}
/* Eine Fehlermeldung darf nicht aussehen wie eine Bestaetigung. */
.toast.error { background: var(--danger); font-weight: 500; }

/* Kopier-Rückfall braucht ein sichtbares, aber unauffälliges Textfeld. */
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
.uprow.failed .st { color: var(--danger); font-weight: 600; }
[hidden] { display: none !important; }

/* ── Mobil ───────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  main { padding: 14px 12px 60px; }
  header.top { gap: 10px; padding: 0 12px; }
  header.top .brand { font-size: 13px; }
  .userbox .uname { display: none; }

  /* Board: eine Spalte je Bildschirm, mit Einrasten. */
  .board {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    gap: 10px; padding-bottom: 10px; -webkit-overflow-scrolling: touch;
  }
  .col { flex: 0 0 86%; scroll-snap-align: start; }
  .lcard { cursor: default; }

  /* Tabelle wird zur Kartenliste. Ohne data-label steht dann nur noch Rohtext da. */
  .leadtable thead { display: none; }
  .leadtable table, .leadtable tbody, .leadtable tr, .leadtable td { display: block; width: 100%; }
  .leadtable tr {
    background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
    margin-bottom: 10px; padding: 6px 4px;
  }
  .leadtable td { border: none; padding: 5px 11px; display: flex; gap: 10px; }
  .leadtable td::before {
    content: attr(data-label); flex: 0 0 108px; color: var(--ink-soft);
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
    padding-top: 2px;
  }
  .leadtable td.num { text-align: left; }
  button, .btn { min-height: 44px; }
  button.small, .btn.small { min-height: 36px; }
  .cardmenu > summary { width: 32px; height: 32px; line-height: 30px; }
}

/* Wer Bewegung reduziert haben will, bekommt sie nicht. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
