/* The Mobile Doctor: sign in / sign up.
 * A rounded card on a soft grey backdrop: solid brand-blue half, white half,
 * underline-only fields, pill button, a ring accent.
 * Self-contained, no framework, no webfonts, no external requests. */

:root {
  color-scheme: light;
  --ink: #0a0a0a; --ink-2: #141414; --ink-3: #1f1f1f;
  --line: #cfd4d9; --bg-2: #f4f6f8;
  --brand: #0070ac; --brand-d: #005a8c; --brand-soft: #e7f2f9;
  --red: #d6382b; --danger: #b3261e; --danger-soft: #fdeeed;
  --ok-soft: #e8f5ee; --warn-soft: #fbf7e8; --warn-line: #e3d9b8; --warn-ink: #5d4a0a;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.auth { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; font-family: var(--font); color: var(--ink); background: #e9ecef; -webkit-font-smoothing: antialiased; line-height: 1.5; position: relative; overflow-x: hidden; }
/* soft blurred photo backdrop, like a frosted office behind the card */
body.auth::before { content: ""; position: fixed; inset: -40px; background: url("/assets/img/ambulance-yellow-640.jpg") center / cover no-repeat; filter: blur(26px) grayscale(1) brightness(1.5); opacity: .16; z-index: 0; }
.stage a { color: var(--brand); text-decoration: none; }
.stage a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ico { width: 1.1rem; height: 1.1rem; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.stage { position: relative; z-index: 1; flex: 1; display: grid; place-items: center; padding: 28px 16px; }
.ch-nav, .ch-foot, .ch-sosbar { position: relative; z-index: 2; }
.ch-nav { position: sticky; }
.board { position: relative; width: 100%; max-width: 920px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 22px; background: #fff; box-shadow: 0 18px 50px -20px rgba(30, 45, 60, .35); }
.is-register .board { max-width: 1040px; }

/* Blue half */
.side { background: var(--brand); color: #fff; border-radius: 22px 0 0 22px; display: flex; align-items: center; }
.side-in { padding: 48px 44px; width: 100%; }
.side-logo { display: inline-block; margin: 0 0 22px; background: #fff; border-radius: 12px; padding: 8px 14px; }
.side-logo img { display: block; width: 150px; height: auto; }
.side h2 { margin: 0; font-size: 1.6rem; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; max-width: 14ch; }
.side .bar { display: block; width: 84px; height: 2px; background: #fff; margin: 12px 0 16px; }
.side p { margin: 0 0 22px; color: #e6f2f9; font-size: .96rem; max-width: 32ch; }
.pill-outline { display: inline-flex; align-items: center; min-height: 38px; padding: 0 22px; border: 1px solid rgba(255,255,255,.85); border-radius: 999px; color: #fff !important; font-size: .9rem; font-weight: 600; text-decoration: none !important; transition: background-color .15s; }
.pill-outline:hover { background: rgba(255,255,255,.14); }
.side-sos { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: #fff !important; font-size: .86rem; opacity: .9; text-decoration: none !important; }
.side-sos:hover { opacity: 1; text-decoration: underline !important; text-underline-offset: 3px; }

/* White half */
.form-side { padding: 44px 48px 22px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }

.card { width: 100%; max-width: 300px; margin: 0 auto; }
.card.wide { max-width: 100%; }
.card h1 { margin: 0; text-align: center; font-size: 1.55rem; font-weight: 700; color: #0a0a0a; letter-spacing: -.01em; }
.card h1::after { content: ""; display: block; width: 28px; height: 3px; background: var(--brand); margin: 8px auto 0; }
.card .sub { margin: 10px 0 18px; text-align: center; color: var(--ink-3); font-size: .9rem; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin: 0 auto 12px; border: 1px solid; max-width: 100%; }
.alert.err { background: var(--danger-soft); color: #6f1a15; border-color: #f0c4c1; }
.alert.ok { background: var(--ok-soft); color: #0b4a2e; border-color: #bfe0cd; }
.alert .ico { margin-top: 2px; }

form { display: grid; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Underline fields. No placeholder text: the label rests on the line and floats up when filled or focused. */
.field { position: relative; }
.field input, .field select { width: 100%; appearance: none; -webkit-appearance: none; font: inherit; font-size: 1rem; color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 22px 2px 6px; min-height: 48px; transition: border-color .15s; }
.field select { padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%230a0a0a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.field input:focus, .field select:focus { outline: none; border-bottom: 2px solid var(--brand); padding-bottom: 5px; }
.field label { position: absolute; left: 2px; top: 16px; color: var(--ink-3); font-size: .95rem; pointer-events: none; transform-origin: left top; transition: transform .15s ease, color .15s ease; }
.field input:focus ~ label, .field input:not(:placeholder-shown) ~ label, .field select ~ label { transform: translateY(-14px) scale(.78); }
.field input:focus ~ label, .field select:focus ~ label { color: var(--brand); }
.field.has-toggle input { padding-right: 40px; }
.field input::placeholder { color: transparent; }
.field input[aria-invalid="true"] { border-bottom-color: var(--danger); }
.field input[type="file"] { padding: 26px 2px 8px; cursor: pointer; font-size: .88rem; }
.field input[type="file"] ~ label { transform: translateY(-14px) scale(.78); }
.field input[type="file"]::file-selector-button { margin-right: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .82rem; background: #fff; color: var(--ink); cursor: pointer; font-weight: 600; }
.eye { position: absolute; right: 0; top: 50%; transform: translateY(-40%); width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.eye:hover { color: var(--ink); background: var(--bg-2); }
.eye .off { display: none; }
.eye[aria-pressed="true"] .on { display: none; }
.eye[aria-pressed="true"] .off { display: block; }
.hint { font-size: .8rem; color: var(--ink-3); margin: 4px 2px 0; }
.hint.bad { color: var(--danger); }
.caps { font-size: .8rem; color: var(--warn-ink); margin: 4px 2px 0; }
.line-between { display: flex; justify-content: flex-end; margin: -8px 0 0; font-size: .85rem; }

/* Pill button */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; margin-top: 6px; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--brand); box-shadow: 0 7px 14px -6px rgba(0, 90, 140, .55); transition: background-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--brand-d); box-shadow: 0 9px 16px -6px rgba(0, 90, 140, .6); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .7; cursor: progress; }
.btn .spin { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.loading .spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); min-height: 38px; width: auto; margin: 0; padding: 0 16px; font-size: .82rem; letter-spacing: .03em; text-transform: none; box-shadow: none; font-weight: 600; }
.btn.ghost:hover { border-color: var(--ink-3); background: #fff; box-shadow: none; }

.alt { text-align: center; margin: 14px 0 0; color: var(--ink-2); font-size: .9rem; }
.alt a { font-weight: 600; }
.fine { text-align: center; font-size: .78rem; color: var(--ink-3); margin: 0 auto; max-width: 40ch; }

/* Role picker */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: .82rem; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.roles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.role { position: relative; display: block; cursor: pointer; }
.role input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.role .body { display: flex; gap: 10px; align-items: center; height: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .12s, background-color .12s; }
.role input:checked + .body { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.role input:focus-visible + .body { outline: 2px solid var(--brand); outline-offset: 2px; }
.role .ri { color: var(--ink-3); display: grid; place-items: center; flex: none; }
.role input:checked + .body .ri { color: var(--brand); }
.role b { display: block; font-size: .88rem; line-height: 1.2; }
.role small { display: block; font-size: .74rem; color: var(--ink-3); line-height: 1.25; margin-top: 1px; }
.role.full { grid-column: 1 / -1; }

.extra { display: grid; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.extra[hidden] { display: none; }
.extra h3 { margin: 0; font-size: .9rem; color: var(--ink-2); }
.note { background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink); padding: 9px 12px; border-radius: 10px; font-size: .84rem; }
.note p { margin: 0 0 4px; } .note p:last-child { margin: 0; }
.locrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.locrow .hint { margin: 0; }


/* Decorative ring (from the reference) */
.ring { position: absolute; left: 50%; bottom: 17%; width: 118px; height: 118px; margin-left: -59px; border: 24px solid #fff; border-radius: 50%; background: var(--brand); pointer-events: none; z-index: 2; }
.board > .form-side, .board > .side { position: relative; z-index: 1; }
.is-register .ring { bottom: 9%; }

@media (max-width: 880px) {
  .board, .is-register .board { grid-template-columns: 1fr; max-width: 520px; }
  .side { border-radius: 22px 22px 0 0; }
  .side-in { padding: 26px 26px 24px; }
  .side-logo { margin-bottom: 14px; padding: 6px 12px; }
  .side-logo img { width: 120px; }
  .side p { margin-bottom: 14px; }
  .form-side { padding: 28px 26px 18px; }
  .ring { display: none; }
}
@media (max-width: 520px) {
  .stage { padding: 0; align-items: start; }
  .board { border-radius: 0; box-shadow: none; max-width: none; }
  .side { border-radius: 0; }
  .side p, .side .bar { display: none; }
  .side h2 { font-size: 1.25rem; max-width: none; }
  .side-sos { display: none; }
  .row2, .roles { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Small type ---------- */
html { font-size: 14px; }
.card h1 { font-size: 1.45rem; }
.side h2 { font-size: 1.45rem; }
.field input, .field select { font-size: .98rem; }

.field.code input { font-size: 1.5rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding-top: 24px; }
.field.code label { left: 50%; transform-origin: center top; margin-left: -3.2em; }
.field.code input:focus ~ label, .field.code input:not(:placeholder-shown) ~ label { transform: translateY(-14px) scale(.78); }
.verify-actions { display: flex; justify-content: space-between; margin-top: 12px; }
.verify-actions form { margin: 0; display: block; }
.linkbtn { border: 0; background: none; font: inherit; font-size: .85rem; font-weight: 600; color: var(--brand); cursor: pointer; padding: 4px 0; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* =====================================================================
 * Phone: every sign-in / sign-up screen behaves like a native app screen.
 * Full height, no website header or footer, logo on top, big filled fields,
 * a big button, and the "create account" link pinned to the bottom.
 * ===================================================================== */
.m-brand, .m-sos { display: none; }
@media (max-width: 960px), (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  body.auth { background: #fff; overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; padding-bottom: 0 !important; }
  body.auth::before { display: none; }
  body.auth .ch-foot, body.auth .tabbar, body.auth .ch-sosbar, body.auth .ch-skip, body.auth .ch-logo, body.auth .ch-links, body.auth .ch-right { display: none !important; }
  /* the website bar is gone, but the round menu button stays (it is fixed to the top-left) */
  body.auth .ch-nav { display: block !important; position: static; height: 0; min-height: 0; padding: 0; border: 0; background: transparent; }
  body.auth .ch-in { height: 0; min-height: 0; padding: 0; width: auto; }
  .stage { padding: 0; display: block; }
  .board, .is-register .board { display: block; width: 100%; max-width: none; min-height: 100vh; min-height: 100dvh; border-radius: 0; box-shadow: none; background: #fff; }
  .side, .ring { display: none !important; }
  .form-side { min-height: 100vh; min-height: 100dvh; width: 100%; max-width: 520px; margin: 0 auto; padding: calc(22px + env(safe-area-inset-top)) 22px calc(22px + env(safe-area-inset-bottom)); justify-content: flex-start; }

  .m-brand { display: block; align-self: center; margin: 4px 0 30px; }
  .m-brand img { display: block; height: 46px; width: auto; }
  .m-sos { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 18px; padding: 12px; border-radius: 14px; background: #fdeceb; color: #a3200f !important; font-size: .95rem; font-weight: 700; text-decoration: none !important; }
  .m-sos .ico { width: 1.2rem; height: 1.2rem; }

  .card { flex: 1; display: flex; flex-direction: column; max-width: none; margin: 0; }
  .card h1 { text-align: left; font-size: 2rem; line-height: 1.12; letter-spacing: -.025em; }
  .card h1::after { display: none; }
  .card .sub { text-align: left; margin: 8px 0 26px; font-size: 1.05rem; color: var(--ink); }
  .card form { gap: 14px; }

  .alert { border: 0; border-radius: 14px; padding: 12px 14px; font-size: 1rem; margin: 0 0 16px; }

  /* filled, borderless fields; 16px text so phones never zoom in */
  .field input, .field select { background-color: #eef3f7; border: 0; border-radius: 14px; padding: 27px 16px 8px; min-height: 62px; font-size: 16px; transition: box-shadow .15s, background-color .15s; }
  .field select { padding-right: 44px; background-position: right 14px center; }
  .field input:focus, .field select:focus { background-color: #fff; box-shadow: inset 0 0 0 2px #0a0a0a; border: 0; padding-bottom: 8px; }
  .field input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--danger); }
  .field label { left: 16px; top: 21px; font-size: 1rem; color: var(--ink); }
  .field input:focus ~ label, .field input:not(:placeholder-shown) ~ label, .field select ~ label { transform: translateY(-13px) scale(.76); }
  .field input:focus ~ label, .field select:focus ~ label { color: var(--ink); }
  .field.has-toggle input { padding-right: 56px; }
  .eye { right: 8px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; color: var(--ink); }
  .eye:hover { background: transparent; }
  .field input[type="file"] { padding: 30px 16px 10px; }
  .field input[type="file"]::file-selector-button { border: 0; background: #fff; padding: 6px 14px; }
  .line-between { margin: -2px 0 6px; font-size: .98rem; }
  .line-between a { font-weight: 700; }
  .hint, .caps { font-size: .9rem; }

  .btn { min-height: 58px; margin-top: 8px; border-radius: 16px; font-size: 1.08rem; letter-spacing: 0; text-transform: none; box-shadow: none; }
  .btn:hover { box-shadow: none; }
  .btn:active { transform: scale(.98); }
  .btn.ghost { min-height: 48px; border: 0; background: #eef3f7; font-size: .95rem; }
  .btn.ghost:hover { background: #e2eaf0; }

  .alt { margin: auto 0 0; padding: 28px 0 0; font-size: 1rem; }
  .alt a { display: inline-block; padding: 6px 4px; font-weight: 700; }

  .roles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .role .body { border: 0; background: #eef3f7; border-radius: 14px; padding: 12px; box-shadow: none; }
  .role input:checked + .body { background: var(--brand); box-shadow: none; color: #fff; }
  .role input:checked + .body .ri, .role input:checked + .body small { color: #fff; }
  .role small { color: var(--ink); }
  .extra { border: 0; background: #f4f8fb; border-radius: 16px; }
  .note { border: 0; border-radius: 14px; }
  legend { font-size: .95rem; margin-bottom: 10px; }
  .verify-actions { margin-top: 16px; }
  .linkbtn { font-size: 1rem; padding: 8px 0; }
  .field.code input { font-size: 1.9rem; }
}
@media (max-width: 380px) { .roles { grid-template-columns: 1fr; } .card h1 { font-size: 1.8rem; } }

/* ---- App sign-in: everything centred, the whole form sits in the middle of the screen ---- */
@media (max-width: 960px), (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .form-side { justify-content: center; align-items: center; }
  .m-brand { margin: 0 0 24px; align-self: center; }
  .m-brand img { height: 56px; }
  .card { flex: none; width: 100%; max-width: 420px; margin: 0 auto; text-align: center; }
  .card h1, .card .sub { text-align: center; }
  .card .sub { margin: 8px 0 24px; }
  .line-between { justify-content: center; margin: 0 0 4px; }
  .alt { margin: 0; padding: 22px 0 0; text-align: center; }
  .fine { text-align: center; }
  .m-sos { width: 100%; max-width: 420px; margin-top: 22px; }
  .alert { width: 100%; max-width: 420px; text-align: left; }
  .verify-actions { justify-content: center; gap: 22px; }
  .field.code input { text-align: center; }
  .field label { text-align: left; }
  .roles, .extra, fieldset, legend { text-align: left; }
}

/* App sign-in: calmer heading size */
@media (max-width: 960px), (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  .card h1 { font-size: 1.4rem; line-height: 1.2; letter-spacing: -.02em; }
  .card .sub { margin: 6px 0 20px; font-size: .9rem; }
  .m-brand { margin-bottom: 18px; }
  .m-brand img { height: 46px; }
}
@media (max-width: 380px) { .card h1 { font-size: 1.3rem; } }

/* ---- App sign-in: our blue gradient behind a white sheet ---- */
@media (max-width: 960px), (display-mode: standalone), (display-mode: fullscreen), (display-mode: minimal-ui) {
  body.auth { background: linear-gradient(160deg, #2d9cd6 0%, #0070ac 52%, #00507f 100%) fixed; }
  .board, .is-register .board { background: transparent; }
  .m-brand { padding: 8px 16px; border-radius: 14px; background: #fff; box-shadow: 0 6px 18px -8px rgba(0, 40, 80, .45); }
  .card { padding: 22px 18px 16px; border-radius: 24px; background: #fff; box-shadow: 0 18px 40px -18px rgba(0, 30, 70, .55); }
  .m-sos { background: rgba(255, 255, 255, .18); color: #fff !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55); }
  .m-sos .ico { color: #fff; }
  .alert { box-shadow: 0 8px 20px -12px rgba(0, 30, 70, .5); }
}

/* Sign-up in two sections */
.reg-step[hidden] { display: none; }
.reg-step { display: grid; gap: 16px; }
.reg-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 10px 14px; border-radius: 12px; background: var(--brand-soft); font-size: .92rem; }
.reg-chip b { font-weight: 700; }
.reg-chip button { border: 0; background: none; font: inherit; font-size: .88rem; font-weight: 700; color: var(--brand-d); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px 2px; }
@media (max-width: 960px), (display-mode: standalone) {
  .reg-step[data-step="role"] .roles { grid-template-columns: 1fr; gap: 10px; }
  .reg-step[data-step="role"] .role.full { grid-column: auto; }
  .reg-step[data-step="role"] .role .body { padding: 14px 16px; min-height: 64px; }
  .reg-step[data-step="role"] .role b { font-size: 1rem; }
  .reg-step[data-step="role"] .role small { font-size: .82rem; }
  .reg-step[data-step="role"] legend { text-align: center; width: 100%; margin-bottom: 12px; font-size: 1rem; }
}
.card .sub[hidden] { display: none; }

/* Sign-up first section: space between the heading and "I am joining as" */
.reg-step[data-step="role"] legend { margin-top: 22px; margin-bottom: 12px; }
@media (max-width: 960px), (display-mode: standalone) { .reg-step[data-step="role"] legend { margin-top: 20px; } }

.reg-step[data-step="role"] { padding-top: 22px; }
@media (max-width: 960px), (display-mode: standalone) { .reg-step[data-step="role"] { padding-top: 18px; } }
