/* Anmeldebildschirm — im selben Look wie das Dashboard.
 *
 * ANLASS (10.08.2026, vom Betreiber): "bitte schau auch das der
 * anmeldebildschirm sauber wird und unser neues design hat!" Er stammte noch
 * aus der Zeit vor der Angleichung an die uebrigen PT24-Oberflaechen: dunkler
 * Farbverlauf, eigene Farbwerte, englische Beschriftung. Die erste Seite, die
 * jemand vom Gateway sieht, sah aus wie ein anderes Programm.
 *
 * Die Werte sind dieselben wie in styles.css — bewusst KOPIERT und nicht
 * importiert: der Anmeldebildschirm laedt aus Sicherheitsgruenden so wenig wie
 * moeglich (er ist die einzige Seite ohne Sitzung). Aendert sich die Palette,
 * gehoert sie hier mitgeaendert; ein Test haelt beide Seiten zusammen. */
:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #0f766e;
  --accent-dark: #0b544f;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 14px;
  --radius-sm: 9px;
  --schatten: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --schatten-hoch: 0 4px 12px rgba(16, 24, 40, 0.07);
  --kachel-bg: rgba(16, 24, 40, 0.035);
  --kachel-rand: rgba(16, 24, 40, 0.08);
  --warn: #b45309;
  --warn-bg: #fff4e0;
}

/* Wer sein Geraet auf Dunkel gestellt hat, bekommt Dunkel — mit denselben
   Rollen, nicht mit umgedrehten Farben. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #14171c;
    --panel: #1b1f26;
    --text: #e9ebef;
    --muted: #9aa2ae;
    --line: #2b313a;
    --accent: #2aa198;
    --accent-dark: #1f8079;
    --danger: #f0796f;
    --ok: #4ade80;
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.24);
    --schatten-hoch: 0 4px 14px rgba(0, 0, 0, 0.35);
    --kachel-bg: rgba(255, 255, 255, 0.04);
    --kachel-rand: rgba(255, 255, 255, 0.09);
    --warn: #fbbf24;
    --warn-bg: rgba(251, 191, 36, 0.14);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button, input { font: inherit; }

.login-container { width: 100%; max-width: 400px; }

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--schatten-hoch);
  padding: 32px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Marke ─────────────────────────────────────────────────── */
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; }

.login-brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.login-subtitle { margin: 0; font-size: 13px; color: var(--muted); }

/* ── Hinweise und Felder ───────────────────────────────────── */
.login-info {
  background: var(--kachel-bg);
  border: 1px solid var(--kachel-rand);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.login-info strong { color: var(--text); }

.login-field { display: grid; gap: 5px; margin-bottom: 12px; }

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

.login-field input {
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
}

.login-field input:focus-visible,
.login-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Knopf ─────────────────────────────────────────────────── */
.login-btn {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-btn:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.login-btn:disabled { opacity: 0.6; cursor: default; }

.touchid-icon { flex: 0 0 auto; }

/* ── Rueckmeldung ──────────────────────────────────────────── */
.login-status {
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--kachel-rand);
  background: var(--kachel-bg);
  color: var(--muted);
}
.login-status.error { color: var(--danger); border-color: currentColor; }
.login-status.success { color: var(--ok); border-color: currentColor; }
.login-status { display: grid; gap: 8px; }
.login-status[hidden] { display: none; }

.login-footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* === UX 10/2026: Anmeldung — Zustaende, Hilfe, Telefon === */
[hidden] { display: none !important; }

.login-form { display: grid; gap: 12px; }
.login-form .login-field { margin-bottom: 0; }
.login-optional { color: var(--muted); font-weight: 400; }
.login-field input[aria-invalid="true"] { border-color: var(--danger); }
.login-field input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.25); }

.login-hilfe { margin: 0; text-align: center; font-size: 12px; line-height: 1.5; color: var(--muted); }

.login-pruefe {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 42px; color: var(--muted); font-size: 13px;
}
.login-spinner,
.login-btn.laedt .touchid-icon {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: login-dreh 0.7s linear infinite;
}
.login-btn.laedt .touchid-icon path { display: none; }
.login-pruefe .login-spinner { color: var(--accent); }
@keyframes login-dreh { to { transform: rotate(360deg); } }
.login-btn.laedt { cursor: progress; }

.login-retry {
  justify-self: start;
  min-height: 34px; padding: 0 12px;
  border: 1px solid currentColor; border-radius: var(--radius-sm);
  background: transparent; color: inherit; font-weight: 600; cursor: pointer;
}
.login-retry:focus-visible,
.login-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-details { font-size: 12.5px; color: var(--muted); }
.login-details summary { cursor: pointer; text-align: center; color: var(--accent-dark); padding: 4px 0; border-radius: var(--radius-sm); }
.login-details ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.55; }

.login-noscript { text-align: center; color: var(--danger); font-size: 13px; }

@media (prefers-color-scheme: dark) {
  .login-details summary { color: var(--accent); }
}

/* Telefon: Karte randlos-nah, Knopf in Daumenhoehe */
@media (max-width: 480px) {
  body { padding: 16px; place-items: start center; padding-top: 12vh; }
  .login-card { padding: 26px 20px 20px; }
  .login-btn { min-height: 48px; font-size: 15px; }
  .login-field input { min-height: 44px; font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-btn { transition: none; }
  .login-spinner, .login-btn.laedt .touchid-icon { animation-duration: 2s; }
}


/* Testinstanz (public/testbetrieb.js) — wie im Dashboard. */
.testbetrieb-band {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 6px 16px;
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid var(--warn);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
