:root {
  color-scheme: light dark;
  --background: #f5f5f7;
  --surface: rgba(255,255,255,.82);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --line: rgba(60,60,67,.18);
  --line-strong: rgba(60,60,67,.28);
  --accent: #007aff;
  --soft: rgba(118,118,128,.10);
  --danger: #c9342f;
  --success: #218739;
  --shadow: 0 18px 50px rgba(0,0,0,.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.topbar-inner {
  width: min(720px, calc(100% - 32px));
  min-height: 58px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -.02em;
}

.language {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.language button {
  min-width: 42px;
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.language button.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.page {
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 58px 0 max(48px, env(safe-area-inset-bottom));
}

.auth-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}



.eyebrow {
  margin: 18px 0 8px;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.panel h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 40px);
  line-height: 1.04;
  letter-spacing: -.045em;
  font-weight: 650;
}

.description {
  margin: 13px 0 24px;
  color: var(--secondary);
  font-size: 16px;
  line-height: 1.48;
}

label {
  display: block;
  margin: 0 0 7px;
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  background: var(--surface-solid);
  color: var(--text);
}

input:focus {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.field-help {
  margin: 7px 0 20px;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.4;
}

.button {
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  padding: 0 16px;
  border-radius: 11px;
  font-weight: 620;
  cursor: pointer;
}

.button.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.button.secondary {
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--text);
}

.button:disabled {
  opacity: .5;
  cursor: default;
}

.secondary-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--secondary);
  font-size: 14px;
}

.text-button {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.message {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.4;
}

.message.error { color: var(--danger); }
.message.success { color: var(--success); }

.recovery-code {
  display: block;
  margin: 20px 0 8px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--soft);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}



.hidden { display: none !important; }

@media (prefers-color-scheme: dark) {
  :root {
    --background: #000000;
    --surface: rgba(28,28,30,.84);
    --surface-solid: #1c1c1e;
    --text: #f5f5f7;
    --secondary: #aeaeb2;
    --line: rgba(235,235,245,.18);
    --line-strong: rgba(235,235,245,.28);
    --soft: rgba(118,118,128,.20);
    --shadow: 0 18px 50px rgba(0,0,0,.34);
  }
}

@media (max-width: 520px) {
  .topbar-inner { width: calc(100% - 24px); }
  .page {
    width: calc(100% - 24px);
    padding-top: 34px;
  }
  .auth-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
  .language button {
    min-width: 38px;
    padding: 0 7px;
  }
}


/* Account methods share the same form widths on desktop and mobile. */
.auth-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 20px 0; border: 1px solid var(--line); border-radius: 14px; background: var(--background, #eeeef0); }
.auth-methods button { min-height: 42px; border: 0; border-radius: 10px; padding: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.auth-methods button[aria-pressed="true"] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px #0002; }
.password-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 8px 0 16px; }
.password-tools button { min-height: 36px; }
.saved-check { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; line-height: 1.5; font-weight: 400; }
.saved-check input { width: 20px; min-height: 20px; height: 20px; flex: 0 0 20px; margin: 2px 0 0; padding: 0; }
button:disabled { opacity: .55; cursor: wait; }
#continueButton:disabled { cursor: default; }
.auth-card input:focus-visible, .auth-card button:focus-visible { outline: 2px solid var(--accent, #234687); outline-offset: 3px; }


html[data-tolf-ui="auth"] .topbar-inner > .brand { gap:8px; justify-content:flex-start; }
html[data-tolf-ui="auth"] .brand .tolf-wordmark { font-size:20px; font-weight:650; letter-spacing:.16em; line-height:1.47; }
.brand-emblem { display:block; flex:0 0 22px; }
.back-chevron { font-size:24px; font-weight:400; color:var(--secondary); letter-spacing:0; }
.auth-card > .eyebrow { margin-top:0; }
 
#downloadCredentialsButton { height:auto; min-height:46px; padding:12px 16px; white-space:normal; }
