/*
 * Sign-in, password reset and related pages.
 * Self-contained (no Tailwind runtime). Brand colours come from the theme via
 * --auth-primary* set in auth/auth_base.html.
 */
:root {
  --auth-primary: #e54f38;
  --auth-primary-strong: #ac3b2a;
  --auth-primary-soft: #fff5f1;
  --auth-primary-ring: #f7c8c1;
  --auth-text: #111827;
  --auth-muted: #6b7280;
  --auth-border: #e5e7eb;
  --auth-border-strong: #d1d5db;
  --auth-surface: #ffffff;
  --auth-page: #f9fafb;
  --auth-danger: #b42318;
  --auth-danger-bg: #fef3f2;
  --auth-danger-border: #fecdca;
  --auth-warn: #93370d;
  --auth-warn-bg: #fffaeb;
  --auth-warn-border: #fedf89;
  --auth-success: #067647;
  --auth-success-bg: #ecfdf3;
  --auth-success-border: #abefc6;
  --auth-info: #175cd3;
  --auth-info-bg: #eff8ff;
  --auth-info-border: #b2ddff;
  --auth-radius: 10px;
}

/* Page-level rules apply to the standalone auth pages only (body.auth);
   the .auth-* components below can also be used inside the app (.auth-ui). */
body.auth,
body.auth *,
body.auth *::before,
body.auth *::after,
.auth-ui,
.auth-ui *,
.auth-ui *::before,
.auth-ui *::after {
  box-sizing: border-box;
}

body.auth {
  margin: 0;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--auth-page);
  color: var(--auth-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

:where(.auth-ui) a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 500;
}

:where(.auth-ui) a:hover {
  color: var(--auth-primary-strong);
  text-decoration: underline;
}

:where(.auth-ui) a:focus-visible,
:where(.auth-ui) button:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------------------------------------------------------------- brand side */
.auth-brand {
  display: none;
  position: relative;
  flex: 0 0 44%;
  max-width: 620px;
  overflow: hidden;
  color: #fff;
  background: var(--auth-primary);
  background-image:
    radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.18), transparent 45%),
    radial-gradient(circle at 90% 95%, rgba(0, 0, 0, 0.18), transparent 50%);
}

.auth-brand::after {
  /* faint grid for texture */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 80%);
  pointer-events: none;
}

.auth-brand__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 48px 56px;
}

.auth-brand__identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-brand__headline {
  margin: 0 0 24px;
  max-width: 14em;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.auth-brand__points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.92);
}

.auth-brand__points li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand__points li::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='m6 10.5 2.6 2.5L14 7.5'/%3E%3C/svg%3E")
    center / 14px no-repeat;
}

.auth-brand__foot {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

/* ---------------------------------------------------------------- brand mark */
.auth-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--auth-primary);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.auth-brand .auth-mark {
  background: #fff;
  color: var(--auth-primary);
}

.auth-mark--lg {
  width: 44px;
  height: 44px;
  font-size: 22px;
}

.auth-mark--image {
  object-fit: contain;
  background: #fff;
  padding: 4px;
}

/* ---------------------------------------------------------------- form side */
.auth-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--auth-surface);
}

.auth-panel {
  width: 100%;
  max-width: 400px;
}

.auth-panel__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-panel__name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin: 0 0 28px;
  color: var(--auth-muted);
}

.auth-form {
  display: grid;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

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

.auth-label {
  font-size: 14px;
  font-weight: 500;
  color: #344054;
}

.auth-field__label-row a {
  font-size: 13px;
}

.auth-input-wrap {
  position: relative;
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--auth-border-strong);
  border-radius: var(--auth-radius);
  background: #fff;
  color: var(--auth-text);
  font: inherit;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-input::placeholder {
  color: #9ca3af;
}

.auth-input:hover {
  border-color: #9ca3af;
}

.auth-input:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px var(--auth-primary-soft), 0 0 0 1px var(--auth-primary);
}

.auth-input--password {
  padding-right: 48px;
}

.auth-field--invalid .auth-input {
  border-color: var(--auth-danger);
}

.auth-field--invalid .auth-input:focus {
  box-shadow: 0 0 0 4px var(--auth-danger-bg), 0 0 0 1px var(--auth-danger);
}

.auth-input__toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--auth-muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.auth-input__toggle:hover {
  background: #f3f4f6;
  color: var(--auth-text);
}

.auth-input__toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-input__toggle .auth-icon-hide,
.auth-input__toggle[aria-pressed="true"] .auth-icon-show {
  display: none;
}

.auth-input__toggle[aria-pressed="true"] .auth-icon-hide {
  display: block;
}

.auth-hint {
  margin: 0;
  font-size: 13px;
  color: var(--auth-muted);
}

.auth-hint--warn {
  color: var(--auth-warn);
}

.auth-errors {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--auth-danger);
}

/* ---------------------------------------------------------------- buttons */
.auth-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  margin-top: 4px;
  padding: 0 18px;
  border: 1px solid var(--auth-primary);
  border-radius: var(--auth-radius);
  background: var(--auth-primary);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
  transition: background-color 0.15s, border-color 0.15s;
}

.auth-button:hover {
  background: var(--auth-primary-strong);
  border-color: var(--auth-primary-strong);
  color: #fff;
  text-decoration: none;
}

.auth-button:disabled {
  cursor: progress;
  opacity: 0.8;
}

.auth-button--secondary {
  background: #fff;
  border-color: var(--auth-border-strong);
  color: #344054;
}

.auth-button--secondary:hover {
  background: #f9fafb;
  border-color: var(--auth-border-strong);
  color: var(--auth-text);
}

.auth-button.is-busy::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}

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

.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--auth-muted);
}

.auth-back:hover {
  color: var(--auth-text);
}

.auth-back svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-center {
  text-align: center;
}

/* ---------------------------------------------------------------- status icon */
.auth-status-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border-radius: 14px;
  background: var(--auth-primary-soft);
  color: var(--auth-primary);
}

.auth-status-icon--danger {
  background: var(--auth-danger-bg);
  color: var(--auth-danger);
}

.auth-status-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- alerts */
.auth-alerts {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--auth-info-border);
  border-radius: var(--auth-radius);
  background: var(--auth-info-bg);
  color: var(--auth-info);
  font-size: 14px;
  animation: auth-fade-in 0.2s ease-out;
}

.auth-alert svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.auth-alert--error {
  border-color: var(--auth-danger-border);
  background: var(--auth-danger-bg);
  color: var(--auth-danger);
}

.auth-alert--warning {
  border-color: var(--auth-warn-border);
  background: var(--auth-warn-bg);
  color: var(--auth-warn);
}

.auth-alert--success {
  border-color: var(--auth-success-border);
  background: var(--auth-success-bg);
  color: var(--auth-success);
}

@keyframes auth-fade-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

/* ---------------------------------------------------------------- layout */
@media (min-width: 960px) {
  .auth-brand {
    display: block;
  }

  .auth-panel__identity {
    display: none;
  }

  .auth-main {
    padding: 48px;
  }
}

@media (max-width: 959.98px) {
  .auth-main {
    align-items: flex-start;
    padding-top: 48px;
    background: var(--auth-surface);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-alert,
  .auth-button.is-busy::before {
    animation: none;
  }
}

/* ---------------------------------------------------------------- account line */
.auth-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: -12px 0 24px;
  padding: 10px 12px;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  background: var(--auth-page);
  font-size: 14px;
  color: var(--auth-muted);
}

.auth-account strong {
  color: var(--auth-text);
  font-weight: 600;
}

.auth-account a {
  margin-left: auto;
}

/* ---------------------------------------------------------------- password rules */
.auth-rules {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--auth-muted);
}

.auth-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-rules li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--auth-border-strong);
  transition: background-color 0.15s;
}

.auth-rules li.is-met {
  color: var(--auth-success);
}

.auth-rules li.is-met::before {
  background: var(--auth-success);
}

/* ---------------------------------------------------------------- in-app card */
.auth-card {
  width: 100%;
  max-width: 480px;
  margin: 8px 0 32px;
  padding: 28px;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  background: var(--auth-surface);
  color: var(--auth-text);
}

.auth-card .auth-title {
  font-size: 22px;
}

.auth-card .auth-subtitle {
  margin-bottom: 24px;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.auth-actions .auth-button {
  width: auto;
  margin-top: 0;
}

@media (max-width: 575.98px) {
  .auth-card {
    padding: 20px;
  }

  .auth-actions {
    flex-direction: column-reverse;
  }

  .auth-actions .auth-button {
    width: 100%;
  }
}
