

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-weight: var(--weight-light);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Soft ambient light behind the glass surfaces. */
.backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(99, 102, 241, 0.10), transparent 60%),
    radial-gradient(50rem 30rem at 110% 110%, rgba(99, 102, 241, 0.06), transparent 60%);
}

h1, h2, h3 { font-weight: var(--weight-heading); letter-spacing: -0.01em; margin: 0; line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }

a { color: var(--color-primary-hover); text-decoration: none; font-weight: var(--weight-regular); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ----------------------------------------------------------------- layout */

.page {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 16px 32px;
}
.page--wide { align-items: stretch; }

.topbar {
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page--wide .topbar { max-width: 960px; margin-left: auto; margin-right: auto; }

.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand__logo { display: block; height: 36px; width: auto; }

.card {
  width: 100%;
  max-width: 440px;
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 36px 32px;
}
.card + .card { margin-top: 16px; }
.card__header { margin-bottom: 28px; }
.card__header p { margin-top: 8px; color: var(--color-text-muted); }
.card__footer { margin-top: 24px; text-align: center; color: var(--color-text-muted); font-size: 14px; }

.wide {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px 32px;
  color: var(--color-text-subtle);
  font-size: 13px;
}
.footer a { color: var(--color-text-muted); font-weight: var(--weight-light); }
.footer a[aria-current="true"] { color: var(--color-text); font-weight: var(--weight-regular); }
.lang { position: relative; }
.lang summary {
  list-style: none; cursor: pointer; user-select: none;
  color: var(--color-text-muted); font-weight: var(--weight-light);
  display: inline-flex; align-items: center; gap: 6px;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after {
  content: ""; width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); transition: transform .15s;
}
.lang[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.lang summary:hover, .lang[open] summary { color: var(--color-text); }
.lang__menu {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  margin: 0; padding: 6px; list-style: none; min-width: 140px;
  background: var(--color-surface-solid); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); z-index: 5;
}
.lang__menu a { display: block; padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
.lang__menu a:hover { background: rgba(255,255,255,.06); text-decoration: none; }

/* ------------------------------------------------------------------ forms */

.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__row { display: flex; justify-content: space-between; align-items: baseline; }
.label { font-size: 13px; font-weight: var(--weight-regular); color: var(--color-text-muted); }
.hint { font-size: 12px; color: var(--color-text-subtle); }

.input {
  width: 100%;
  appearance: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font: inherit;
  font-weight: var(--weight-regular);
  padding: 12px 14px;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.input::placeholder { color: var(--color-text-subtle); }
.input:hover { border-color: rgba(255, 255, 255, 0.22); }
.input:focus { outline: none; border-color: var(--color-primary); background: var(--tint-focus); }
.input--code {
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
select.input { padding-right: 36px; }

.checkbox { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--color-text-muted); }
.checkbox input {
  appearance: none;
  flex: none;
  width: 18px; height: 18px; margin: 2px 0 0;
  border-radius: 6px;
  border: 1px solid var(--color-border-strong);
  background: rgba(255, 255, 255, 0.03);
  display: grid; place-items: center;
}
.checkbox input:checked { background: var(--color-primary); border-color: var(--color-primary); }
.checkbox input:checked::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid var(--color-text); border-bottom: 2px solid var(--color-text);
  transform: rotate(-45deg);
}
.checkbox input:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 12px 22px;
  font: inherit;
  font-weight: var(--weight-heading);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  transition: background 160ms var(--ease), border-color 160ms var(--ease), transform 80ms var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; }
.btn--primary { background: var(--color-primary); color: var(--color-text); box-shadow: var(--shadow-soft); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--primary:active { background: var(--color-primary-active); }
.btn--ghost { background: transparent; color: var(--color-text); border-color: var(--color-border-strong); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.04); }
.btn--danger { background: transparent; color: var(--color-danger); border-color: rgba(248, 113, 113, 0.35); }
.btn--danger:hover { background: var(--color-danger-bg); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-row { display: flex; gap: 12px; }
.btn-row > * { flex: 1; }

.link-btn {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--color-primary-hover); font-weight: var(--weight-regular);
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ----------------------------------------------------------------- alerts */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  margin-bottom: 18px;
}
.alert--error { border-color: rgba(248, 113, 113, 0.28); background: var(--color-danger-bg); color: #FECACA; }
.alert--success { border-color: var(--success-border); background: var(--color-success-bg); }
.alert--success::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-accent); margin-right: 10px; vertical-align: middle; }

/* --------------------------------------------------------------- consent */

.client {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  margin-bottom: 22px;
}
.client__logo {
  width: 44px; height: 44px; flex: none;
  border-radius: var(--radius-sm);
  background: var(--tint-strong);
  display: grid; place-items: center;
  font-weight: var(--weight-heading);
  font-size: 18px;
  overflow: hidden;
}
.client__logo img { width: 100%; height: 100%; object-fit: cover; }
.client__name { font-weight: var(--weight-heading); }
.client__meta { color: var(--color-text-muted); font-size: 13px; }

.scopes { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; }
.scopes li { display: flex; gap: 12px; align-items: flex-start; }
.scopes li::before {
  content: ""; flex: none; width: 6px; height: 6px; margin-top: 9px; border-radius: 50%;
  background: var(--color-accent);
}
.scopes strong { font-weight: var(--weight-regular); display: block; }
.scopes span { color: var(--color-text-muted); font-size: 13px; }

.divider { height: 1px; background: var(--color-border); margin: 24px 0; border: 0; }

/* -------------------------------------------------------------- account */

.grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 860px) { .grid--2 { grid-template-columns: 1fr 1fr; } }

.panel {
  background: var(--color-surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 28px;
}
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.panel__head p { color: var(--color-text-muted); font-size: 13px; margin-top: 4px; } /* slop-ok: Compact helper text rather than body copy. */
.panel--danger { border-color: rgba(248, 113, 113, 0.18); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--color-border);
}
.list li:first-child { border-top: 0; padding-top: 0; }
.list__title { font-weight: var(--weight-regular); }
.list__meta { color: var(--color-text-muted); font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: var(--weight-regular);
  border: 1px solid var(--color-border-strong);
  color: var(--color-text-muted);
}
.badge--on { border-color: var(--success-border-strong); color: var(--color-accent); }
.badge--primary { border-color: var(--badge-primary-border); color: var(--badge-primary-text); }

.stack { display: flex; flex-direction: column; gap: 12px; }
details.disclose summary { cursor: pointer; color: var(--color-primary-hover); font-weight: var(--weight-regular);
  list-style: none; }
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose[open] summary { margin-bottom: 14px; }

.codes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  padding: 18px; margin: 0 0 20px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-align: center;
  list-style: none;
}
.qr { display: flex; justify-content: center; margin: 4px 0 18px; }
.qr img { width: 200px; height: 200px; border-radius: var(--radius-sm); }
.secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; letter-spacing: 0.06em; word-break: break-all;
  padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--color-border); color: var(--color-text-muted);
}
.user-code {
  font-size: 30px; letter-spacing: 0.25em; text-align: center; font-weight: var(--weight-heading);
  font-variant-numeric: tabular-nums; margin: 6px 0 22px;
}
.muted { color: var(--color-text-muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.hidden-frames iframe { display: none; width: 0; height: 0; border: 0; }

.icon-circle {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--tint-medium);
  margin: 0 auto 20px;
}
.icon-circle svg { width: 24px; height: 24px; stroke: var(--color-text); }

@media (max-width: 480px) {
  .page { padding-top: 24px; }
  .card { padding: 28px 20px; }
  .panel { padding: 22px 18px; }
  .btn-row { flex-direction: column-reverse; }
  .btn-row:has(> .field) { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.account-head { margin-bottom: 24px; }

/* ----------------------------------------------------------------- polish */
.btn--sm { white-space: nowrap; }
.form > .btn:not(.btn--block) { align-self: flex-start; }
.table td:first-child, .table th { white-space: nowrap; }
.footer { flex-wrap: wrap; row-gap: 8px; }
/* Standard dark-on-light QR: inverted codes trip up some authenticator apps. */
.qr img { background: #FAFAFA; padding: 10px; box-shadow: var(--shadow-soft); }

/* ----------------------------------------------------------- UX helpers */

/* 16px inputs on touch screens stop iOS from zooming into fields. */
@media (max-width: 720px), (pointer: coarse) { .input { font-size: 16px; } }
@media (pointer: coarse) { .btn--sm { min-height: 38px; } }
a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: 4px; }
.page { padding-top: max(48px, env(safe-area-inset-top)); }
@media (max-width: 480px) {
  .page { padding: 20px 12px 24px; }
  .topbar { margin-bottom: 20px; }
  .card { padding: 26px 18px; border-radius: 18px; }
}

.pw { position: relative; }
.pw .input { padding-right: 64px; }
.pw__toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--color-text-muted); font: inherit; font-size: 12.5px; font-weight: var(--weight-regular);
  cursor: pointer;
}
.pw__toggle:hover { color: var(--color-text); background: rgba(255, 255, 255, 0.06); }
.pw__toggle:focus-visible { outline: 2px solid var(--color-primary); }
.caps-hint { font-size: 12px; color: #FCD34D; }
.caps-hint[hidden] { display: none; }

.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(250, 250, 250, 0.35); border-top-color: var(--color-text);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
