/* ============================================================================
   BSB Mandantenportal – Design-System
   Markenwelt der BSB-Website (Teal), aber deutlich moderner:
   animierter Verlauf-Hintergrund, Glas-Karten, sanfte Reveal-Animationen.
   Mobile-first, große Touch-Flächen, Safe-Area, prefers-reduced-motion.
   Alles selbst gehostet – keine externen Fonts/CDNs (strenge CSP).
   ============================================================================ */

:root {
  /* BSB-Markenfarben */
  --teal:      #70C1BC;
  --teal-2:    #4FA9A3;
  --teal-soft: #D4ECEB;
  --deep:      #0B5F59;
  --deep-2:    #08423E;
  --ink:       #172423;
  --soft:      #5b6b6a;
  --muted:     #8b9a99;
  --line:      #e2ecec;
  --bg:        #eef5f4;
  --card:      #ffffff;
  --ok:        #1D9E75;
  --ok-soft:   #E4F6EE;
  --warn:      #B6862B;
  --warn-soft: #FBF3DE;
  --err:       #C0392B;
  --err-soft:  #FBEAE8;

  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 10px 30px -12px rgba(8,66,62,.28), 0 2px 8px -2px rgba(8,66,62,.10);
  --shadow-lg: 0 24px 60px -18px rgba(8,66,62,.40);
  --ring:      0 0 0 4px rgba(112,193,188,.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 560px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.6;
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Animierter Verlauf-Hintergrund (dezent, GPU-freundlich) ------------- */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-orbs span {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(60px); opacity: .55;
  animation: drift 26s ease-in-out infinite;
  will-change: transform;
}
.bg-orbs span:nth-child(1){ width: 460px; height: 460px; left: -140px; top: -120px;
  background: radial-gradient(circle at 30% 30%, var(--teal), transparent 70%); }
.bg-orbs span:nth-child(2){ width: 520px; height: 520px; right: -180px; top: 8%;
  background: radial-gradient(circle at 60% 40%, var(--teal-soft), transparent 70%); animation-delay: -8s; }
.bg-orbs span:nth-child(3){ width: 420px; height: 420px; left: 10%; bottom: -180px;
  background: radial-gradient(circle at 50% 50%, #bfe6e3, transparent 70%); animation-delay: -14s; }
@keyframes drift {
  0%,100% { transform: translate3d(0,0,0) scale(1); }
  33%     { transform: translate3d(30px,40px,0) scale(1.08); }
  66%     { transform: translate3d(-25px,20px,0) scale(.96); }
}

/* ---- Kopfzeile ----------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.72);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226,236,236,.8);
}
.top-in {
  max-width: var(--maxw); margin: 0 auto;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--deep); }
.brand .logo { height: 30px; width: auto; flex: none; display: block; }
.brand .wm { display: flex; flex-direction: column; line-height: 1; padding-left: 11px; border-left: 1.5px solid var(--line); }
.brand .wm i { font-style: normal; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.top .spacer { flex: 1; }
.logout {
  font-size: 13px; color: var(--soft); text-decoration: none;
  padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; transition: .18s;
}
.logout:hover { color: var(--deep); border-color: var(--teal); }

/* ---- Layout -------------------------------------------------------------- */
.wrap {
  max-width: var(--maxw); margin: 0 auto;
  padding: 22px max(16px, env(safe-area-inset-left)) calc(48px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
}

/* ---- Hero ---------------------------------------------------------------- */
.hero { text-align: center; padding: 18px 6px 6px; }
.hero .kicker {
  display: inline-block; font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--teal-2); font-weight: 700; margin-bottom: 10px;
}
.hero h1 {
  font-size: clamp(26px, 7vw, 36px); line-height: 1.15; margin: 0 0 10px;
  color: var(--deep); font-weight: 800; letter-spacing: -.4px;
}
.hero p.claim { margin: 0 auto; max-width: 30ch; color: var(--soft); font-size: 15.5px; }

/* ---- Karte --------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid rgba(226,236,236,.9);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 22px; margin-top: 20px; position: relative;
}
.card.glow::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1;
  background: linear-gradient(135deg, var(--teal), transparent 40%, transparent 60%, var(--teal-soft));
  opacity: .5;
}
.card h2 { margin: 0 0 4px; font-size: 20px; color: var(--deep); font-weight: 800; }
.card .lead { margin: 0 0 18px; color: var(--soft); font-size: 14.5px; }

/* ---- Formularfelder ------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin: 5px 2px 0; }
.input {
  width: 100%; font: inherit; font-size: 16px; /* ≥16px: iOS zoomt nicht */
  padding: 14px 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfdfd; transition: border-color .16s, box-shadow .16s, background .16s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: #a9b7b6; }
.input:focus { outline: 0; border-color: var(--teal); background: #fff; box-shadow: var(--ring); }
.input:disabled { background: #f2f6f5; color: var(--soft); }
textarea.input { min-height: 96px; resize: vertical; }

/* ---- OTP-Code (Ziffernfelder) ------------------------------------------- */
.otp { display: flex; gap: 9px; justify-content: center; margin: 6px 0 4px; }
.otp input {
  width: 100%; max-width: 52px; aspect-ratio: 3/4; text-align: center;
  font-size: 26px; font-weight: 800; color: var(--deep);
  border: 1.5px solid var(--line); border-radius: 13px; background: #fbfdfd;
  transition: border-color .16s, box-shadow .16s, transform .12s;
  -webkit-appearance: none; appearance: none;
}
.otp input:focus { outline: 0; border-color: var(--teal); background: #fff; box-shadow: var(--ring); transform: translateY(-2px); }
.otp input.filled { border-color: var(--teal-2); }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; font: inherit; font-size: 16.5px; font-weight: 700; cursor: pointer;
  padding: 15px 22px; border-radius: 13px; border: 0;
  color: #fff; background: linear-gradient(135deg, var(--teal), var(--teal-2));
  box-shadow: 0 8px 20px -8px rgba(79,169,163,.7);
  transition: transform .12s, box-shadow .18s, filter .18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.03); box-shadow: 0 12px 26px -8px rgba(79,169,163,.8); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn.secondary {
  background: #fff; color: var(--deep); border: 1.5px solid var(--line); box-shadow: none;
}
.btn.secondary:hover { border-color: var(--teal); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn .spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.5); border-top-color:#fff; border-radius: 50%; animation: spin .7s linear infinite; display: none; }
.btn.loading .spin { display: inline-block; }
.btn.loading .lbl { opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-row { display: flex; gap: 10px; margin-top: 6px; }
.btn-row .btn { width: auto; flex: 1; }

/* ---- Kacheln (Dashboard) ------------------------------------------------- */
.tiles { display: grid; gap: 14px; margin-top: 4px; }
.tile {
  display: flex; align-items: center; gap: 15px; text-decoration: none;
  background: var(--card); border: 1px solid rgba(226,236,236,.9);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px;
  color: var(--ink); transition: transform .16s, box-shadow .2s, border-color .2s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--teal); }
.tile:active { transform: translateY(-1px); }
.tile .ic {
  width: 50px; height: 50px; flex: none; border-radius: 14px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
}
.tile .ic svg { width: 26px; height: 26px; }
.tile .tx b { display: block; font-size: 16px; color: var(--deep); font-weight: 800; }
.tile .tx span { font-size: 13px; color: var(--soft); }
.tile .arw { margin-left: auto; color: var(--muted); transition: transform .16s, color .16s; }
.tile:hover .arw { transform: translateX(3px); color: var(--teal-2); }

/* ---- Datenliste (Stammdaten-Anzeige) ------------------------------------ */
.data { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.data td { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; vertical-align: top; }
.data td.k { color: var(--soft); width: 42%; padding-right: 12px; }
.data td.v { font-weight: 700; color: var(--ink); }
.data tr:last-child td { border-bottom: 0; }

/* ---- Hinweise / Flash ---------------------------------------------------- */
.note { border-radius: var(--radius-sm); padding: 12px 15px; font-size: 13.5px; margin: 14px 0; border: 1px solid; }
.note.info { background: var(--teal-soft); border-color: #b6ddda; color: #0a4f4a; }
.note.warn { background: var(--warn-soft); border-color: #ecd9a0; color: #6b5518; }
.note.err  { background: var(--err-soft); border-color: #f0c4bf; color: #7a241b; }
.note.ok   { background: var(--ok-soft); border-color: #b8e6d3; color: #0f6b4a; }

/* ---- Erfolg-Zustand ------------------------------------------------------ */
.center { text-align: center; }
.ok-badge {
  width: 84px; height: 84px; margin: 4px auto 16px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-soft);
  animation: pop .5s cubic-bezier(.2,1.4,.5,1) both;
}
.ok-badge svg { width: 44px; height: 44px; }
.ok-badge svg path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .5s .25s ease forwards; }
@keyframes pop  { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---- Fußzeile ------------------------------------------------------------ */
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; line-height: 1.7; }
.foot .lock { display: inline-flex; align-items: center; gap: 6px; color: var(--teal-2); font-weight: 600; }
.foot .lock svg { width: 13px; height: 13px; }
.foot a { color: var(--soft); text-decoration: none; }

/* ---- Reveal-Animation beim Laden ---------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); animation: reveal .6s cubic-bezier(.2,.7,.3,1) forwards; }
.reveal.d1 { animation-delay: .06s; }
.reveal.d2 { animation-delay: .14s; }
.reveal.d3 { animation-delay: .22s; }
.reveal.d4 { animation-delay: .30s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---- Steppanzeige (Login 1/2) ------------------------------------------- */
.steps { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 2px 0 16px; }
.steps .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: .2s; }
.steps .dot.on { background: var(--teal); width: 22px; border-radius: 999px; }

@media (min-width: 600px) {
  .card { padding: 30px 30px; }
}

/* ---- Reduzierte Bewegung ------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .bg-orbs span, .reveal, .ok-badge, .ok-badge svg path, .btn .spin { animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
