/* Sign-in page — standalone (no app shell/sidebar). Reuses the app's color
   and radius language from styles.css but keeps its own token set since this
   page never mixes with the authenticated app chrome. */

:root {
  /* Color */
  --auth-navy-900: #0b2540;
  --auth-navy-800: #10314f;
  --auth-teal-500: #14b8a6;
  /* Darker than --auth-teal-500 specifically for surfaces that carry white text
     (e.g. the submit button gradient) — the lighter teal alone only reaches ~2.5:1
     contrast with white and fails WCAG 1.4.3; this stop keeps the button >= 4.5:1
     across the whole gradient while --auth-teal-500 stays for decorative accents. */
  --auth-teal-700: #0f766e;
  --auth-blue-500: #2f80ed;
  --auth-blue-600: #1d4ed8;
  --auth-accent: #f5a524;
  --auth-bg: #f4f7fb;
  --auth-card: #ffffff;
  --auth-text: #0f172a;
  --auth-muted: #64748b;
  --auth-muted-soft: #94a3b8;
  --auth-border: #dbe3ef;
  --auth-error: #b42318;
  --auth-error-bg: #fef3f2;
  --auth-error-border: #fecdca;

  /* Spacing (8px system) */
  --auth-space-1: 4px;
  --auth-space-2: 8px;
  --auth-space-3: 16px;
  --auth-space-4: 24px;
  --auth-space-5: 32px;
  --auth-space-6: 48px;
  --auth-space-7: 64px;

  /* Radius */
  --auth-radius-sm: 10px;
  --auth-radius-md: 12px;
  --auth-radius-lg: 14px;

  /* Control sizing */
  --auth-control-height: 52px;

  /* Type */
  --auth-font: "Segoe UI", Inter, Arial, sans-serif;
}

.auth-body {
  margin: 0;
  font-family: var(--auth-font);
  color: var(--auth-text);
  background: var(--auth-bg);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-main {
  flex: 1;
  display: grid;
  grid-template-columns: 60% 40%;
  min-height: 0;
}

/* ---------- Left: product intro ---------- */

.auth-intro {
  position: relative;
  background: linear-gradient(160deg, var(--auth-navy-900) 0%, var(--auth-navy-800) 55%, #0e3b52 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--auth-space-7) var(--auth-space-6);
  overflow: hidden;
}

.auth-intro-inner {
  position: relative;
  z-index: 1;
  max-width: 620px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--auth-space-2);
  margin-bottom: var(--auth-space-5);
}

.auth-brand-mark {
  width: 48px;
  height: 48px;
  border-radius: var(--auth-radius-sm);
  background: rgba(255, 255, 255, 0.08);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.auth-brand-mark img {
  width: 28px;
  height: 28px;
}

.auth-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-brand-name {
  font-size: 26px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.15;
}

.auth-brand-tagline {
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
}

.auth-intro-heading {
  margin: 0 0 var(--auth-space-3);
  font-size: 34px;
  line-height: 1.2;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.auth-intro-lead {
  margin: 0 0 var(--auth-space-5);
  font-size: 16px;
  line-height: 1.6;
  color: #cbd5e1;
  max-width: 520px;
}

.auth-feature-list {
  list-style: none;
  margin: 0 0 var(--auth-space-5);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--auth-space-4);
}

.auth-feature {
  display: flex;
  align-items: flex-start;
  gap: var(--auth-space-3);
}

.auth-feature-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 184, 166, 0.16);
  color: #5eead4;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.auth-feature-icon img {
  width: 20px;
  height: 20px;
  filter: invert(1) sepia(1) saturate(400%) hue-rotate(140deg) brightness(1.1);
}

.auth-feature-copy {
  font-size: 14.5px;
  line-height: 1.55;
  color: #cbd5e1;
  padding-top: 8px;
}

.auth-feature-copy strong {
  color: #f1f5f9;
  font-weight: 700;
}

.auth-intro-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #94a3b8;
  max-width: 480px;
}

.auth-art {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--auth-space-2);
  margin-top: var(--auth-space-6);
  max-width: 560px;
}

.auth-art-card {
  flex: 0 0 auto;
  width: 128px;
  padding: var(--auth-space-3);
  border-radius: var(--auth-radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: var(--auth-space-2);
}

.auth-art-line {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.35);
}

.auth-art-line.short {
  width: 60%;
}

.auth-art-line.accent {
  background: var(--auth-teal-500);
  width: 45%;
}

.auth-art-connector {
  flex: 1 1 auto;
  min-width: 40px;
  height: 32px;
  overflow: visible;
}

.auth-art-connector path {
  fill: none;
  stroke: var(--auth-teal-500);
  stroke-width: 2;
  opacity: 0.7;
}

.auth-art-connector circle {
  fill: var(--auth-teal-500);
}

/* ---------- Right: auth form ---------- */

.auth-panel {
  position: relative;
  background: var(--auth-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--auth-space-5);
}

.auth-panel-corner-logo {
  position: absolute;
  top: var(--auth-space-4);
  right: var(--auth-space-4);
  height: 56px;
  width: auto;
  object-fit: contain;
}

.auth-panel-inner {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-panel-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--auth-radius-md);
  background: var(--auth-bg);
  border: 1px solid var(--auth-border);
  display: grid;
  place-items: center;
  margin-bottom: var(--auth-space-3);
}

.auth-panel-icon img {
  width: 30px;
  height: 30px;
}

.auth-panel-heading {
  margin: 0 0 var(--auth-space-2);
  font-size: 26px;
  font-weight: 800;
  color: var(--auth-text);
}

.auth-panel-subtext {
  margin: 0 0 var(--auth-space-4);
  font-size: 14px;
  color: var(--auth-muted);
  line-height: 1.5;
}

.auth-alert {
  width: 100%;
  margin: 0 0 var(--auth-space-3);
  padding: var(--auth-space-2) var(--auth-space-3);
  border-radius: var(--auth-radius-sm);
  background: var(--auth-error-bg);
  border: 1px solid var(--auth-error-border);
  color: var(--auth-error);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
}

.auth-alert[hidden] {
  display: none;
}

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--auth-space-3);
  text-align: left;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--auth-space-1);
}

.auth-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--auth-text);
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: var(--auth-space-3);
  display: grid;
  place-items: center;
  color: var(--auth-muted-soft);
  pointer-events: none;
}

.auth-input-icon img {
  width: 18px;
  height: 18px;
  /* SVGs loaded via <img src> render in an isolated document, so CSS `color`
     never reaches their stroke="currentColor" — filter is the only way to tint them. */
  filter: brightness(0) saturate(100%) invert(46%);
}

.auth-input {
  width: 100%;
  height: var(--auth-control-height);
  padding: 0 var(--auth-space-3) 0 44px;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-sm);
  background: #ffffff;
  color: var(--auth-text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

#password {
  padding-right: 44px;
}

.auth-input::placeholder {
  color: var(--auth-muted-soft);
}

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

.auth-input:focus-visible {
  outline: none;
  border-color: var(--auth-blue-500);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.18);
}

.auth-input:disabled {
  background: #f1f5f9;
  color: var(--auth-muted-soft);
  cursor: not-allowed;
}

.auth-field.has-error .auth-input {
  border-color: var(--auth-error);
}

.auth-field.has-error .auth-input:focus-visible {
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16);
}

.auth-field-error {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--auth-error);
  line-height: 1.4;
}

.auth-field-error[hidden] {
  display: none;
}

.auth-visibility-toggle {
  position: absolute;
  right: 6px;
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: var(--auth-radius-sm);
  color: var(--auth-muted);
  cursor: pointer;
}

.auth-visibility-toggle img {
  width: 20px;
  height: 20px;
  filter: brightness(0) saturate(100%) invert(46%);
}

.auth-visibility-toggle:hover {
  background: var(--auth-bg);
}

.auth-visibility-toggle:focus-visible {
  outline: 2px solid var(--auth-blue-500);
  outline-offset: 2px;
}

.auth-visibility-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.auth-submit {
  height: var(--auth-control-height);
  margin-top: var(--auth-space-2);
  border: none;
  border-radius: var(--auth-radius-sm);
  background: linear-gradient(120deg, var(--auth-blue-600) 0%, var(--auth-teal-700) 100%);
  color: #ffffff;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--auth-space-2);
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.22);
}

.auth-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 28px rgba(29, 78, 216, 0.28);
}

.auth-submit:focus-visible {
  outline: 2px solid var(--auth-blue-600);
  outline-offset: 3px;
}

.auth-submit:disabled {
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
  background: #c4cfdf;
}

.auth-submit-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
}

.auth-submit.is-loading .auth-submit-spinner {
  display: inline-block;
  animation: auth-spin 0.8s linear infinite;
}

.auth-submit.is-loading .auth-submit-label {
  opacity: 0.85;
}

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

.auth-caption {
  margin: var(--auth-space-3) 0 0;
  font-size: 12.5px;
  color: var(--auth-muted);
}

/* ---------- Footer ---------- */

.auth-footer {
  flex-shrink: 0;
  width: 100%;
  padding: var(--auth-space-3) var(--auth-space-4);
  text-align: center;
  background: var(--auth-card);
  border-top: 1px solid var(--auth-border);
}

.auth-footer p {
  margin: 0;
  font-size: 12.5px;
  color: var(--auth-muted-soft);
}

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

@media (max-width: 1024px) {
  .auth-intro-heading {
    font-size: 28px;
  }

  .auth-intro {
    padding: var(--auth-space-6) var(--auth-space-5);
  }
}

@media (max-width: 860px) {
  .auth-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  /* Login comes first on small screens; intro art is simplified below it. */
  .auth-panel {
    order: 1;
    padding: var(--auth-space-6) var(--auth-space-4) var(--auth-space-4);
  }

  .auth-intro {
    order: 2;
    padding: var(--auth-space-5) var(--auth-space-4);
  }

  .auth-art {
    display: none;
  }
}

@media (max-width: 520px) {
  .auth-panel {
    padding: var(--auth-space-5) var(--auth-space-3) var(--auth-space-3);
  }

  .auth-intro {
    padding: var(--auth-space-4) var(--auth-space-3);
  }

  .auth-intro-heading {
    font-size: 24px;
  }

  .auth-feature-copy {
    font-size: 14px;
  }

  .auth-panel-heading {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-submit-spinner {
    animation: none;
  }

  .auth-submit,
  .auth-input,
  .auth-visibility-toggle {
    transition: none;
  }
}
