/* Unified form system for rossCRM. Keep business-specific layouts outside this file. */
.crm-form-page {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 0 40px;
}

.crm-form-page--compact {
  max-width: 640px;
}

.crm-form-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.crm-form-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--primary, #2563eb), #60a5fa 55%, #10b981);
}

.crm-form-header {
  margin-bottom: 28px;
}

.crm-form-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--primary, #2563eb);
  background: #eff6ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-form-title {
  margin: 0;
  color: var(--text-main, #0f172a);
  font-size: clamp(25px, 3.2vw, 34px);
  letter-spacing: -0.025em;
}

.crm-form-subtitle {
  max-width: 660px;
  margin: 10px 0 0;
  color: var(--text-muted, #64748b);
  font-size: 15px;
}

.crm-form {
  display: grid;
  gap: 20px;
}

.crm-form--compact {
  gap: 12px;
}

.crm-form--compact > p {
  gap: 6px;
}

.crm-form > p,
.crm-form-field {
  display: grid;
  gap: 8px;
  margin: 0;
  text-align: left;
}

.crm-form label,
.crm-form legend {
  margin: 0;
  color: var(--text-main, #0f172a);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.crm-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]),
.crm-form select,
.crm-form textarea {
  display: block;
  width: 100% !important;
  min-height: 48px;
  margin: 0 !important;
  padding: 11px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  color: #0f172a;
  background: #fff;
  font: inherit;
  font-size: 15px;
  text-align: left;
}

.crm-form textarea {
  min-height: 120px;
  resize: vertical;
}

.crm-form input[type="file"] {
  padding: 9px 10px !important;
  background: #f8fafc !important;
}

.crm-form input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  color: #1e3a8a;
  background: #dbeafe;
  font-weight: 700;
  cursor: pointer;
}

.crm-form input:focus,
.crm-form select:focus,
.crm-form textarea:focus {
  border-color: var(--primary, #2563eb) !important;
  outline: 0;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12) !important;
}

.crm-form-actions .btn:focus-visible,
.crm-choice-card:focus-within {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.crm-form input:disabled,
.crm-form select:disabled,
.crm-form textarea:disabled {
  color: #64748b;
  background: #f1f5f9;
  cursor: not-allowed;
}

.crm-form .helptext,
.crm-form .form-text,
.crm-form small {
  display: block;
  margin: 0;
  color: var(--text-muted, #64748b);
  font-size: 13px;
  line-height: 1.5;
}

.crm-form .helptext ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.crm-form .errorlist {
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b91c1c;
  background: #fef2f2;
  font-size: 13px;
  font-weight: 600;
}

.crm-form .errorlist.nonfield {
  margin-bottom: 4px;
}

.crm-form fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.crm-choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.crm-choice-card {
  display: grid !important;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: start;
  margin: 0 !important;
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.crm-choice-card:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  transform: translateY(-1px);
}

.crm-choice-card input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary, #2563eb);
}

.crm-choice-card strong,
.crm-choice-card small {
  grid-column: 2;
}

.crm-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
  padding-top: 4px;
}

.crm-form-actions .btn,
.crm-form > .btn,
.crm-form > button[type="submit"],
.crm-form > input[type="submit"] {
  min-height: 46px;
  padding: 10px 20px;
}

.crm-form-note {
  padding: 14px 16px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  color: #1e3a8a;
  background: #eff6ff;
  font-size: 14px;
}

.crm-form-section-title {
  margin: 4px 0 0;
  color: var(--text-main, #0f172a);
  font-size: 20px;
}

.crm-form-divider {
  height: 1px;
  margin: 4px 0;
  border: 0;
  background: var(--border-soft, #e5e7eb);
}

@media (max-width: 767.98px) {
  .crm-form-page {
    padding-top: 0;
  }

  .crm-form-card {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .crm-choice-list {
    grid-template-columns: 1fr;
  }

  .crm-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-form-actions .btn,
  .crm-form-actions button,
  .crm-form-actions a {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .crm-form *,
  .crm-choice-card {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Standalone registration pages use the same system without the CRM sidebar. */
.crm-auth-page {
  display: grid;
  min-height: 100vh;
  margin: 0;
  padding: 32px 16px;
  place-items: center;
  color: #475569;
  background:
    radial-gradient(circle at 15% 10%, rgba(37, 99, 235, 0.12), transparent 28%),
    radial-gradient(circle at 90% 90%, rgba(16, 185, 129, 0.1), transparent 26%),
    #f8fafc;
}

.crm-auth-page .crm-form-page {
  padding: 0;
}

/* Authentication */
.crm-login-body {
  min-height: 100vh;
  background: #eef3f9;
}

main.crm-public-content {
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

.crm-login-shell {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(440px, 1.1fr);
  width: 100%;
  min-height: 100vh;
  color: #475569;
  background: #fff;
}

.crm-login-brand-panel {
  display: flex;
  position: relative;
  overflow: hidden;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 90% 15%, rgba(96, 165, 250, 0.38), transparent 28%),
    radial-gradient(circle at 15% 90%, rgba(16, 185, 129, 0.25), transparent 30%),
    linear-gradient(145deg, #0b1f3a 0%, #123d70 54%, #175b92 100%);
}

.crm-login-brand-panel::after {
  position: absolute;
  right: -110px;
  bottom: 12%;
  width: 330px;
  height: 330px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 42px rgba(255, 255, 255, 0.035),
    0 0 0 94px rgba(255, 255, 255, 0.025);
}

.crm-login-logo {
  display: inline-flex;
  z-index: 1;
  gap: 12px;
  align-items: center;
  width: max-content;
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.crm-login-logo:hover {
  color: #fff;
}

.crm-login-logo-mark {
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 13px;
  color: #123d70;
  background: #fff;
  place-items: center;
  font-size: 21px;
  font-weight: 900;
}

.crm-login-brand-copy {
  z-index: 1;
  max-width: 570px;
  margin: 70px 0;
}

.crm-login-kicker {
  display: inline-flex;
  margin-bottom: 20px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-login-brand-copy h1 {
  max-width: 560px;
  margin: 0;
  color: #fff;
  font-size: clamp(36px, 4.4vw, 62px);
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.crm-login-brand-copy > p {
  max-width: 520px;
  margin: 24px 0 0;
  color: #dbeafe;
  font-size: 17px;
  line-height: 1.7;
}

.crm-login-benefits {
  display: grid;
  gap: 13px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
  color: #eff6ff;
  font-size: 15px;
}

.crm-login-benefits li {
  display: flex;
  gap: 10px;
  align-items: center;
}

.crm-login-benefits span {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.22);
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}

.crm-login-about {
  display: inline-flex;
  z-index: 1;
  gap: 8px;
  align-items: center;
  width: max-content;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 700;
}

.crm-login-about:hover {
  color: #fff;
}

.crm-login-form-panel {
  display: grid;
  min-height: 100vh;
  padding: clamp(30px, 6vw, 90px);
  background: #fff;
  place-items: center;
}

.crm-login-form-wrap {
  width: 100%;
  max-width: 460px;
}

.crm-login-form {
  margin-top: 32px;
}

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

.crm-password-field input {
  padding-right: 92px !important;
}

.crm-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px !important;
  color: #2563eb;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  transform: translateY(-50%);
}

.crm-password-toggle:hover {
  background: #eff6ff;
}

.crm-login-submit {
  width: 100%;
  min-height: 50px !important;
  margin-top: 4px;
}

.crm-login-register {
  margin: 24px 0 0;
  color: #64748b;
  text-align: center;
  font-size: 14px;
}

.crm-login-register a {
  color: #2563eb;
  font-weight: 700;
}

@media (max-width: 900px) {
  .crm-login-shell {
    grid-template-columns: 1fr;
  }

  .crm-login-brand-panel {
    min-height: auto;
    padding: 28px clamp(20px, 6vw, 54px) 34px;
  }

  .crm-login-brand-copy {
    margin: 58px 0 16px;
  }

  .crm-login-brand-copy h1 {
    max-width: 650px;
    font-size: clamp(32px, 8vw, 52px);
  }

  .crm-login-benefits,
  .crm-login-about {
    display: none;
  }

  .crm-login-form-panel {
    min-height: auto;
    padding: 46px 20px 64px;
  }
}

@media (max-width: 575.98px) {
  .crm-login-brand-panel {
    padding: 22px 18px 28px;
  }

  .crm-login-logo {
    font-size: 21px;
  }

  .crm-login-logo-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .crm-login-brand-copy {
    margin-top: 42px;
  }

  .crm-login-brand-copy > p {
    margin-top: 16px;
    font-size: 15px;
  }

  .crm-login-form-panel {
    padding-top: 38px;
  }
}
