/* login.css — CSP-safe styling for the AURIX login screen (M-AUTH · F1).
   No Tailwind / no CDN: every utility the page needs is declared here so the
   page renders fully under `Content-Security-Policy: default-src 'self'`.
   Fonts: Inter if installed, otherwise system stack (no Google Fonts fetch).
   Light is the default; `html.dark` flips the token block for optional dark. */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  /* brand */
  --brand: #107040;
  --brand-dark: #086838;
  --brand-ink: #107040;     /* brand color used on text/links */
  --lime: #D0E890;
  --lime-soft: #EAF3D6;

  /* neutral (slate) */
  --page: #FFFFFF;
  --card: #FFFFFF;
  --field: #FFFFFF;
  --ink: #0F172A;
  --muted: #475569;
  --muted-2: #64748B;
  --faint: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --hover: #F8FAFC;
  --track: #F1F5F9;

  /* semantic */
  --err: #DC2626;  --err-bg: #FEF2F2;  --err-bd: #FECACA;
  --warn: #D97706; --warn-bg: #FFFBEB; --warn-bd: #FDE68A;
  --info: #2563EB; --info-bg: #EFF6FF; --info-bd: #BFDBFE;
  --ok: #16A34A;

  --shadow-card: 0 12px 40px -12px rgba(15,23,42,.22), 0 4px 12px rgba(15,23,42,.06);
  --ring: rgba(16,112,64,.20);
}

html.dark {
  --brand-ink: #56C98B;
  --page: #0B1220;
  --card: #141D30;
  --field: #0E1626;
  --ink: #EAEEF6;
  --muted: #9AA6BE;
  --muted-2: #8893AC;
  --faint: #6D7894;
  --border: #26324C;
  --border-strong: #3A4A66;
  --hover: #1C2740;
  --track: #1C2740;
  --err-bg: rgba(220,38,38,.12);  --err-bd: rgba(248,113,113,.35);
  --warn-bg: rgba(217,119,6,.14);  --warn-bd: rgba(251,191,36,.35);
  --info-bg: rgba(37,99,235,.14);  --info-bd: rgba(96,165,250,.35);
  --shadow-card: 0 16px 48px -16px rgba(0,0,0,.6), 0 4px 14px rgba(0,0,0,.4);
  --ring: rgba(86,201,139,.25);
}
html.dark { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body.login {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--page);
  background-image: radial-gradient(110% 70% at 50% -8%, rgba(208,232,144,.55) 0%, rgba(208,232,144,.12) 38%, rgba(255,255,255,0) 64%);
  background-repeat: no-repeat;
  display: grid;
  place-items: center;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html.dark body.login {
  background-image: radial-gradient(120% 75% at 50% -10%, rgba(16,112,64,.40) 0%, rgba(16,112,64,.10) 42%, rgba(11,18,32,0) 68%);
}

.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }

/* ---- Layout ---- */
.login__main { width: 100%; max-width: 408px; }
.login__logo { display: block; height: 88px; width: auto; margin: 0 auto 26px; }
.login__footer { text-align: center; font-size: 12px; color: var(--muted-2); margin: 22px 0 0; }
html.dark .login__footer { color: var(--faint); }

/* ---- Card + steps ---- */
.card {
  background: var(--card);
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 30px 30px 26px;
  position: relative;
  overflow: hidden;
}
html.dark .card { border-color: var(--border); }

.step { display: none; }
.step.is-active { display: block; opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .step.is-active { animation: stepIn .28s cubic-bezier(.2,.7,.3,1); }
}
@keyframes stepIn {
  from { transform: translateY(8px); }
  to   { transform: translateY(0); }
}

.step__head { margin-bottom: 22px; }
.step__back {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 0; cursor: pointer; padding: 0;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--muted);
  margin-bottom: 14px;
}
.step__back:hover { color: var(--ink); }
.step__back svg { width: 15px; height: 15px; }
.step__title { font-size: 21px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; margin: 0; }
.step__sub { color: var(--muted-2); margin: 6px 0 0; font-size: 13.5px; }

/* ---- Form fields ---- */
.field { display: block; margin-bottom: 16px; }
.field__label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.field__label > span:first-child { font-size: 13px; font-weight: 500; color: var(--muted); }
.field__hint { font-size: 12px; color: var(--faint); white-space: nowrap; }

.input {
  width: 100%; height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--field);
  color: var(--ink);
  font: inherit; font-size: 14px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }

.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.toggle-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; background: none; cursor: pointer; border-radius: 8px; color: var(--faint);
}
.toggle-eye:hover { background: var(--track); color: var(--muted); }
.toggle-eye svg { width: 18px; height: 18px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 46px; margin-top: 6px;
  border: 0; border-radius: 11px; cursor: pointer;
  font: inherit; font-size: 14.5px; font-weight: 600;
  transition: background-color .12s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.btn--primary:hover { background: var(--brand-dark); }
.btn svg { width: 18px; height: 18px; }

/* ---- Checkbox ---- */
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--muted); margin: 4px 0 2px; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); flex-shrink: 0; }

/* ---- Reset note (replaces "forgot password" link) ---- */
.reset-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--faint);
}
.reset-note svg { width: 14px; height: 14px; margin-top: 1px; flex-shrink: 0; }

/* ---- Banners (error / lockout / info) ---- */
.banner {
  display: none; align-items: flex-start; gap: 10px;
  margin-bottom: 18px; padding: 11px 13px; border-radius: 11px;
  font-size: 13px; font-weight: 500; line-height: 1.4;
}
.banner.is-show { display: flex; }
.banner svg { width: 17px; height: 17px; margin-top: 1px; flex-shrink: 0; }
.banner--err  { background: var(--err-bg);  border: 1px solid var(--err-bd);  color: var(--err); }
.banner--warn { background: var(--warn-bg); border: 1px solid var(--warn-bd); color: var(--warn); }
.banner--info { background: var(--info-bg); border: 1px solid var(--info-bd); color: var(--info); }

/* ---- OTP (6-digit code) ---- */
.otp { display: flex; gap: 9px; justify-content: space-between; margin: 4px 0 18px; }
.otp__cell {
  width: 100%; height: 56px; min-width: 0;
  text-align: center; font-family: var(--mono); font-size: 24px; font-weight: 500;
  color: var(--ink); background: var(--field);
  border: 1.5px solid var(--border-strong); border-radius: 11px;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.otp__cell:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.otp__cell.is-filled { border-color: var(--brand); }

/* ---- 2FA enrollment (QR + manual key) ---- */
.enroll-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.qr-box {
  display: grid; place-items: center;
  width: 196px; height: 196px; margin: 2px auto 0;
  padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 14px;
}
.qr-box svg { width: 100%; height: 100%; display: block; }
.enroll-instr { text-align: center; font-size: 13px; color: var(--muted-2); margin: 0; }
.secret {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; background: var(--track); border: 1px solid var(--border);
}
.secret__label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.secret__key { flex: 1; font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--ink); letter-spacing: .04em; word-break: break-all; }
.secret__copy {
  border: 0; background: none; cursor: pointer; color: var(--muted-2);
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; flex-shrink: 0;
}
.secret__copy:hover { background: var(--card); color: var(--brand-ink); }
.secret__copy svg { width: 16px; height: 16px; }
.copied-flash { color: var(--ok) !important; }

/* ---- Password strength (step 4) ---- */
.pw-meter { margin: -6px 0 14px; }
.pw-meter__bars { display: flex; gap: 5px; margin-bottom: 6px; }
.pw-meter__seg { flex: 1; height: 4px; border-radius: 3px; background: var(--border); transition: background-color .15s; }
.pw-meter__label { font-size: 12px; color: var(--faint); }
.pw-meter__label b { color: var(--muted); font-weight: 600; }

/* ---- Success ---- */
.success { text-align: center; padding: 8px 0 4px; }
.success__ring {
  width: 60px; height: 60px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--lime-soft); color: var(--brand); display: grid; place-items: center;
}
html.dark .success__ring { background: rgba(86,201,139,.14); }
.success__ring svg { width: 30px; height: 30px; }
.spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Module signature (bottom-right, also on error) ---- */
.sig {
  position: fixed; right: 14px; bottom: 12px; z-index: 50;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; color: var(--muted-2);
  background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 6px;
  opacity: .55; transition: opacity .12s, background-color .12s;
}
.sig:hover { opacity: 1; background: var(--card); }
.sig__dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sig__dot--prod { background: var(--ok); }
.sig__dot--staging { background: var(--warn); }
.sig__dot--dev { background: var(--faint); }
.sig__copied { color: var(--ok); }

/* ---- Theme switch ---- */
.theme-toggle { position: fixed; top: 18px; right: 18px; z-index: 50; }
.theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--track); border: 1px solid var(--border); }
.theme-seg { width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted-2); transition: .12s; }
.theme-seg:hover { background: var(--card); color: var(--ink); }
.theme-seg svg { width: 15px; height: 15px; }
.theme-seg--on { background: var(--card); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(15,23,42,.10); }
html.dark .theme-seg--on { box-shadow: none; }

/* ---- Demo step navigator (mockup-only; remove for production) ---- */
.demo {
  position: fixed; left: 14px; bottom: 12px; z-index: 50;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 11px; box-shadow: 0 8px 24px -8px rgba(15,23,42,.2); max-width: 280px;
}
.demo__title { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin: 0 0 7px; }
.demo__row { display: flex; flex-wrap: wrap; gap: 5px; }
.demo__btn { font: inherit; font-size: 11px; font-weight: 500; padding: 4px 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--hover); color: var(--muted); cursor: pointer; }
.demo__btn:hover { border-color: var(--border-strong); color: var(--ink); }
.demo__btn--on { background: var(--brand); border-color: var(--brand); color: #fff; }
.demo__sep { height: 1px; background: var(--border); margin: 8px 0 7px; }

/* wejście „szybkie logowanie" (M-AUTH delegacja) — na ekranie Logowania obok klasycznego */
.login-alt { margin-top: 18px; text-align: center; }
.login-alt__sep { display: block; font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 12px; }
.btn--fast { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; text-decoration: none; background: var(--field); color: var(--ink); border: 1px solid var(--border-strong); }
.btn--fast:hover { border-color: var(--brand); color: var(--brand-ink); }
.btn--fast svg { width: 18px; height: 18px; }
