/* Application entry: one focused task, with the same tokens as the workspace.
   Loaded after access styles; auth behavior and account tools remain unchanged. */
/* The legacy phone refinement applies important inline gutters to every route.
   The entry owns its own safe-area gutters, so do not apply them twice. */
html body.pwauth-gated #app-root { padding: 0 !important; }
html body.pwauth-gated .pwauth-entry {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(32px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(32px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: var(--pw-bg, #f4f5f7);
  color: var(--pw-text, #20242c);
  font-family: var(--pw-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

html body.pwauth-gated .pwauth-entry .pwauth-welcome {
  position: static;
  width: min(100%, 460px);
  min-height: 0;
  padding: 0 4px;
  background: transparent;
  overflow: visible;
}
html body.pwauth-gated .pwauth-entry .pwauth-welcome::before,
html body.pwauth-gated .pwauth-entry .pwauth-welcome::after { display: none; }
html body.pwauth-gated .pwauth-entry .pwauth-brand {
  position: static;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  min-width: 0;
}
html body.pwauth-gated .pwauth-entry .pwauth-brand-mark { flex: 0 0 48px; width: 48px; height: 48px; display: block; border-radius: 12px; }
html body.pwauth-gated .pwauth-entry .pwauth-brand-copy { min-width: 0; }
html body.pwauth-gated .pwauth-entry .pwauth-brand strong { color: var(--pw-text); font-size: 1.375rem; font-weight: 720; letter-spacing: -.035em; line-height: 1.2; }
html body.pwauth-gated .pwauth-entry .pwauth-brand-copy > span { margin-top: 4px; color: var(--pw-text-muted); font-size: .875rem; font-weight: 500; letter-spacing: .01em; line-height: 1.35; text-transform: none; }
html body.pwauth-gated .pwauth-entry .pwauth-panel { width: 100%; padding: 0; background: transparent; }
html body.pwauth-gated .pwauth-entry .pwauth-card {
  width: min(100%, 460px);
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--pw-border);
  border-radius: 14px;
  background: var(--pw-surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .035);
}
html body.pwauth-gated .pwauth-entry .pwauth-card :is(h1, h2) { margin: 0; color: var(--pw-text); font-size: 1.625rem; font-weight: 680; line-height: 1.2; letter-spacing: -.025em; overflow-wrap: anywhere; }
html body.pwauth-gated .pwauth-entry .pwauth-lead { margin: 8px 0 24px; color: var(--pw-text-muted); font-size: 1rem; line-height: 1.5; }
html body.pwauth-gated .pwauth-entry .pwauth-field { margin-top: 18px; }
html body.pwauth-gated .pwauth-entry .pwauth-field label { margin-bottom: 8px; color: var(--pw-text); font-size: .875rem; font-weight: 650; line-height: 1.4; }
html body.pwauth-gated .pwauth-entry .pwauth-field input {
  min-height: 48px;
  padding: 11px 12px;
  border-width: 1px;
  border-radius: 8px;
  background: var(--pw-surface);
  font-size: max(16px, 1rem);
  line-height: 1.5;
}
html body.pwauth-gated .pwauth-entry .pwauth-password-wrap input { padding-right: calc(5rem + 4px); }
html body.pwauth-gated .pwauth-entry .pwauth-show {
  top: 2px;
  right: 2px;
  min-width: 64px;
  min-height: 44px;
  padding: 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--pw-text-muted);
  font-size: .875rem;
  font-weight: 600;
}
html body.pwauth-gated .pwauth-entry .pwauth-show:hover { background: var(--pw-surface-muted); color: var(--pw-text); }
html body.pwauth-gated .pwauth-entry :is(input, button, summary):focus-visible { outline: 2px solid var(--pw-focus); outline-offset: 2px; box-shadow: none; }
html body.pwauth-gated .pwauth-entry :is(.pwauth-primary, .pwauth-secondary, .pwauth-role) { min-height: 48px; padding: 11px 14px; border-width: 1px; border-radius: 8px; font-size: 1rem; line-height: 1.45; font-weight: 650; box-shadow: none; }
html body.pwauth-gated .pwauth-entry .pwauth-primary { margin-top: 20px; }
html body.pwauth-gated .pwauth-entry .pwauth-secondary { margin-top: 10px; }
html body.pwauth-gated .pwauth-entry .pwauth-text-button { min-height: 44px; margin-top: 8px; color: var(--pw-accent); font-size: .875rem; font-weight: 600; line-height: 1.45; }
html body.pwauth-gated .pwauth-entry .pwauth-help { margin-top: 8px; color: var(--pw-text-muted); font-size: .875rem; line-height: 1.5; }
html body.pwauth-gated .pwauth-entry .pwauth-security-note { margin: 20px 0 0; padding-top: 16px; color: var(--pw-text-muted); font-size: .875rem; line-height: 1.5; }
html body.pwauth-gated .pwauth-entry .pwauth-lanes { border-radius: 8px; padding: 3px; }
html body.pwauth-gated .pwauth-entry .pwauth-lane { min-height: 44px; border-radius: 6px; font-size: .875rem; font-weight: 600; }
html body.pwauth-gated .pwauth-entry .pwauth-status { margin-top: 16px; padding: 12px; font-size: .875rem; line-height: 1.5; }
html body.pwauth-gated .pwauth-entry .pwauth-roles { gap: 8px; margin-top: 20px; }
html body.pwauth-gated .pwauth-entry .pwauth-role { justify-content: stretch; gap: 4px; }
html body.pwauth-gated .pwauth-entry .pwauth-role small { color: var(--pw-text-muted); font-size: .875rem; font-weight: 400; line-height: 1.45; }
html body.pwauth-gated .pwauth-entry .pwauth-mfa-setup { gap: 8px; padding: 16px; border-radius: 8px; background: var(--pw-surface-muted); }
html body.pwauth-gated .pwauth-entry .pwauth-mfa-setup img { max-width: 100%; }
html body.pwauth-gated .pwauth-entry .pwauth-mfa-setup code { font-size: .875rem; letter-spacing: .04em; }
html body.pwauth-gated .pwauth-entry .pwauth-state-icon { width: 40px; height: 40px; margin-bottom: 18px; border-radius: 8px; background: var(--pw-surface-muted); color: var(--pw-accent); }
html body.pwauth-gated .pwauth-entry .pwauth-state-icon svg { width: 22px; height: 22px; }
/* The state already has its own spinner or alert glyph beside the heading. */
html body.pwauth-gated .pwauth-entry #pwauth-state-detail { display: block; }
html body.pwauth-gated .pwauth-entry #pwauth-state-detail > .pwil4-feedback-icon { display: none; }
html body.pwauth-gated .pwauth-entry .pwauth-connectivity { margin-bottom: 20px; }

/* An indeterminate spinner reflects work in progress without inventing a
   completion percentage. The actual session phase remains a live status. */
html body.pwauth-gated .pwauth-entry:is([data-pwauth-phase="booting"], [data-pwauth-phase="verifying"], [data-pwauth-phase="signing-in"], [data-pwauth-phase="signing-out"], [data-pwauth-phase="loading-data"], [data-pwauth-phase="mfa-starting"]) .pwauth-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 6px 12px;
  padding: 24px;
}
html body.pwauth-gated .pwauth-entry .pwauth-state-icon.is-loading { grid-column: 1; grid-row: 1; width: 24px; height: 24px; margin: 0; border: 0; background: transparent; }
html body.pwauth-gated .pwauth-entry .pwauth-state-icon.is-loading + #pwauth-title { grid-column: 2; grid-row: 1; align-self: center; font-size: 1rem; font-weight: 650; letter-spacing: 0; }
html body.pwauth-gated .pwauth-entry .pwauth-state-icon.is-loading ~ #pwauth-state-detail { grid-column: 2; margin: 0; font-size: .875rem; line-height: 1.5; }
html body.pwauth-gated .pwauth-entry .pwauth-connectivity:not([hidden]),
html body.pwauth-gated .pwauth-entry .pwauth-mode { grid-column: 1 / -1; }

html body.pwauth-gated .pwauth-entry .pwaccess-activation { margin-top: 12px; border-radius: 8px; background: transparent; }
html body.pwauth-gated .pwauth-entry .pwaccess-activation summary { min-height: 48px; padding: 11px 12px; font-size: .875rem; font-weight: 600; }
html body.pwauth-gated .pwauth-entry .pwaccess-activation summary::before { display: none; }
html body.pwauth-gated .pwauth-entry .pwaccess-activation__body { padding: 0 12px 16px; font-size: .875rem; }
html body.pwauth-gated .pwauth-entry .pwaccess-progress { gap: 6px; margin-bottom: 20px; }
html body.pwauth-gated .pwauth-entry .pwaccess-progress li { padding: 8px; border-radius: 6px; font-size: .875rem; }
body.pwauth-gated .pwaccess-recovery { border-radius: 14px; padding: 24px; }
body.pwauth-gated .pwaccess-recovery h2 { font-size: 1.5rem; letter-spacing: -.02em; }
body.pwauth-gated .pwaccess-recovery input { min-height: 48px; border-width: 1px; border-radius: 8px; font-size: max(16px, 1rem); }
body.pwauth-gated .pwaccess-recovery__head { grid-template-columns: minmax(0, 1fr) 44px; gap: 12px; }
body.pwauth-gated .pwaccess-recovery__head button { width: 44px; height: 44px; border-radius: 8px; }
body.pwauth-gated .pwaccess-recovery__actions button { min-height: 48px; border-width: 1px; border-radius: 8px; }

@media (max-width: 767px) {
  html body.pwauth-gated .pwauth-entry { justify-content: flex-start; gap: 28px; padding: max(28px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); background: var(--pw-surface); }
  html body.pwauth-gated .pwauth-entry .pwauth-welcome { padding: 0; }
  html body.pwauth-gated .pwauth-entry .pwauth-brand-mark { flex-basis: 44px; width: 44px; height: 44px; border-radius: 10px; }
  html body.pwauth-gated .pwauth-entry .pwauth-brand strong { font-size: 1.25rem; }
  html body.pwauth-gated .pwauth-entry .pwauth-card { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  html body.pwauth-gated .pwauth-entry:is([data-pwauth-phase="booting"], [data-pwauth-phase="verifying"], [data-pwauth-phase="signing-in"], [data-pwauth-phase="signing-out"], [data-pwauth-phase="loading-data"], [data-pwauth-phase="mfa-starting"]) { justify-content: center; }
  html body.pwauth-gated .pwauth-entry:is([data-pwauth-phase="booting"], [data-pwauth-phase="verifying"], [data-pwauth-phase="signing-in"], [data-pwauth-phase="signing-out"], [data-pwauth-phase="loading-data"], [data-pwauth-phase="mfa-starting"]) .pwauth-card { padding: 20px 0; border-top: 1px solid var(--pw-border); }
  body.pwauth-gated .pwaccess-recovery { border-radius: 16px 16px 0 0; padding: 20px max(20px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); }
}

@media (max-width: 359px) {
  html body.pwauth-gated .pwauth-entry { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  html body.pwauth-gated .pwauth-entry .pwaccess-progress { grid-template-columns: 1fr; }
  html body.pwauth-gated .pwauth-entry .pwaccess-progress li { display: flex; gap: 10px; align-items: baseline; }
  html body.pwauth-gated .pwauth-entry .pwaccess-progress b { margin: 0; }
}

@media (max-height: 540px) {
  html body.pwauth-gated .pwauth-entry { justify-content: flex-start; padding-top: max(20px, env(safe-area-inset-top, 0px)); }
}

@media (forced-colors: active) {
  html body.pwauth-gated .pwauth-entry .pwauth-card { border-color: CanvasText; }
  html body.pwauth-gated .pwauth-entry .pwauth-spinner { color: Highlight; }
}
