/* Anmeldung - diskret: nur Zeichen und Felder. Gleiche Tokens wie das Dashboard.
   Formensystem: Panel 14px, Felder 10px, Button als Pille. */

@font-face { font-family: "Chakra Petch"; font-weight: 400; font-display: swap; src: url("/assets/fonts/chakra-petch-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url("/assets/fonts/chakra-petch-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 600; font-display: swap; src: url("/assets/fonts/chakra-petch-latin-600-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --page: #edf3f7;
  --spill-a: rgba(0, 120, 230, 0.16);
  --spill-b: rgba(0, 190, 170, 0.10);
  --surface-1: rgba(251, 253, 254, 0.92);
  --surface-2: #f3f8fb;
  --surface-3: #e2ebf1;
  --border: rgba(7, 26, 38, 0.10);
  --border-strong: rgba(7, 26, 38, 0.20);
  --text-1: #071a26;
  --text-2: #3b5566;
  --text-3: #5f7787;
  --accent: #0086b3;
  --accent-strong: #006f94;
  --accent-ink: #ffffff;
  --accent-wash: rgba(0, 134, 179, 0.16);
  --loss: #cc2f5a;
  --loss-text: #b4234c;
  --loss-wash: rgba(204, 47, 90, 0.14);
  --warn: #b07800;
  --good: #0b7f0b;
  --panel-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 28px 60px -28px rgba(0, 60, 90, 0.35);
  --button-shadow: 0 12px 26px -12px rgba(0, 111, 148, 0.65);
  --logo-shadow: drop-shadow(0 14px 26px rgba(0, 110, 210, 0.28));
  --font-ui: "Chakra Petch", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #04070c;
    --spill-a: rgba(30, 110, 255, 0.22);
    --spill-b: rgba(40, 230, 200, 0.10);
    --surface-1: rgba(11, 17, 27, 0.88);
    --surface-2: #0f1724;
    --surface-3: #18243a;
    --border: rgba(125, 220, 255, 0.10);
    --border-strong: rgba(125, 220, 255, 0.22);
    --text-1: #e8f6ff;
    --text-2: #a9c1d3;
    --text-3: #7f97a8;
    --accent: #5ee7ff;
    --accent-strong: #00d8ff;
    --accent-ink: #04121a;
    --accent-wash: rgba(94, 231, 255, 0.16);
    --loss: #ff6b8b;
    --loss-text: #ff8aa3;
    --loss-wash: rgba(255, 107, 139, 0.16);
    --warn: #fab219;
    --good: #2fbf4f;
    --panel-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 34px 70px -30px rgba(0, 0, 0, 0.8);
    --button-shadow: 0 14px 30px -12px rgba(0, 216, 255, 0.55);
    --logo-shadow: drop-shadow(0 16px 34px rgba(0, 140, 255, 0.45));
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #04070c;
  --spill-a: rgba(30, 110, 255, 0.22);
  --spill-b: rgba(40, 230, 200, 0.10);
  --surface-1: rgba(11, 17, 27, 0.88);
  --surface-2: #0f1724;
  --surface-3: #18243a;
  --border: rgba(125, 220, 255, 0.10);
  --border-strong: rgba(125, 220, 255, 0.22);
  --text-1: #e8f6ff;
  --text-2: #a9c1d3;
  --text-3: #7f97a8;
  --accent: #5ee7ff;
  --accent-strong: #00d8ff;
  --accent-ink: #04121a;
  --accent-wash: rgba(94, 231, 255, 0.16);
  --loss: #ff6b8b;
  --loss-text: #ff8aa3;
  --loss-wash: rgba(255, 107, 139, 0.16);
  --warn: #fab219;
  --good: #2fbf4f;
  --panel-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 34px 70px -30px rgba(0, 0, 0, 0.8);
  --button-shadow: 0 14px 30px -12px rgba(0, 216, 255, 0.55);
  --logo-shadow: drop-shadow(0 16px 34px rgba(0, 140, 255, 0.45));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  font-family: var(--font-ui);
  color: var(--text-1);
  background:
    radial-gradient(70% 42% at 50% 22%, var(--spill-a), transparent 72%),
    radial-gradient(42% 30% at 64% 30%, var(--spill-b), transparent 70%),
    var(--page);
  background-attachment: fixed;
}
::selection { background: var(--accent-wash); color: var(--text-1); }

.scene { width: min(400px, 100%); display: grid; justify-items: center; gap: 24px; }

.mark { width: 120px; height: 120px; }
.mark img { width: 100%; height: 100%; display: block; filter: var(--logo-shadow); }

.panel {
  width: 100%;
  padding: 26px 22px 22px;
  border-radius: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  box-shadow: var(--panel-shadow);
  -webkit-backdrop-filter: saturate(140%) blur(18px);
  backdrop-filter: saturate(140%) blur(18px);
}
h1 { margin: 0 0 20px; font-size: 22px; font-weight: 600; letter-spacing: 0.01em; }

.field { display: grid; gap: 8px; margin-bottom: 16px; }
label { font-size: 13px; font-weight: 500; color: var(--text-2); }
input[type="text"], input[type="password"] {
  width: 100%;
  height: 52px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-1);
  font: 400 16px/1 var(--font-ui);  /* 16 px: kein Zoom beim Antippen auf dem iPhone */
  caret-color: var(--accent);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input[type="text"]:focus, input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
input[aria-invalid="true"] { border-color: var(--loss); box-shadow: 0 0 0 3px var(--loss-wash); }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-1);
  -webkit-box-shadow: 0 0 0 100px var(--surface-2) inset;
  caret-color: var(--accent);
  transition: background-color 600000s 0s;
}

.pw { position: relative; }
.pw input { padding-right: 54px; }
.reveal {
  position: absolute; top: 6px; right: 6px;
  width: 40px; height: 40px; border-radius: 8px;
  display: grid; place-items: center;
  border: 0; background: transparent; color: var(--text-3); cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
.reveal:hover { color: var(--text-1); background: var(--accent-wash); }
.reveal:focus-visible, .submit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 20px; height: 20px; flex: none; }

.hint { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.hint .ic { width: 16px; height: 16px; color: var(--warn); }

.remember { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.remember input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  position: relative; width: 40px; height: 24px; flex: none; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .2s ease, border-color .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-3); transition: transform .25s cubic-bezier(.16, 1, .3, 1), background .2s ease;
}
.remember input:checked + .switch { background: var(--accent-wash); border-color: var(--accent); }
.remember input:checked + .switch::after { transform: translateX(16px); background: var(--accent); }
.remember input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.error {
  display: flex; align-items: flex-start; gap: 8px;
  min-height: 20px; margin: 0 0 10px; font-size: 13.5px; line-height: 1.45; color: var(--loss-text);
}
.error .ic { width: 16px; height: 16px; margin-top: 2px; }

.submit {
  position: relative; width: 100%; height: 52px; border: 0; border-radius: 999px; cursor: pointer;
  display: grid; place-items: center;
  background: var(--accent-strong); color: var(--accent-ink);
  font: 600 16px/1 var(--font-ui); letter-spacing: 0.02em;
  box-shadow: var(--button-shadow);
  transition: transform .15s ease, filter .2s ease, opacity .2s ease;
}
.submit:hover { filter: brightness(1.06); }
.submit:active { transform: translateY(1px) scale(0.995); }
.submit:disabled { cursor: progress; }
.submit > * { grid-area: 1 / 1; }
.spinner, .done { opacity: 0; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
}
.submit.busy .label, .submit.ok .label { opacity: 0; }
.submit.busy .spinner { opacity: 1; }
.submit.ok .done { opacity: 1; }

.foot { margin: 0; font-size: 12.5px; color: var(--text-3); text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .mark img { animation: ignite 1.1s cubic-bezier(.16, 1, .3, 1) both; }
  .panel { animation: rise .7s cubic-bezier(.16, 1, .3, 1) .18s both; }
  .foot { animation: rise .7s cubic-bezier(.16, 1, .3, 1) .28s both; }
  .submit.busy .spinner { animation: spin .8s linear infinite; }
  .panel.shake { animation: shake .32s cubic-bezier(.36, .07, .19, .97) both; }
  body.leaving .scene { transition: opacity .35s ease, transform .35s cubic-bezier(.16, 1, .3, 1), filter .35s ease;
    opacity: 0; transform: scale(.985); filter: blur(4px); }
  @keyframes ignite { from { opacity: 0; filter: blur(14px) var(--logo-shadow); transform: scale(.92); } to { opacity: 1; } }
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
}

@media (min-width: 700px) {
  .mark { width: 136px; height: 136px; }
  .panel { padding: 30px 28px 26px; }
}
@media (max-height: 640px) {
  .scene { gap: 16px; }
  .mark { width: 88px; height: 88px; }
}
