:root {
  --auth-background: #f8f7fa;
  --auth-surface: #ffffff;
  --auth-surface-soft: #f3f0f5;
  --auth-text: #332d3b;
  --auth-muted: #756e7a;
  --auth-outline: #d9d3dd;
  --auth-accent: #6750a4;
  --auth-accent-strong: #58418f;
  --auth-accent-soft: #eee8f7;
}
html[data-theme="dark"] {
  --auth-background: #151318;
  --auth-surface: #201d23;
  --auth-surface-soft: #29252c;
  --auth-text: #f0edf3;
  --auth-muted: #b9b2bd;
  --auth-outline: #49424e;
  --auth-accent: #cdb7f6;
  --auth-accent-strong: #ddccfa;
  --auth-accent-soft: #3b2f4d;
}

.auth-page {
  width: 100%;
  min-height: 0;
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 470px);
  align-items: center;
  gap: clamp(38px, 8vw, 105px);
  margin: 0 auto;
  padding: clamp(26px, 5vh, 64px) clamp(18px, 5vw, 64px);
}
main h1[tabindex="-1"]:focus,
main h2[tabindex="-1"]:focus { outline: 0; }
.compact-auth-page { grid-template-columns: minmax(0, 560px); justify-content: center; }
.auth-story { max-width: 540px; }
.auth-story h1 { margin: 0 0 18px; font-size: clamp(2.3rem, 5vw, 4.4rem); line-height: .98; letter-spacing: -.06em; }
.auth-story > p:not(.eyebrow) { max-width: 510px; margin-bottom: 30px; color: var(--auth-muted); font-size: 1rem; line-height: 1.7; }
.auth-story ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.auth-story li { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 12px; }
.auth-story li > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--auth-accent-soft); color: var(--auth-accent); font-size: .66rem; font-weight: 850; }
.auth-story li div { display: grid; gap: 2px; }
.auth-story li strong { font-size: .84rem; }
.auth-story li small { color: var(--auth-muted); font-size: .72rem; }

.auth-card { width: 100%; padding: clamp(8px, 2vw, 20px); border: 0; border-radius: 0; background: transparent; color: var(--auth-text); box-shadow: none; }
.narrow-auth-card { max-width: 490px; justify-self: center; }
.auth-card-heading h1, .auth-card-heading h2, .auth-message-card h1 { margin: 0 0 7px; font-size: clamp(1.75rem, 4vw, 2.2rem); letter-spacing: -.045em; }
.auth-card-heading > p:not(.eyebrow), .auth-message-card > p:not(.eyebrow):not(.email-destination):not(.auth-help) { margin: 0; color: var(--auth-muted); font-size: .84rem; line-height: 1.55; }
.auth-back { display: inline-flex; margin: -4px 0 24px; color: var(--auth-muted); font-size: .74rem; font-weight: 720; text-decoration: none; }
.auth-back:hover { color: var(--auth-accent); }
.auth-symbol { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 22px; border-radius: 16px; background: #eee8f6; color: #6750a4; font-size: 1.45rem; font-weight: 850; }
.auth-symbol svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.auth-symbol.success { background: #e4f4ed; color: #17715a; }
.auth-symbol.warning { background: #fff2d8; color: #79520d; }
.auth-symbol.error { background: #fdebea; color: #a73731; }

.auth-form { display: grid; gap: 15px; margin-top: 24px; }
.auth-card .auth-field { display: grid; gap: 6px; margin: 0; color: var(--auth-text); font-size: .76rem; font-weight: 760; }
.auth-field > small { color: var(--auth-muted); font-size: .66rem; font-weight: 520; }
.auth-field > input, .password-control, .auth-field select { min-height: 48px; border: 1px solid var(--auth-outline); border-radius: 12px; background: var(--auth-surface); color: var(--auth-text); }
.auth-field > input, .auth-field select { width: 100%; margin: 0; padding: 11px 13px; outline: none; }
.auth-field > input:focus, .password-control:focus-within, .auth-field select:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 3px var(--auth-accent-soft); }
.password-control { display: grid; grid-template-columns: minmax(0,1fr) auto; overflow: hidden; }
.password-control input { min-width: 0; width: 100%; margin: 0; border: 0; padding: 11px 13px; outline: none; background: transparent; color: var(--auth-text); }
.auth-card .password-control input,
.auth-card .password-control input:focus {
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  appearance: none;
}
.password-control button { border: 0; background: transparent; padding: 0 12px; color: #675487; font-size: .68rem; font-weight: 760; }
.password-control button:hover { background: #f7f3fa; }
.auth-card .auth-form-options { min-height: 24px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.auth-form-options > a { color: var(--auth-accent); font-size: .7rem; font-weight: 730; text-decoration: none; }
.auth-card .auth-check { min-width: 0; display: inline-grid; grid-template-columns: 18px minmax(0, auto); align-items: center; justify-self: start; gap: 8px; margin: 0; color: var(--auth-muted); font-size: .7rem; font-weight: 600; line-height: 1.25; cursor: pointer; }
.auth-card .auth-check input { width: 18px; height: 18px; flex: none; margin: 0; accent-color: #6750a4; }
.auth-card .auth-check span { min-width: 0; }
.auth-primary { min-height: 47px; display: grid; place-items: center; border: 0; border-radius: 12px; background: #6750a4; color: #fff; font-size: .79rem; font-weight: 780; box-shadow: 0 9px 22px rgba(76,52,126,.2); }
.auth-primary:hover { background: #59428f; }
.auth-google-choice {
  min-height: 54px;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr);
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 9px 14px;
  border: 1px solid var(--auth-outline);
  border-radius: 12px;
  background: var(--auth-surface);
  color: var(--auth-text);
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.auth-google-choice:hover { border-color: #a99bb7; background: var(--auth-surface-soft); transform: translateY(-1px); }
.auth-google-choice:focus-visible { outline: 3px solid var(--auth-accent-soft); outline-offset: 2px; }
.auth-google-choice svg { width: 22px; height: 22px; }
.auth-google-choice span { min-width: 0; display: grid; gap: 2px; }
.auth-google-choice strong { font-size: .76rem; }
.auth-google-choice small { color: var(--auth-muted); font-size: .64rem; }
.auth-google-choice.is-unavailable { border-style: dashed; }
.auth-button-link { margin-top: 22px; padding-inline: 16px; text-decoration: none; }
.auth-feedback { display: grid; gap: 2px; margin-top: 18px; padding: 11px 13px; border-radius: 12px; font-size: .73rem; line-height: 1.45; }
.auth-feedback span { opacity: .86; }
.auth-feedback.error { background: #fcede9; color: #912f2a; }
.auth-feedback.warning { background: #fff2d8; color: #79520d; }
.auth-feedback.info { background: #f0ebf7; color: #594378; }
.auth-feedback.success { background: #e4f4ed; color: #176c57; }
.auth-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 17px 0 12px; color: var(--auth-muted); font-size: .65rem; }
.auth-divider::before, .auth-divider::after { height: 1px; background: var(--auth-outline); content: ""; }
.auth-local-choice { min-height: 56px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--auth-outline); border-radius: 13px; background: var(--auth-surface-soft); color: var(--auth-text); text-decoration: none; }
.auth-local-choice:hover { border-color: #bcaece; background: #f5f0fa; }
.auth-local-choice svg { width: 22px; height: 22px; fill: none; stroke: #6750a4; stroke-width: 1.7; stroke-linecap: round; }
.auth-local-choice span { display: grid; gap: 2px; }
.auth-local-choice strong { font-size: .74rem; }
.auth-local-choice small { color: var(--auth-muted); font-size: .64rem; }
.auth-web-calendar-note { min-height: 58px; display: grid; grid-template-columns: 30px minmax(0,1fr); align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px; border: 1px solid var(--auth-outline); border-radius: 13px; background: var(--auth-surface-soft); color: var(--auth-text); }
.auth-web-calendar-note svg { width: 23px; height: 23px; fill: none; stroke: #6750a4; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.auth-web-calendar-note span { min-width: 0; display: grid; gap: 2px; }
.auth-web-calendar-note strong { font-size: .74rem; }
.auth-web-calendar-note small { color: var(--auth-muted); font-size: .64rem; line-height: 1.4; }
.auth-switch { margin: 20px 0 0; color: var(--auth-muted); font-size: .75rem; text-align: center; }
.auth-switch a, .resend-form button { color: #60458e; font-weight: 760; }
.resend-form { margin-top: 10px; text-align: center; }
.resend-form.roomy { margin-top: 14px; }
.resend-form button { min-height: 38px; border: 0; border-radius: 9px; background: transparent; padding: 7px 10px; font-size: .7rem; }
.resend-form button:hover { background: #f3eef7; }
.auth-privacy-note, .auth-help { margin: 15px 0 0; color: var(--auth-muted); font-size: .64rem; line-height: 1.5; text-align: center; }
.demo-login { position: static; right: auto; bottom: auto; z-index: auto; width: auto; margin-top: 18px; padding: 14px 0 0; border: 0; border-top: 1px solid #ece8ee; border-radius: 0; background: transparent; box-shadow: none; }
.demo-login summary { color: var(--auth-muted); font-size: .69rem; font-weight: 730; cursor: pointer; }
.demo-login form { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 8px; margin-top: 11px; }
.demo-login label { display: grid; gap: 5px; color: #6e6672; font-size: .66rem; font-weight: 730; }
.demo-login select { min-width: 0; min-height: 40px; border: 1px solid #dcd6e1; border-radius: 9px; padding: 7px 9px; background: #fff; }
.demo-login button { min-height: 40px; border: 0; border-radius: 9px; background: #eee8f5; color: #59427f; padding: 7px 11px; font-size: .68rem; font-weight: 760; }
.demo-login > small { display: block; margin-top: 7px; color: var(--auth-muted); font-size: .61rem; }
.auth-message-card { max-width: 480px; justify-self: center; text-align: center; }
.auth-message-card .auth-symbol { margin-inline: auto; }
.email-destination { margin: 17px 0 0; padding: 9px 11px; border-radius: 9px; background: var(--auth-surface-soft); color: var(--auth-muted); font-size: .7rem; }

@media (max-width: 860px) {
  .auth-page { max-width: 570px; grid-template-columns: 1fr; gap: 24px; padding-top: 18px; }
  .auth-story { display: none; }
}
@media (max-width: 520px) {
  .auth-shell-main { align-items: start !important; }
  .auth-page { display: block; padding: 8px 12px 24px; }
  .auth-card { padding: 18px 8px 24px; }
  .auth-form { gap: 13px; margin-top: 20px; }
  .auth-field > input, .password-control { min-height: 50px; }
  .auth-card .auth-form-options { gap: 10px; }
  .auth-form-options > a { text-align: right; }
  .demo-login form { grid-template-columns: 1fr; }
}

html.android-host .auth-shell-header {
  min-height: calc(58px + max(var(--system-top, 0px), env(safe-area-inset-top, 0px)));
  padding-top: max(var(--system-top, 0px), env(safe-area-inset-top, 0px));
}
html.android-host .auth-shell { min-height: var(--app-viewport-height, 100dvh); }

/* Component CSS isolation cannot reliably target the Android host element. */
.portal-android-link { display: none !important; }
html.android-host .portal-back-web,
html.android-host .portal-web-link { display: none !important; }
html.android-host .portal-back-android,
html.android-host .portal-android-link { display: inline-flex !important; }
html.android-host .calendar-portal-header {
  box-sizing: border-box;
  min-height: calc(56px + max(var(--system-top, 0px), env(safe-area-inset-top, 0px)));
  padding-top: max(var(--system-top, 0px), env(safe-area-inset-top, 0px));
  padding-right: max(8px, var(--system-right, 0px));
  padding-bottom: 0;
  padding-left: max(8px, var(--system-left, 0px));
}
html.android-host .calendar-portal-header .portal-back {
  width: 48px;
  height: 48px;
}

html[data-theme="dark"] .auth-primary { background: var(--auth-accent); color: #261a34; box-shadow: none; }
html[data-theme="dark"] .auth-primary:hover { background: var(--auth-accent-strong); }
html[data-theme="dark"] .auth-field input::placeholder { color: #827b87; }
html[data-theme="dark"] .password-control button, html[data-theme="dark"] .auth-form-options > a, html[data-theme="dark"] .auth-switch a, html[data-theme="dark"] .resend-form button { color: var(--auth-accent); }
html[data-theme="dark"] .password-control button:hover, html[data-theme="dark"] .resend-form button:hover, html[data-theme="dark"] .auth-local-choice:hover { background: var(--auth-surface-soft); }
html[data-theme="dark"] .auth-divider::before, html[data-theme="dark"] .auth-divider::after, html[data-theme="dark"] .demo-login { border-color: var(--auth-outline); }
html[data-theme="dark"] .demo-login select { border-color: var(--auth-outline); background: var(--auth-surface); color: var(--auth-text); }
html[data-theme="dark"] .demo-login button { background: var(--auth-accent-soft); color: var(--auth-accent); }
html[data-theme="dark"] .auth-symbol, html[data-theme="dark"] .email-destination { background: var(--auth-surface-soft); color: var(--auth-accent); }
html[data-theme="dark"] .auth-symbol.success { background: #193a31; color: #9ad8c4; }
html[data-theme="dark"] .auth-symbol.warning { background: #3d321e; color: #e9c879; }
html[data-theme="dark"] .auth-symbol.error { background: #442522; color: #ffb4aa; }
html[data-theme="dark"] .auth-divider::before, html[data-theme="dark"] .auth-divider::after { background: var(--auth-outline); }
html[data-theme="dark"] .auth-feedback.error { background: #442522; color: #ffb4aa; }
html[data-theme="dark"] .auth-feedback.warning { background: #3d321e; color: #e9c879; }
html[data-theme="dark"] .auth-feedback.info { background: var(--auth-accent-soft); color: var(--auth-accent); }
html[data-theme="dark"] .auth-feedback.success { background: #193a31; color: #9ad8c4; }

html[data-theme="dark"] .calendar-portal-shell .sharing-principle,
html[data-theme="dark"] .calendar-portal-shell .sharing-dialog .access-choice:has(input:checked) {
  background: var(--auth-accent-soft);
}
html[data-theme="dark"] .calendar-portal-shell .personal-calendar-surface,
html[data-theme="dark"] .calendar-portal-shell .linked-calendar-list,
html[data-theme="dark"] .calendar-portal-shell .linked-calendar-row,
html[data-theme="dark"] .calendar-portal-shell .pending-share-list,
html[data-theme="dark"] .calendar-portal-shell .empty-sharing-state,
html[data-theme="dark"] .calendar-portal-shell .event-dialog,
html[data-theme="dark"] .calendar-portal-shell .confirm-dialog,
html[data-theme="dark"] .calendar-portal-shell .sharing-dialog .access-choice {
  border-color: var(--auth-outline);
  background: var(--auth-surface);
  color: var(--auth-text);
}
html[data-theme="dark"] .calendar-portal-shell .calendar-title-line h3,
html[data-theme="dark"] .calendar-portal-shell .linked-calendar-copy h3,
html[data-theme="dark"] .calendar-portal-shell .mutual-sharing-hint strong,
html[data-theme="dark"] .calendar-portal-shell .empty-sharing-state strong {
  color: var(--auth-text);
}
html[data-theme="dark"] .calendar-portal-shell .personal-calendar-copy p,
html[data-theme="dark"] .calendar-portal-shell .linked-calendar-copy p,
html[data-theme="dark"] .calendar-portal-shell .sharing-section-heading p:not(.section-kicker),
html[data-theme="dark"] .calendar-portal-shell .mutual-sharing-hint,
html[data-theme="dark"] .calendar-portal-shell .pending-share-list article small,
html[data-theme="dark"] .calendar-portal-shell .access-choice small {
  color: var(--auth-muted);
}
html[data-theme="dark"] .calendar-portal-shell .pending-share-heading,
html[data-theme="dark"] .calendar-portal-shell .pending-share-list article + article,
html[data-theme="dark"] .calendar-portal-shell .linked-calendar-row + .linked-calendar-row {
  border-color: var(--auth-outline);
}
html[data-theme="dark"] .calendar-portal-shell .read-only-badge { background: var(--auth-surface-soft); color: var(--auth-muted); }
html[data-theme="dark"] .calendar-portal-shell .choice-radio { background: var(--auth-surface); }
html[data-theme="dark"] .calendar-portal-shell .sharing-principle { color: var(--auth-text); }
html[data-theme="dark"] .calendar-portal-shell .sharing-principle span { color: var(--auth-muted); }
html[data-theme="dark"] .calendar-portal-shell .secondary-action { border-color: var(--auth-outline); background: var(--auth-surface-soft); color: var(--auth-text); }
html[data-theme="dark"] .calendar-portal-shell .secondary-action:hover { border-color: var(--auth-accent); background: var(--auth-accent-soft); }
html[data-theme="dark"] .calendar-portal-shell .text-action { color: var(--auth-muted); }
html[data-theme="dark"] .calendar-portal-shell .text-action:hover { background: var(--auth-surface-soft); color: var(--auth-accent); }
html[data-theme="dark"] .calendar-portal-shell .danger-text { color: #ffb4aa; }
