/* Registration only. Semantic Apple Design tokens in the PointOS palette. */
#pwaAuth:has(#pwaRegisterForm:not([hidden])), #pwaRegisterForm {
  --reg-bg: #f5f5fa; --reg-surface: #fff; --reg-field: #f7f7fb;
  --reg-text: #20212c; --reg-secondary: #646574; --reg-border: #dcdde8;
  --reg-accent: #6346d9; --reg-tint: #f0edff;
  --reg-shadow: 0 12px 48px rgb(35 30 80 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #pwaAuth:has(#pwaRegisterForm:not([hidden])),
  :root:not([data-theme="light"]) #pwaRegisterForm {
    --reg-bg: #111219; --reg-surface: #1c1d27; --reg-field: #252632;
    --reg-text: #f5f5fc; --reg-secondary: #b0b0c2; --reg-border: #424354;
    --reg-accent: #b9a8ff; --reg-tint: #302840; --reg-shadow: none;
    color-scheme: dark;
  }
}
[data-theme="dark"] #pwaAuth:has(#pwaRegisterForm:not([hidden])), [data-theme="dark"] #pwaRegisterForm {
  --reg-bg: #111219; --reg-surface: #1c1d27; --reg-field: #252632;
  --reg-text: #f5f5fc; --reg-secondary: #b0b0c2; --reg-border: #424354;
  --reg-accent: #b9a8ff; --reg-tint: #302840; --reg-shadow: none;
  color-scheme: dark;
}
body #pwaAuth:has(#pwaRegisterForm:not([hidden])) {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 0;
  overflow-y: auto; overflow-x: hidden; background: var(--reg-bg);
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)) !important;
  -webkit-overflow-scrolling: touch; scroll-padding-block: 24px;
}
/* The desktop shell mounts its own welcome for login. Registration already
   has a welcome, so never stack both presentations above the form. */
body #pwaAuth:has(> #pwaRegisterForm:not([hidden])) > .web-auth-intro {
  display: none !important;
}
/* Keep the application out of the visual/accessibility layers while registering.
   Hidden auth (after sign-in) must not affect the actual application. */
body #pwaAuth:not([hidden]):has(> #pwaRegisterForm:not([hidden])) ~ :is(.hero, #homeScreen, #content, #backBar, #bottomNav) {
  display: none !important;
}
body #pwaAuth:has(#pwaRegisterForm:not([hidden])) > .legal-public-link {
  order: 1; margin-top: 12px; color: var(--reg-secondary); min-height: 44px;
  display: inline-flex !important; align-items: center; flex: 0 0 auto;
}
body #pwaAuth #pwaRegisterForm.pointos-registration {
  box-sizing: border-box; flex: 0 0 auto; width: 100% !important;
  max-width: 680px !important; min-width: 0 !important; margin: 0; padding: 0;
  border: 1px solid var(--reg-border); border-radius: 24px;
  background: var(--reg-surface); box-shadow: var(--reg-shadow); backdrop-filter: none;
  color: var(--reg-text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; text-align: left;
}
#pwaRegisterForm[hidden] { display: none !important; }
#pwaAuth[hidden] { display: none !important; }
#pwaRegisterForm *, #pwaRegisterForm *::before, #pwaRegisterForm *::after { box-sizing: border-box; }
#pwaRegisterForm .registration-welcome {
  padding: 28px 32px 24px; border-bottom: 1px solid var(--reg-border); border-radius: 24px 24px 0 0;
  background: linear-gradient(135deg, var(--reg-tint), var(--reg-surface) 80%);
}
body #pwaAuth #pwaRegisterForm .pwa-auth-brand { margin: 0 0 24px; gap: 12px; }
body #pwaAuth #pwaRegisterForm .pwa-auth-logo { width: 44px; height: 44px; border-radius: 12px; flex: 0 0 44px; }
body #pwaAuth #pwaRegisterForm .pwa-auth-brand b { color: var(--reg-text); font-size: 18px; line-height: 1.3; font-weight: 650; }
#pwaRegisterForm .pwa-auth-brand span { color: var(--reg-secondary); font-size: 12px; line-height: 1.5; }
body #pwaAuth #pwaRegisterForm h1 { color: var(--reg-text); font-size: clamp(26px, 4vw, 32px); line-height: 1.12; font-weight: 650; letter-spacing: -.025em; margin: 0 0 10px; }
#pwaRegisterForm h1 > span { color: var(--reg-accent); }
#pwaRegisterForm .pwa-auth-copy { color: var(--reg-secondary); font-size: 14px; font-weight: 400; line-height: 1.5; margin: 0; max-width: 390px; }
#pwaRegisterForm .registration-route { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-wrap: wrap; gap: 10px 18px; }
#pwaRegisterForm .registration-route li { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--reg-secondary); font-size: 12px; font-weight: 500; }
#pwaRegisterForm .registration-route li > span { display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--reg-border); border-radius: 50%; font-variant-numeric: tabular-nums; }
#pwaRegisterForm .registration-route [aria-current] { color: var(--reg-accent); }
#pwaRegisterForm .registration-route [aria-current] > span { color: #fff; background: #6346d9; border-color: #6346d9; }
#pwaRegisterForm .registration-fields { padding: 28px 32px 18px; }
#pwaRegisterForm .registration-section { padding: 0; margin: 0 0 28px; border: 0; min-width: 0; }
#pwaRegisterForm legend { padding: 0; margin-bottom: 6px; color: var(--reg-text); font-size: 17px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3; }
#pwaRegisterForm .registration-section-number { font-size: 11px; letter-spacing: .02em; color: var(--reg-accent); margin-right: 8px; vertical-align: 2px; }
#pwaRegisterForm .registration-hint { margin: 0 0 4px; font-size: 12px; line-height: 1.5; color: var(--reg-secondary); }
#pwaRegisterForm .pwa-name-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#pwaRegisterForm .registration-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#pwaRegisterForm label { display: block; font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--reg-text); margin: 14px 0 6px; }
#pwaRegisterForm input:not([type="checkbox"]), #pwaRegisterForm select {
  display: block; width: 100%; min-width: 0; max-width: 100%; height: 48px; min-height: 48px;
  margin: 0; padding: 10px 12px; background: var(--reg-field); color: var(--reg-text);
  border: 1px solid var(--reg-border); border-radius: 12px; box-shadow: none;
  font-family: inherit; font-size: 16px; font-weight: 400; line-height: 1.4;
}
#pwaRegisterForm input::placeholder { color: var(--reg-secondary); opacity: 1; }
#pwaRegisterForm select { padding-right: 28px; text-overflow: ellipsis; }
#pwaRegisterForm :is(input,select,button,a):focus-visible { outline: 3px solid var(--reg-accent); outline-offset: 3px; }
#pwaRegisterForm input[type="date"]::-webkit-date-and-time-value { text-align: left; }
#pwaRegisterForm .registration-next { display: flex; align-items: flex-start; gap: 10px; background: var(--reg-tint); padding: 14px; border-radius: 14px; margin-bottom: 20px; }
#pwaRegisterForm .registration-next-icon { flex: 0 0 24px; width: 24px; height: 24px; display: grid; place-items: center; color: var(--reg-accent); background: var(--reg-surface); border-radius: 50%; font-size: 14px; }
#pwaRegisterForm .registration-next b { display: block; color: var(--reg-text); font-size: 13px; font-weight: 600; line-height: 1.5; }
#pwaRegisterForm .registration-next p { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: var(--reg-secondary); }
#pwaRegisterForm .pwa-auth-consent { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 6px 0; min-height: 44px; }
#pwaRegisterForm .pwa-auth-consent input { flex: 0 0 20px; width: 20px; height: 20px; min-height: 20px; margin: 2px 0 0; accent-color: #6346d9; }
#pwaRegisterForm .pwa-auth-consent label { margin: 0; font-size: 12px; line-height: 1.6; font-weight: 400; color: var(--reg-secondary); cursor: pointer; min-height: 32px; }
#pwaRegisterForm a { color: var(--reg-accent); text-decoration: underline; text-underline-offset: 2px; }
#pwaRegisterForm #pwaRegisterButton { height: 50px; min-height: 50px; margin: 20px 0 0; border-radius: 14px; border: 0; background: linear-gradient(110deg, #6847df, #465cd6); color: #fff; font-size: 15px; font-weight: 600; box-shadow: none; }
#pwaRegisterForm #pwaRegisterButton:disabled { opacity: .6; }
#pwaRegisterForm #pwaBackToLoginButton { height: 44px; min-height: 44px; margin: 8px 0 0; padding: 8px; font-size: 13px; font-weight: 500; color: var(--reg-secondary); background: transparent; box-shadow: none; border: 0; }
#pwaRegisterForm .pwa-auth-error { font-size: 13px; line-height: 1.5; color: #b4233b; margin: 12px 0 0; }
#pwaRegisterForm .pwa-auth-error:empty { display: none; }
/* The desktop shell also styles auth controls. Keep this form self-contained. */
body #pwaAuth #pwaRegisterForm :is(input:not([type="checkbox"]), select) {
  color: var(--reg-text); background: var(--reg-field); border-color: var(--reg-border);
  border-radius: 12px; font-size: 16px;
}
body #pwaAuth #pwaRegisterForm label { color: var(--reg-text); font-size: 13px; }
body #pwaAuth #pwaRegisterForm :is(.pwa-auth-brand span, .pwa-auth-copy, .pwa-auth-consent label) { color: var(--reg-secondary); }
body #pwaAuth #pwaRegisterForm .pwa-auth-consent label { font-size: 12px; }
body #pwaAuth #pwaRegisterForm .pwa-auth-consent a { color: var(--reg-accent); }
[data-theme="dark"] #pwaAuth #pwaRegisterForm .pwa-auth-error { color: #ff9c9e; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #pwaAuth #pwaRegisterForm .pwa-auth-error { color: #ff9c9e; }
}
@media (max-width: 540px) {
  body #pwaAuth:has(#pwaRegisterForm:not([hidden])) { padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)) !important; }
  body #pwaAuth #pwaRegisterForm.pointos-registration { border-radius: 20px; }
  #pwaRegisterForm .registration-welcome { padding: 24px 20px 20px; border-radius: 20px 20px 0 0; }
  #pwaRegisterForm .registration-fields { padding: 24px 20px 12px; }
  #pwaRegisterForm .pwa-name-fields, #pwaRegisterForm .registration-pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #pwaRegisterForm .registration-route { gap: 8px 12px; }
}
@media (prefers-reduced-motion: no-preference) {
  #pwaRegisterForm:not([hidden]) .registration-welcome { animation: registration-appear .18s ease-out both; }
  @keyframes registration-appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
}
