/* ─── AUTH LAYOUT ─── */
:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #eeedf2;
  --text: #0e1323;
  --muted: #5d667b;
  --line: rgba(14, 19, 35, 0.12);
  --card: #ffffff;
  --shadow: 0 24px 60px rgba(16, 24, 40, 0.14);
  --shadow-sm: 0 14px 32px rgba(16, 24, 40, 0.14);
  --ring: rgba(var(--app-accent-rgb, 91, 86, 255), 0.18);
  --a-accent: var(--app-accent, #5b56ff);
  --a-accent2: var(--app-accent2, #18c48a);
  --a-accent-rgb: var(--app-accent-rgb, 91, 86, 255);
  --a-accent2-rgb: var(--app-accent2-rgb, 24, 196, 138);
  --a-ring: rgba(var(--a-accent-rgb), 0.15);
  --a-danger: #e24b4a;
  --a-surface: rgba(255, 255, 255, 0.72);
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --text: #e0e7ff;
  --muted: #9ca3af;
  --line: rgba(229, 231, 235, 0.14);
  --card: #111827;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 14px 32px rgba(0, 0, 0, 0.35);
  --ring: rgba(var(--app-accent-rgb, 91, 86, 255), 0.24);
  --a-ring: rgba(var(--a-accent-rgb), 0.24);
  --a-surface: rgba(17, 24, 39, 0.72);
}

:root[data-theme="light"] {
  --bg: #eeedf2;
  --text: #0e1323;
  --muted: #5d667b;
  --line: rgba(14, 19, 35, 0.12);
  --card: #ffffff;
  --shadow: 0 24px 60px rgba(16, 24, 40, 0.14);
  --shadow-sm: 0 14px 32px rgba(16, 24, 40, 0.14);
  --ring: rgba(var(--app-accent-rgb, 91, 86, 255), 0.18);
  --a-surface: rgba(255, 255, 255, 0.72);
}

body.auth {
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
}

.a-header,
.a-main,
.a-header .a-container,
.a-main .a-container,
.a-card {
  box-sizing: border-box;
}

.a-header {
  width: 100%;
  padding: 18px 24px 0;
}

.a-header .a-container {
  width: min(100%, 480px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.a-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  text-decoration: none;
}

.a-name {
  min-width: 0;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.a-link {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 10px 0;
}

.a-link:hover {
  color: var(--text);
}

.a-brandLogo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.a-brandLogoWide {
  width: auto;
  min-width: 72px;
  max-width: 160px;
  height: 40px;
}

.brand-logo {
  max-width: 160px;
  max-height: 40px;
  object-fit: contain;
}

.brand-logo-light {
  display: block;
}

.brand-logo-dark {
  display: none;
}

:root[data-theme="light"] .brand-logo-light {
  display: block;
}

:root[data-theme="light"] .brand-logo-dark {
  display: none;
}

:root[data-theme="dark"] .brand-logo-light {
  display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
  display: block;
}

.a-main {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 36px 24px 48px;
}

.a-main .a-container {
  width: min(100%, 480px);
  min-width: 0;
}

.a-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background:
    radial-gradient(circle at top left, rgba(var(--a-accent-rgb), 0.08), transparent 28%),
    radial-gradient(circle at bottom right, rgba(var(--a-accent2-rgb), 0.08), transparent 24%),
    var(--bg);
}

/* Left panel — branding side */
.a-panel {
  background:
    linear-gradient(160deg, rgba(var(--a-accent-rgb), 0.22), rgba(var(--a-accent2-rgb), 0.18)),
    linear-gradient(160deg, #0d0b2e 0%, #0d2617 100%);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  position: relative;
  overflow: hidden;
}
.a-panel::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--a-accent-rgb), 0.25), transparent 70%);
  top: -150px; left: -100px;
  pointer-events: none;
}
.a-panel::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--a-accent2-rgb), 0.2), transparent 70%);
  bottom: -100px; right: -80px;
  pointer-events: none;
}
.a-panelBrand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; position: relative; z-index: 1;
}
.a-panelMark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--a-accent), var(--a-accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
  font-family: var(--font-sans);
}
.a-panelBrandName {
  font-weight: 800; font-size: 18px; color: #fff;
  letter-spacing: -0.3px;
}
.a-brandLogo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.a-brandLogoWide {
  width: auto;
  min-width: 72px;
  max-width: 160px;
  height: 40px;
}
.brand-logo {
  display: block;
  max-width: 160px;
  max-height: 40px;
  object-fit: contain;
}
.a-panelContent { position: relative; z-index: 1; }
.a-panelHeadline {
  font-family: 'Syne', sans-serif;
  font-size: clamp(30px, 3vw, 44px);
  font-weight: 800; color: #fff;
  line-height: 1.04; letter-spacing: -0.8px;
  margin-bottom: 14px;
  max-width: 12ch;
}
.a-panelHeadline span {
  background: linear-gradient(90deg, var(--a-accent), var(--a-accent2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.a-panelSub {
  font-size: 15px; color: rgba(255,255,255,0.62);
  line-height: 1.65; max-width: 36ch;
}
.a-panelStats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap; position: relative; z-index: 1;
}
.a-panelStat { }
.a-panelStatNum {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800; color: #fff;
  letter-spacing: -0.3px;
}
.a-panelStatLabel {
  font-size: 12px; color: rgba(255,255,255,0.45);
  font-weight: 500; margin-top: 2px;
}
.a-panelFooter {
  font-size: 12px; color: rgba(255,255,255,0.38);
  position: relative; z-index: 1;
}

/* Right panel — form side */
.a-formSide {
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 36px 24px;
}
.a-card {
  width: 100%;
  max-width: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 30px 28px;
  box-shadow: 0 24px 60px rgba(13,15,26,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

:root[data-theme="dark"] .a-card {
  box-shadow: var(--shadow);
}

/* Badge for admin */
.a-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(226,75,74,0.1); border: 1px solid rgba(226,75,74,0.25);
  color: var(--a-danger); font-size: 12px; font-weight: 700;
  padding: 5px 10px; border-radius: 999px;
  margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.3px;
}
.a-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--a-danger);
  display: block;
}

.a-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
  color: var(--text);
  letter-spacing: -0.6px; line-height: 1.08;
  margin-bottom: 10px;
}
.a-sub {
  font-size: 14px; color: var(--muted);
  line-height: 1.65; margin-bottom: 26px;
  max-width: 34ch;
}

.a-loginPills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.a-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(var(--a-accent-rgb), 0.18);
  background: rgba(var(--a-accent-rgb), 0.08);
  color: var(--a-accent);
  font-size: 12px;
  font-weight: 700;
}

/* Flash messages */
.a-flash {
  padding: 12px 14px; border-radius: 12px;
  font-size: 13px; font-weight: 500; margin-bottom: 20px;
  display: flex; align-items: flex-start; gap: 8px;
}
.a-flash-error { background: rgba(226,75,74,0.08); border: 1px solid rgba(226,75,74,0.2); color: var(--a-danger); }
.a-flash-success { background: rgba(var(--a-accent2-rgb), 0.08); border: 1px solid rgba(var(--a-accent2-rgb), 0.2); color: var(--a-accent2); }

/* Public site banners */
.site-banners {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.site-banner {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.site-banner-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.16);
}

.site-banner-success {
  background: rgba(var(--a-accent2-rgb), 0.08);
  border-color: rgba(var(--a-accent2-rgb), 0.16);
}

.site-banner-warning {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.18);
}

.site-bannerIcon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--text);
  background: rgba(14, 19, 35, 0.06);
}

.site-banner-info .site-bannerIcon {
  background: rgba(59, 130, 246, 0.16);
  color: #1d4ed8;
}

.site-banner-success .site-bannerIcon {
  background: rgba(var(--a-accent2-rgb), 0.16);
  color: #12805a;
}

.site-banner-warning .site-bannerIcon {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.site-bannerBody {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.site-bannerTitle {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.site-bannerText {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.site-bannerClose {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms cubic-bezier(0.4, 0, 0.2, 1), color 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

.site-bannerClose:hover {
  background: rgba(14, 19, 35, 0.06);
  color: var(--text);
}

.site-banner.hidden {
  display: none;
}

/* Form */
.a-form { display: grid; gap: 0; }
.a-form {
  width: 100%;
  justify-items: stretch;
}

.a-field {
  margin-bottom: 14px;
  width: 100%;
}
.a-field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.a-fieldWrap { position: relative; }
.a-fieldWrap {
  width: 100%;
}

.a-field .input {
  width: 100%;
  display: block !important;
}

.a-field .input > input {
  width: 100%;
  display: block;
  box-sizing: border-box;
}

.a-field .input > select {
  width: 100%;
  display: block;
  box-sizing: border-box;
}

.a-field .input.email,
.a-field .input.password,
.a-field .input.text {
  width: 100% !important;
  display: block !important;
}

.a-grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  margin-bottom: 14px;
}

.a-grid2 .a-field {
  margin-bottom: 0;
}

.a-passWrap {
  position: relative;
  width: 100%;
  display: block;
}

.a-passWrap > input {
  padding-right: 46px;
}

.a-passToggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s, opacity 0.15s;
  opacity: 0.75;
}

.a-passToggle:hover {
  background: rgba(var(--a-accent-rgb), 0.08);
  color: var(--a-accent);
  opacity: 1;
}

.a-passToggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--a-ring);
}

/* Left icon slot */
.a-fieldWrap .a-fieldIcon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted); font-size: 16px; pointer-events: none;
  opacity: 0.6; z-index: 1;
}
.a-field input[type="email"],
.a-field input[type="password"],
.a-field input[type="text"],
.a-field input[type="tel"],
.a-field select {
  width: 100%; height: 44px;
  padding: 0 42px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--a-surface);
  color: var(--text);
  font-size: 16px; font-weight: 500;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-appearance: none;
  box-sizing: border-box;
}
.a-field input:hover { border-color: rgba(var(--a-accent-rgb), 0.35); }
.a-field select:hover { border-color: rgba(var(--a-accent-rgb), 0.35); }
.a-field input:focus {
  border-color: var(--a-accent);
  box-shadow: 0 0 0 4px var(--a-ring);
  background: var(--card);
}
.a-field select:focus {
  border-color: var(--a-accent);
  box-shadow: 0 0 0 4px var(--a-ring);
  background: var(--card);
  outline: none;
}
.a-field select {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.a-field input::placeholder { color: var(--muted); opacity: 0.5; }

/* Password toggle */
.a-eyeBtn {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 6px; border-radius: 6px;
  font-size: 16px; opacity: 0.5;
  transition: opacity 0.15s;
}
.a-eyeBtn:hover { opacity: 1; }

/* Forgot link */
.a-forgotRow {
  display: flex;
  justify-content: center;
  margin-top: -8px;
  margin-bottom: 20px;
  width: 100%;
}
.a-forgotLink {
  display: inline-block;
  max-width: 100%;
  font-size: 12px; font-weight: 600; color: var(--a-accent);
  text-decoration: none; opacity: 0.85;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.a-forgotLink:hover { opacity: 1; }

/* Buttons */
.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 46px; padding: 0 20px; border-radius: 14px;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, opacity 0.15s;
  border: 1.5px solid var(--line);
  background: var(--card); color: var(--text);
}
.a-btn:hover { background: var(--bg); transform: translateY(-1px); }
.a-btn:active { transform: translateY(0); }

.a-btnPrimary {
  background: var(--a-accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(var(--a-accent-rgb), 0.35);
  width: 100%;
}
.a-btnPrimary:hover {
  background: var(--a-accent);
  opacity: 0.9;
  box-shadow: 0 8px 24px rgba(var(--a-accent-rgb), 0.4);
  transform: translateY(-1px);
}
.a-btnPrimary::after {
  content: '→';
  font-size: 15px;
}

/* Actions row */
.a-actions { display: flex; flex-direction: column; gap: 10px; }
.a-actions {
  width: 100%;
}

/* Divider */
.a-divider {
  display: flex; align-items: center; gap: 12px; margin: 6px 0;
}
.a-dividerLine { flex: 1; height: 1px; background: var(--line); }
.a-dividerText { font-size: 12px; color: var(--muted); font-weight: 500; }

/* Demo button */
.a-btnDemo {
  background: rgba(var(--a-accent-rgb), 0.06);
  border-color: rgba(var(--a-accent-rgb), 0.2);
  color: var(--a-accent);
  width: 100%;
}
.a-btnDemo:hover { background: rgba(var(--a-accent-rgb), 0.1); }

/* Meta links */
.a-metaLinks {
  display: flex; justify-content: center; gap: 18px;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  width: 100%;
}
.a-metaLinks a {
  font-size: 13px; color: var(--muted); text-decoration: none;
  font-weight: 500; transition: color 0.15s;
}
.a-metaLinks a:hover { color: var(--text); }

/* Trust line */
.a-trust {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12px; color: var(--muted); margin-top: 18px;
  opacity: 0.8;
}

.a-note {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* Responsive */
@media(max-width: 820px) {
  .a-header {
    padding: 14px 14px 0;
  }

  .a-header .a-container {
    width: 100%;
    align-items: center;
    flex-wrap: wrap;
  }

  .a-brand {
    gap: 8px;
    flex: 1 1 220px;
  }

  .a-name {
    font-size: 16px;
  }

  .a-link {
    margin-left: auto;
  }

  .a-main {
    padding: 18px 14px 28px;
  }

  .a-main .a-container {
    width: 100%;
  }

  .a-layout { grid-template-columns: 1fr; }
  .a-panel { display: none; }
  .a-formSide { min-height: 100vh; padding: 18px 14px; }
  .a-card {
    max-width: 100%;
    border-radius: 22px;
    border: 1px solid var(--line);
    box-shadow: 0 20px 48px rgba(13,15,26,0.10);
    background: var(--card);
    padding: 28px 22px 22px;
  }
}

@media(max-width: 520px) {
  .a-header {
    padding: 12px 12px 0;
  }

  .a-header .a-container {
    gap: 8px;
    align-items: center;
  }

  .a-link {
    font-size: 12px;
    width: 100%;
    text-align: right;
    margin-left: 0;
  }

  .a-card {
    padding: 24px 18px 18px;
    border-radius: 20px;
  }

  .a-title {
    font-size: 24px;
  }

  .a-sub {
    margin-bottom: 22px;
  }

  .a-loginPills {
    gap: 6px;
    margin-bottom: 16px;
  }

  .a-field input[type="email"],
  .a-field input[type="password"],
  .a-field input[type="text"],
  .a-field input[type="tel"],
  .a-field select {
    height: 46px;
    font-size: 16px;
  }

  .a-passToggle {
    width: 32px;
    height: 32px;
    right: 6px;
  }

  .a-actions {
    gap: 8px;
  }

  .a-metaLinks {
    gap: 12px;
  }

  .a-metaLinks a,
  .a-forgotLink {
    font-size: 12px;
  }

  .a-grid2 {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 0;
  }

  .a-grid2 .a-field {
    margin-bottom: 14px;
  }

  .a-brandLogoWide {
    max-width: 120px;
    height: 34px;
  }

  .brand-logo {
    max-width: 120px;
    max-height: 34px;
  }

  .a-name {
    font-size: 15px;
  }
}
