:root {
  /* The platform brand colour, the same #d4fb08 the dashboard uses.
     It was #d7ff00 here — near enough to pass for the brand at a glance,
     far enough to look like a second green when the two are seen together. */
  --auth-accent: #d4fb08;
  --auth-accent-hover: #bfe307;
  --auth-ink: #111827;
  --auth-muted: #64748b;
  --auth-line: #d8e1e8;
  --auth-card: rgba(255, 255, 255, 0.94);
  --auth-input: #f7f9fb;
  --auth-bg: #f5f8f6;
}

.dark,
:root.dark,
body.auth-shell-page:has(.dark),
body.auth-shell-page.crm-auth-dark {
  --auth-ink: #f5f7fa;
  --auth-muted: #94a3b8;
  --auth-line: #283548;
  --auth-card: rgba(13, 20, 31, 0.96);
  --auth-input: #0b121c;
  --auth-bg: #080d12;
}

body.auth-shell-page {
  min-height: 100vh;
  margin: 0;
  color: var(--auth-ink);
  background: var(--auth-bg);
}

body.auth-shell-page #app::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: '';
  pointer-events: none;
  background-image:
    linear-gradient(135deg, rgba(132, 204, 22, 0.045), transparent 38%),
    radial-gradient(circle, rgba(100, 116, 139, 0.16) 0.7px, transparent 0.8px);
  background-size: auto, 24px 24px;
}

.dark body.auth-shell-page #app::before,
body.auth-shell-page:has(.dark) #app::before {
  background-image:
    linear-gradient(135deg, rgba(101, 163, 13, 0.07), transparent 42%),
    radial-gradient(circle, rgba(148, 163, 184, 0.08) 0.7px, transparent 0.8px);
}

#crm-auth-toolbar {
  position: fixed;
  z-index: 1000;
  top: 20px;
  right: 28px;
  left: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

#crm-auth-toolbar > * {
  pointer-events: auto;
}

.crm-auth-brand {
  display: inline-flex;
  width: 150px;
  height: 52px;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.crm-auth-logo {
  display: block;
  width: 140px;
  max-width: 140px;
  height: 50px;
  object-fit: contain;
}

.crm-auth-logo--dark { display: none; }
.dark .crm-auth-logo--light { display: none; }
.dark .crm-auth-logo--dark { display: block; }
body.auth-shell-page:has(.dark) .crm-auth-logo--light { display: none; }
body.auth-shell-page:has(.dark) .crm-auth-logo--dark { display: block; }
body.auth-shell-page.crm-auth-dark .crm-auth-logo--light { display: none; }
body.auth-shell-page.crm-auth-dark .crm-auth-logo--dark { display: block; }

.crm-auth-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.crm-auth-control {
  display: inline-flex;
  min-width: 42px;
  height: 42px;
  padding: 0 11px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--auth-ink);
  cursor: pointer;
  background: color-mix(in srgb, var(--auth-card) 92%, transparent);
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(14px);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.crm-auth-control:hover {
  border-color: #a7bf28;
  transform: translateY(-1px);
}

.crm-auth-control svg {
  width: 18px;
  height: 18px;
}

.crm-auth-language {
  min-width: 64px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

body.auth-shell-page #app > div,
body.auth-shell-page #app > div > div:first-child,
body.auth-shell-page main {
  position: relative;
  z-index: 1;
  min-height: 100vh !important;
  background: transparent !important;
}

body.auth-shell-page #app > div,
body.auth-shell-page #app > div > div:first-child,
body.auth-shell-page main {
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

/* Login */
body[data-auth-view='login'] main {
  display: flex !important;
  padding: 76px 20px 34px !important;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

body[data-auth-view='login'] main::before,
body[data-auth-view='login'] main::after {
  display: none !important;
  content: none !important;
}

body[data-auth-view='login'] main > section:first-child {
  display: none !important;
}

body[data-auth-view='login'] main > section:nth-child(2) {
  width: min(100%, 528px) !important;
  max-width: 528px !important;
  padding: 38px 36px 28px !important;
  margin: 0 !important;
  color: var(--auth-ink) !important;
  background: var(--auth-card) !important;
  border: 1px solid var(--auth-line) !important;
  border-radius: 28px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12) !important;
  backdrop-filter: blur(18px);
}

.dark body[data-auth-view='login'] main > section:nth-child(2),
body[data-auth-view='login']:has(.dark) main > section:nth-child(2) {
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42) !important;
}

.crm-auth-heading {
  margin: 0 0 24px;
  color: var(--auth-ink);
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

/* Signup */
body[data-auth-view='signup'] #app div[class*='min-h-[640px]'] {
  position: relative;
  z-index: 1;
  min-height: 100vh !important;
  padding: 56px 20px 20px !important;
  align-items: center !important;
}

body[data-auth-view='signup'] #app div[class*='min-h-[640px]'] > div {
  width: min(100%, 500px) !important;
  max-width: 500px !important;
  max-height: none !important;
  padding: 24px 28px 18px !important;
  overflow: visible !important;
  color: var(--auth-ink) !important;
  background: var(--auth-card) !important;
  border: 1px solid var(--auth-line) !important;
  border-radius: 26px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12) !important;
  backdrop-filter: blur(18px);
}

body[data-auth-view='signup'] #app div[class*='min-h-[640px]'] > div,
body[data-auth-view='signup'] #app div[class*='min-h-[640px]'] > div > div,
body[data-auth-view='signup'] #app .flex-1.px-1.overflow-auto {
  height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

body[data-auth-view='signup'] .mb-4 > img {
  display: none !important;
}

body[data-auth-view='signup'] .mb-4 h2 {
  margin: 0 0 14px !important;
  color: var(--auth-ink) !important;
  font-size: 24px !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em;
}

/* Reset password */
body[data-auth-view='reset'] #app > div > div:first-child {
  display: flex !important;
  min-height: 100vh !important;
  padding: 76px 20px 34px !important;
  align-items: center !important;
  justify-content: center !important;
  background: transparent !important;
}

body[data-auth-view='reset'] #app > div > div:first-child::before,
body[data-auth-view='reset'] #app > div > div:first-child::after {
  display: none !important;
  content: none !important;
}

body[data-auth-view='reset'] form {
  width: min(100%, 528px) !important;
  max-width: 528px !important;
  padding: 38px 36px 28px !important;
  margin: 0 !important;
  color: var(--auth-ink) !important;
  background: var(--auth-card) !important;
  border: 1px solid var(--auth-line) !important;
  border-radius: 28px !important;
  outline: 0 !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12) !important;
  backdrop-filter: blur(18px);
}

.dark body[data-auth-view='reset'] form,
body[data-auth-view='reset']:has(.dark) form {
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42) !important;
}

body[data-auth-view='reset'] form > h1 {
  margin: 0 0 10px !important;
  color: var(--auth-ink) !important;
  font-size: 25px !important;
  font-weight: 800 !important;
  letter-spacing: -0.035em !important;
}

body[data-auth-view='reset'] .crm-reset-description {
  margin: 0 0 10px !important;
  color: var(--auth-muted) !important;
  font-size: 13px !important;
  line-height: 1.75 !important;
}

body[data-auth-view='reset'] form > .space-y-5 {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

body[data-auth-view='reset'] form > .space-y-5 > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body[data-auth-view='reset'] .crm-reset-back {
  margin: 4px 0 0 !important;
  color: var(--auth-muted) !important;
  font-size: 13px !important;
  text-align: center !important;
}

body[data-auth-view='reset'] .crm-auth-trust {
  margin-top: 8px;
}

/* Shared form */
body.auth-shell-page form {
  display: flex;
  flex-direction: column;
  gap: 14px !important;
}

body.auth-shell-page form > div,
body.auth-shell-page form .space-y-1 {
  margin: 0 !important;
}

body.auth-shell-page form label {
  margin-bottom: 6px;
  color: var(--auth-ink) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

body.auth-shell-page form input {
  min-height: 46px !important;
  padding: 10px 42px !important;
  color: var(--auth-ink) !important;
  background: var(--auth-input) !important;
  border: 0 !important;
  border-radius: 12px !important;
  outline: 1px solid var(--auth-line) !important;
  box-shadow: none !important;
}

body.auth-shell-page form input:focus {
  outline: 2px solid #a8c300 !important;
}

body.auth-shell-page form input::placeholder {
  color: #8da0ba !important;
}

.crm-auth-field {
  position: relative;
}

.crm-field-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 13px;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: #7185a1;
  pointer-events: none;
  transform: translateY(-50%);
}

.crm-field-icon svg {
  width: 16px;
  height: 16px;
}

body.crm-rtl .crm-field-icon {
  right: 13px;
  left: auto;
}

body.auth-shell-page form button[aria-label*='password'] {
  right: 4px !important;
}

body.crm-rtl form button[aria-label*='password'] {
  right: auto !important;
  left: 4px !important;
}

body.auth-shell-page form button[type='submit'] {
  min-height: 49px !important;
  margin-top: 18px !important;
  color: #101410 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  background: var(--auth-accent) !important;
  border-radius: 13px !important;
  box-shadow: 0 10px 26px rgba(212, 251, 8, 0.22) !important;
}

body.auth-shell-page form button[type='submit'],
body.auth-shell-page form button[type='submit'] * {
  color: #101410 !important;
}

body.auth-shell-page form button[type='submit']:hover:not(:disabled) {
  background: var(--auth-accent-hover) !important;
}

body.auth-shell-page form button[type='submit']:disabled {
  color: rgba(16, 20, 16, 0.5) !important;
  opacity: 0.7 !important;
}

body[data-auth-view='signup'] form {
  gap: 9px !important;
}

body[data-auth-view='signup'] form label {
  margin-bottom: 4px !important;
}

body[data-auth-view='signup'] form input {
  min-height: 42px !important;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

body.auth-shell-page a {
  color: #008f62 !important;
  font-weight: 700;
}

.dark body.auth-shell-page a,
body.auth-shell-page:has(.dark) a {
  color: var(--auth-accent) !important;
}

body[data-auth-view='signup'] #password-requirements {
  padding: 8px 12px !important;
  color: var(--auth-ink) !important;
  background: color-mix(in srgb, #d1fae5 55%, var(--auth-card)) !important;
  border: 1px solid rgba(16, 185, 129, 0.38) !important;
  border-radius: 12px !important;
  outline: 0 !important;
}

.dark body[data-auth-view='signup'] #password-requirements,
body[data-auth-view='signup']:has(.dark) #password-requirements {
  background: rgba(3, 34, 28, 0.35) !important;
}

body[data-auth-view='signup'] #password-requirements ul {
  gap: 5px 14px !important;
}

.crm-password-title {
  margin-bottom: 6px;
  color: #00966b;
  font-size: 10px;
  font-weight: 800;
}

.dark .crm-password-title,
body.crm-auth-dark .crm-password-title {
  color: #63e6be;
}

body[data-auth-view='signup'] #password-requirements span {
  color: var(--auth-muted) !important;
  font-size: 10px !important;
}

.crm-auth-divider {
  display: flex;
  margin: 24px 0 18px;
  align-items: center;
  gap: 14px;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 800;
}

.crm-auth-divider::before,
.crm-auth-divider::after {
  height: 1px;
  content: '';
  flex: 1;
  background: var(--auth-line);
}

.crm-auth-switch {
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
  text-align: center;
}

.crm-auth-trust {
  display: flex;
  margin-top: 24px;
  padding-top: 20px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--auth-muted);
  border-top: 1px solid var(--auth-line);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.crm-auth-trust span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.crm-auth-trust svg {
  width: 14px;
  height: 14px;
  color: #00a878;
}

.dark .crm-auth-trust svg { color: var(--auth-accent); }

body[data-auth-view='signup'] p.text-sm.mb-1.mt-5 {
  margin: 2px 0 0 !important;
  color: var(--auth-muted) !important;
  font-size: 9px !important;
  line-height: 1.5 !important;
  text-align: center;
}

body[data-auth-view='signup'] .crm-auth-divider {
  margin: 15px 0 13px;
}

body[data-auth-view='signup'] .crm-auth-trust {
  margin-top: 16px;
  padding-top: 14px;
}

body[data-auth-view='signup'] .px-1.text-sm.text-n-slate-12 {
  color: var(--auth-muted) !important;
  text-align: center;
}

body[data-auth-view='signup'] .px-1.text-sm.text-n-slate-12 > a {
  margin-inline-start: 4px;
}

#cw-legal-links { display: none !important; }

body.crm-rtl {
  direction: rtl;
  font-family: 'Noto Sans Arabic', sans-serif;
}

body.crm-rtl #crm-auth-toolbar { direction: ltr; }
body.crm-rtl .crm-auth-heading,
body.crm-rtl[data-auth-view='signup'] .mb-4 h2,
body.crm-rtl[data-auth-view='reset'] form > h1,
body.crm-rtl form label,
body.crm-rtl input { text-align: right !important; }

body.crm-rtl .crm-auth-heading,
body.crm-rtl[data-auth-view='signup'] .mb-4 h2,
body.crm-rtl[data-auth-view='reset'] form > h1 {
  width: 100%;
  align-self: stretch;
}

@media (max-width: 640px) {
  #crm-auth-toolbar {
    top: 12px;
    right: 14px;
    left: 14px;
  }

  .crm-auth-brand { width: 96px; }
  .crm-auth-logo { max-width: 96px; height: 30px; }

  body[data-auth-view='login'] main,
  body[data-auth-view='signup'] #app div[class*='min-h-[640px]'],
  body[data-auth-view='reset'] #app > div > div:first-child {
    padding: 72px 12px 18px !important;
    align-items: flex-start !important;
  }

  body[data-auth-view='login'] main > section:nth-child(2),
  body[data-auth-view='signup'] #app > div > div > div.flex-1 > div,
  body[data-auth-view='reset'] form {
    padding: 28px 20px 22px !important;
    border-radius: 22px !important;
  }

  body[data-auth-view='signup'] form .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }

  .crm-auth-trust {
    flex-wrap: wrap;
    gap: 8px 12px;
    white-space: normal;
  }
}
