*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --brand: #1e293b;
  --brand-mid: #334155;
  --brand-light: #475569;
  --accent: #e8322a;
  --surface: #ffffff;
  --bg: #f4f6fb;
  --text-main: #1a1f2e;
  --text-sub: #5b6580;
  --text-hint: #9aa3b8;
  --border: #dde3f0;
  --border-focus: #334155;
  --error: #d93025;
  --success: #1a7f4b;
  --radius: 12px;
  --shadow-card:
    0 8px 40px rgba(26, 60, 110, 0.1), 0 2px 8px rgba(26, 60, 110, 0.06);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
  height: 100%;
  font-family: "Outfit", sans-serif;
  background: var(--bg);
}

.crm-wrap {
  display: flex;
  min-height: 100vh;
}

.crm-left {
  flex: 0 0 58%;
  background: linear-gradient(
    145deg,
    var(--brand) 0%,
    var(--brand-mid) 55%,
    var(--brand-light) 100%
  );
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 56px 40px;
}

.crm-left-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.crm-left-bg svg {
  width: 100%;
  height: 100%;
  opacity: 0.13;
}

.crm-left-content {
  position: relative;
  z-index: 1;
}

.crm-brand {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
}

.crm-brand-icon {
  flex-shrink: 0;
}

.crm-brand-name {
  font-family: "Lexend", sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  line-height: 1;
}

.crm-brand-name span {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  margin-top: 5px;
}

.crm-divider {
  width: 48px;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 99px;
  margin-bottom: 80px;
}

.crm-tagline {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 400;
  line-height: 1.6;
  max-width: 340px;
}

.crm-feature-list {
  margin-top: 48px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 18px;
}

.crm-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
  font-weight: 400;
}

.crm-feature-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.crm-left-footer {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.42);
  font-weight: 400;
  letter-spacing: 0.7px;
}

.crm-left-footer b {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
}

/* ───── RIGHT PANEL ───── */
.crm-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--surface);
}

.crm-right-inner {
  width: 100%;
  max-width: 380px;
}

.crm-right-logo {
  text-align: center;
  margin-bottom: 50px;
}

.crm-right-logo img {
  height: 72px;
  width: auto;
  object-fit: contain;
}

/* Fallback if logo missing */
.crm-right-logo .logo-fallback {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Lexend", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.3px;
}

.crm-form-heading {
  margin-bottom: 25px;
}

.crm-form-heading h2 {
  font-family: "Lexend", sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.crm-form-heading p {
  font-size: 0.88rem;
  color: var(--text-sub);
  font-weight: 400;
}

/* ───── FORM FIELDS ───── */
.crm-field {
  margin-bottom: 18px;
}

.crm-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}

.crm-input-wrap {
  position: relative;
}

.crm-input {
  width: 100%;
  padding: 11px 44px 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: "Outfit", sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-main);
  background: var(--bg);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
  -webkit-appearance: none;
}

.crm-input::placeholder {
  color: var(--text-hint);
}

.crm-input:focus {
  border-color: var(--border-focus);
  background: #fff;
  box-shadow: 0 0 0 3.5px rgba(30, 90, 168, 0.1);
}

.crm-input.input-error {
  border-color: var(--error);
  box-shadow: 0 0 0 3.5px rgba(217, 48, 37, 0.1);
}

.crm-input.input-error:focus {
  box-shadow: 0 0 0 3.5px rgba(217, 48, 37, 0.13);
}

/* Input icon */
.crm-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
  pointer-events: none;
  transition: color var(--transition);
  display: none;
  /* keep clean — no icon clutter */
}

/* Eye toggle */
.crm-eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-hint);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    color var(--transition),
    background var(--transition);
  outline: none;
}

.crm-eye-btn:hover {
  color: var(--brand-mid);
  background: rgba(30, 90, 168, 0.07);
}

.crm-eye-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(30, 90, 168, 0.18);
}

/* Field error message */
.crm-field-error {
  font-size: 0.78rem;
  color: var(--error);
  margin-top: 5px;
  display: none;
  align-items: center;
  gap: 5px;
}

.crm-field-error.visible {
  display: flex;
}

/* ───── SIGN IN BUTTON ───── */
.crm-btn-signin {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: "Outfit", sans-serif;
  font-size: 0.97rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition:
    opacity var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  box-shadow: 0 4px 18px rgba(26, 60, 110, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline: none;
  position: relative;
  overflow: hidden;
}

.crm-btn-signin:hover:not(:disabled) {
  opacity: 0.93;
  box-shadow: 0 6px 24px rgba(26, 60, 110, 0.3);
  transform: translateY(-1px);
}

.crm-btn-signin:active:not(:disabled) {
  transform: translateY(0);
}

.crm-btn-signin:focus-visible {
  box-shadow: 0 0 0 3.5px rgba(30, 90, 168, 0.28);
}

.crm-btn-signin:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Spinner inside button */
.crm-spinner {
  width: 17px;
  height: 17px;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-loading .crm-spinner {
  display: block;
}

.btn-loading .btn-label {
  display: none;
}

/* ───── ALERT BANNER ───── */
.crm-alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 18px;
  display: none;
  align-items: center;
  gap: 9px;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.crm-alert.alert-error {
  display: flex;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
}

.crm-alert.alert-success {
  display: flex;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: var(--success);
}

/* ───── SHAKE ANIMATION ───── */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.shake {
  animation: shake 0.4s ease;
}

.crm-right-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 0.77rem;
  color: var(--text-hint);
}

@media (max-width: 860px) {
  .crm-left {
    display: none;
  }

  .crm-right {
    padding: 36px 24px;
    background: var(--bg);
  }

  .crm-right-inner {
    background: var(--surface);
    border-radius: 20px;
    padding: 36px 28px;
    box-shadow: var(--shadow-card);
  }
}

@media (max-width: 460px) {
  .crm-right {
    padding: 20px 12px;
  }

  .crm-right-inner {
    padding: 28px 20px;
  }
}

/* ── Additional mobile polish ── */
@media (max-width: 380px) {
  .crm-right-inner {
    padding: 22px 14px !important;
    border-radius: 14px !important;
  }
  .crm-btn-signin {
    font-size: 14px !important;
  }
}
