/* NanoHealth sign-in page — the HIMS login card (nh_server_app devise/sessions/new.html.erb,
   SignInForm.jsx). --cdp-primary-color is the HIMS default; a tenant's own colour is not sent yet. */
:root {
  --cdp-primary-color: #2563eb;
  --nh-ink: #0b1220;
  --nh-muted: #64748b;
  --nh-border: #d1d5db;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body.nh-page {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--nh-ink);
  background-color: #e8edf3;
  background-image: linear-gradient(135deg, #e8edf3 0%, #d7dfe9 100%);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.nh-shell {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 16px 32px;
}

.nh-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 24px 48px -16px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.nh-card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 24px 20px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--cdp-primary-color) 12%, white), white);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.nh-logo-link { display: block; line-height: 0; }
.nh-logo { width: 150px; max-width: 100%; height: 48px; object-fit: contain; visibility: hidden; }
.nh-logo.nh-ready { visibility: visible; }

.nh-title {
  font-size: 16px;
  font-weight: 600;
  margin-top: 12px;
  letter-spacing: -0.01em;
  color: var(--nh-ink);
}

.nh-card-body { padding: 20px 24px 20px; }

.nh-form { display: flex; flex-direction: column; gap: 8px; }

.nh-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 46px;
  border: 1px solid var(--nh-border);
  border-radius: 8px;
  background: #fff;
  transition: border-color 120ms, box-shadow 120ms;
}
.nh-field:focus-within {
  border-color: var(--cdp-primary-color);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--cdp-primary-color) 18%, transparent);
}
.nh-field input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0 40px 0 40px;
  font: inherit;
  font-size: 16px;
  color: var(--nh-ink);
}
.nh-field input::placeholder { color: #6b7280; }
.nh-field input[aria-invalid="true"] { color: #b91c1c; }

.nh-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  fill: #6b7280;
  pointer-events: none;
}

.nh-eye {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px;
}
.nh-eye svg { width: 100%; height: 100%; fill: #6b7280; }

/* The HIMS sum captcha: question box, refresh, answer. */
.nh-captcha { display: flex; align-items: center; gap: 8px; }
.nh-captcha-question {
  flex: none;
  height: 46px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  background: #f1f5f9;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--nh-ink);
  white-space: nowrap;
}
.nh-captcha-refresh {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 4px;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.nh-captcha-refresh svg { width: 100%; height: 100%; fill: #6b7280; }
.nh-captcha-refresh:hover svg { fill: var(--cdp-primary-color); }
.nh-captcha-answer {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 1px solid var(--nh-border);
  border-radius: 8px;
  padding: 0 12px;
  font: inherit;
  font-size: 16px;
  color: var(--nh-ink);
  outline: 0;
}
.nh-captcha-answer:focus {
  border-color: var(--cdp-primary-color);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--cdp-primary-color) 18%, transparent);
}
.nh-captcha-answer::placeholder { color: #6b7280; }

.nh-button {
  height: 46px;
  margin-top: 4px;
  border: 0;
  border-radius: 6px;
  background: var(--cdp-primary-color);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.nh-button:hover { filter: brightness(0.95); }
.nh-button:disabled { opacity: 0.7; cursor: default; }

.nh-center { text-align: center; margin-top: 12px; }

.nh-link {
  font-size: 12px;
  color: #1e3a8a;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nh-link:hover { color: var(--cdp-primary-color); }

.nh-alert {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}
.nh-form .nh-alert { margin: 0; }
.nh-alert-error { background: #fef2f2; color: #b91c1c; }
.nh-alert-warning { background: #fffbeb; color: #92400e; }
.nh-alert-success { background: #ecfdf5; color: #065f46; }
.nh-alert-info { background: #eff6ff; color: #1e40af; }

.nh-attempted {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.nh-remember { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--nh-muted); }

.nh-info { margin-top: 16px; text-align: center; font-size: 13px; color: var(--nh-muted); }

/* Other pages (forgot password, update password, notices) reuse the parent forms inside the card. */
.nh-card-body form:not(.nh-form) { display: flex; flex-direction: column; gap: 12px; }
.nh-card-body input[type="text"]:not(.nh-field input):not(.nh-captcha-answer), .nh-card-body input[type="email"]:not(.nh-field input),
.nh-card-body input[type="password"]:not(.nh-field input) {
  height: 46px; border: 1px solid var(--nh-border); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 16px;
}
.nh-card-body input[type="submit"], .nh-card-body button[type="submit"]:not(.nh-button) {
  height: 46px; border: 0; border-radius: 6px; background: var(--cdp-primary-color); color: #fff;
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.nh-card-body label:not(.nh-field):not(.nh-remember) { font-size: 13px; color: var(--nh-muted); }
.nh-card-body a { color: #1e3a8a; font-size: 13px; }
.nh-card-body #kc-form-options, .nh-card-body .kc-form-options { font-size: 13px; }

@media (max-width: 420px) {
  .nh-shell { padding-top: 32px; }
}
