/* ==========================================================================
   OFinder Atlas — page layer (staging copy only)

   Scope: page-level surfaces only.
     #auth-view        auth + onboarding entry
     #page-profile     profile / onboarding steps
     #page-saved       saved list
     #page-applications applications tracker
     #page-admin       review queue, reports, organisations
     #notifications-menu  notification popup
     .app-promo        PWA install bar (styled in app-promo.css)

   Global tokens, navigation and the post/opportunity cards belong to the
   global layer (ofinder-tokens.css + the shared card work) and are NOT
   redefined here. This file consumes the Atlas semantic tokens and falls back
   to the published hexes when the token file is not linked yet, so the pages
   render correctly either way.

   Rules honoured from the spec: logical properties only, Arabic type rules,
   paper/night surfaces, 20/24 card radius, 44px targets, focus ring, motion
   from tokens, reduced-motion respected by the token layer.
   ========================================================================== */

/* ---------- 0. Alias layer (tokens when present, published hexes otherwise) ---------- */
html {
  --ap-bg: var(--color-bg, #f8f5ee);
  --ap-sunken: var(--color-bg-sunken, #f1ece1);
  --ap-surface: var(--color-surface, #ffffff);
  --ap-surface-2: var(--color-surface-2, #f8f5ee);
  --ap-surface-3: var(--color-surface-3, #f1ece1);
  --ap-text: var(--color-text, #0f1517);
  --ap-text-2: var(--color-text-secondary, #33454a);
  --ap-meta: var(--color-text-meta, #57696e);
  --ap-line: var(--color-border, #e6decd);
  --ap-line-strong: var(--color-border-strong, #7c8c90);
  --ap-primary: var(--color-primary, #0a544c);
  --ap-primary-hover: var(--color-primary-hover, #0d6b60);
  --ap-primary-tint: var(--color-primary-tint, #eef7f4);
  --ap-on-primary: var(--color-on-primary, #ffffff);
  --ap-accent: var(--color-accent, #b23f16);
  --ap-accent-tint: var(--color-accent-tint, #fbe7dc);
  --ap-success: var(--color-success, #1b6b3a);
  --ap-warning: var(--color-warning, #7a5200);
  --ap-warning-tint: var(--color-warning-tint, #fcefd2);
  --ap-danger: var(--color-danger, #9e2a20);
  --ap-focus: var(--color-focus, #1b63d6);
  --ap-shadow-1: var(--shadow-1, 0 1px 2px rgba(15, 21, 23, .06));
  --ap-shadow-2: var(--shadow-2, 0 2px 6px rgba(15, 21, 23, .07), 0 10px 24px -14px rgba(15, 21, 23, .16));
  --ap-shadow-3: var(--shadow-3, 0 12px 32px -12px rgba(15, 21, 23, .20));
  --ap-radius-card: var(--radius-xl, 20px);
  --ap-radius-media: var(--radius-lg, 16px);
  --ap-radius-control: var(--radius-md, 12px);
  --ap-dur-1: var(--dur-1, 100ms);
  --ap-dur-2: var(--dur-2, 160ms);
  --ap-dur-3: var(--dur-3, 220ms);
  --ap-ease: var(--ease-standard, cubic-bezier(.2, 0, 0, 1));
  --ap-ease-out: var(--ease-out, cubic-bezier(.05, .7, .1, 1));
  --ap-font: "Rubik", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;
  --ap-mono: "Rubik", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;   /* no monospace in the UI (owner, 2026-11-30) */
}

html[data-theme="dark"] {
  --ap-bg: var(--color-bg, #0C2620);
  --ap-sunken: var(--color-bg-sunken, #091D18);
  --ap-surface: var(--color-surface, #123B33);
  --ap-surface-2: var(--color-surface-2, #17463C);
  --ap-surface-3: var(--color-surface-3, #1D5145);
  --ap-text: var(--color-text, #F2F0E6);
  --ap-text-2: var(--color-text-secondary, #C6D6CD);
  --ap-meta: var(--color-text-meta, #A9C2B6);
  --ap-line: var(--color-border, #2E6456);
  --ap-line-strong: var(--color-border-strong, #5E9A88);
  --ap-primary: var(--color-primary, #D8EC9F);
  --ap-primary-hover: var(--color-primary-hover, #E6F5BC);
  --ap-primary-tint: var(--color-primary-tint, #1D5145);
  --ap-on-primary: var(--color-on-primary, #16211C);
  --ap-accent: var(--color-accent, #DCC08A);
  --ap-accent-tint: var(--color-accent-tint, #26382E);
  --ap-success: var(--color-success, #6bd79b);
  --ap-warning: var(--color-warning, #f2c46b);
  --ap-warning-tint: var(--color-warning-tint, #33260c);
  --ap-danger: var(--color-danger, #ff8f82);
  --ap-focus: var(--color-focus, #8cb6ff);
  --ap-shadow-1: var(--shadow-1, 0 1px 0 rgba(255, 255, 255, .04) inset);
  --ap-shadow-2: var(--shadow-2, 0 1px 0 rgba(255, 255, 255, .04) inset);
  --ap-shadow-3: var(--shadow-3, 0 24px 56px -20px rgba(0, 0, 0, .72));
}

/* ---------- 1. Page canvas: flat paper / night glass, no gradient ---------- */
body:has(#app-view:not([hidden])),
body:has(#auth-view:not([hidden])) {
  color: var(--ap-text);
  background: var(--ap-bg);
}

#auth-view,
#page-profile,
#page-saved,
#page-applications,
#page-admin {
  color: var(--ap-text);
  font-family: var(--ap-font);
  font-size: 16px;
  line-height: 1.55;
}

html[lang="ar"] #auth-view,
html[lang="ar"] #page-profile,
html[lang="ar"] #page-saved,
html[lang="ar"] #page-applications,
html[lang="ar"] #page-admin {
  font-size: 17px;
  line-height: 1.8;
}

/* Reading measure: pages read in one column never exceed 720px of text. */
#page-profile .page-intro,
#page-saved .page-intro,
#page-applications .page-intro,
#page-admin .page-intro {
  max-width: 64ch;
  color: var(--ap-text-2);
  font-size: 15px;
  line-height: 1.75;
}

/* ---------- 2. Plate header (index rail + code, kicker, title, intro, meta) ---------- */
#page-profile .page-title-row,
#page-saved .page-title-row,
#page-applications .page-title-row,
#page-admin .page-title-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px 24px;
  margin: 18px 0 24px;
  padding-block-start: 22px;
  border-block-start: 1px solid var(--ap-line);
}

/* Plate codes are decorative page labels and look like record IDs. IDs are
   staff-only, so only the admin page shows one. */
#page-admin .page-title-row::before {
  content: attr(data-plate);
  position: absolute;
  inset-block-start: -10px;
  inset-inline-end: 0;
  padding-inline: 8px;
  color: var(--ap-meta);
  background: var(--ap-bg);
  font-family: var(--ap-mono);
  font-size: 12px;
  line-height: 1.35;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
}

#page-profile .page-title-row h1,
#page-saved .page-title-row h1,
#page-applications .page-title-row h1,
#page-admin .page-title-row h1 {
  margin: 2px 0 8px;
  font-size: clamp(24px, 1.3rem + .9vw, 30px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  text-wrap: balance;
}

html[lang="ar"] #page-profile .page-title-row h1,
html[lang="ar"] #page-saved .page-title-row h1,
html[lang="ar"] #page-applications .page-title-row h1,
html[lang="ar"] #page-admin .page-title-row h1 {
  line-height: 1.45;
  letter-spacing: 0;
}

/* The kicker: 12/500, tracked in Latin, plain in Arabic. */
#page-profile .page-title-row .eyebrow,
#page-saved .page-title-row .eyebrow,
#page-applications .page-title-row .eyebrow,
#page-admin .page-title-row .eyebrow {
  margin: 0;
  color: var(--ap-meta);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}

html[lang="ar"] #page-profile .page-title-row .eyebrow,
html[lang="ar"] #page-saved .page-title-row .eyebrow,
html[lang="ar"] #page-applications .page-title-row .eyebrow,
html[lang="ar"] #page-admin .page-title-row .eyebrow {
  letter-spacing: 0;
  text-transform: none;
  font-size: 13px;
}

#page-profile .private-chip,
#page-admin .admin-chip {
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 12px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- 3. Shared page primitives ---------- */

/* Cards: paper surface, hairline, one shadow step (none in dark). */
#page-profile .form-card,
#page-profile .preference-disclosure,
#page-saved .opportunity-card,
#page-applications .application-card,
#page-admin .form-card,
#page-admin .admin-table-card,
#page-admin .review-principles {
  padding: 20px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: var(--ap-shadow-2);
}

#page-profile .form-card,
#page-admin .form-card,
#page-admin .admin-table-card {
  padding: 20px;
}

/* Section heading inside a page: numbered plate + hairline. */
#page-profile .form-card,
#page-admin .form-card,
#page-admin .admin-table-card,
#page-admin .review-principles {
  counter-increment: atlas-sec;
}

#page-profile .profile-main,
#page-admin .admin-main,
#page-admin .admin-side {
  counter-reset: atlas-sec;
}

#page-profile .form-card-heading,
#page-admin .form-card-heading,
#page-admin .table-card-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  margin: 0 0 18px;
  padding-block-end: 14px;
  border-block-end: 1px solid var(--ap-line);
}

#page-profile .form-card-heading h2,
#page-admin .form-card-heading h2,
#page-admin .table-card-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.005em;
}

#page-profile .form-card-heading h2::before,
#page-admin .form-card-heading h2::before,
#page-admin .table-card-heading h2::before {
  content: counter(atlas-sec, decimal-leading-zero);
  margin-inline-end: 8px;
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 12px;
  font-weight: 400;
  vertical-align: .35em;
  direction: ltr;
  unicode-bidi: isolate;
}

#page-profile .form-card-heading p,
#page-admin .form-card-heading p,
#page-admin .table-card-heading p {
  margin: 3px 0 0;
  color: var(--ap-meta);
  font-size: 14px;
  line-height: 1.6;
}

/* The decorative icon chip becomes a quiet 32px marker. */
#page-profile .form-heading-icon,
#page-admin .form-heading-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-radius: 8px;
}

/* Margin note: 3px start rule, 12px inset. Used for "why", warnings, privacy notes. */
#page-profile .aside-note,
#page-profile .onboarding-note,
#page-admin .review-principles,
#page-applications .application-notice {
  position: relative;
  padding: 14px 16px;
  padding-inline-start: 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-inline-start: 3px solid var(--ap-primary);
  box-shadow: none;
}

#page-profile .aside-note h3,
#page-admin .review-principles h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

#page-profile .aside-note p,
#page-profile .aside-note li,
#page-admin .review-principles li {
  color: var(--ap-text-2);
  font-size: 14px;
  line-height: 1.7;
}

#page-profile .aside-note-icon {
  display: none;
}

#page-profile .aside-note-warm {
  border-inline-start-color: var(--ap-warning);
}

#page-profile .aside-note-warm .aside-note-icon {
  display: none;
}

/* ---------- 4. Fields, buttons, chips: one shape across the pages ---------- */
#auth-view .field,
#page-profile .field,
#page-admin .field {
  display: grid;
  gap: 6px;
  color: var(--ap-text-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

#auth-view .field > span,
#page-profile .field > span,
#page-admin .field > span {
  color: var(--ap-text-2);
  font-size: 13px;
  font-weight: 500;
}

#auth-view .field input,
#auth-view .field select,
#auth-view .field textarea,
#page-profile .field input,
#page-profile .field select,
#page-profile .field textarea,
#page-admin .field input,
#page-admin .field select,
#page-admin .field textarea,
#page-admin .search-field input,
#page-admin .select-field select {
  min-height: 48px;
  padding: 10px 14px;
  color: var(--ap-text);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line-strong);
  border-radius: var(--ap-radius-control);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.4;
  transition: border-color var(--ap-dur-2) var(--ap-ease), background var(--ap-dur-2) var(--ap-ease);
}

#page-profile .field textarea,
#page-admin .field textarea {
  min-height: 88px;
  line-height: 1.6;
}

#auth-view .field input:focus,
#auth-view .field select:focus,
#auth-view .field textarea:focus,
#page-profile .field input:focus,
#page-profile .field select:focus,
#page-profile .field textarea:focus,
#page-admin .field input:focus,
#page-admin .field select:focus,
#page-admin .field textarea:focus {
  border-color: var(--ap-primary);
  background: var(--ap-surface);
}

#auth-view .field input::placeholder,
#page-profile .field input::placeholder,
#page-profile .field textarea::placeholder,
#page-admin .field input::placeholder {
  color: var(--ap-meta);
  opacity: 1;
}

#auth-view .field-hint,
#page-profile .field-hint,
#page-profile .field > span small,
#page-admin .field-hint {
  color: var(--ap-meta);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}

#page-profile .required-legend {
  color: var(--ap-meta);
  font-size: 12px;
}

/* Buttons */
#auth-view .button,
#page-profile .button,
#page-saved .button,
#page-applications .button,
#page-admin .button,
#notifications-menu .button {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--ap-radius-control);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition: background var(--ap-dur-1) var(--ap-ease), border-color var(--ap-dur-1) var(--ap-ease), transform var(--ap-dur-1) var(--ap-ease);
}

#auth-view .button-primary,
#page-profile .button-primary,
#page-saved .button-primary,
#page-applications .button-primary,
#page-admin .button-primary {
  color: var(--ap-on-primary);
  background: var(--ap-primary);
  border-color: transparent;
  box-shadow: none;
}

#auth-view .button-primary:hover,
#page-profile .button-primary:hover,
#page-saved .button-primary:hover,
#page-applications .button-primary:hover,
#page-admin .button-primary:hover {
  background: var(--ap-primary-hover);
}

#auth-view .button-secondary,
#page-profile .button-secondary,
#page-saved .button-secondary,
#page-applications .button-secondary,
#page-admin .button-secondary {
  color: var(--ap-primary);
  background: transparent;
  border: 1px solid var(--ap-line-strong);
}

#auth-view .button-secondary:hover,
#page-profile .button-secondary:hover,
#page-saved .button-secondary:hover,
#page-applications .button-secondary:hover,
#page-admin .button-secondary:hover {
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#auth-view .button-text,
#page-profile .button-text,
#page-saved .button-text,
#page-applications .button-text,
#page-admin .button-text {
  color: var(--ap-primary);
  background: transparent;
  border-color: transparent;
  padding-inline: 4px;
}

#auth-view .button-danger-text,
#page-profile .button-danger-text,
#page-applications .button-danger-text,
#page-admin .button-danger-text {
  color: var(--ap-danger);
  background: transparent;
  border-color: transparent;
}

#page-profile .button-small,
#page-applications .button-small,
#page-admin .button-small,
#notifications-menu .button-small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
}

#auth-view .button:active,
#page-profile .button:active,
#page-saved .button:active,
#page-applications .button:active,
#page-admin .button:active {
  transform: scale(.98);
}

/* Focus: one ring, from the token. */
#auth-view :is(a, button, input, select, textarea, summary):focus-visible,
#page-profile :is(a, button, input, select, textarea, summary):focus-visible,
#page-saved :is(a, button, summary):focus-visible,
#page-applications :is(a, button, input, select, textarea, summary):focus-visible,
#page-admin :is(a, button, input, select, textarea, summary):focus-visible,
#notifications-menu :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--ap-focus);
  outline-offset: 2px;
  box-shadow: none;
}

/* Chips: 32px pill, selected = tint + 1px primary border. */
#page-profile .check-chip,
#page-admin .check-chip {
  min-height: 36px;
  padding: 6px 12px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}

#page-profile .check-chip:has(input:checked),
#page-admin .check-chip:has(input:checked) {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#page-profile .selected-chips .chip,
#page-admin .selected-chips .chip {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border: 1px solid var(--ap-primary);
  border-radius: 999px;
  font-size: 13px;
}

/* Disclosure blocks: hairline rows, not cards inside cards. */
#page-profile .preference-disclosure {
  margin-block-start: 12px;
  padding: 0;
  background: var(--ap-surface);
}

#page-profile .preference-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
}

#page-profile .preference-disclosure > summary::-webkit-details-marker {
  display: none;
}

#page-profile .preference-disclosure > summary strong {
  font-size: 16px;
  font-weight: 600;
}

#page-profile .preference-disclosure > summary small {
  display: block;
  color: var(--ap-meta);
  font-size: 13px;
  font-weight: 400;
}

#page-profile .preference-disclosure[open] > summary {
  border-block-end: 1px solid var(--ap-line);
}

#page-profile .preference-disclosure > :not(summary) {
  padding: 18px 20px;
}

#page-profile .disclosure-mark {
  color: var(--ap-meta);
  transition: transform var(--ap-dur-2) var(--ap-ease);
}

#page-profile .preference-disclosure[open] .disclosure-mark {
  transform: rotate(45deg);
}

/* ---------- 5. Auth + onboarding entry ---------- */
/* Atlas: one column, 400px card, one primary action, no aurora or floating cards. */
#auth-view.auth-layout {
  display: block;
  width: 100%;
  min-height: 100svh;
  margin: 0;
  padding: 40px 16px 56px;
  background: var(--ap-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#auth-view .auth-aurora,
#auth-view .auth-spotlight,
#auth-view .auth-sparks,
#auth-view .auth-float,
#auth-view .auth-orbit {
  display: none;
}

#auth-view .auth-card {
  position: relative;
  width: min(400px, 100%);
  margin: 0 auto;
  padding: 24px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#auth-view .auth-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 1px;
  background: var(--ap-line);
}

#auth-view .auth-card-head {
  margin-block-end: 20px;
}

#auth-view .brand-small {
  color: var(--ap-text);
  font-size: 17px;
  letter-spacing: 0;
}

#auth-view .auth-card h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.005em;
}

html[lang="ar"] #auth-view .auth-card h2 {
  line-height: 1.45;
  letter-spacing: 0;
}

#auth-view .auth-card .muted {
  color: var(--ap-text-2);
  font-size: 15px;
  line-height: 1.7;
}

#auth-view .auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 18px 0 20px;
  padding: 4px;
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
}

#auth-view .auth-tab {
  min-height: 40px;
  padding: 8px 12px;
  color: var(--ap-text-2);
  background: transparent;
  border: 0;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--ap-dur-2) var(--ap-ease), color var(--ap-dur-2) var(--ap-ease);
}

#auth-view .auth-tab.active {
  color: var(--ap-text);
  background: var(--ap-surface);
  box-shadow: var(--ap-shadow-1);
}

#auth-view .auth-form .button-wide,
#auth-view .form-stack .button-wide {
  width: 100%;
}

#auth-view .google-button {
  color: var(--ap-text);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line-strong);
}

#auth-view .auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--ap-meta);
  font-size: 12px;
}

#auth-view .auth-divider::before,
#auth-view .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ap-line);
}

#auth-view .auth-private {
  color: var(--ap-meta);
  background: transparent;
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
}

#auth-view .register-terms,
#auth-view .auth-footnote,
#auth-view .auth-get-app {
  color: var(--ap-meta);
  font-size: 13px;
  line-height: 1.6;
}

#auth-view .auth-get-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-block-start: 8px;
}

#auth-view .auth-secondary-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

#auth-view .language-select,
#auth-view .theme-toggle {
  min-height: 36px;
  color: var(--ap-text-2);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: 9px;
}

#auth-view .code-input {
  font-family: var(--ap-mono);
  font-size: 20px;
  letter-spacing: .35em;
  text-align: center;
}

#auth-view .inline-error {
  color: var(--ap-danger);
  font-size: 13px;
}

#auth-view .inline-success {
  color: var(--ap-success);
  font-size: 13px;
}

#auth-view .auth-site-footer {
  width: min(400px, 100%);
  margin: 28px auto 0;
  padding: 16px 0 0;
  border-block-start: 1px solid var(--ap-line);
  color: var(--ap-meta);
  font-size: 12px;
}

/* ---------- 6. Profile ---------- */
#page-profile {
  max-width: 1080px;
}

#page-profile .profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 288px;
  gap: 20px;
  align-items: start;
}

#page-profile .profile-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

#page-profile .profile-aside {
  display: grid;
  gap: 14px;
  position: sticky;
  inset-block-start: 72px;
}

#page-profile .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#page-profile .account-id-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block-end: 12px;
  padding: 10px 14px;
  color: var(--ap-meta);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  font-size: 13px;
}

#page-profile .account-id-value {
  color: var(--ap-text);
  font-family: var(--ap-mono);
  font-size: 12.5px;
}

/* Completeness: a 44px ring that links to the first missing field. */
#page-profile .atlas-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
}

#page-profile .atlas-ring {
  --atlas-ring-value: 0;
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: conic-gradient(var(--ap-primary) calc(var(--atlas-ring-value) * 1%), var(--ap-surface-3) 0);
  display: grid;
  place-items: center;
}

#page-profile .atlas-ring::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--ap-surface);
  border-radius: 50%;
}

#page-profile .atlas-ring span {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ap-text);
}

#page-profile .atlas-progress-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

#page-profile .atlas-progress-copy strong {
  font-size: 15px;
  font-weight: 600;
}

#page-profile .atlas-progress-copy small {
  color: var(--ap-meta);
  font-size: 13px;
}

#page-profile .onboarding-progress-row {
  display: grid;
  gap: 10px;
  margin-block-end: 16px;
}

#page-profile .onboarding-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: atlas-step;
}

#page-profile .onboarding-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
  color: var(--ap-text-2);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 13px;
}

#page-profile .onboarding-step.is-current {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#page-profile .onboarding-step-number {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ap-surface-3);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#page-profile .onboarding-step.is-current .onboarding-step-number {
  color: var(--ap-on-primary);
  background: var(--ap-primary);
}

#page-profile .onboarding-step-tag {
  color: var(--ap-meta);
  font-size: 11px;
}

#page-profile .onboarding-progress {
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: var(--ap-surface-3);
  appearance: none;
  overflow: hidden;
}

#page-profile .onboarding-progress::-webkit-progress-bar {
  background: var(--ap-surface-3);
  border-radius: 2px;
}

#page-profile .onboarding-progress::-webkit-progress-value {
  background: var(--ap-primary);
  border-radius: 2px;
  transition: width var(--ap-dur-3) var(--ap-ease);
}

#page-profile .onboarding-progress::-moz-progress-bar {
  background: var(--ap-primary);
  border-radius: 2px;
}

#page-profile .onboarding-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

#page-profile .profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-block-start: 8px;
}

#page-profile .profile-actions .button-primary {
  min-height: 48px;
  padding-inline: 24px;
}

#page-profile .choice-field {
  margin: 0;
  padding: 0;
  border: 0;
}

#page-profile .choice-field legend {
  margin-block-end: 8px;
  color: var(--ap-text-2);
  font-size: 13px;
  font-weight: 500;
}

#page-profile .checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#page-profile .form-end {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- 7. Saved ---------- */
#page-saved {
  max-width: 880px;
}

#page-saved .atlas-group {
  margin-block-end: 24px;
}

#page-saved .atlas-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  padding-block-end: 8px;
  border-block-end: 1px solid var(--ap-line);
}

#page-saved .atlas-group-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

#page-saved .atlas-group-head .atlas-group-count {
  color: var(--ap-meta);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#page-saved .atlas-group-head .atlas-group-code {
  margin-inline-start: auto;
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 12px;
  direction: ltr;
  unicode-bidi: isolate;
}

#page-saved .atlas-group[data-urgency="closed"] .atlas-group-head h2 {
  color: var(--ap-meta);
}

#page-saved .opportunity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#page-saved .opportunity-card {
  border-radius: var(--ap-radius-card);
}

/* ---------- 8. Applications ---------- */
#page-applications {
  max-width: 900px;
}

#page-applications .tracker-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
  padding: 10px 14px;
  color: var(--ap-meta);
  background: transparent;
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  font-size: 13px;
}

#page-applications .tracker-legend .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ap-line-strong);
}

#page-applications .tracker-legend .dot-current {
  background: var(--ap-primary);
}

#page-applications .tracker-privacy {
  margin-inline-start: auto;
  color: var(--ap-meta);
}

/* Three counters: 24/600 numbers over 12 labels. */
#page-applications .pipeline-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  padding: 0;
  background: var(--ap-line);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  overflow: hidden;
}

#page-applications .pipeline-summary-stage {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--ap-surface);
  border: 0;
  border-radius: 0;
}

#page-applications .pipeline-summary-stage span {
  order: 2;
  color: var(--ap-meta);
  font-size: 12px;
  font-weight: 500;
}

#page-applications .pipeline-summary-stage strong {
  order: 1;
  color: var(--ap-text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#page-applications .pipeline-arrow {
  display: none;
}

#page-applications .applications-list {
  display: grid;
  gap: 16px;
}

#page-applications .application-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

#page-applications .application-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

#page-applications .application-title-group h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: pretty;
}

#page-applications .application-title-group p {
  margin: 0;
  color: var(--ap-meta);
  font-size: 14px;
}

#page-applications .application-ids {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block-start: 6px;
}

#page-applications .public-id {
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 12px;
}

#page-applications .tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

#page-applications .tag-internal {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#page-applications .status-select {
  min-height: 40px;
  padding: 6px 12px;
  color: var(--ap-text);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line-strong);
  border-radius: var(--ap-radius-control);
  font-size: 14px;
}

/* Status stepper: four dots with labels, 44px targets, connector hairline. */
#page-applications .pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 4px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#page-applications .pipeline::-webkit-scrollbar {
  display: none;
}

#page-applications .pipeline-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 8px;
  color: var(--ap-meta);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}

#page-applications .pipeline-step.is-choosable {
  cursor: pointer;
}

#page-applications .pipeline-step.is-choosable:hover {
  background: var(--ap-primary-tint);
}

#page-applications .pipeline-step::after {
  content: "";
  display: block;
  width: clamp(16px, 4vw, 40px);
  height: 1px;
  margin-inline: 8px;
  background: var(--ap-line);
}

#page-applications .pipeline-step:last-child::after {
  display: none;
}

#page-applications .pipeline-step .step-dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ap-line-strong);
  border-radius: 50%;
  background: var(--ap-surface);
  font-size: 10px;
  font-style: normal;
  line-height: 1;
}

#page-applications .pipeline-step.is-complete {
  color: var(--ap-text-2);
}

#page-applications .pipeline-step.is-complete .step-dot {
  color: var(--ap-on-primary);
  background: var(--ap-primary);
  border-color: var(--ap-primary);
}

#page-applications .pipeline-step.is-current {
  color: var(--ap-text);
  font-weight: 600;
}

#page-applications .pipeline-step.is-current .step-dot {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 4px var(--ap-primary-tint);
}

#page-applications .application-outcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#page-applications .application-outcome-label {
  color: var(--ap-meta);
  font-size: 13px;
  font-weight: 500;
}

/* The disclaimer is an info line, not body copy. */
#page-applications .application-notice {
  margin: 0;
  padding: 10px 14px;
  padding-inline-start: 16px;
  color: var(--ap-text-2);
  background: transparent;
  border-inline-start: 3px solid var(--ap-line-strong);
  font-size: 13px;
  line-height: 1.6;
}

#page-applications .application-notice p {
  margin: 0;
}

#page-applications .application-notice small {
  display: block;
  margin-block-start: 2px;
  color: var(--ap-meta);
  font-size: 12px;
}

#page-applications .application-tools {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-block-start: 12px;
  border-block-start: 1px solid var(--ap-line);
}

#page-applications .application-tools .field {
  display: grid;
  gap: 6px;
  color: var(--ap-text-2);
  font-size: 13px;
  font-weight: 500;
}

#page-applications .application-tools input,
#page-applications .application-tools textarea {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ap-text);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line-strong);
  border-radius: var(--ap-radius-control);
  font-family: inherit;
  font-size: 15px;
}

/* ---------- 9. Admin ---------- */
#page-admin {
  max-width: 1180px;
}

#page-admin .admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  background: var(--ap-line);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  overflow: hidden;
}

#page-admin .admin-stat {
  padding: 14px 16px;
  background: var(--ap-surface);
}

#page-admin .admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

#page-admin .admin-main,
#page-admin .admin-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* Dense record tables: 48px rows, 13px text, sticky header. */
#page-admin .admin-record-list {
  display: grid;
  gap: 0;
  border-block-start: 1px solid var(--ap-line);
}

#page-admin .admin-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 4px;
  border-block-end: 1px solid var(--ap-line);
  font-size: 13px;
}

#page-admin .admin-record:hover {
  background: var(--ap-surface-2);
}

#page-admin .admin-record strong {
  font-size: 14px;
  font-weight: 600;
}

#page-admin .admin-record small {
  color: var(--ap-meta);
  font-size: 12px;
}

#page-admin .admin-record .public-id,
#page-admin .admin-record code {
  font-family: var(--ap-mono);
  font-size: 12px;
  color: var(--ap-meta);
}

#page-admin .table-card-heading {
  margin-block-end: 4px;
}

#page-admin .table-card-heading .button {
  align-self: center;
}

/* Review panel: the three required checks read as a checklist. */
#page-admin .review-principles {
  background: var(--ap-surface);
  border-inline-start: 3px solid var(--ap-warning);
  border-radius: 0 var(--ap-radius-card) var(--ap-radius-card) 0;
  box-shadow: none;
}

#page-admin .review-principles ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
}

#page-admin .review-principles .eyebrow {
  margin: 0 0 2px;
  color: var(--ap-meta);
  font-size: 12.5px;
  letter-spacing: normal;
  text-transform: none;
}

html[lang="ar"] #page-admin .review-principles .eyebrow {
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- 10. Notification popup ---------- */
#notifications-menu.notification-menu {
  inset-block-start: 64px;
  inset-inline-end: 16px;
  inset-inline-start: auto;
  width: min(400px, calc(100vw - 24px));
  max-height: calc(100dvh - 88px);
  padding: 0;
  gap: 0;
  color: var(--ap-text);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: var(--ap-shadow-3);
  overflow: hidden;
}

#notifications-menu .notification-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border-block-end: 1px solid var(--ap-line);
}

#notifications-menu .notification-menu-head strong {
  font-size: 16px;
  font-weight: 600;
}

#notifications-menu .notification-menu-head .text-button {
  min-height: 36px;
  padding-inline: 8px;
  color: var(--ap-primary);
  font-size: 13px;
  font-weight: 500;
}

#notifications-menu .notification-filters {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  border-block-end: 1px solid var(--ap-line);
  scrollbar-width: none;
}

#notifications-menu .notification-filters::-webkit-scrollbar {
  display: none;
}

#notifications-menu .filter-chip {
  flex: none;
  min-height: 32px;
  padding: 4px 12px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

#notifications-menu .filter-chip[aria-pressed="true"] {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#notifications-menu .notification-items {
  display: grid;
  gap: 0;
  max-height: min(60vh, 440px);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#notifications-menu .notification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-height: 64px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-block-end: 1px solid var(--ap-line);
  border-radius: 0;
}

#notifications-menu .notification-row.is-unread {
  border-inline-start: 3px solid var(--ap-primary);
  padding-inline-start: 13px;
  background: var(--ap-primary-tint);
}

#notifications-menu .notification-row.is-read {
  opacity: 1;
}

#notifications-menu .notification-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: start;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: default;
}

#notifications-menu .notification-open {
  cursor: pointer;
}

#notifications-menu .notification-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

#notifications-menu .notification-kind {
  color: var(--ap-primary);
  font-size: 13px;
}

#notifications-menu .notification-copy strong {
  display: block;
  color: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

#notifications-menu .notification-copy p {
  margin: 2px 0;
  color: var(--ap-text-2);
  font-size: 13px;
  line-height: 1.55;
}

#notifications-menu .notification-copy small {
  color: var(--ap-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#notifications-menu .notification-subject {
  color: var(--ap-text-2);
  font-size: 13px;
}

#notifications-menu .notification-read {
  min-height: 32px;
  padding: 4px 10px;
  color: var(--ap-primary);
  background: transparent;
  border: 1px solid var(--ap-line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

#notifications-menu .notification-read:hover {
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#notifications-menu .notification-empty {
  margin: 0;
  padding: 28px 20px;
  color: var(--ap-meta);
  font-size: 14px;
  text-align: center;
}

/* ---------- 11. Empty states (one shape, names the value) ---------- */
#page-saved .empty-state,
#page-applications .empty-state,
#page-admin .empty-state,
#page-profile .empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 480px;
  margin: 24px auto;
  padding: 32px 24px;
  text-align: center;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: none;
}

#page-saved .empty-state .empty-symbol,
#page-applications .empty-state .empty-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-block-end: 6px;
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-radius: 50%;
}

#page-saved .empty-state h3,
#page-applications .empty-state h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
}

#page-saved .empty-state p,
#page-applications .empty-state p {
  margin: 0 0 12px;
  max-width: 40ch;
  color: var(--ap-text-2);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 12. Responsive: compact first, expanded deltas ---------- */
@media (min-width: 1024px) {
  #page-profile .form-card,
  #page-saved .opportunity-card,
  #page-applications .application-card,
  #page-admin .form-card,
  #page-admin .admin-table-card {
    border-radius: var(--radius-2xl, 24px);
    padding: 24px;
  }

  #page-saved .opportunity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  #page-profile .profile-layout,
  #page-admin .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-profile .profile-aside {
    position: static;
  }

  #page-applications .application-tools {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  #page-profile .form-grid,
  #page-profile .profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-profile .page-title-row,
  #page-saved .page-title-row,
  #page-applications .page-title-row,
  #page-admin .page-title-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  #page-applications .application-head {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-applications .status-select {
    width: 100%;
  }

  #page-applications .tracker-privacy {
    margin-inline-start: 0;
  }

  #notifications-menu.notification-menu {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-height: 82dvh;
    border-radius: var(--radius-3xl, 28px) var(--radius-3xl, 28px) 0 0;
    border-inline: 0;
    border-block-end: 0;
    padding-block-end: var(--safe-bottom, env(safe-area-inset-bottom, 0px));
  }

  #notifications-menu .notification-items {
    max-height: 56dvh;
  }

  #auth-view.auth-layout {
    padding: 24px 16px 40px;
  }
}

/* ---------- 13. Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  #auth-view *,
  #page-profile *,
  #page-saved *,
  #page-applications *,
  #page-admin *,
  #notifications-menu * {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ---------- 14. PWA install / push prompt (pwa.js) ---------- */
/* Same sheet shape as the install bar: paper surface, 28px top radius on
   compact, centred 400px dialog from 720px up. */
.atlas-pwa-card {
  position: fixed;
  z-index: 9000;
  inset-inline: 0;
  inset-block-end: 0;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  display: grid;
  gap: 6px;
  padding: 20px 16px;
  padding-block-end: max(20px, env(safe-area-inset-bottom, 0px));
  color: var(--ap-text);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--radius-3xl, 28px) var(--radius-3xl, 28px) 0 0;
  box-shadow: var(--ap-shadow-3);
  font-family: var(--ap-font);
  text-align: start;
}

.atlas-pwa-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.atlas-pwa-body {
  color: var(--ap-text-2);
  font-size: 15px;
  line-height: 1.6;
}

.atlas-pwa-status {
  min-height: 20px;
  color: var(--ap-meta);
  font-size: 13px;
}

.atlas-pwa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 6px;
}

.atlas-pwa-button {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--ap-radius-control);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.atlas-pwa-primary {
  color: var(--ap-on-primary);
  background: var(--ap-primary);
  border: 1px solid transparent;
}

.atlas-pwa-primary:hover,
.atlas-pwa-primary:focus-visible {
  background: var(--ap-primary-hover);
}

.atlas-pwa-secondary {
  color: var(--ap-primary);
  background: transparent;
  border: 1px solid var(--ap-line-strong);
}

.atlas-pwa-button:focus-visible {
  outline: 2px solid var(--ap-focus);
  outline-offset: 2px;
}

@media (min-width: 720px) {
  .atlas-pwa-card {
    inset-block-end: 20px;
    width: min(480px, calc(100vw - 32px));
    border-radius: var(--radius-xl, 20px);
    padding: 20px;
  }
}

/* ---------- 15. Admin record rows and status chips (renderAdmin* output) ---------- */
#page-admin .admin-stat {
  display: grid;
  gap: 2px;
}

#page-admin .admin-stat small {
  color: var(--ap-meta);
  font-size: 12px;
  font-weight: 500;
}

#page-admin .admin-stat strong {
  color: var(--ap-text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#page-admin .admin-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 2px;
  border-block-end: 1px solid var(--ap-line);
  font-size: 13px;
}

#page-admin .admin-record:hover {
  background: var(--ap-surface-2);
}

#page-admin .admin-record-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#page-admin .admin-record-copy strong {
  color: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

#page-admin .admin-record-copy small {
  color: var(--ap-meta);
  font-size: 12px;
}

#page-admin .admin-record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

#page-admin .record-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

#page-admin .record-status.published {
  color: var(--ap-success);
  background: var(--ap-primary-tint);
  border-color: var(--ap-success);
}

#page-admin .record-status.draft {
  color: var(--ap-meta);
}

#page-admin .record-status.needs_review {
  color: var(--ap-warning);
  background: var(--ap-warning-tint);
  border-color: var(--ap-warning);
}

#page-admin .record-status.rejected,
#page-admin .record-status.closed {
  color: var(--ap-danger);
  background: var(--ap-accent-tint);
  border-color: var(--ap-danger);
}

#page-admin .empty-copy {
  margin: 0;
  padding: 18px 2px;
  color: var(--ap-meta);
  font-size: 14px;
}

@media (max-width: 640px) {
  #page-admin .admin-record {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  #page-admin .admin-record-actions {
    justify-content: flex-start;
  }
}

#page-applications .public-id[hidden] { display: none; }

#page-applications .public-id[hidden] { display: none; }

/* ---------- 16. Profile view (one page, Instagram's rhythm, Atlas surfaces) ---------- */
#page-member {
  max-width: 760px;
  padding-inline: 0;
  color: var(--ap-text);
}

#page-member .pf-top {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding-inline: 6px;
  background: var(--ap-bg);
  border-block-end: 1px solid var(--ap-line);
}

#page-member .pf-top-handle {
  margin: 0;
  padding: 0;
  min-height: 0;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-align: center;
  color: var(--ap-text);
  font-family: var(--ap-font);
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Always LTR and isolated, so the @ sits first even inside an Arabic page. */
  direction: ltr;
  unicode-bidi: isolate;
}

#page-member .pf-top-handle:hover {
  color: var(--ap-text-2);
}

#page-member .pf-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ap-text);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--ap-dur-2) var(--ap-ease);
}

#page-member .pf-icon-btn:hover {
  background: var(--ap-surface-2);
}

#page-member .pf-icon-btn .ico {
  width: 22px;
  height: 22px;
}

/* The back arrow points to the start edge in both directions. */
#page-member .pf-back .ico {
  transform: scaleX(1);
}

html[dir="rtl"] #page-member .pf-back .ico {
  transform: scaleX(-1);
}

#page-member .pf-menu-wrap {
  position: relative;
  justify-self: end;
}

#page-member .pf-menu {
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-end: 0;
  z-index: 30;
  min-width: 232px;
  padding: 6px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  box-shadow: var(--ap-shadow-3);
  animation: pf-menu-in var(--ap-dur-2) var(--ap-ease-out) both;
}

@keyframes pf-menu-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to { opacity: 1; transform: none; }
}

#page-member .pf-menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ap-text);
  background: transparent;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: 14.5px;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

#page-member .pf-menu-item:hover {
  background: var(--ap-surface-2);
}

#page-member .pf-menu-item.is-danger {
  color: var(--ap-danger);
}

#page-member .pf-menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ap-text);
  font-size: 14.5px;
}

#page-member .pf-menu-select {
  min-height: 32px;
  padding-inline: 8px;
  color: var(--ap-text);
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-line);
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
}

#page-member .pf-head {
  display: grid;
  gap: 14px;
  padding: 20px 18px 6px;
}

/* Avatar and the three counts on one row, the way the reference does it. */
#page-member .pf-row {
  display: flex;
  align-items: center;
  gap: 22px;
}

#page-member .pf-avatar {
  flex: 0 0 auto;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ap-primary-tint);
  border: 1px solid var(--ap-line);
}

#page-member .pf-avatar .pf-avatar-img,
#page-member .pf-avatar img,
#page-member .pf-avatar .avatar-large {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 34px;
  color: var(--ap-primary);
}

#page-member .pf-stats {
  display: flex;
  align-items: center;
  gap: 26px;
  min-width: 0;
}

#page-member .pf-stat {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 4px 2px;
  color: var(--ap-text);
  background: transparent;
  border: 0;
  border-radius: 10px;
  font: inherit;
  cursor: pointer;
  transition: background var(--ap-dur-2) var(--ap-ease);
}

#page-member .pf-stat:hover {
  background: var(--ap-surface-2);
}

#page-member .pf-stat strong {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

#page-member .pf-stat span {
  color: var(--ap-meta);
  font-size: 12.5px;
}

#page-member .pf-stat-quiet strong {
  color: var(--ap-primary);
}

#page-member .pf-names {
  display: grid;
  gap: 3px;
}

#page-member .pf-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

#page-member .pf-name {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

#page-member .pf-headline {
  margin: 0;
  color: var(--ap-text-2);
  font-size: 14.5px;
  line-height: 1.6;
}

#page-member .pf-bio {
  margin: 2px 0 0;
  color: var(--ap-text);
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-line;
}

#page-member .pf-bio.is-empty {
  color: var(--ap-meta);
}

#page-member .pf-country,
#page-member .pf-since {
  margin: 0;
  color: var(--ap-meta);
  font-size: 13px;
}

#page-member .pf-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#page-member .pf-actions .pf-action {
  flex: 1 1 0;
  min-width: 0;
  min-height: 42px;
}

#page-member .pf-bell.is-on {
  color: var(--ap-primary);
}

/* Tabs: two labels, one hairline that slides, no pill background. */
#page-member .pf-tabs {
  position: sticky;
  inset-block-start: 52px;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  margin-block-start: 10px;
  background: var(--ap-bg);
  border-block-end: 1px solid var(--ap-line);
}

#page-member .pf-tab {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 10px;
  color: var(--ap-meta);
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--ap-dur-2) var(--ap-ease);
}

#page-member .pf-tab::after {
  content: "";
  position: absolute;
  inset-inline: 12px;
  inset-block-end: -1px;
  height: 2px;
  background: var(--ap-primary);
  transform: scaleX(0);
  transition: transform var(--ap-dur-3) var(--ap-ease);
}

#page-member .pf-tab.is-active {
  color: var(--ap-text);
}

#page-member .pf-tab.is-active::after {
  transform: scaleX(1);
}

#page-member .pf-tab-count {
  color: var(--ap-meta);
  font-size: 11.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#page-member .pf-panel {
  padding: 14px 0 40px;
  animation: pf-panel-in var(--ap-dur-3) var(--ap-ease-out) both;
}

#page-member .pf-panel[hidden] {
  display: none;
}

@keyframes pf-panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* Posts keep the feed's card rhythm, one column, no outer card. */
#page-member .pf-panel .post-card,
#page-member .pf-panel .community-post {
  margin: 0 0 14px;
}

#page-member .pf-accepted {
  display: grid;
  gap: 10px;
  padding: 0 18px;
}

#page-member .pf-accepted-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: var(--ap-shadow-1);
  transition: border-color var(--ap-dur-2) var(--ap-ease), transform var(--ap-dur-2) var(--ap-ease);
}

#page-member .pf-accepted-card.is-linked {
  cursor: pointer;
}

#page-member .pf-accepted-card.is-linked:hover {
  border-color: var(--ap-line-strong);
  transform: translateY(-1px);
}

#page-member .pf-accepted-rail {
  display: flex;
  align-items: center;
  gap: 8px;
}

#page-member .pf-accepted-card h3 {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.45;
}

#page-member .pf-accepted-note {
  margin: 0;
  color: var(--ap-meta);
  font-size: 12.5px;
}

#page-member .pf-accepted-remove {
  justify-self: start;
}

#page-member .pf-add-accepted {
  margin: 14px 18px 0;
}

#page-member .pf-empty {
  display: grid;
  gap: 6px;
  padding: 34px 22px;
  text-align: center;
  color: var(--ap-text-2);
  background: var(--ap-surface);
  border: 1px dashed var(--ap-line-strong);
  border-radius: var(--ap-radius-card);
  margin: 0 18px;
}

#page-member .pf-empty h3 {
  margin: 0;
  color: var(--ap-text);
  font-size: 17px;
  font-weight: 600;
}

#page-member .pf-empty p {
  margin: 0;
  color: var(--ap-meta);
  font-size: 13.5px;
  line-height: 1.7;
}

@media (min-width: 860px) {
  #page-member .pf-head {
    padding: 26px 22px 8px;
  }

  #page-member .pf-avatar {
    width: 116px;
    height: 116px;
  }

  #page-member .pf-row {
    gap: 34px;
  }

  #page-member .pf-stats {
    gap: 40px;
  }

  #page-member .pf-stat strong {
    font-size: 20px;
  }

  #page-member .pf-name {
    font-size: 24px;
  }

  #page-member .pf-actions .pf-action {
    flex: 0 0 auto;
    min-width: 190px;
  }

  #page-member .pf-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
    padding: 16px 0 48px;
  }

  #page-member .pf-panel[hidden] {
    display: none;
  }

  #page-member .pf-panel .post-card,
  #page-member .pf-panel .community-post {
    margin: 0;
  }

  #page-member .pf-panel .pf-accepted,
  #page-member .pf-panel .pf-empty,
  #page-member .pf-panel .pf-add-accepted,
  #page-member .pf-panel > .button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  #page-member .pf-row {
    gap: 16px;
  }

  #page-member .pf-avatar {
    width: 76px;
    height: 76px;
  }

  #page-member .pf-stats {
    gap: 18px;
  }

  #page-member .pf-stat strong {
    font-size: 16.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #page-member .pf-menu,
  #page-member .pf-panel { animation: none; }
  #page-member .pf-tab::after,
  #page-member .pf-stat,
  #page-member .pf-accepted-card { transition: none; }
}

/* ---------- 16.1 About this profile (sheet) ---------- */
/* Opened from the handle in the top bar. Full screen on a phone, a centred card on a desktop. */
#page-member .pf-about {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--ap-bg);
  color: var(--ap-text);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--ap-dur-3) var(--ap-ease), transform var(--ap-dur-3) var(--ap-ease-out);
}

#page-member .pf-about.is-in {
  opacity: 1;
  transform: none;
}

#page-member .pf-about[hidden] {
  display: none;
}

#page-member .pf-about-bar {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding-inline: 6px;
  border-block-end: 1px solid var(--ap-line);
}

#page-member .pf-about-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0;
}

#page-member .pf-about-back .ico {
  transform: scaleX(1);
}

html[dir="rtl"] #page-member .pf-about-back .ico {
  transform: scaleX(-1);
}

#page-member .pf-about-body {
  flex: 1 1 auto;
  overflow-y: auto;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  padding: 34px 22px 40px;
}

#page-member .pf-about-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ap-primary-tint);
  border: 1px solid var(--ap-line);
  display: grid;
  place-items: center;
  font-size: 34px;
  color: var(--ap-primary);
}

#page-member .pf-about-avatar .pf-avatar-img,
#page-member .pf-about-avatar img,
#page-member .pf-about-avatar .avatar-large {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 34px;
}

#page-member .pf-about-handle {
  margin: 2px 0 4px;
  font-family: var(--ap-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--ap-text);
}

#page-member .pf-about-note {
  margin: 0 0 12px;
  max-width: 44ch;
  color: var(--ap-meta);
  font-size: 13.5px;
  line-height: 1.75;
  text-align: center;
}

#page-member .pf-about-facts {
  display: grid;
  gap: 4px;
  width: 100%;
  max-width: 420px;
  margin: 0;
}

#page-member .pf-about-fact {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 4px;
  border-block-start: 1px solid var(--ap-line);
}

#page-member .pf-about-fact:last-child {
  border-block-end: 1px solid var(--ap-line);
}

#page-member .pf-about-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--ap-text-2);
}

#page-member .pf-about-icon .ico {
  width: 22px;
  height: 22px;
}

#page-member .pf-about-fact dt {
  margin: 0;
  color: var(--ap-text-2);
  font-size: 13px;
}

#page-member .pf-about-fact dd {
  margin: 1px 0 0;
  color: var(--ap-text);
  font-size: 15.5px;
  font-weight: 500;
}

#page-member .pf-about-foot {
  margin: 16px 0 0;
  max-width: 44ch;
  color: var(--ap-meta);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
}

body.pf-about-open {
  overflow: hidden;
}

@media (min-width: 860px) {
  #page-member .pf-about {
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--ap-bg) 72%, #000 28%);
    padding: 24px;
  }

  #page-member .pf-about-bar {
    width: min(480px, 100%);
    border: 1px solid var(--ap-line);
    border-block-end: 0;
    border-start-start-radius: var(--ap-radius-card);
    border-start-end-radius: var(--ap-radius-card);
    background: var(--ap-surface);
  }

  #page-member .pf-about-body {
    width: min(480px, 100%);
    flex: 0 1 auto;
    max-height: 76vh;
    background: var(--ap-surface);
    border: 1px solid var(--ap-line);
    border-block-start: 0;
    border-end-start-radius: var(--ap-radius-card);
    border-end-end-radius: var(--ap-radius-card);
    box-shadow: var(--ap-shadow-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  #page-member .pf-about { transition: none; }
}
/* ---------- 6.1 Account header (My profile) ---------- */
/* Who you are, then the four settings people come here for, then the fields that drive
   matching under an "About you" heading. One paper card, hairline rules, no nested cards. */
#page-profile .acct {
  display: grid;
  gap: 18px;
  margin-block-end: 16px;
  padding: 22px 22px 20px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: var(--ap-shadow-1);
}

#page-profile .acct-main {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

#page-profile .acct-avatar {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--ap-primary-tint);
  border: 1px solid var(--ap-line);
  color: var(--ap-primary);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

#page-profile .acct-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#page-profile .acct-identity {
  min-width: 0;
  display: grid;
  gap: 4px;
}

#page-profile .acct-name-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#page-profile .acct-name {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--ap-text);
  overflow-wrap: anywhere;
}

#page-profile .acct-handle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

#page-profile .acct-handle {
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 14px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

#page-profile .acct-edit {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--ap-meta);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--ap-dur-2) var(--ap-ease), background var(--ap-dur-2) var(--ap-ease), border-color var(--ap-dur-2) var(--ap-ease);
}

#page-profile .acct-edit .ico {
  width: 16px;
  height: 16px;
}

#page-profile .acct-edit:hover {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-line);
}

/* The verification seal beside the name, exactly as the profile, posts and staff console draw it:
   no pill, no word, no tinted background (owner, 2026-11-30). */
#page-profile .acct-badge {
  display: inline-flex;
  align-items: center;
  margin-inline-start: 2px;
  font-size: 16px;
  line-height: 1;
}

#page-profile .acct-badge[hidden] {
  display: none;
}

/* The profile link: one tap copies the whole address, not the bare handle. */
#page-profile .acct-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#page-profile .acct-copy {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  max-width: 100%;
  padding: 0 12px 0 10px;
  color: var(--ap-text-2);
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color var(--ap-dur-2) var(--ap-ease), background var(--ap-dur-2) var(--ap-ease), color var(--ap-dur-2) var(--ap-ease);
}

#page-profile .acct-copy:hover {
  color: var(--ap-text);
  border-color: var(--ap-line-strong);
}

#page-profile .acct-copy .ico {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--ap-meta);
}

#page-profile .acct-copy-url {
  font-family: var(--ap-mono);
  font-size: 13px;
  color: var(--ap-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#page-profile .acct-copy-hint {
  flex: 0 0 auto;
  color: var(--ap-primary);
  font-size: 12.5px;
  font-weight: 600;
}

#page-profile .acct-copy.is-copied {
  border-color: var(--ap-primary);
  background: var(--ap-primary-tint);
}

/* Inline editors: one field, one primary action, and the reason the change matters. */
#page-profile .acct-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  animation: acct-reveal var(--ap-dur-3) var(--ap-ease-out) both;
}

#page-profile .acct-editor[hidden] {
  display: none;
}

@keyframes acct-reveal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

#page-profile .acct-editor .field span {
  color: var(--ap-text-2);
  font-size: 13px;
  font-weight: 500;
}

#page-profile .acct-editor input {
  min-height: 44px;
  padding: 0 12px;
  color: var(--ap-text);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  font: inherit;
  font-size: 16px;
}

#page-profile .acct-handle-field {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  overflow: hidden;
}

#page-profile .acct-handle-field:focus-within {
  border-color: var(--ap-primary);
}

#page-profile .acct-at {
  padding-inline-start: 12px;
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 15px;
}

#page-profile .acct-handle-field input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  font-family: var(--ap-mono);
  font-size: 15px;
}

#page-profile .acct-handle-field input:focus {
  outline: none;
}

#page-profile .acct-handle-status {
  margin: 0;
  min-height: 18px;
  color: var(--ap-meta);
  font-size: 12.5px;
}

#page-profile .acct-handle-status.is-ok { color: var(--ap-success); }
#page-profile .acct-handle-status.is-bad { color: var(--ap-danger); }

#page-profile .acct-error {
  margin: 0;
  color: var(--ap-danger);
  font-size: 13px;
}

#page-profile .acct-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

#page-profile .acct-editor-actions .button {
  min-height: 40px;
}

#page-profile .acct-editor-note {
  margin: 0;
  color: var(--ap-meta);
  font-size: 12.5px;
  line-height: 1.6;
}

/* Sections: hairline rows, 56px, one icon, one label, one control at the end side. */
#page-profile .acct-sections {
  display: grid;
  margin-block-end: 16px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: var(--ap-shadow-1);
  overflow: hidden;
}

#page-profile .acct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 18px;
  color: var(--ap-text);
  background: transparent;
  border: 0;
  border-block-start: 1px solid var(--ap-line);
  font: inherit;
  font-size: 15px;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ap-dur-2) var(--ap-ease);
}

#page-profile .acct-row:first-child {
  border-block-start: 0;
}

#page-profile .acct-row:hover {
  background: var(--ap-surface-2);
}

#page-profile .acct-row-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-radius: 10px;
}

#page-profile .acct-row-icon .ico {
  width: 17px;
  height: 17px;
}

#page-profile .acct-row-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  flex: 1 1 auto;
}

#page-profile .acct-row-copy strong {
  font-size: 15px;
  font-weight: 600;
}

#page-profile .acct-row-copy small {
  color: var(--ap-meta);
  font-size: 12.5px;
  line-height: 1.5;
}

#page-profile .acct-row-go {
  flex: 0 0 auto;
  color: var(--ap-meta);
  font-size: 20px;
  line-height: 1;
  transform: scaleX(-1);
}

html[lang="ar"] #page-profile .acct-row-go { transform: none; }

#page-profile .acct-language {
  flex: 0 0 auto;
  min-height: 38px;
  padding-inline: 10px;
  color: var(--ap-text);
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  font: inherit;
  font-size: 14px;
}

#page-profile .acct-row-end .acct-row-icon {
  color: var(--ap-danger);
  background: color-mix(in srgb, var(--ap-danger) 12%, transparent);
}

#page-profile .acct-row-end .acct-row-copy strong {
  color: var(--ap-danger);
}

/* About you: the section heading over the existing profile form. */
#page-profile .acct-about {
  display: grid;
  gap: 2px;
  margin-block-end: 12px;
  padding-block-start: 6px;
}

#page-profile .acct-about-title {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
}

#page-profile .acct-about-note {
  margin: 0;
  max-width: 60ch;
  color: var(--ap-meta);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 720px) {
  #page-profile .acct {
    padding: 18px 16px 16px;
    gap: 16px;
  }

  #page-profile .acct-main {
    gap: 14px;
    align-items: flex-start;
  }

  #page-profile .acct-avatar {
    width: 64px;
    height: 64px;
    font-size: 26px;
  }

  #page-profile .acct-name {
    font-size: 20px;
  }

  #page-profile .acct-copy {
    width: 100%;
  }

  #page-profile .acct-copy-url {
    flex: 1 1 auto;
  }

  #page-profile .acct-row {
    padding: 10px 14px;
    min-height: 64px;
  }
}

@media (min-width: 1000px) {
  #page-profile .acct {
    padding: 26px 26px 22px;
  }

  #page-profile .acct-avatar {
    width: 92px;
    height: 92px;
    font-size: 34px;
  }

  #page-profile .acct-name {
    font-size: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #page-profile .acct-editor { animation: none; }
  #page-profile .acct-row,
  #page-profile .acct-copy,
  #page-profile .acct-edit { transition: none; }
}

/* ---------- 7. Saved ---------- */
#page-saved {
  max-width: 880px;
}

#page-saved .atlas-group {
  margin-block-end: 24px;
}

#page-saved .atlas-group-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  padding-block-end: 8px;
  border-block-end: 1px solid var(--ap-line);
}

#page-saved .atlas-group-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

#page-saved .atlas-group-head .atlas-group-count {
  color: var(--ap-meta);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

#page-saved .atlas-group-head .atlas-group-code {
  margin-inline-start: auto;
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 12px;
  direction: ltr;
  unicode-bidi: isolate;
}

#page-saved .atlas-group[data-urgency="closed"] .atlas-group-head h2 {
  color: var(--ap-meta);
}

#page-saved .opportunity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

#page-saved .opportunity-card {
  border-radius: var(--ap-radius-card);
}

/* ---------- 8. Applications ---------- */
#page-applications {
  max-width: 900px;
}

#page-applications .tracker-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin: 0 0 16px;
  padding: 10px 14px;
  color: var(--ap-meta);
  background: transparent;
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-control);
  font-size: 13px;
}

#page-applications .tracker-legend .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ap-line-strong);
}

#page-applications .tracker-legend .dot-current {
  background: var(--ap-primary);
}

#page-applications .tracker-privacy {
  margin-inline-start: auto;
  color: var(--ap-meta);
}

/* Three counters: 24/600 numbers over 12 labels. */
#page-applications .pipeline-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  padding: 0;
  background: var(--ap-line);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  overflow: hidden;
}

#page-applications .pipeline-summary-stage {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--ap-surface);
  border: 0;
  border-radius: 0;
}

#page-applications .pipeline-summary-stage span {
  order: 2;
  color: var(--ap-meta);
  font-size: 12px;
  font-weight: 500;
}

#page-applications .pipeline-summary-stage strong {
  order: 1;
  color: var(--ap-text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#page-applications .pipeline-arrow {
  display: none;
}

#page-applications .applications-list {
  display: grid;
  gap: 16px;
}

#page-applications .application-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

#page-applications .application-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

#page-applications .application-title-group h3 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: pretty;
}

#page-applications .application-title-group p {
  margin: 0;
  color: var(--ap-meta);
  font-size: 14px;
}

#page-applications .application-ids {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block-start: 6px;
}

#page-applications .public-id {
  color: var(--ap-meta);
  font-family: var(--ap-mono);
  font-size: 12px;
}

#page-applications .tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

#page-applications .tag-internal {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#page-applications .status-select {
  min-height: 40px;
  padding: 6px 12px;
  color: var(--ap-text);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line-strong);
  border-radius: var(--ap-radius-control);
  font-size: 14px;
}

/* Status stepper: four dots with labels, 44px targets, connector hairline. */
#page-applications .pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 4px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#page-applications .pipeline::-webkit-scrollbar {
  display: none;
}

#page-applications .pipeline-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 8px;
  color: var(--ap-meta);
  background: transparent;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
}

#page-applications .pipeline-step.is-choosable {
  cursor: pointer;
}

#page-applications .pipeline-step.is-choosable:hover {
  background: var(--ap-primary-tint);
}

#page-applications .pipeline-step::after {
  content: "";
  display: block;
  width: clamp(16px, 4vw, 40px);
  height: 1px;
  margin-inline: 8px;
  background: var(--ap-line);
}

#page-applications .pipeline-step:last-child::after {
  display: none;
}

#page-applications .pipeline-step .step-dot {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--ap-line-strong);
  border-radius: 50%;
  background: var(--ap-surface);
  font-size: 10px;
  font-style: normal;
  line-height: 1;
}

#page-applications .pipeline-step.is-complete {
  color: var(--ap-text-2);
}

#page-applications .pipeline-step.is-complete .step-dot {
  color: var(--ap-on-primary);
  background: var(--ap-primary);
  border-color: var(--ap-primary);
}

#page-applications .pipeline-step.is-current {
  color: var(--ap-text);
  font-weight: 600;
}

#page-applications .pipeline-step.is-current .step-dot {
  border-color: var(--ap-primary);
  box-shadow: 0 0 0 4px var(--ap-primary-tint);
}

#page-applications .application-outcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#page-applications .application-outcome-label {
  color: var(--ap-meta);
  font-size: 13px;
  font-weight: 500;
}

/* The disclaimer is an info line, not body copy. */
#page-applications .application-notice {
  margin: 0;
  padding: 10px 14px;
  padding-inline-start: 16px;
  color: var(--ap-text-2);
  background: transparent;
  border-inline-start: 3px solid var(--ap-line-strong);
  font-size: 13px;
  line-height: 1.6;
}

#page-applications .application-notice p {
  margin: 0;
}

#page-applications .application-notice small {
  display: block;
  margin-block-start: 2px;
  color: var(--ap-meta);
  font-size: 12px;
}

#page-applications .application-tools {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding-block-start: 12px;
  border-block-start: 1px solid var(--ap-line);
}

#page-applications .application-tools .field {
  display: grid;
  gap: 6px;
  color: var(--ap-text-2);
  font-size: 13px;
  font-weight: 500;
}

#page-applications .application-tools input,
#page-applications .application-tools textarea {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--ap-text);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line-strong);
  border-radius: var(--ap-radius-control);
  font-family: inherit;
  font-size: 15px;
}

/* ---------- 9. Admin ---------- */
#page-admin {
  max-width: 1180px;
}

#page-admin .admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  margin: 0 0 20px;
  background: var(--ap-line);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  overflow: hidden;
}

#page-admin .admin-stat {
  padding: 14px 16px;
  background: var(--ap-surface);
}

#page-admin .admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

#page-admin .admin-main,
#page-admin .admin-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* Dense record tables: 48px rows, 13px text, sticky header. */
#page-admin .admin-record-list {
  display: grid;
  gap: 0;
  border-block-start: 1px solid var(--ap-line);
}

#page-admin .admin-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 4px;
  border-block-end: 1px solid var(--ap-line);
  font-size: 13px;
}

#page-admin .admin-record:hover {
  background: var(--ap-surface-2);
}

#page-admin .admin-record strong {
  font-size: 14px;
  font-weight: 600;
}

#page-admin .admin-record small {
  color: var(--ap-meta);
  font-size: 12px;
}

#page-admin .admin-record .public-id,
#page-admin .admin-record code {
  font-family: var(--ap-mono);
  font-size: 12px;
  color: var(--ap-meta);
}

#page-admin .table-card-heading {
  margin-block-end: 4px;
}

#page-admin .table-card-heading .button {
  align-self: center;
}

/* Review panel: the three required checks read as a checklist. */
#page-admin .review-principles {
  background: var(--ap-surface);
  border-inline-start: 3px solid var(--ap-warning);
  border-radius: 0 var(--ap-radius-card) var(--ap-radius-card) 0;
  box-shadow: none;
}

#page-admin .review-principles ul {
  margin: 6px 0 0;
  padding-inline-start: 18px;
}

#page-admin .review-principles .eyebrow {
  margin: 0 0 2px;
  color: var(--ap-meta);
  font-size: 12.5px;
  letter-spacing: normal;
  text-transform: none;
}

html[lang="ar"] #page-admin .review-principles .eyebrow {
  letter-spacing: 0;
  text-transform: none;
}

/* ---------- 10. Notification popup ---------- */
#notifications-menu.notification-menu {
  inset-block-start: 64px;
  inset-inline-end: 16px;
  inset-inline-start: auto;
  width: min(400px, calc(100vw - 24px));
  max-height: calc(100dvh - 88px);
  padding: 0;
  gap: 0;
  color: var(--ap-text);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: var(--ap-shadow-3);
  overflow: hidden;
}

#notifications-menu .notification-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  border-block-end: 1px solid var(--ap-line);
}

#notifications-menu .notification-menu-head strong {
  font-size: 16px;
  font-weight: 600;
}

#notifications-menu .notification-menu-head .text-button {
  min-height: 36px;
  padding-inline: 8px;
  color: var(--ap-primary);
  font-size: 13px;
  font-weight: 500;
}

#notifications-menu .notification-filters {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  border-block-end: 1px solid var(--ap-line);
  scrollbar-width: none;
}

#notifications-menu .notification-filters::-webkit-scrollbar {
  display: none;
}

#notifications-menu .filter-chip {
  flex: none;
  min-height: 32px;
  padding: 4px 12px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

#notifications-menu .filter-chip[aria-pressed="true"] {
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#notifications-menu .notification-items {
  display: grid;
  gap: 0;
  max-height: min(60vh, 440px);
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#notifications-menu .notification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  min-height: 64px;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-block-end: 1px solid var(--ap-line);
  border-radius: 0;
}

#notifications-menu .notification-row.is-unread {
  border-inline-start: 3px solid var(--ap-primary);
  padding-inline-start: 13px;
  background: var(--ap-primary-tint);
}

#notifications-menu .notification-row.is-read {
  opacity: 1;
}

#notifications-menu .notification-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  text-align: start;
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: default;
}

#notifications-menu .notification-open {
  cursor: pointer;
}

#notifications-menu .notification-title-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

#notifications-menu .notification-kind {
  color: var(--ap-primary);
  font-size: 13px;
}

#notifications-menu .notification-copy strong {
  display: block;
  color: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

#notifications-menu .notification-copy p {
  margin: 2px 0;
  color: var(--ap-text-2);
  font-size: 13px;
  line-height: 1.55;
}

#notifications-menu .notification-copy small {
  color: var(--ap-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

#notifications-menu .notification-subject {
  color: var(--ap-text-2);
  font-size: 13px;
}

#notifications-menu .notification-read {
  min-height: 32px;
  padding: 4px 10px;
  color: var(--ap-primary);
  background: transparent;
  border: 1px solid var(--ap-line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

#notifications-menu .notification-read:hover {
  background: var(--ap-primary-tint);
  border-color: var(--ap-primary);
}

#notifications-menu .notification-empty {
  margin: 0;
  padding: 28px 20px;
  color: var(--ap-meta);
  font-size: 14px;
  text-align: center;
}

/* ---------- 11. Empty states (one shape, names the value) ---------- */
#page-saved .empty-state,
#page-applications .empty-state,
#page-admin .empty-state,
#page-profile .empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 480px;
  margin: 24px auto;
  padding: 32px 24px;
  text-align: center;
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--ap-radius-card);
  box-shadow: none;
}

#page-saved .empty-state .empty-symbol,
#page-applications .empty-state .empty-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-block-end: 6px;
  color: var(--ap-primary);
  background: var(--ap-primary-tint);
  border-radius: 50%;
}

#page-saved .empty-state h3,
#page-applications .empty-state h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.35;
}

#page-saved .empty-state p,
#page-applications .empty-state p {
  margin: 0 0 12px;
  max-width: 40ch;
  color: var(--ap-text-2);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 12. Responsive: compact first, expanded deltas ---------- */
@media (min-width: 1024px) {
  #page-profile .form-card,
  #page-saved .opportunity-card,
  #page-applications .application-card,
  #page-admin .form-card,
  #page-admin .admin-table-card {
    border-radius: var(--radius-2xl, 24px);
    padding: 24px;
  }

  #page-saved .opportunity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  #page-profile .profile-layout,
  #page-admin .admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-profile .profile-aside {
    position: static;
  }

  #page-applications .application-tools {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  #page-profile .form-grid,
  #page-profile .profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-profile .page-title-row,
  #page-saved .page-title-row,
  #page-applications .page-title-row,
  #page-admin .page-title-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  #page-applications .application-head {
    grid-template-columns: minmax(0, 1fr);
  }

  #page-applications .status-select {
    width: 100%;
  }

  #page-applications .tracker-privacy {
    margin-inline-start: 0;
  }

  #notifications-menu.notification-menu {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-height: 82dvh;
    border-radius: var(--radius-3xl, 28px) var(--radius-3xl, 28px) 0 0;
    border-inline: 0;
    border-block-end: 0;
    padding-block-end: var(--safe-bottom, env(safe-area-inset-bottom, 0px));
  }

  #notifications-menu .notification-items {
    max-height: 56dvh;
  }

  #auth-view.auth-layout {
    padding: 24px 16px 40px;
  }
}

/* ---------- 13. Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  #auth-view *,
  #page-profile *,
  #page-saved *,
  #page-applications *,
  #page-admin *,
  #notifications-menu * {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

/* ---------- 14. PWA install / push prompt (pwa.js) ---------- */
/* Same sheet shape as the install bar: paper surface, 28px top radius on
   compact, centred 400px dialog from 720px up. */
.atlas-pwa-card {
  position: fixed;
  z-index: 9000;
  inset-inline: 0;
  inset-block-end: 0;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  display: grid;
  gap: 6px;
  padding: 20px 16px;
  padding-block-end: max(20px, env(safe-area-inset-bottom, 0px));
  color: var(--ap-text);
  background: var(--ap-surface);
  border: 1px solid var(--ap-line);
  border-radius: var(--radius-3xl, 28px) var(--radius-3xl, 28px) 0 0;
  box-shadow: var(--ap-shadow-3);
  font-family: var(--ap-font);
  text-align: start;
}

.atlas-pwa-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.atlas-pwa-body {
  color: var(--ap-text-2);
  font-size: 15px;
  line-height: 1.6;
}

.atlas-pwa-status {
  min-height: 20px;
  color: var(--ap-meta);
  font-size: 13px;
}

.atlas-pwa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-block-start: 6px;
}

.atlas-pwa-button {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--ap-radius-control);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.atlas-pwa-primary {
  color: var(--ap-on-primary);
  background: var(--ap-primary);
  border: 1px solid transparent;
}

.atlas-pwa-primary:hover,
.atlas-pwa-primary:focus-visible {
  background: var(--ap-primary-hover);
}

.atlas-pwa-secondary {
  color: var(--ap-primary);
  background: transparent;
  border: 1px solid var(--ap-line-strong);
}

.atlas-pwa-button:focus-visible {
  outline: 2px solid var(--ap-focus);
  outline-offset: 2px;
}

@media (min-width: 720px) {
  .atlas-pwa-card {
    inset-block-end: 20px;
    width: min(480px, calc(100vw - 32px));
    border-radius: var(--radius-xl, 20px);
    padding: 20px;
  }
}

/* ---------- 15. Admin record rows and status chips (renderAdmin* output) ---------- */
#page-admin .admin-stat {
  display: grid;
  gap: 2px;
}

#page-admin .admin-stat small {
  color: var(--ap-meta);
  font-size: 12px;
  font-weight: 500;
}

#page-admin .admin-stat strong {
  color: var(--ap-text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#page-admin .admin-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 2px;
  border-block-end: 1px solid var(--ap-line);
  font-size: 13px;
}

#page-admin .admin-record:hover {
  background: var(--ap-surface-2);
}

#page-admin .admin-record-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

#page-admin .admin-record-copy strong {
  color: var(--ap-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

#page-admin .admin-record-copy small {
  color: var(--ap-meta);
  font-size: 12px;
}

#page-admin .admin-record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

#page-admin .record-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 10px;
  color: var(--ap-text-2);
  background: var(--ap-surface-3);
  border: 1px solid var(--ap-line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

#page-admin .record-status.published {
  color: var(--ap-success);
  background: var(--ap-primary-tint);
  border-color: var(--ap-success);
}

#page-admin .record-status.draft {
  color: var(--ap-meta);
}

#page-admin .record-status.needs_review {
  color: var(--ap-warning);
  background: var(--ap-warning-tint);
  border-color: var(--ap-warning);
}

#page-admin .record-status.rejected,
#page-admin .record-status.closed {
  color: var(--ap-danger);
  background: var(--ap-accent-tint);
  border-color: var(--ap-danger);
}

#page-admin .empty-copy {
  margin: 0;
  padding: 18px 2px;
  color: var(--ap-meta);
  font-size: 14px;
}

@media (max-width: 640px) {
  #page-admin .admin-record {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  #page-admin .admin-record-actions {
    justify-content: flex-start;
  }
}

/* ---------- 17. User-written text: direction from the text, not the UI (owner, 2026-11-30) ---------- */
/* An Arabic post in the English UI used to sit left-aligned with its line flow mirrored, and a
   #hashtag jumped to the other end. Each block now resolves its own base direction from its first
   strong character, and alignment follows that direction. */
:is(.pc-body, .comment-body, .pf-bio, .member-bio, .pf-headline, .community-headline,
    .pc-poll-q, .pc-poll-note, .pc-poll-meta, .pc-poll-row, .poll-title, .poll-answers,
    .notif-quote, .notif-mini-title, .notif-context, .pc-name, .comment-author,
    .application-title, .toast-text, .match-subtitle, .readiness-body, .why-text,
    .member-country, .pf-about-line, .doc-sec-body) {
  unicode-bidi: plaintext;
  text-align: start;
}

/* The same rule for what people type: the composer, a comment box, a poll option. */
:is(#community-composer textarea, #community-composer input, .comment-composer textarea,
    .comment-composer input, .pc-poll-input, .poll-option-input) {
  unicode-bidi: plaintext;
  text-align: start;
}

/* Hashtags, @mentions and links sit in their own bidi run, so the "#" or "@" stays in front of
   the word it belongs to whatever the paragraph direction is. */
.pc-tag,
.pc-mention,
.pc-link {
  unicode-bidi: isolate;
}

/* ---------- 18. Header mark and the phone tab bar (owner, 2026-11-30) ---------- */
/* The brand mark is the real logo: the lime tile with the four-point spark, not a glyph in a
   green box. The tile and the spark carry their own colours, so the mark is the same in light
   and dark and on the dark auth panel. */
.brand .brand-mark {
  background: none;
  border-radius: 0;
  box-shadow: none;
  color: inherit;
  font-size: 0;
}

.brand .brand-mark > svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* On a phone the tab bar is icons only: the label is gone from the layout but stays in the
   accessible name, which every nav button already carries through its own text. Tap targets keep
   their height and the five primary items stay evenly spaced. */
@media (max-width: 740px) {
  /* The phone tab bar is icons only (owner, 2026-11-30). Each tab keeps its accessible name from
     aria-label, its 58px height, its active top rule and its badge, so nothing shifts and nothing
     becomes unlabelled for a screen reader. */
  .bottom-link > .nav-label { display: none; }
  .bottom-link { gap: 0; min-height: 58px; }
  .bottom-link .ico { width: 25px; height: 25px; }
  .main-nav .nav-label { display: none; }
  .main-nav .nav-link { justify-content: center; padding-inline: 10px; min-height: 44px; }
  .main-nav .nav-icon .ico { width: 23px; height: 23px; }
}

@media (max-width: 410px) {
  .main-nav .nav-link { padding-inline: 8px; min-height: 44px; }
}

/* ---------- 19. Phone top bar: the brand leads, the actions follow (owner, 2026-11-30) ---------- */
/* The phone header used to put the picture, the bell and the menu at the start of the line and leave the
   logo alone at the end, so the bar read backwards in both languages. Instagram and Facebook both lead
   with the brand and keep the actions on the trailing edge, which is what this does. The avatar is gone
   from the phone bar: the profile is the last tab of the bottom bar, and the menu still carries the
   language, the appearance toggle and signing out. */
@media (max-width: 740px) {
  .topbar-inner, .topbar-inner.nav-stacked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-inline: 14px;
    /* The phone bar is physically the same in every language (owner, 2026-11-30): the brand on the
       left, the bell and the menu on the right. The page keeps its own direction, so Arabic content
       still reads right to left below the bar. */
    direction: ltr;
  }
  .topbar-inner > .brand { gap: 8px; font-size: 17px; }
  .topbar-inner > .brand .brand-mark { width: 28px; height: 28px; }
  .topbar-user { order: 0; gap: 0; margin-inline-start: auto; margin-inline-end: 0; }
  .topbar-user > .profile-shortcut { display: none; }
  .topbar-user > .notification-control { margin-inline-end: 2px; }
  .topbar-user .icon-button { width: 42px; height: 42px; }
  .topbar-user .icon-button .ico { width: 22px; height: 22px; }
}

/* The bar is laid out left to right in every language, but what opens from it is still the page's
   own language, so the notification sheet keeps its right-to-left reading in Arabic. */
html[dir="rtl"] .topbar-inner .notification-menu { direction: rtl; }

/* The count on the bell. styles.css pinned it with a physical right while atlas.css pinned the same
   badge with a logical inset-inline-end, so in Arabic both edges were set, the pill stretched across
   the bell and hid its dome. Logical edges only now, so the badge stays a small round count in the
   top corner of the bell in both directions. */
.topbar .notification-control .notification-badge {
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  inset-block-start: 4px;
  inset-inline-end: 4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

/* ---------- 20. The profile tab wears the person's picture (owner, 2026-11-30) ---------- */
/* The last tab of the phone bar was a generic person glyph. It shows the account's own picture now,
   the way the apps do, and falls back to the first letter of the name in a disc when there is no
   photo. The accessible name stays on the button, the top rule marks the active tab like the others,
   and the ring makes the active tab read the same at a glance even though there is no line icon. */
@media (max-width: 740px) {
  .bottom-link-profile { padding-top: 4px; }
  .bottom-avatar {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: #e3edc6;
    color: #24543f;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 0 0 1px var(--line);
  }
  .bottom-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .bottom-link.active .bottom-avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px currentColor; }
  html[data-theme="dark"] .bottom-avatar { background: #1D5145; color: #D8EC9F; }
}

/* One-off codes stay aligned in the UI face (owner, 2026-11-30: no monospace anywhere in the app). */
#auth-view .code-input { font-variant-numeric: tabular-nums; letter-spacing: .12em; }


/* ---------------------------------------------------------------- 19. palette B: small print on a tint
   The step tags on the profile sat on a tint with meta text, which lands under 4.5:1 in both themes.
   Text follows the palette's secondary ink, and the required tag keeps the warning pair. */
#page-profile .onboarding-step-tag { color: var(--color-text-secondary); background: var(--color-surface-3); }
#page-profile .onboarding-step-tag.is-required { color: var(--color-warning); background: var(--color-warning-tint); }

/* ---------------------------------------------------------------- 20. palette B: the signed-out landing (#auth-view)
   Mobile first, and deliberately quiet: a short hero, then the sign-in card straight under it, so the
   way in is on the first screen. The aurora, sparks, orbits and the three floating preview cards are
   gone: on a phone they overlapped the checklist, and the cards carried invented urgency ("2 days
   left"). Type, paddings and the card are all one step down from the app shell, because this is the
   first screen a stranger sees and it should not shout. Nothing here changes what the form does. */

#auth-view.auth-layout {
  display: block;
  width: 100%;
  max-width: 480px;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  overflow: visible;
  background: var(--color-surface);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  animation: none;
}

/* ---- the hero: ink-green in light, a raised warm surface in dark */
#auth-view .auth-intro {
  display: block;
  min-height: 0;
  padding: 12px 16px 14px;
  overflow: visible;
  color: var(--paper-0);
  background: var(--teal-700);
  border-radius: 0 0 18px 18px;
  font-family: var(--font-ui);
}
#auth-view .auth-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  direction: ltr;                 /* the mark stays left in both directions, like the app header */
}
#auth-view .auth-hero-top .brand-large { gap: 8px; font-size: 16px; color: var(--paper-0); }
#auth-view .auth-hero-top .brand-large .brand-mark { width: 24px; height: 24px; }
#auth-view .auth-hero-top .auth-control-group { gap: 6px; }
#auth-view .auth-hero-top .language-select {
  height: 30px;
  min-width: 84px;
  padding: 0 8px;
  color: var(--paper-0);
  background: rgba(255, 253, 248, .10);
  border: 1px solid rgba(255, 253, 248, .28);
  border-radius: var(--radius-pill);
  font-family: var(--font-ui);
  font-size: 11.5px;
}
#auth-view .auth-hero-top .icon-button {
  width: 30px;
  min-height: 30px;
  color: var(--paper-0);
  background: rgba(255, 253, 248, .10);
  border: 1px solid rgba(255, 253, 248, .28);
  border-radius: var(--radius-pill);
}

/* the eyebrow: a plain sentence in the UI face. No monospace, no tracked-out caps. */
#auth-view .auth-intro .eyebrow {
  margin: 12px 0 3px;
  color: #D8BE8A;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
html[lang="ar"] #auth-view .auth-intro .eyebrow { font-family: var(--font-ui); font-size: 12px; letter-spacing: 0; }
#auth-view .auth-intro h1 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -.01em;
  color: var(--paper-0);
}
#auth-view .auth-intro h1 span { color: var(--paper-0); }
#auth-view .auth-intro h1 .auth-line-accent { color: #C9A45F; }
html[lang="ar"] #auth-view .auth-intro h1 { font-size: 22px; line-height: 1.42; letter-spacing: 0; }
#auth-view .auth-lead { margin: 5px 0 9px; max-width: 46ch; color: rgba(255, 253, 248, .78); font-size: 12.5px; line-height: 1.5; }
#auth-view .auth-points { display: grid; gap: 4px; margin: 0; padding: 0; color: rgba(255, 253, 248, .90); font-size: 11.5px; line-height: 1.5; }
#auth-view .auth-points > div { display: flex; align-items: center; gap: 8px; }
#auth-view .auth-intro .point-check {
  flex: none;
  width: 17px;
  height: 17px;
  background: rgba(255, 253, 248, .16);
  color: var(--paper-0);
  border: 1px solid rgba(255, 253, 248, .30);
}
#auth-view .auth-intro .point-check .ico { width: 11px; height: 11px; }
#auth-view .auth-aurora,
#auth-view .auth-spotlight,
#auth-view .auth-sparks,
#auth-view .auth-float,
#auth-view .auth-orbit { display: none; }

/* ---- the card */
#auth-view .auth-card { width: 100%; max-width: none; margin: 0; padding: 14px 16px 20px; }
#auth-view .auth-card-head { display: none; }
#auth-view .auth-private {
  display: inline-block;
  margin: 0 0 7px;
  padding: 2px 8px;
  color: var(--color-text-meta);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 600;
}
#auth-view .auth-card h2 { margin: 0; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; }
#auth-view #auth-description { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; }
#auth-view .auth-tabs { margin: 12px 0; padding: 3px; border-radius: 10px; }
#auth-view .auth-tab { padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--color-text-secondary); }
#auth-view .auth-tab.active { color: var(--color-primary); background: var(--color-surface); box-shadow: 0 1px 2px rgba(15, 21, 23, .08); }

/* the terms sentence: the link is part of the sentence, so it can never break the line it sits in */
#auth-view .register-terms { margin: 10px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--color-text-meta); }
#auth-view .register-terms .button-text {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  vertical-align: baseline;
}
#auth-view .auth-secondary-action { margin-top: 6px; padding-inline: 0; font-size: 12.5px; color: var(--color-primary); }
#auth-view .auth-get-app {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 10px;
  color: var(--color-text-secondary);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: 11.5px;
}
#auth-view .auth-get-app .ico { color: var(--color-primary); }

/* ---- dark: a raised warm hero, chalk type, and a check mark that actually reads */
html[data-theme="dark"] #auth-view .auth-intro { color: var(--color-text); background: var(--color-surface-2); }
html[data-theme="dark"] #auth-view .auth-hero-top .brand-large,
html[data-theme="dark"] #auth-view .auth-intro h1,
html[data-theme="dark"] #auth-view .auth-intro h1 span { color: var(--color-text); }
html[data-theme="dark"] #auth-view .auth-intro h1 .auth-line-accent { color: var(--color-accent); }
html[data-theme="dark"] #auth-view .auth-intro .eyebrow { color: var(--color-accent); }
html[data-theme="dark"] #auth-view .auth-lead,
html[data-theme="dark"] #auth-view .auth-points { color: var(--color-text-secondary); }
/* the check was a sage glyph on a near-black disc; now the disc is sage and the tick is ink */
html[data-theme="dark"] #auth-view .auth-intro .point-check {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}
html[data-theme="dark"] #auth-view .auth-hero-top .language-select,
html[data-theme="dark"] #auth-view .auth-hero-top .icon-button { color: var(--color-text); background: var(--color-surface-3); border-color: var(--color-border); }
html[data-theme="dark"] #auth-view .auth-tab.active { background: var(--color-surface-3); }

/* ---- desktop: two columns, same content, no decoration */
@media (min-width: 861px) {
  #auth-view.auth-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    max-width: 880px;
    margin: 26px auto;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    box-shadow: var(--shadow-3);
  }
  /* the card column is taller than the hero copy, so the hero sits centred in its half
     instead of leaving a long empty green slab under the checklist */
  #auth-view .auth-intro { display: flex; flex-direction: column; justify-content: center; padding: 26px 30px; border-radius: 0; }
  #auth-view .auth-hero-top { margin-bottom: 22px; }
  #auth-view .auth-hero-top .brand-large { font-size: 18px; }
  #auth-view .auth-intro .eyebrow { margin-top: 0; font-size: 12px; }
  #auth-view .auth-intro h1 { font-size: 30px; line-height: 1.22; }
  html[lang="ar"] #auth-view .auth-intro h1 { font-size: 28px; }
  #auth-view .auth-lead { font-size: 13px; }
  #auth-view .auth-points { font-size: 12.5px; }
  #auth-view .auth-card { padding: 26px 28px 30px; align-self: center; }
  #auth-view .auth-card h2 { font-size: 22px; }
}

/* ---------------------------------------------------------------- 21. palette B, dark: brand identity on the public and sign-in surfaces
   The dark theme had drifted to a mint/sage primary on grey-green surfaces, which read as washed
   out and off-brand next to the lime brand tile and the brass accents. Here the dark side of the
   public surfaces is pinned to the real identity: deep ink surfaces, the lime tile colour as the
   fill of primary actions (ink text on it), brass for links and small accents, and no sage. */

/* ---- the signed-out landing (#auth-view lives on index.html) */
html[data-theme="dark"] #auth-view {
  /* atlas-pages layer. Deep brand green throughout: the page sits at the brand green darkened one
     step, the form card sits at the brand green itself (#123B33, the light theme's primary), and the
     hero panel sits a step above the card. Nothing here is near-black. */
  --ap-bg: #0C2620;
  --ap-surface: #123B33;
  --ap-surface-2: #17463C;
  --ap-surface-3: #1D5145;
  --ap-text: #F2F0E6;
  --ap-text-2: #C6D6CD;
  --ap-border: #2E6456;
  --ap-primary: #D8EC9F;
  --ap-primary-hover: #E6F5BC;
  --ap-primary-tint: #1D5145;
  --ap-on-primary: #16211C;
  /* app token layer, for the pieces that read --color-* directly */
  --color-bg: #0C2620;
  --color-surface: #123B33;
  --color-surface-2: #17463C;
  --color-surface-3: #1D5145;
  --color-border: #2E6456;
  --color-text: #F2F0E6;
  --color-text-secondary: #C6D6CD;
  --color-text-meta: #A9C2B6;
  --color-primary: #D8EC9F;
  --color-primary-hover: #E6F5BC;
  --color-primary-tint: #1D5145;
  --color-on-primary: #16211C;
  --color-accent: #DCC08A;
  --color-on-accent: #16211C;
  background: #0C2620;
}
html[data-theme="dark"] #auth-view .auth-intro { background: #17463C; }
html[data-theme="dark"] #auth-view .auth-card { background: #123B33; }
/* primary action: the lime tile colour with ink on it, never sage */
html[data-theme="dark"] #auth-view .button-primary,
html[data-theme="dark"] #auth-view #auth-submit {
  color: #16211C;
  background: #D8EC9F;
  border-color: #D8EC9F;
  box-shadow: none;
}
html[data-theme="dark"] #auth-view .button-primary:hover,
html[data-theme="dark"] #auth-view #auth-submit:hover { background: #E6F5BC; border-color: #E6F5BC; }
/* links and small accents take the brass, so lime means "action" and nothing else */
html[data-theme="dark"] #auth-view .register-terms .button-text,
html[data-theme="dark"] #auth-view .auth-secondary-action,
html[data-theme="dark"] #auth-view .auth-partner-link,
html[data-theme="dark"] #auth-view .auth-footnote a { color: #DCC08A; }
html[data-theme="dark"] #auth-view .auth-intro .eyebrow { color: #DCC08A; }
html[data-theme="dark"] #auth-view .auth-intro h1 .auth-line-accent { color: #DCC08A; }
/* the hero check marks: lime discs, ink ticks */
html[data-theme="dark"] #auth-view .auth-intro .point-check {
  background: #D8EC9F;
  color: #16211C;
  border-color: #D8EC9F;
}
html[data-theme="dark"] #auth-view .auth-private {
  color: #DCC08A;
  background: #17463C;
  border-color: #2E6456;
}
html[data-theme="dark"] #auth-view .auth-hero-top .language-select,
html[data-theme="dark"] #auth-view .auth-hero-top .icon-button {
  color: #F2F0E6;
  background: #1D5145;
  border-color: #5E9A88;
}
html[data-theme="dark"] #auth-view .auth-tabs { background: #123B33; border-color: #2E6456; }
html[data-theme="dark"] #auth-view .auth-tab.active { color: #D8EC9F; background: #1D5145; box-shadow: none; }

/* ---- the partner portal entry, next to the personal-account chip */
#auth-view .auth-account-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 10px;
  margin: 0 0 10px;
}
#auth-view .auth-account-row .auth-private { margin: 0; }
#auth-view .auth-partner-entry {
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 2px;
}
html[lang="ar"] #auth-view .auth-partner-entry { font-size: 11.5px; }
#auth-view .auth-partner-entry:hover { text-decoration-thickness: 2px; }

/* The token layer still names the old sage as the dark primary. The landing reads lime for
   actions, so restate it here, scoped to the documents that load this file. */
:root[data-theme="dark"]:has(#auth-view) {
  --color-primary: #D8EC9F; --color-primary-hover: #E6F5BC;
  --color-on-primary: #16211C; --color-primary-tint: #1D5145;
}

/* ---- compact sign-in landing on phones (owner asked for it smaller, 2026-11-30)
   The hero gives up height in spacing and type, and the card tightens its own gaps, so the sign-in
   form and the Browse button sit higher on the first screen. Desktop (861px and up) is untouched. */
@media (max-width: 740px) {
  #auth-view .auth-intro { padding: 10px 14px 12px; }
  #auth-view .auth-intro .eyebrow { margin: 6px 0 2px; font-size: 11px; }
  html[lang="ar"] #auth-view .auth-intro .eyebrow { font-size: 11.5px; }
  #auth-view .auth-intro h1 { font-size: 20px; line-height: 1.18; }
  html[lang="ar"] #auth-view .auth-intro h1 { font-size: 19px; line-height: 1.32; }
  #auth-view .auth-lead { margin: 4px 0 7px; font-size: 11.5px; line-height: 1.45; }
  #auth-view .auth-points { gap: 3px; font-size: 10.5px; line-height: 1.45; }
  #auth-view .auth-intro .point-check { width: 15px; height: 15px; }
  #auth-view .auth-intro .point-check .ico { width: 9px; height: 9px; }
  #auth-view .auth-browse-top { margin-top: 10px; }
  #auth-view .auth-card { padding-top: 18px; }
  #auth-view .auth-tabs { margin: 10px 0; }
  #auth-view .auth-tab { min-height: 36px; }
  #auth-view .form-stack { gap: 12px; }
}

/* ---------------------------------------------------------------- 22. the landing, alive
   Section 20 made the signed-out landing deliberately quiet, but a page with no motion at all
   reads as stalled, so it breathes now: a slow aurora and a few sparks inside the hero, the copy
   and the form arrive in a stagger, the accent line carries a soft brass shine, the checks draw
   themselves, the tab pill slides, and on wide screens three preview cards bob in the empty half
   of the hero and lean toward the pointer. The cards are generic previews on purpose: no invented
   counts and no urgency copy. Everything is transform/opacity only, the floating cards never
   render under 861px so nothing covers the checklist on a phone, and prefers-reduced-motion gets
   the same page standing still. */

/* ---- the hero is the stage: ambient layers sit under the copy */
#auth-view .auth-intro { position: relative; overflow: hidden; isolation: isolate; }
#auth-view .auth-intro > *:not(.auth-aurora):not(.auth-spotlight):not(.auth-sparks) { position: relative; z-index: 1; }

#auth-view .auth-aurora,
#auth-view .auth-spotlight,
#auth-view .auth-sparks { display: block; position: absolute; inset: 0; pointer-events: none; z-index: 0; }

/* soft light fields, drawn as gradients so there is no blur filter for a mid-range phone to pay for */
#auth-view .auth-aurora i { position: absolute; width: 62%; aspect-ratio: 1; border-radius: 50%; }
#auth-view .auth-aurora i:nth-child(1) {
  top: -28%; inset-inline-start: -18%;
  background: radial-gradient(circle, rgba(216, 236, 159, .20), rgba(216, 236, 159, 0) 65%);
  animation: auth-aurora-a 14s ease-in-out infinite alternate;
}
#auth-view .auth-aurora i:nth-child(2) {
  bottom: -34%; inset-inline-end: -12%;
  background: radial-gradient(circle, rgba(220, 192, 138, .17), rgba(220, 192, 138, 0) 65%);
  animation: auth-aurora-b 18s ease-in-out infinite alternate;
}
#auth-view .auth-aurora i:nth-child(3) {
  top: 22%; inset-inline-end: 24%; width: 42%;
  background: radial-gradient(circle, rgba(255, 253, 248, .10), rgba(255, 253, 248, 0) 62%);
  animation: auth-aurora-c 22s ease-in-out infinite alternate;
}
@keyframes auth-aurora-a { to { transform: translate3d(16%, 20%, 0) scale(1.12); } }
@keyframes auth-aurora-b { to { transform: translate3d(-18%, -16%, 0) scale(.92); } }
@keyframes auth-aurora-c { to { transform: translate3d(22%, 14%, 0) scale(1.2); } }

/* a soft light that follows the pointer (auth-motion.js writes --mx/--my; static otherwise) */
#auth-view .auth-spotlight {
  background: radial-gradient(circle 240px at var(--mx, 72%) var(--my, 26%), rgba(255, 253, 248, .10), rgba(255, 253, 248, 0) 70%);
}

/* a handful of sparks that wake and settle */
#auth-view .auth-sparks i {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: #EBDDB8; box-shadow: 0 0 8px 2px rgba(235, 221, 184, .45);
  opacity: 0; animation: auth-spark 4.5s ease-in-out infinite;
}
#auth-view .auth-sparks i:nth-child(1) { top: 16%; inset-inline-start: 20%; }
#auth-view .auth-sparks i:nth-child(2) { top: 58%; inset-inline-start: 10%; animation-delay: .9s; }
#auth-view .auth-sparks i:nth-child(3) { top: 30%; inset-inline-start: 76%; animation-delay: 1.7s; }
#auth-view .auth-sparks i:nth-child(4) { top: 76%; inset-inline-start: 62%; animation-delay: 2.3s; }
#auth-view .auth-sparks i:nth-child(5) { top: 10%; inset-inline-start: 54%; animation-delay: 3s; }
@keyframes auth-spark { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .9; transform: scale(1); } }

/* ---- the entrance: the hero browse button joins the stagger the rest already had */
#auth-view .auth-browse-top { animation: rise-soft .7s var(--ease-out) both; animation-delay: 1.05s; }

/* the accent line carries a slow brass shine instead of sitting flat */
#auth-view .auth-intro h1 .auth-line-accent {
  background: linear-gradient(90deg, #C9A45F, #F0DCA9, #C9A45F) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: line-up .9s var(--ease-out) .5s both, shine-text 2.6s ease-in-out 1.4s 1;
}
html[data-theme="dark"] #auth-view .auth-intro h1 .auth-line-accent {
  background-image: linear-gradient(90deg, #DCC08A, #F5E7C0, #DCC08A);
}

/* ---- the tab pill slides instead of the active tab repainting */
#auth-view .auth-tabs { position: relative; }
#auth-view .auth-tabs::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; inset-inline-start: 3px;
  width: calc(50% - 3px); border-radius: 8px;
  background: var(--color-surface); box-shadow: 0 1px 2px rgba(15, 21, 23, .08);
  transition: transform .4s var(--ease-out);
}
#auth-view .auth-tabs:has(.auth-tab:nth-of-type(2).active)::before { transform: translateX(-100%); }
html[dir="ltr"] #auth-view .auth-tabs:has(.auth-tab:nth-of-type(2).active)::before { transform: translateX(100%); }
#auth-view .auth-tabs .auth-tab { position: relative; z-index: 1; transition: color .3s; }
#auth-view .auth-tabs .auth-tab.active,
html[data-theme="dark"] #auth-view .auth-tabs .auth-tab.active { background: transparent; box-shadow: none; }
html[data-theme="dark"] #auth-view .auth-tabs::before { background: #1D5145; box-shadow: none; }

/* ---- surfaces glide when the theme flips instead of snapping */
#auth-view, #auth-view .auth-intro, #auth-view .auth-card, #auth-view .auth-tabs,
#auth-view .auth-hero-top .language-select, #auth-view .auth-hero-top .icon-button {
  transition: background-color .35s ease, border-color .35s ease;
}

/* ---- wide screens: preview cards bob in the empty half of the hero and lean toward the pointer.
   Under 861px they stay away entirely: the compact hero keeps the checklist clear. */
#auth-view .auth-float { display: none; }
@media (min-width: 861px) {
  #auth-view .auth-float {
    display: block; position: relative; z-index: 1;
    margin-top: 26px; padding-top: 0; width: 100%; height: 138px; perspective: 900px;
    animation: rise-soft .7s var(--ease-out) 1.05s both;
  }
  #auth-view .float-card {
    position: absolute; display: flex; align-items: center; gap: 9px;
    padding: 10px 13px; border-radius: 14px;
    color: #FFFDF8; font-size: 12.5px;
    background: rgba(255, 253, 248, .10);
    border: 1px solid rgba(255, 253, 248, .22);
    box-shadow: 0 14px 30px rgba(9, 32, 27, .25), inset 0 1px 0 rgba(255, 253, 248, .14);
    backdrop-filter: none; -webkit-backdrop-filter: none;
    transform: translate3d(calc(var(--px, 0) * var(--depth) * -22px), calc(var(--py, 0) * var(--depth) * -15px), 0);
    transition: transform .45s var(--ease-out);
  }
  #auth-view .float-card strong { font-weight: 650; white-space: nowrap; }
  #auth-view .float-text { display: flex; flex-direction: column; gap: 1px; }
  #auth-view .float-meta { color: rgba(255, 253, 248, .72); font-size: 11px; white-space: nowrap; }
  #auth-view .float-chip { padding: 2px 8px; border-radius: 999px; background: #D8EC9F; color: #16211C; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
  #auth-view .float-bell { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #D8EC9F; color: #16211C; flex: none; }
  #auth-view .float-bell .ico { width: 15px; height: 15px; animation: auth-bell 4.5s ease 2.5s infinite; transform-origin: 50% 20%; }
  #auth-view .float-a { --depth: 1.1; top: 2px; inset-inline-start: 0; animation: auth-bob 6s ease-in-out infinite; }
  #auth-view .float-b { --depth: .7; top: 90px; inset-inline-start: 32%; animation: auth-bob 7s ease-in-out -2s infinite; }
  #auth-view .float-c { --depth: 1.5; top: 50px; inset-inline-end: 0; animation: auth-bob 5.4s ease-in-out -1s infinite; }
  @keyframes auth-bob { 50% { translate: 0 -8px; } }
  @keyframes auth-bell {
    0%, 88%, 100% { transform: rotate(0); }
    90% { transform: rotate(12deg); } 92% { transform: rotate(-9deg); }
    94% { transform: rotate(5deg); } 96% { transform: rotate(-2deg); }
  }
}

/* the preview cards speak the page language without the i18n pass touching them */
#auth-view .auth-float .i18n-en, #auth-view .auth-float .i18n-ru { display: none; }
html[lang="en"] #auth-view .auth-float .i18n-ar, html[lang="ru"] #auth-view .auth-float .i18n-ar { display: none; }
html[lang="en"] #auth-view .auth-float .i18n-en { display: inline; }
html[lang="ru"] #auth-view .auth-float .i18n-ru { display: inline; }

/* ---- reduced motion: the same page, standing still */
@media (prefers-reduced-motion: reduce) {
  #auth-view .auth-aurora i, #auth-view .auth-sparks i,
  #auth-view .float-a, #auth-view .float-b, #auth-view .float-c,
  #auth-view .float-bell .ico, #auth-view .auth-browse-top,
  #auth-view .auth-intro h1 .auth-line-accent, #auth-view .auth-float { animation: none !important; }
  #auth-view .auth-sparks { display: none; }
}

/* ---------------------------------------------------------------- 23. polish pass (benchmark: Linear, Stripe, Vercel, Wellfound)
   What those pages share is not more effects, it is restraint: one large headline with a single
   accent, one muted lead, one primary action, a product-shaped proof element instead of a list of
   claims, and generous space. So: wide screens get a wider, airier card and display-size type; the
   three loose preview cards become one tidy "matched to your profile" panel (rows with a dot and a
   tag, hairline dividers); ambient motion is cut to the aurora plus two sparks; the phone hero
   stays compact. No invented numbers: the panel is generic and the trust line only says what is true
   (official sources, free account). Fonts stay on --font-ui; no letter-spacing on Arabic. */

#auth-view .auth-sparks i:nth-child(n+4) { display: none; }
#auth-view .auth-aurora i:nth-child(1) { background: radial-gradient(circle, rgba(216, 236, 159, .14), rgba(216, 236, 159, 0) 65%); }
#auth-view .auth-aurora i:nth-child(2) { background: radial-gradient(circle, rgba(220, 192, 138, .12), rgba(220, 192, 138, 0) 65%); }
#auth-view .auth-float .float-head, #auth-view .auth-float .float-foot { display: none; }

@media (max-width: 860px) {
  #auth-view .auth-intro h1 { letter-spacing: -.01em; }
  html[lang="ar"] #auth-view .auth-intro h1 { letter-spacing: 0; }
  #auth-view .auth-intro .eyebrow { font-weight: 600; opacity: .9; }
}

@media (min-width: 861px) {
  #auth-view.auth-layout {
    max-width: 1160px; margin: 40px auto 56px;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
    border-radius: 24px;
  }
  #auth-view .auth-intro { justify-content: flex-start; padding: 36px 56px 44px; }
  #auth-view .auth-hero-top { margin-bottom: 40px; }
  #auth-view .auth-card { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
  #auth-view .auth-hero-top .brand-large { font-size: 20px; }
  #auth-view .auth-intro .eyebrow { font-size: 14px; font-weight: 600; margin-bottom: 14px; }
  #auth-view .auth-intro h1 { font-size: 54px; line-height: 1.05; letter-spacing: -.025em; margin: 0; }
  html[lang="ar"] #auth-view .auth-intro h1 { font-size: 50px; line-height: 1.3; letter-spacing: 0; }
  html[lang="ru"] #auth-view .auth-intro h1 { font-size: 46px; }
  #auth-view .auth-lead { margin: 18px 0 18px; max-width: 42ch; font-size: 17px; line-height: 1.6; }
  html[lang="ar"] #auth-view .auth-lead { line-height: 1.8; }
  #auth-view .auth-points { font-size: 14.5px; gap: 10px; margin-bottom: 26px; }
  #auth-view .auth-browse-top { display: none; }
  #auth-view .auth-card { padding: 40px 48px 44px; }
  #auth-view .auth-card h2 { font-size: 28px; line-height: 1.2; letter-spacing: -.015em; }
  html[lang="ar"] #auth-view .auth-card h2 { letter-spacing: 0; }

  /* the proof panel: one surface, three rows */
  #auth-view .auth-float {
    height: auto; margin-top: 8px; padding: 6px 6px 4px; perspective: none; max-width: 470px;
    border-radius: 18px; background: rgba(255, 253, 248, .07); border: 1px solid rgba(255, 253, 248, .16);
    box-shadow: 0 18px 40px rgba(6, 26, 22, .28);
  }
  #auth-view .auth-float .float-head {
    display: flex; align-items: center; gap: 8px; padding: 10px 14px 8px;
    color: rgba(255, 253, 248, .74); font-size: 12.5px; font-weight: 600;
  }
  #auth-view .float-dot { width: 7px; height: 7px; border-radius: 50%; background: #D8EC9F; box-shadow: 0 0 0 4px rgba(216, 236, 159, .16); }
  #auth-view .auth-float .float-foot {
    display: block; padding: 8px 14px 10px; color: rgba(255, 253, 248, .6); font-size: 12px;
  }
  #auth-view .float-card, #auth-view .float-card.float-a, #auth-view .float-card.float-b, #auth-view .float-card.float-c {
    position: relative; inset: auto; top: auto; animation: none; transform: none; translate: none; will-change: auto;
    width: auto; padding: 12px 14px; gap: 12px; border-radius: 12px; font-size: 14px;
    background: transparent; border: 0; box-shadow: none;
    transition: background-color .25s ease;
  }
  #auth-view .float-card + .float-card { border-top: 1px solid rgba(255, 253, 248, .11); border-radius: 0; }
  #auth-view .float-card:hover { background: rgba(255, 253, 248, .07); }
  #auth-view .float-chip { font-size: 11.5px; padding: 3px 10px; min-width: 76px; text-align: center; }
  #auth-view .float-meta { font-size: 12px; }
  #auth-view .float-b { order: 0; }
  /* entrance only: rows rise in one after another, then rest */
  #auth-view .float-card { animation: rise-soft .6s var(--ease-out) both !important; }
  #auth-view .float-a { animation-delay: 1.1s !important; }
  #auth-view .float-b { animation-delay: 1.25s !important; }
  #auth-view .float-c { animation-delay: 1.4s !important; }
}
@media (min-width: 861px) and (prefers-reduced-motion: reduce) {
  #auth-view .float-card { animation: none !important; }
}

/* ---------------------------------------------------------------- 24. the sign-in landing, full show
   Overrides the calmer motion of section 23 on request: the sign-up area is where a visitor should
   be wowed. Layers, from back to front: a bright drifting aurora and sparks, a pointer spotlight,
   the headline lines sweeping in, a preview panel that tilts toward the pointer with one row
   lighting up at a time and a toast that comes and goes, a card with a light that follows the
   pointer and a glint along its top edge, fields that rise in one by one and glow on focus, a
   primary button with a travelling shine, a magnetic lean, a ripple and a busy ring, a shake when a
   request fails, and a cursor ring on desktop. Transform and opacity only (plus box-shadow on the
   focused field and the card glow, which are single small elements). Reduced motion removes all of
   it; touch phones skip the cursor, the tilt and the toast. */

#auth-view .auth-sparks i:nth-child(n+4) { display: block; }
#auth-view .auth-aurora i:nth-child(1) { background: radial-gradient(circle, rgba(216, 236, 159, .34), rgba(216, 236, 159, 0) 65%); }
#auth-view .auth-aurora i:nth-child(2) { background: radial-gradient(circle, rgba(220, 192, 138, .30), rgba(220, 192, 138, 0) 65%); }
#auth-view .auth-aurora i:nth-child(3) { background: radial-gradient(circle, rgba(255, 253, 248, .16), rgba(255, 253, 248, 0) 62%); }
#auth-view .auth-aurora i:nth-child(1) { animation-duration: 9s; }
#auth-view .auth-aurora i:nth-child(2) { animation-duration: 12s; }
#auth-view .auth-aurora i:nth-child(3) { animation-duration: 15s; }
#auth-view .auth-spotlight { background: radial-gradient(circle 360px at var(--mx, 72%) var(--my, 26%), rgba(255, 253, 248, .16), rgba(255, 253, 248, 0) 70%); }
#auth-view .auth-sparks i { animation-duration: 3.4s; width: 5px; height: 5px; }

/* headline: each line sweeps up out of a mask, the accent line shines faster */
#auth-view .auth-intro h1 .auth-line-accent { animation: line-up 1s var(--ease-out) .55s both, shine-text 2.6s ease-in-out 1.6s 1; }
#auth-view .auth-intro .eyebrow { animation: rise-soft .8s var(--ease-out) .15s both; }

/* the card: a light that follows the pointer, a glint across the top edge */
#auth-view .auth-card { position: relative; isolation: isolate; overflow: hidden; }
#auth-view .auth-card::before {
  content: ""; position: absolute; z-index: -1; left: 0; top: 0; width: 380px; height: 380px; margin: -190px 0 0 -190px;
  border-radius: 50%; pointer-events: none; opacity: 0; transition: opacity .35s ease;
  transform: translate3d(var(--cx, 50%), var(--cy, 30%), 0);
  background: radial-gradient(circle, rgba(201, 164, 95, .20), rgba(201, 164, 95, 0) 68%);
}
#auth-view .auth-card:hover::before { opacity: 1; }
html[dir="rtl"] #auth-view .auth-card::before { left: 0; }
#auth-view .auth-card::after {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 3px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #C9A45F 35%, #F0DCA9 50%, #C9A45F 65%, transparent);
  transform: translate3d(-100%, 0, 0); animation: auth-glint 5.5s ease-in-out 1.6s infinite;
}
@keyframes auth-glint { 0% { transform: translate3d(-100%, 0, 0); } 45%, 100% { transform: translate3d(100%, 0, 0); } }
html[data-theme="dark"] #auth-view .auth-card::before { background: radial-gradient(circle, rgba(216, 236, 159, .13), rgba(216, 236, 159, 0) 68%); }

/* fields rise in one by one, and again when the tab switches */
#auth-view #auth-form > * { animation: rise-soft .65s var(--ease-out) both; }
#auth-view #auth-form > :nth-child(1) { animation-delay: .35s; }
#auth-view #auth-form > :nth-child(2) { animation-delay: .42s; }
#auth-view #auth-form > :nth-child(3) { animation-delay: .5s; }
#auth-view #auth-form > :nth-child(4) { animation-delay: .58s; }
#auth-view #auth-form > :nth-child(5) { animation-delay: .66s; }
#auth-view #auth-form > :nth-child(6) { animation-delay: .72s; }
#auth-view #auth-form > :nth-child(7) { animation-delay: .78s; }
#auth-view #auth-form > :nth-child(8) { animation-delay: .84s; }
#auth-view #auth-form > :nth-child(9) { animation-delay: .9s; }
#auth-view #auth-form.is-swap > * { animation: swap-in .55s var(--ease-out) both; }
#auth-view #auth-form.is-swap > :nth-child(2) { animation-delay: .04s; }
#auth-view #auth-form.is-swap > :nth-child(3) { animation-delay: .1s; }
#auth-view #auth-form.is-swap > :nth-child(4) { animation-delay: .16s; }
#auth-view #auth-form.is-swap > :nth-child(5) { animation-delay: .22s; }
#auth-view #auth-form.is-swap > :nth-child(n+6) { animation-delay: .28s; }
@keyframes swap-in { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.985); } }

/* focus: the field lifts and a brass halo grows; a valid email gets a check */
#auth-view .field input { transition: box-shadow .25s ease, transform .25s var(--ease-out), border-color .2s ease; }
#auth-view .field input:focus { transform: translate3d(0, -2px, 0); box-shadow: 0 0 0 4px rgba(201, 164, 95, .26), 0 10px 22px rgba(18, 59, 51, .10); border-color: #C9A45F; }
#auth-view .field:focus-within > span { color: #8A6A2F; transition: color .2s; }
html[data-theme="dark"] #auth-view .field:focus-within > span { color: #DCC08A; }
#auth-view .field input[type="email"]:not(:placeholder-shown):valid {
  background-repeat: no-repeat; background-size: 18px 18px; background-position: calc(100% - 14px) 50%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232F8F5B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.5l4.5 4.5L19 7.5'/></svg>");
}
html[dir="rtl"] #auth-view .field input[type="email"]:not(:placeholder-shown):valid { background-position: 14px 50%; }

/* the primary button: travelling shine, magnetic lean, press, ripple, busy ring */
#auth-view #auth-submit { position: relative; overflow: hidden; isolation: isolate;
  transform: translate3d(var(--mgx, 0), var(--mgy, 0), 0); transition: transform .25s var(--ease-out), box-shadow .25s ease; }
#auth-view #auth-submit::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 45%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .34), transparent);
  transform: translate3d(-130%, 0, 0) skewX(-18deg); animation: auth-btn-shine 4.2s ease-in-out 2s infinite;
}
@keyframes auth-btn-shine { 0% { transform: translate3d(-130%, 0, 0) skewX(-18deg); } 35%, 100% { transform: translate3d(330%, 0, 0) skewX(-18deg); } }
#auth-view #auth-submit:hover { box-shadow: 0 12px 26px rgba(18, 59, 51, .28); }
#auth-view #auth-submit:active { transform: translate3d(var(--mgx, 0), var(--mgy, 0), 0) scale(.97); }
#auth-view #auth-submit span[aria-hidden] { display: inline-block; transition: transform .25s var(--ease-out); }
#auth-view #auth-submit:hover span[aria-hidden] { transform: translate3d(-5px, 0, 0); }
html[dir="ltr"] #auth-view #auth-submit:hover span[aria-hidden] { transform: translate3d(5px, 0, 0); }
#auth-view .auth-explore { transform: translate3d(var(--mgx, 0), var(--mgy, 0), 0); transition: transform .25s var(--ease-out), border-color .2s, background-color .2s; }
#auth-view #auth-submit .ripple {
  position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; z-index: -1; pointer-events: none;
  background: rgba(255, 255, 255, .45); animation: auth-ripple .65s ease-out forwards;
}
@keyframes auth-ripple { to { transform: scale(16); opacity: 0; } }
#auth-view #auth-submit.is-busy::before {
  content: ""; position: absolute; inset-block: 0; margin: auto 0; inset-inline-start: 16px; width: 16px; height: 16px;
  border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* a failed request shakes the card */
#auth-view .auth-card.is-shake { animation: auth-shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes auth-shake { 10%, 90% { transform: translate3d(-2px, 0, 0); } 20%, 80% { transform: translate3d(4px, 0, 0); } 30%, 50%, 70% { transform: translate3d(-6px, 0, 0); } 40%, 60% { transform: translate3d(6px, 0, 0); } }

/* cursor ring (desktop with a fine pointer only) */
#auth-view .auth-cursor { display: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 861px) {
  #auth-view .auth-cursor { display: block; position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; opacity: 0; transition: opacity .25s ease; }
  #auth-view.has-cursor .auth-cursor { opacity: 1; }
  #auth-view .auth-cursor i {
    display: block; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
    border: 1.5px solid #C9A45F; background: rgba(201, 164, 95, .10);
    transition: transform .25s var(--ease-out), background-color .2s;
  }
  #auth-view.cursor-hot .auth-cursor i { transform: scale(1.7); background: rgba(201, 164, 95, .18); }
  #auth-view.cursor-down .auth-cursor i { transform: scale(.7); }
}

@media (min-width: 861px) {
  /* the preview panel: floats, tilts toward the pointer, one row glows at a time */
  #auth-view .auth-intro { perspective: 1200px; }
  #auth-view .auth-float {
    animation: rise-soft .8s var(--ease-out) .9s both, auth-bob 7s ease-in-out 1.8s infinite;
    rotate: var(--tx, 0) var(--ty, 1) 0 var(--td, 0deg); transition: rotate .5s var(--ease-out);
    box-shadow: 0 24px 56px rgba(4, 20, 17, .38), inset 0 1px 0 rgba(255, 253, 248, .16);
  }
  #auth-view .float-card { opacity: 1; transition: background-color .45s ease; }
  #auth-view .float-card.is-hot { background: rgba(216, 236, 159, .13); }
  #auth-view .float-chip { transition: transform .45s var(--ease-out); }
  #auth-view .float-card.is-hot .float-chip, #auth-view .float-card.is-hot .float-bell { transform: scale(1.1); }
  #auth-view .float-bell { transition: transform .45s var(--ease-out); }
  #auth-view .float-dot { animation: auth-pulse 2.2s ease-in-out infinite; }
  @keyframes auth-pulse { 50% { opacity: .35; } }
  /* a toast that slides in at the corner, stays, and leaves */
  #auth-view .auth-float .float-toast {
    position: absolute; z-index: 2; top: -12px; inset-inline-end: -14px; display: flex; align-items: center; gap: 8px;
    padding: 9px 14px 9px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; white-space: nowrap;
    color: #16211C; background: #FFFDF8; box-shadow: 0 14px 30px rgba(4, 20, 17, .35);
    opacity: 0; animation: auth-toast 9s ease-in-out 3s infinite;
  }
  #auth-view .float-toast-ico { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #2F8F5B; color: #fff; }
  #auth-view .float-toast-ico .ico { width: 12px; height: 12px; }
  @keyframes auth-toast {
    0% { opacity: 0; transform: translate3d(0, 14px, 0) scale(.9); }
    7%, 62% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
    70%, 100% { opacity: 0; transform: translate3d(0, -10px, 0) scale(.96); }
  }
}
@media (min-width: 861px) and (prefers-reduced-motion: reduce) {
  #auth-view .auth-float .float-toast { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #auth-view .auth-card::after, #auth-view #auth-submit::after, #auth-view #auth-form > *, #auth-view .float-dot,
  #auth-view .auth-intro .eyebrow, #auth-view .auth-card.is-shake { animation: none !important; }
  #auth-view .auth-cursor { display: none !important; }
  #auth-view .auth-float { rotate: none; }
}


/* ---------------------------------------------------------------- 25. light on devices
   The show was built to be rich; this section makes it cheap without changing the look on a
   capable device. Rules: nothing animates while the tab is hidden or the hero is scrolled out of
   view (the class toggles come from auth-motion.js), no infinite paint animations (the text shine
   runs once (it repaints the glyphs every frame, the single most expensive effect we had), the live dot pulses opacity not box-shadow), will-change only where the
   browser needs no hint. Nothing is switched off by device class: the motion always runs unless the device's own
   remove-animations setting is on. */
html.tab-hidden *, html.tab-hidden *::before, html.tab-hidden *::after { animation-play-state: paused !important; }
#auth-view.intro-off .auth-intro *, #auth-view.intro-off .auth-intro *::before, #auth-view.intro-off .auth-intro *::after { animation-play-state: paused !important; }
@media (max-width: 700px) {
  #auth-view .auth-sparks i:nth-child(n+3) { display: none; }
  #auth-view .auth-aurora i:nth-child(3) { display: none; }
}

/* Safeguard (see auth-motion.js): animations that never ticked must not leave content invisible. */
html.anim-stuck #auth-view *, html.anim-stuck #auth-view *::before, html.anim-stuck #auth-view *::after { animation: none !important; }

/* ---- landing polish: the accent line carries a soft light that sweeps across it every few seconds.
   A background-clip gradient, so Arabic letters stay joined; it moves only for ~1.5 s of each 7 s cycle (no repaint while idle). */
#auth-view .auth-intro h1 .auth-line-accent {
  background-image: linear-gradient(100deg, #C9A45F 34%, #FFFBEA 50%, #C9A45F 66%);
  color: transparent; -webkit-text-fill-color: transparent;
  background-size: 300% 100%; background-position: 100% 0; background-repeat: no-repeat;
  animation: line-up .9s var(--ease-out) .5s both, accent-sweep 7s ease-in-out 1.8s infinite;
}
html[data-theme="dark"] #auth-view .auth-intro h1 .auth-line-accent {
  background-image: linear-gradient(100deg, #DCC08A 34%, #FFFFFF 50%, #DCC08A 66%);
  color: transparent; -webkit-text-fill-color: transparent;
}
html[dir="rtl"] #auth-view .auth-intro h1 .auth-line-accent { animation-name: line-up, accent-sweep-rtl; }
@keyframes accent-sweep { 0% { background-position: 100% 0; } 22% { background-position: 0 0; } 100% { background-position: 0 0; } }
@keyframes accent-sweep-rtl { 0% { background-position: 0 0; } 22% { background-position: 100% 0; } 100% { background-position: 100% 0; } }

/* ---- dark theme: the landing hero sits on the same deep green as the sign-in card below it */
html[data-theme="dark"] #auth-view .auth-intro { background: #123B33; }
html[data-theme="dark"] #auth-view .auth-aurora i:nth-child(1) { background: radial-gradient(circle, rgba(216, 236, 159, .12), rgba(216, 236, 159, 0) 65%); }
html[data-theme="dark"] #auth-view .auth-aurora i:nth-child(2) { background: radial-gradient(circle, rgba(220, 192, 138, .09), rgba(220, 192, 138, 0) 65%); }
html[data-theme="dark"] #auth-view .auth-aurora i:nth-child(3) { background: radial-gradient(circle, rgba(216, 236, 159, .07), rgba(216, 236, 159, 0) 65%); }
