/* Login screen: split brand panel + form card */

.login-body {
  background: var(--white);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------------------------------------------------------------- Brand panel */

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-7) var(--space-8);
  background:
    radial-gradient(120% 90% at 12% 4%, #16386e 0%, transparent 58%),
    linear-gradient(160deg, var(--brand-navy-800) 0%, var(--brand-navy-900) 100%);
  color: var(--white);
  overflow: hidden;
}

/* Faint grid, evokes a ledger without competing with the copy */
.brand-panel__pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(90% 70% at 30% 30%, #000 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(90% 70% at 30% 30%, #000 20%, transparent 100%);
  pointer-events: none;
}

.brand-panel__content {
  position: relative;
  max-width: 470px;
  margin-top: auto;
  margin-bottom: auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-7);
}

/* The mark is drawn in currentColor, so each surface sets its own ink. */
.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.brand-panel .brand-mark {
  color: var(--white);
}

.form-card__mobile-brand .brand-mark {
  color: var(--brand-blue-600);
}

.brand-name {
  font-size: var(--text-md);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-headline {
  margin: 0 0 var(--space-4);
  font-size: var(--text-2xl);
  line-height: 1.22;
  font-weight: 660;
  letter-spacing: -0.02em;
}

.brand-sub {
  margin: 0;
  max-width: 42ch;
  font-size: var(--text-md);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.72);
}

.brand-stats {
  display: flex;
  gap: var(--space-6);
  margin: var(--space-7) 0 0;
  padding: var(--space-5) 0 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-stats__value {
  display: block;
  font-size: var(--text-lg);
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand-stats__label {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.6);
}

.brand-panel__footer {
  position: relative;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.45);
}

/* ----------------------------------------------------------------- Form panel */

.form-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-7) var(--space-6);
  background: var(--white);
}

.form-card {
  width: 100%;
  max-width: 396px;
}

.form-card__mobile-brand {
  display: none;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  font-size: var(--text-md);
  font-weight: 650;
  color: var(--brand-navy-900);
}

.form-header h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
  font-weight: 660;
  letter-spacing: -0.02em;
  color: var(--gray-950);
}

.form-header p {
  margin: 0 0 var(--space-6);
  color: var(--gray-600);
}

/* Alerts */
.alert {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--danger-600);
  background: var(--danger-050);
  color: #8f1f1f;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.alert--info {
  border-left-color: var(--brand-blue-600);
  background: var(--brand-blue-050);
  color: #133f8f;
}

.alert--success {
  border-left-color: var(--success-600);
  background: var(--success-050);
  color: #10603a;
}

/* Fields */
.field {
  margin-bottom: var(--space-5);
}

.field label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 560;
  color: var(--gray-800);
}

.field__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field__label-row label {
  margin-bottom: var(--space-2);
}

.field__hint {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: var(--gray-500);
}

.field__error {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  color: var(--danger-600);
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
  width: 100%;
  height: 40px;
  padding: 0 var(--space-3);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--gray-950);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--gray-950);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--gray-400);
}

input:hover:not(:disabled),
select:hover:not(:disabled) {
  border-color: var(--gray-400);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand-blue-500);
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

input[aria-invalid="true"] {
  border-color: var(--danger-600);
}

input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.2);
}

/* Password reveal */
.input-wrap {
  position: relative;
}

.input-wrap input {
  padding-right: 42px;
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  color: var(--gray-500);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
}

.reveal-button:hover {
  color: var(--gray-800);
  background: var(--gray-100);
}

/* Both icons share one grid cell so the button never grows to stack them.
   Visibility is driven by CSS, not the `hidden` attribute - these are SVG
   elements, and `hidden` does not hide them. */
.reveal-button svg {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
}

.reveal-button .icon-eye-off,
.reveal-button.is-revealed .icon-eye {
  display: none;
}

.reveal-button.is-revealed .icon-eye-off {
  display: block;
}

/* Checkbox */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
}

.checkbox-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-blue-600);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  height: 40px;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 570;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    box-shadow var(--transition);
}

.btn--primary {
  color: var(--white);
  background: var(--brand-blue-600);
}

.btn--primary:hover:not(:disabled) {
  background: #164fb0;
}

.btn--primary:active:not(:disabled) {
  background: #123f8e;
}

.btn--secondary {
  color: var(--gray-800);
  background: var(--white);
  border-color: var(--gray-300);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--gray-050);
  border-color: var(--gray-400);
}

.btn:disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.btn__icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Loading spinner inside the submit button */
.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 620ms linear infinite;
}

.btn.is-loading .spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}

/* Link-styled button (Forgot password) */
.link-button {
  padding: 0;
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 540;
  color: var(--brand-blue-600);
  background: none;
  border: none;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

/* Divider */
.divider {
  position: relative;
  margin: var(--space-5) 0;
  text-align: center;
}

.divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1px solid var(--gray-200);
}

.divider span {
  position: relative;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  color: var(--gray-500);
  background: var(--white);
}

/* Footer + demo hint */
.form-footer {
  margin: var(--space-6) 0 0;
  font-size: var(--text-xs);
  color: var(--gray-500);
  text-align: center;
}

.demo-hint {
  width: 100%;
  max-width: 396px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--gray-600);
  background: var(--gray-050);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
}

.demo-hint strong {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--gray-800);
}

.demo-hint code {
  font-size: var(--text-xs);
  color: var(--gray-800);
  background: var(--gray-200);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
}

/* ---------------------------------------------------------------- Responsive */

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

  .brand-panel {
    display: none;
  }

  .form-card__mobile-brand {
    display: flex;
  }

  .form-panel {
    justify-content: flex-start;
    padding: var(--space-6) var(--space-5);
  }
}
