/* =====================================================================
   Sign in, sign up, forgot and reset password, the sign-in code and team
   sign-up (templates/auth_base.html). Tokens only (tessamed-tokens.css):
   a navy panel beside the form on cream, one light heading, cobalt for the
   single primary action, the status tones for notices.
   No shadow, no gradient (the logo's dot is the logo), no motion.
   ===================================================================== */

/* ── The split: navy panel and form column ── */
.tm-auth-split {
  display: grid;
  grid-template-columns: minmax(360px, 42%) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--tm-cream);
}

/* As tall as the window at least, and as tall as the form beside it: nothing in it is ever cut off */
.tm-auth-panel {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 40px clamp(32px, 4.5vw, 64px) 32px;
  background: var(--tm-night);
  color: var(--tm-on-night);
}
.tm-auth-split-team .tm-auth-panel { background: var(--tm-night-2); }

.tm-auth-logo { position: relative; z-index: 1; align-self: flex-start; text-decoration: none; border-radius: 6px; }
.tm-auth-logo:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(255,255,255,.45); }

.tm-auth-pitch { position: relative; z-index: 1; margin: auto 0; padding: 48px 0; max-width: 30rem; }

/* The one brand moment: the whisper-light line of the TessaMed site */
.tm-auth-line {
  font-size: var(--tm-text-h1);
  font-weight: var(--tm-weight-display);
  letter-spacing: var(--tm-track-h1);
  line-height: var(--tm-leading-tight);
  color: var(--tm-on-night);
  margin: 0 0 var(--tm-space-5);
}
.tm-auth-lede {
  font-size: var(--tm-text-lead);
  line-height: 1.55;
  color: var(--tm-on-night-muted);
  margin: 0 0 var(--tm-space-6);
  max-width: 36ch;
}
.tm-auth-status { display: flex; align-items: baseline; gap: 10px; font-size: 14px; color: var(--tm-on-night-muted); margin: 0; }
.tm-auth-live { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--tm-cobalt); transform: translateY(-1px); }

.tm-auth-eyebrow { color: var(--tm-on-night-muted); margin: 0 0 var(--tm-space-4); }

/* The team's panel: the steps of a team sign-in, the current one in cobalt */
.tm-auth-stages { list-style: none; counter-reset: tm-stage; padding: 0; margin: var(--tm-space-6) 0 0; display: grid; gap: 14px; }
.tm-auth-stages li {
  counter-increment: tm-stage;
  display: flex; align-items: center; gap: 14px;
  font-size: 15px; color: var(--tm-on-night-muted);
}
.tm-auth-stages li::before {
  content: counter(tm-stage);
  flex: 0 0 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--tm-hairline-night);
  font-family: var(--tm-font-mono); font-size: 13px;
}
.tm-auth-stages li.is-done::before { border-color: var(--tm-on-night-muted); }
.tm-auth-stages li[aria-current="step"] { color: var(--tm-on-night); }
.tm-auth-stages li[aria-current="step"]::before { border-color: var(--tm-cobalt); background: var(--tm-cobalt); color: #fff; }

.tm-auth-foot { position: relative; z-index: 1; margin: 0; font-size: 13px; color: var(--tm-on-night-muted); }

/* The logo's ring, oversize and cropped off the panel's corner: decoration only */
.tm-auth-art { position: absolute; right: -190px; bottom: -200px; z-index: 0; line-height: 0; pointer-events: none; }
.tm-auth-art .tm-ring { display: block; width: 560px; height: 560px; }
/* The team's: smaller, in the top corner, with its multicoloured dot in full */
.tm-auth-split-team .tm-auth-art { top: -150px; right: -70px; bottom: auto; }
.tm-auth-split-team .tm-auth-art .tm-ring { width: 420px; height: 420px; }

/* ── The form column ── */
.tm-auth-main {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 56px clamp(24px, 5vw, 72px) 72px;
}
.tm-auth { width: 100%; max-width: 440px; margin: 0 auto; }
.tm-auth.tm-auth-wide { max-width: 560px; }
/* The sign-up's steps differ in height: start at a fixed place so the heading does not move */
.tm-auth-main:has(.tm-auth-wide) { justify-content: flex-start; padding-top: clamp(40px, 9vh, 96px); }

.tm-auth-title {
  font-size: 34px;
  font-weight: var(--tm-weight-display);
  letter-spacing: -0.9px;
  line-height: var(--tm-leading-tight);
  color: var(--tm-night);
  margin: 0 0 var(--tm-space-2);
}
.tm-auth-lead {
  font-size: 15px;
  color: var(--tm-secondary);
  line-height: 1.5;
  margin: 0;
  max-width: 52ch;
}
.tm-auth-body { margin-top: var(--tm-space-6); }

/* Notices sit above the form they are about */
.tm-auth-notice { font-size: 14.5px; line-height: 1.5; margin-bottom: var(--tm-space-5); }
.tm-auth-notice:focus { outline: none; box-shadow: var(--tm-focus-ring); }

/* Fields: white on cream, so each one reads as a place to type */
.tm-auth .form-control, .tm-auth .form-select { min-height: 48px; font-size: 16px; background-color: var(--tm-white); }   /* 16px: no zoom on iPhone */
.tm-auth .form-control::placeholder { color: var(--tm-muted); opacity: 1; }
.tm-auth .form-text { color: var(--tm-secondary); }
.tm-auth .form-label { margin-bottom: 6px; font-weight: 500; color: var(--tm-night); }
.tm-field { margin-bottom: var(--tm-space-5); }

/* Label row with a link at the far end (Password ... Forgot password?) */
.tm-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--tm-space-3); }
.tm-label-row a { font-size: 13px; font-weight: 500; }

/* Show / Hide: a written button inside the field's group, reachable by keyboard */
.tm-reveal {
  min-width: 64px;
  font-size: 13px;
  border: 1.5px solid var(--tm-input-border);
  border-left: 0;
  background: var(--tm-white);   /* the field's own colour: one control, not two */
  color: var(--tm-night);
  border-radius: 0 var(--tm-radius-input) var(--tm-radius-input) 0 !important;
}
.tm-reveal:hover { background: var(--tm-off); color: var(--tm-night); }
.tm-reveal:focus-visible { box-shadow: var(--tm-focus-ring); position: relative; z-index: 3; }
/* Edge draws its own eye inside password fields; the Show button already does that job */
.tm-auth input[type="password"]::-ms-reveal, .tm-auth input[type="password"]::-ms-clear { display: none; }

/* Short notes under a field: Caps Lock, a field the person missed */
.tm-note { display: block; font-size: 13px; margin-top: 6px; }
.tm-note-warn { color: var(--tm-status-pending-fg); }
.tm-note-act  { color: var(--tm-status-action-fg); }
.tm-auth .form-control.is-invalid, .tm-auth .form-select.is-invalid {
  border-color: var(--tm-status-action-fg);
  background-image: none;
  padding-right: .75rem;
}
.tm-auth .form-check-input.is-invalid { border-color: var(--tm-status-action-fg); }
.tm-auth .form-check-input.is-invalid ~ .form-check-label { color: inherit; }

/* Primary action */
.tm-auth .btn-lg { min-height: 50px; font-size: 16px; }
.tm-auth .btn[aria-busy="true"] { opacity: .7; cursor: progress; }

/* Divider before the passkey button */
.tm-or { display: flex; align-items: center; gap: var(--tm-space-3); margin: var(--tm-space-5) 0 var(--tm-space-4); color: var(--tm-muted); font-size: 13px; }
.tm-or::before, .tm-or::after { content: ""; flex: 1; border-top: 1px solid var(--tm-line); }

/* Quiet links and help under the form */
.tm-auth-after { margin-top: var(--tm-space-6); padding-top: var(--tm-space-5); border-top: 1px solid var(--tm-line); font-size: 14.5px; color: var(--tm-secondary); line-height: 1.6; }
.tm-auth-after p { margin: 0 0 var(--tm-space-2); }
.tm-auth-after a { font-weight: 500; }
.tm-auth-help { font-size: 13px; color: var(--tm-muted); }

/* Text inside state messages (check your email, link expired, ...) */
.tm-auth-body > p { line-height: 1.6; }
.tm-auth-small { font-size: 13px; color: var(--tm-secondary); }

/* Sign-up: the form's parts, each under a small heading and a hairline */
.tm-part { border: 0; padding: 0; margin: 0 0 var(--tm-space-5); min-width: 0; }
/* The hairline is drawn on the legend, not the fieldset: a fieldset border runs through its legend,
   and Bootstrap's floated legend makes a grid row after it lose its gutter offset (uneven gaps) */
.tm-part-title, .tm-part > legend {
  float: none; width: 100%;
  font-size: 15px; font-weight: 500; color: var(--tm-night);
  margin: 0 0 var(--tm-space-3); padding: 0;
}
.tm-part + .tm-part > legend,
.tm-step + .tm-step > .tm-part:first-child > legend { border-top: 1px solid var(--tm-line); padding-top: var(--tm-space-5); }
.tm-part[hidden] { display: none; }

/* Role choice: the whole option is the target, the chosen one gets a navy edge */
.tm-choice { display: grid; gap: var(--tm-space-2); }
.tm-choice .form-check {
  margin: 0; padding: 12px 14px 12px 42px;
  border: 1.5px solid var(--tm-border); border-radius: var(--tm-radius-input);
  background: var(--tm-white); cursor: pointer;
}
.tm-choice .form-check:has(.form-check-input:checked) { border-color: var(--tm-night); background: var(--tm-sand); }
.tm-choice .form-check-input { margin-left: -28px; margin-top: .3em; cursor: pointer; }
.tm-choice .form-check-label { cursor: pointer; display: block; }
.tm-choice .form-check-label strong { font-weight: 500; color: var(--tm-night); }
.tm-choice-hint { display: block; font-size: 13px; color: var(--tm-secondary); margin-top: 2px; }

/* ── Sign-up in steps (form[data-tm-steps], static/js/tessamed-auth.js). Without the script every
      step shows, one under the other: the whole form, as before ── */
.tm-step[hidden] { display: none; }
form.tm-stepping .tm-step > .tm-part:first-child > legend { border-top: 0; padding-top: 0; }
.tm-progress { margin: 0 0 var(--tm-space-5); }
.tm-progress-text { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.tm-progress-text:focus { outline: none; }
.tm-progress-text:focus-visible { box-shadow: var(--tm-focus-ring); border-radius: 4px; }
.tm-progress-count { font-family: var(--tm-font-mono); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--tm-muted); }
.tm-progress-name { font-size: 15px; font-weight: 500; color: var(--tm-night); }
.tm-progress-bar { height: 4px; border-radius: 4px; background: var(--tm-line); overflow: hidden; }
.tm-progress-bar > span { display: block; height: 100%; width: 0; background: var(--tm-cobalt); }
.tm-step-nav { display: flex; gap: var(--tm-space-3); margin-top: var(--tm-space-2); }
.tm-step-nav .btn { min-width: 112px; }
.tm-step-nav [data-tm-next] { flex: 1 1 auto; }
.tm-step-nav [hidden] { display: none; }
form.tm-on-last .tm-step-nav { margin-top: var(--tm-space-3); }
.tm-recap { font-size: 14.5px; color: var(--tm-body); background: var(--tm-sand); border: 1px solid var(--tm-border);
  border-radius: var(--tm-radius-input); padding: 10px 14px; margin: 0 0 var(--tm-space-4); }
.tm-recap .btn-link { font-size: 14.5px; font-weight: 500; vertical-align: baseline; }

/* The TessaMed team's way in: a quiet link in the form column's corner, not for practice staff */
.tm-auth-corner { position: absolute; right: 24px; bottom: 18px; font-size: 12px; }
.tm-auth-corner a { color: var(--tm-muted); text-decoration: none; }
.tm-auth-corner a:hover, .tm-auth-corner a:focus-visible { color: var(--tm-night); text-decoration: underline; }

/* The sign-in code: the setup QR on white with room around it, and the code typed large */
.tm-qr { display: block; width: 192px; height: 192px; margin: 0 auto var(--tm-space-4); background: #fff;
  border: 1px solid var(--tm-border); border-radius: var(--tm-radius-input); padding: 8px; }
.tm-secret { font-family: var(--tm-font-mono); font-size: 13px; letter-spacing: .5px; word-break: break-all;
  background: var(--tm-off); border-radius: var(--tm-radius-input); padding: 8px 12px; color: var(--tm-night); }
.tm-code-input { font-family: var(--tm-font-mono); font-size: 24px !important; letter-spacing: 6px; text-align: center; }
.tm-steps { padding-left: 1.2em; margin-bottom: var(--tm-space-4); }
.tm-steps li { margin-bottom: 6px; }

/* ── Tablets and phones: the panel becomes a navy band across the top, the form follows ── */
@media (max-width: 991.98px) {
  .tm-auth-split { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .tm-auth-panel { min-height: 0; padding: 18px 20px 22px; }
  .tm-auth-pitch { margin: 14px 0 0; padding: 0; max-width: 36rem; }
  .tm-auth-line { font-size: 24px; letter-spacing: -0.5px; margin: 0; }
  .tm-auth-eyebrow { margin-bottom: 6px; }
  .tm-auth-lede, .tm-auth-status, .tm-auth-stages, .tm-auth-foot, .tm-auth-art { display: none; }
  .tm-auth-main, .tm-auth-main:has(.tm-auth-wide) { justify-content: flex-start; padding: 28px 20px 32px; }
  .tm-auth-corner { position: static; text-align: right; margin: var(--tm-space-6) 0 0; }
}
@media (max-width: 575.98px) {
  .tm-auth-title { font-size: 28px; }
  .tm-auth-line { font-size: 21px; }
  .tm-auth-body { margin-top: var(--tm-space-5); }
}
