/* ============================================================
   Omnia – Auth-Seiten (App-Login, Control-Plane-Login, Einrichtung)
   Referenz: .claude/Login Redesign/design_handoff_login_unification/README.md

   Bewusst standalone: login.php laedt nur variables.css + diese Datei (kein App-Bundle),
   admin.php laedt zusaetzlich admin-variables.css + admin.css. Damit beide Seiten identisch
   aussehen, bringt diese Datei die Tokens selbst mit (gleiche Werte wie admin-variables.css)
   und definiert Felder, Buttons und Meldungen unter .auth-page - dadurch gewinnt sie gegen
   die kompakteren Admin-Basisregeln, ohne sie ausserhalb der Auth-Seiten zu veraendern.
   ============================================================ */

body.auth-page {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e4e8ee;
  --line-2: #d3d9e2;
  --ink: #131b26;
  --ink-2: #4a5768;
  --ink-3: #7b8797;

  --brand: #1a4a7a;
  --brand-2: #2d6da8;
  --brand-ink: #ffffff;
  --brand-soft: rgba(26, 74, 122, .09);

  --ok: #0f9d70;
  --ok-soft: rgba(15, 157, 112, .12);
  --ok-line: rgba(15, 157, 112, .30);

  --warn: #b87500;
  --warn-soft: rgba(184, 117, 0, .12);
  --warn-line: rgba(184, 117, 0, .30);

  --bad: #d0342c;
  --bad-soft: rgba(208, 52, 44, .10);
  --bad-line: rgba(208, 52, 44, .30);

  /* Markenseite: in beiden Themes dunkelblau, damit das Logo immer weiss darauf steht. */
  --panel-bg: linear-gradient(150deg, #0d2743 0%, #143a61 45%, #1a4a7a 100%);

  --auth-font: 'Lexend Deca', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --auth-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

[data-theme="dark"] body.auth-page {
  --bg: #0b1017;
  --surface: #121a24;
  --surface-2: #18222e;
  --line: #233040;
  --line-2: #33445a;
  --ink: #e8eef6;
  --ink-2: #a3b1c2;
  --ink-3: #72839a;

  --brand: #5b9dd6;
  --brand-2: #7ab4e4;
  --brand-ink: #08121e;
  --brand-soft: rgba(91, 157, 214, .14);

  --ok: #37c295;
  --ok-soft: rgba(55, 194, 149, .14);
  --ok-line: rgba(55, 194, 149, .32);

  --warn: #e0a13a;
  --warn-soft: rgba(224, 161, 58, .14);
  --warn-line: rgba(224, 161, 58, .32);

  --bad: #f0655c;
  --bad-soft: rgba(240, 101, 92, .13);
  --bad-line: rgba(240, 101, 92, .32);

  --panel-bg: linear-gradient(150deg, #060c14 0%, #0c1a29 45%, #14304d 100%);
}

body.auth-page {
  box-sizing: border-box;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--auth-font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

/* ===== HÜLLE ===== */
.auth {
  width: 100%;
  max-width: 1080px;
  min-height: 660px;
  display: grid;
  grid-template-columns: 1.02fr 1fr;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .16);
  background: var(--surface);
}

/* ===== MARKENSEITE ===== */
.auth__brand {
  background: var(--panel-bg);
  padding: 44px 46px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.auth__brand-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* Die Markenseite ist in beiden Themes dunkelblau - das Logo wird darum immer weiss
   invertiert (nicht ueber --logo-filter, der nur im Dark Mode greift). */
.auth__logo {
  height: 52px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1) opacity(.94);
}

.auth__badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .2);
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.auth__claim {
  max-width: 380px;
}

.auth__claim h2 {
  margin: 0 0 12px;
  font-size: 29px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -.02em;
  color: #fff;
}

.auth__claim p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .72);
}

.auth__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .5);
}

.auth__meta a {
  color: rgba(255, 255, 255, .62);
  text-decoration: none;
}

.auth__meta a:hover {
  color: #fff;
  text-decoration: underline;
}

/* ===== FORMULARSEITE ===== */
.auth__form {
  background: var(--surface);
  padding: 44px 46px;
  display: flex;
  align-items: center;
}

.auth__form-inner {
  width: 100%;
  max-width: 384px;
  margin: 0 auto;
}

/* Einrichtungs-Assistent: mehrspaltiges Formular braucht mehr Breite. */
.auth--wide {
  max-width: 1180px;
}

.auth--wide .auth__form-inner {
  max-width: 520px;
}

.auth__head {
  margin-bottom: 26px;
}

.auth__eyebrow {
  display: block;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.auth__head h1 {
  margin: 0 0 6px;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink);
}

.auth__head p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

/* ===== MELDUNGEN ===== */
.auth-page .alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.auth-page .alert__marker {
  flex: 0 0 auto;
  font-weight: 600;
}

.auth-page .alert--error {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: var(--bad-line);
}

.auth-page .alert--ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-line);
}

.auth-page .alert--warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-line);
}

/* ===== FELDER ===== */
.auth__fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.auth-page label:not(.auth__pick) {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.auth__label-row label {
  margin-bottom: 0;
}

.auth__label-row + input {
  margin-top: 7px;
}

.auth-page input[type="text"],
.auth-page input[type="email"],
.auth-page input[type="password"],
.auth-page input[type="number"] {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.auth-page input.mono {
  font-family: var(--auth-mono);
}

.auth-page input::placeholder {
  color: var(--ink-3);
}

.auth-page input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.auth__pw-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}

.auth__pw-toggle:hover {
  color: var(--brand);
}

.auth__hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

/* ===== BUTTONS ===== */
.auth-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.auth-page .btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.auth-page .btn--primary:hover {
  background: var(--brand-2);
  border-color: var(--brand-2);
}

.auth-page .btn--secondary {
  background: var(--surface);
  border-color: var(--line-2);
  color: var(--ink);
}

.auth-page .btn--secondary:hover {
  background: var(--surface-2);
}

.auth-page .btn--block {
  width: 100%;
}

.auth-page .btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.auth-page .btn.is-loading,
.auth-page .btn:disabled {
  opacity: .75;
  cursor: not-allowed;
}

.auth__submit {
  margin-top: 22px;
}

.auth__cancel {
  margin-top: 10px;
}

.auth__spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== AUSWAHL-KARTEN (Mandant / Sitzung) ===== */
.auth__picks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Ab sieben Optionen scrollt die Liste, statt das Formular zu strecken. */
.auth__picks--scroll {
  max-height: 320px;
  overflow-y: auto;
}

.auth__pick {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.auth__pick:hover {
  border-color: var(--brand);
}

.auth__pick input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.auth__pick-marker {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
}

.auth__pick-title {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.auth__pick-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-3);
}

.auth__pick:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.auth__pick:has(input:checked) .auth__pick-marker {
  border: 5px solid var(--brand);
}

.auth__pick:has(input:focus-visible) {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ===== STEPPER (Erst-Einrichtung) ===== */
.auth__stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.auth__step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.auth__step--active,
.auth__step--done {
  color: var(--ink);
}

.auth__step-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 600;
}

.auth__step--active .auth__step-dot,
.auth__step--done .auth__step-dot {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.auth__step-line {
  flex: 1 1 auto;
  min-width: 12px;
  height: 1px;
  background: var(--line);
}

/* ===== FUSSNOTE ===== */
.auth__foot {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
}

/* ===== EINRICHTUNGS-ASSISTENT ===== */
.auth__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
}

.auth__section-title {
  margin: 22px 0 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.auth__keybox {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--warn-line);
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--auth-mono);
  font-size: 12px;
  word-break: break-all;
}

.auth__text {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}

.auth__text code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  font-family: var(--auth-mono);
  font-size: .85em;
  overflow-wrap: anywhere;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  body.auth-page {
    align-items: flex-start;
    padding: 0;
  }

  .auth {
    grid-template-columns: 1fr;
    /* Kopfstreifen hugt den Inhalt, das Formular bekommt den Rest - sonst wuerde die
       Grid-Standardverteilung beide Zeilen auf die volle Hoehe strecken. */
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    max-width: none;
  }

  .auth__brand {
    padding: 26px 24px;
    justify-content: flex-start;
  }

  .auth__logo {
    height: 40px;
  }

  .auth__claim,
  .auth__meta {
    display: none;
  }

  .auth__form {
    padding: 32px 24px;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .auth {
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 480px) {
  .auth__form {
    padding: 24px 18px;
  }

  .auth__head h1 {
    font-size: 21px;
  }

  /* 16px verhindert den Auto-Zoom von iOS beim Fokussieren. */
  .auth-page input[type="text"],
  .auth-page input[type="email"],
  .auth-page input[type="password"],
  .auth-page input[type="number"] {
    font-size: 16px;
  }
}
