/* ============================================================
   XENIUS HES — Login
   Clean SaaS login. Fully responsive, no overlapping elements,
   CSP-safe (no inline styles required). Drop-in.
   Palette grounded in grid/power: steel canvas + electric amber.
   ============================================================ */

:root {
  /* Color */
  --bg-deep:      #0d1b2a;   /* deep slate (left brand panel)   */
  --bg-deep-2:    #14293f;   /* gradient partner                */
  --canvas:       #f4f6f9;   /* app canvas (right panel)        */
  --surface:      #ffffff;   /* card                            */
  --ink:          #15233a;   /* primary text                    */
  --ink-soft:     #5a6b85;   /* secondary text                  */
  --line:         #e3e8ef;   /* borders                         */
  --line-strong:  #cdd6e3;
  --brand:        #155785;   /* Xenius blue (kept from your kit)*/
  --brand-700:    #0f4267;
  --accent:       #f5a623;   /* electric amber = current/energy */
  --danger:       #db1e49;
  --ok:           #1f9d6b;
  --field-focus:  rgba(21,87,133,.16);

  /* Type */
  --font: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* Metrics */
  --radius: 14px;
  --radius-sm: 10px;
  --field-h: 50px;
  --maxw: 1120px;
  --pad-card: clamp(24px, 4vw, 44px);
  --shadow: 0 1px 2px rgba(16,32,56,.06), 0 12px 32px rgba(16,32,56,.10);
  --shadow-sm: 0 1px 2px rgba(16,32,56,.08);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--brand); }
button { font-family: inherit; }

/* ---------- Top utility bar (lang + theme) ---------- */
.top-navbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px clamp(16px, 4vw, 32px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-width: 0;
}
.nav-left { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.nav-brand-logo { width: 168px; height: auto; max-width: 100%; }
.nav-right { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.lang-switcher { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.lang-btn {
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 13px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.lang-btn + .lang-btn { border-left: 1px solid var(--line); }
.lang-btn:hover { color: var(--ink); }
.lang-btn.active { background: var(--brand); color: #fff; }

.theme-toggle {
  position: relative; width: 56px; height: 30px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #eef2f7; cursor: pointer;
  display: inline-flex; align-items: center; padding: 0 4px; justify-content: space-between;
}
.theme-toggle .theme-icon { font-size: 13px; color: var(--ink-soft); line-height: 1; }
.theme-toggle-slider {
  position: absolute; top: 50%; left: 4px; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: var(--shadow-sm); transition: left .2s ease;
}
.theme-toggle.active .theme-toggle-slider { left: calc(100% - 26px); }

/* ---------- Page shell ---------- */
.auth-shell {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
}
.auth-grid {
  width: 100%; max-width: var(--maxw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.05fr .95fr;   /* brand | form */
}

/* ---------- Left brand panel ---------- */
.brand-panel {
  position: relative;
  background:
    radial-gradient(1200px 400px at -10% -10%, rgba(245,166,35,.18), transparent 60%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-deep-2) 100%);
  color: #eaf1fb;
  padding: clamp(28px, 4vw, 52px);
  display: flex; flex-direction: column; gap: 28px;
}
.brand-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: #0d1b2a; background: var(--accent);
  padding: 6px 12px; border-radius: 999px;
}
.brand-title {
  font-size: clamp(26px, 3vw, 38px); line-height: 1.12; font-weight: 700; margin: 0;
  letter-spacing: -.01em;
}
.brand-sub { margin: 0; color: #aebfd6; font-size: 15px; line-height: 1.6; max-width: 42ch; }

.brand-features { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.bfeature { display: flex; gap: 14px; align-items: flex-start; }
.bfeature .ic {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px;
  background: rgba(245,166,35,.14); color: var(--accent);
  border: 1px solid rgba(245,166,35,.28);
}
.bfeature h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: #fff; }
.bfeature p  { margin: 0; font-size: 13.5px; color: #9fb2cc; line-height: 1.5; }

.brand-stats {
  margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  border-top: 1px solid rgba(255,255,255,.10); padding-top: 22px;
}
.bstat .v { font-size: 20px; font-weight: 700; color: #fff; }
.bstat .l { font-size: 11.5px; color: #8ea3c0; letter-spacing: .03em; text-transform: uppercase; }

/* ---------- Right form panel ---------- */
.form-panel {
  padding: var(--pad-card);
  display: flex; flex-direction: column; justify-content: center;
}
.form-card { width: 100%; max-width: 380px; margin: 0 auto; }
.form-head { margin-bottom: 22px; }
.form-head h2 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.form-head p  { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

.field { margin-bottom: 16px; }
.field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink);
  margin-bottom: 7px;
}
.field-wrap { position: relative; }
.field-input {
  width: 100%; height: var(--field-h);
  padding: 0 14px;
  font-size: 15px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.field-input::placeholder { color: #9aa7bd; }
.field-input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--field-focus);
}
.field-input.has-pw { padding-right: 70px; }   /* room for SHOW button, no overlap */

.pw-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  height: 34px; padding: 0 10px;
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--ink-soft);
  border-radius: 8px;
}
.pw-toggle:hover { color: var(--brand); background: #f1f5fa; }

/* Captcha */
.captcha-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.captcha-box {
  flex: 1 1 auto; min-width: 0;
  height: var(--field-h); display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; letter-spacing: .35em; color: var(--ink);
  background: repeating-linear-gradient(45deg, #f1f4f9, #f1f4f9 8px, #eaf2f7 8px, #eef2f7 16px);
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-sm);
  user-select: none;
}
.captcha-btn {
  flex: 0 0 auto; width: var(--field-h); height: var(--field-h);
  display: grid; place-items: center; font-size: 18px;
  background: #fff; color: var(--ink-soft);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.captcha-btn:hover { color: var(--brand); border-color: var(--brand); background: #f7fafd; }

.error-message { color: var(--danger); font-size: 12.5px; margin-top: 6px; min-height: 1em; }

.submit-btn {
  width: 100%; height: 52px; margin-top: 6px;
  border: 0; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15.5px; font-weight: 700; color: #fff;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-700) 100%);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: filter .15s, transform .05s;
}
.submit-btn:hover { filter: brightness(1.06); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn:disabled { opacity: .7; cursor: not-allowed; }
.submit-btn .arrow { font-size: 18px; }
.submit-btn.loading .arrow { display: none; }

.forgot { text-align: center; margin-top: 16px; }
.forgot a { color: var(--danger); font-weight: 600; font-size: 14px; text-decoration: none; }
.forgot a:hover { text-decoration: underline; }

/* ---------- Site footer ---------- */
.site-footer {
  flex: 0 0 auto;
  width: 100%;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.footer-content {
  width: 100%;
   margin: 0 auto;
  padding: 16px clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(320px, 1.35fr);
  align-items: center;
  gap: 18px 24px;
  font-size: 12px;
  color: var(--ink-soft);
}

.footer-left p {
  margin: 0;
  line-height: 1.5;
}

.footer-center {
  display: flex;
  justify-content: center;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.social-icon {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  transition: border-color .15s, background .15s, color .15s, transform .15s;
}

.social-icon:hover {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  transform: translateY(-1px);
}

.policy-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px 8px;
  line-height: 1.5;
}

.policy-links a {
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
}

.policy-links a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.footer-separator {
  color: var(--line-strong);
}

.footer-version {
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Focus visibility (a11y floor) ---------- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Toasts ---------- */
.toast-wrap {
  position: fixed; top: 16px; right: 16px; z-index: 60;
  display: flex; flex-direction: column; gap: 10px; max-width: min(92vw, 360px);
}

/* ============================================================
   RESPONSIVE — single source of truth, nothing absolute that
   can overlap; the brand panel simply drops away on small screens.
   ============================================================ */

/* Tablet / small laptop: stack panels */
@media (max-width: 920px) {
  .auth-grid { grid-template-columns: 1fr; max-width: 560px; }
  .brand-panel {
    padding: clamp(24px, 6vw, 36px);
    gap: 20px;
  }
  .brand-features { display: none; }          /* keep stacked card compact */
  .brand-stats { margin-top: 8px; }

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 12px;
  }

  .footer-center,
  .policy-links {
    justify-content: center;
  }
}

/* Phone */
@media (max-width: 560px) {
  .auth-shell { padding: 0; align-items: stretch; }
  .auth-grid {
    border: 0; border-radius: 0; box-shadow: none;
    grid-template-rows: auto 1fr;
  }
  .brand-panel { gap: 16px; }
  .brand-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .bstat .v { font-size: 17px; }
  .form-panel { padding: 24px 20px 32px; }
  .form-card { max-width: 100%; }
  .nav-brand-logo { width: 140px; }

  .footer-content {
    padding: 14px 16px;
  }

  .footer-separator {
    display: none;
  }

  .policy-links {
    gap: 6px 12px;
  }
}

/* Very small phones: reduce captcha letter-spacing so it never clips */
@media (max-width: 400px) {
  .captcha-box { font-size: 19px; letter-spacing: .2em; }
  .nav-inner { padding: 8px 12px; gap: 8px; }
  .nav-brand-logo { width: 120px; }
  .lang-btn { padding: 6px 9px; font-size: 12px; }
  .theme-toggle { width: 50px; height: 28px; }
  .theme-toggle.active .theme-toggle-slider { left: calc(100% - 24px); }
}

@media (max-width: 340px) {
  .nav-brand-logo { width: 100px; }
  .lang-btn { padding: 5px 7px; }
}

/* Large screens: a touch more breathing room */
@media (min-width: 1280px) {
  :root { --pad-card: 56px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Optional dark mode (toggle adds .dark-mode on body) ---------- */
body.dark-mode {
  --canvas: #0b1521;
  --surface: #11202f;
  --ink: #e8eef7;
  --ink-soft: #9fb0c7;
  --line: #20344a;
  --line-strong: #2a425c;
}
body.dark-mode .top-navbar { background: rgba(17,32,47,.85); }
body.dark-mode .field-input { background: #0e1c2a; }
body.dark-mode .captcha-box {
  background: repeating-linear-gradient(45deg, #13243600, #132436 8px, #16293d 8px, #16293d 16px);
}
body.dark-mode .captcha-btn { background: #0e1c2a; }

body.dark-mode .site-footer,
body.dark-mode .social-icon {
  background: var(--surface);
}
