/* Reset and base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --page-bg: #ffffff; /* white page background */
  --surface: #ffffff;
  --text: #1d2327; /* default text */
  --muted: #646970; /* gray */
  --border: #dcdcde;
  --primary: #3858e9;
  --primary-hover: #2145e6;
  --primary-active: #1d3ec4;
  --input-border: #8c8f94;
  --error: #d63638;

  --radius: 12px;
  --shadow: 0 10px 30px rgba(0,0,0,0.08);

  /* Scrollbar colors */
  --scrollbarBG: #e7e8ea;
  --thumbBG: #b9bcc2;
}

/* Keep page white even in dark mode, per request */
@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #ffffff;
    --surface: #ffffff;
    --text: #1d2327;
    --muted: #646970;
    --border: #dcdcde;
    --primary: #3858e9;
    --primary-hover: #2145e6;
    --primary-active: #1d3ec4;
    --input-border: #8c8f94;
    --error: #d63638;
    --scrollbarBG: #e7e8ea;
    --thumbBG: #b9bcc2;
  }
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--page-bg);
  color: var(--text);
  line-height: 1.5;
}

/* Custom scrollbar (WebKit + Firefox), only for pointer: fine devices */
@media (hover: hover) and (pointer: fine) {
  html {
    scrollbar-width: thin;
    scrollbar-color: var(--thumbBG) var(--scrollbarBG);
  }
  body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  body::-webkit-scrollbar-track {
    background: var(--scrollbarBG);
  }
  body::-webkit-scrollbar-thumb {
    background-color: var(--thumbBG);
    border-radius: 6px;
    border: 2px solid var(--scrollbarBG);
  }
}

/* Reduce motion when requested */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Layout shell */
.layout {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* Top bar (exact height: 45px) */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 45px;            /* exact header height requested */
  padding: 0 16px;         /* compact vertical padding to fit 45px height */
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-bar__left, .top-bar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Logo sized to fit the 45px header cleanly */
.top-bar__logo {
  display: block;
  height: 28px;  /* fits within 45px header neatly */
  width: auto;   /* keep aspect ratio */
}

/* Right link button style */
.link-button {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.link-button:hover { text-decoration: underline; }

/* Content area: center vertically and horizontally minus header */
.layout__content {
  display: grid;
  min-height: calc(100vh - 45px);
  place-items: center;      /* center both axes */
  padding: 28px 16px;       /* balanced padding with vertical centering */
}

/* Main login shell */
.login-shell {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 22px;
}

/* Heading (centered under header logo) */
.login-heading {
  text-align: center;
  max-width: 760px;
}

/* Title: Merriweather (serif), bold, classic black */
.page-title {
  font-family: "Merriweather", Georgia, "Times New Roman", Times, serif;
  font-size: 30px;
  font-weight: 700 !important; /* force bold per request */
  letter-spacing: -0.2px;
  margin-bottom: 12px; /* pixel spacing below title */
  color: #000000; /* classic black */
}

/* Subtext: Open Sans (sans-serif), regular, light gray */
.page-subtitle {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color: #6b7280; /* light gray */
  font-size: 14px;
  line-height: 1.7;
  margin-top: 0; /* already spaced via title margin-bottom */
}
.inline-link {
  color: var(--primary);
  text-decoration: none;
}
.inline-link:hover { text-decoration: underline; }

/* Centered group to position the login form in the center, no card/cadre */
.login-center-group {
  width: 100%;
  display: grid;
  justify-items: center; /* center horizontally */
  padding: 0 16px;
}

/* Form (centered, no card) */
.login-form {
  width: 100%;
  max-width: 460px; /* keep readable width */
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  gap: 8px;
}

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

.form-text-input {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
  background: var(--surface);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.form-text-input::placeholder { color: var(--muted); }

.form-text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 20%, transparent);
}

.form-password-input {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
}
.password-toggle:hover {
  color: var(--text);
  background: color-mix(in oklab, var(--muted) 10%, transparent);
}

/* Error */
.form-error {
  display: none;
  margin-top: 4px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--error);
  color: var(--error);
  border-radius: 8px;
  background: color-mix(in oklab, var(--error) 12%, transparent);
}
.form-error.visible { display: block; }

/* Actions & primary button */
.form-actions {
  margin-top: 4px;
  display: flex;                 /* center the button horizontally */
  justify-content: center;       /* center within the form row */
}

.components-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;       /* center text/icon inside the button */
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  transition: background-color 160ms ease, color 160ms ease, transform 80ms ease, border-color 160ms ease;
  text-align: center;            /* ensure text centering */
}

/* Make the login button wider and keep it centered */
.login-button {
  width: 320px;                  /* larger width */
  max-width: 100%;               /* don't overflow small screens */
}

.is-next-40px-default-size { min-height: 40px; }

.is-primary {
  background: var(--primary);
  color: #fff;
}
.is-primary:hover { background: var(--primary-hover); }
.is-primary:active {
  background: var(--primary-active);
  transform: translateY(1px);
}
.components-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.components-button.is-loading {
  position: relative;
}
.components-button.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  border-right-color: transparent;
  display: inline-block;
  vertical-align: middle;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

/* Footer links row */
.one-login__footer {
  margin-top: 12px;
  display: flex;
  justify-content: flex-start;
}
.one-login__footer-link {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
}
.one-login__footer-link:hover { text-decoration: underline; }

/* Accessibility helper */
.screen-reader-text,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Responsive */
@media (max-width: 640px) {
  .top-bar { padding: 0 14px; height: 45px; } /* keep exact height on mobile */
  .top-bar__logo { height: 24px; width: auto; } /* slightly smaller logo on mobile */
  .layout__content { min-height: calc(100vh - 45px); place-items: center; padding: 22px 12px; }
  .page-title { font-size: 26px; }
}

/* Narrow devices: button goes full width if needed */
@media (max-width: 400px) {
  .login-button { width: 100%; }
}