/* ==========================================================================
   OFinder "Atlas" — staging design system layer, v1.0
   Loaded after styles.css. Nothing here ships to production.
   Rules: tokens only from section 1; logical properties only; no gradients,
   no glass, no decorative motion. RTL is the reference direction.
   ========================================================================== */

/* ---------------------------------------------------------------- 1. tokens */
:root {
  /* paper (light) — Palette B "Ink & brass": warm paper, ink-green, brass accent.
     The hues come from the logo mark's deep green (#0A544C); primary sits a step deeper so
     green reads as ink rather than as the loudest colour on the page. */
  --paper-0: #FFFDF8; --paper-50: #FAF7F1; --paper-100: #F6F2E9;
  --paper-200: #E5DECF; --paper-300: #8F8B7E;
  --ink-900: #1A1C1B; --ink-700: #4A4E48; --ink-500: #6D7069; --ink-400: #6D7069;
  --teal-700: #123B33; --teal-600: #174A40; --teal-500: #174A40; --teal-100: #ECF0EC; --teal-50: #ECF0EC;
  --ember-600: #8A6A2F; --ember-500: #8A6A2F; --ember-100: #F5EEDA;
  --amber-700: #7A5200; --amber-100: #FCEFD2;
  --green-700: #1B6B3A; --red-700: #9E2A20; --focus: #1B63D6;
  /* night (dark) — the brand's own deep green, never a near-black: the page is the brand green
     darkened one step, cards sit at the brand green itself (#123B33, the light primary), and
     raised surfaces climb from there. Lime fills primary actions, brass carries links. */
  --night-950: #0C2620; --night-900: #123B33; --night-850: #17463C; --night-800: #1D5145; --night-700: #245C4F;
  --chalk-50: #F2F0E6; --chalk-300: #C6D6CD; --chalk-500: #A9C2B6;
  --lime-300: #D8EC9F; --lime-400: #E6F5BC; --lime-900: #16211C;
  --mint-300: #A3BFAE; --mint-400: #B6CFBF; --mint-900: #1F2A24;
  --ember-400: #DCC08A; --amber-300: #F2C46B; --green-300: #6BD79B; --red-300: #FF8F82; --focus-dark: #8CB6FF;
  /* the brand mark keeps its own lime tile and dark spark; this is the asset, never a surface */
  --brand-lime: #D8EC9F;

  /* semantic: light */
  --color-bg: var(--paper-50);
  --color-bg-sunken: var(--paper-100);
  --color-surface: var(--paper-0);
  --color-surface-2: var(--paper-50);
  --color-surface-3: var(--paper-100);
  --color-text: var(--ink-900);
  --color-text-secondary: var(--ink-700);
  --color-text-meta: var(--ink-500);
  --color-text-inverse: var(--paper-0);
  --color-border: var(--paper-200);
  --color-border-strong: #8F8B7E;
  --color-primary: var(--teal-700);
  --color-primary-hover: var(--teal-600);
  --color-primary-tint: var(--teal-50);
  --color-on-primary: var(--paper-0);
  --color-accent: var(--ember-600);
  --color-accent-tint: var(--ember-100);
  --color-on-accent: var(--paper-0);
  /* the neutral disc behind an initial when there is no picture: no lime, no green wash */
  --color-disc: #EAE6DA;
  --color-disc-ink: #123B33;
  --color-success: var(--green-700);
  --color-warning: var(--amber-700);
  --color-warning-tint: var(--amber-100);
  --color-danger: var(--red-700);
  --color-focus: var(--focus);
  --color-scrim: rgba(15, 21, 23, .48);
  --color-media-scrim: linear-gradient(180deg, rgba(11,18,20,0) 42%, rgba(11,18,20,.82) 100%);
  --color-skeleton: linear-gradient(90deg, var(--paper-100) 0%, #FDFAF4 50%, var(--paper-100) 100%);

  /* type: one stack, Rubik for Latin and Cyrillic, Cairo for Arabic (each @font-face
     carries its own unicode-range, so the browser picks the face per script). */
  /* THE swap point: change this one value to move the whole product to another family.
     Working default is Rubik + Cairo, pending the paid font. */
  --font-ui: "Rubik", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-display-latin: "Rubik", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-display-ar: "Rubik", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;
  --font-mono: "Rubik", "Cairo", ui-sans-serif, system-ui, "Segoe UI", Tahoma, sans-serif;   /* no monospace in the UI (owner, 2026-11-30) */

  --fs-display-1: clamp(2rem, 1.4rem + 2.6vw, 2.75rem);
  --fs-display-2: clamp(1.75rem, 1.35rem + 1.6vw, 2.25rem);
  --fs-h1: clamp(1.5rem, 1.3rem + .9vw, 1.875rem);
  --fs-h2: clamp(1.3125rem, 1.2rem + .5vw, 1.5rem);
  --fs-h3: 1.25rem; --fs-body-lg: 1.0625rem; --fs-body: 1rem; --fs-body-sm: .9375rem;
  --fs-label: .8125rem; --fs-caption: .75rem; --fs-code: .78125rem;
  --lh-tight: 1.2; --lh-heading: 1.35; --lh-heading-ar: 1.45; --lh-body: 1.55; --lh-body-ar: 1.8; --lh-ui: 1.25;
  --weight-regular: 400; --weight-medium: 500; --weight-semi: 600; --weight-bold: 700;

  --space-1: 2px; --space-2: 4px; --space-3: 6px; --space-4: 8px; --space-5: 12px;
  --space-6: 16px; --space-7: 20px; --space-8: 24px; --space-9: 32px; --space-10: 40px;
  --space-11: 48px; --space-12: 64px;

  --radius-xs: 4px; --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px;
  --radius-xl: 20px; --radius-2xl: 24px; --radius-3xl: 28px; --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(15,21,23,.06), 0 1px 1px rgba(15,21,23,.04);
  --shadow-2: 0 2px 6px rgba(15,21,23,.07), 0 10px 24px -14px rgba(15,21,23,.16);
  --shadow-3: 0 12px 32px -12px rgba(15,21,23,.20), 0 2px 8px rgba(15,21,23,.06);
  --shadow-dark-1: 0 1px 0 rgba(255,255,255,.04) inset;
  --ring-focus: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-focus);

  --shell-max: 1240px; --feed-col: 640px; --rail-col: 320px; --nav-rail: 248px;
  --gutter-mobile: 16px; --gutter-desktop: 32px;
  --tabbar-h: 62px; --header-h: 56px; --safe-bottom: env(safe-area-inset-bottom, 0px);
  --touch-min: 44px; --control-h: 48px;

  --dur-1: 100ms; --dur-2: 160ms; --dur-3: 220ms; --dur-4: 320ms; --dur-5: 480ms; --dur-6: 700ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-out: cubic-bezier(.05, .7, .1, 1);
  --ease-in: cubic-bezier(.3, 0, .8, .15);

  --z-sticky: 10; --z-tabbar: 30; --z-sheet: 40; --z-modal: 50; --z-toast: 60; --z-staging-banner: 70;

  /* legacy variable remap: the old stylesheet reads these names everywhere */
  --ink: var(--color-text);
  --ink-soft: var(--color-text-secondary);
  --muted: var(--color-text-meta);
  --line: var(--color-border);
  --paper: var(--color-surface);
  --canvas: var(--color-bg);
  --navy: var(--color-primary);
  --blue: var(--color-primary);
  --blue-deep: var(--color-primary-hover);
  --mint: var(--color-primary-tint);
  --mint-deep: var(--color-success);
  --lilac: var(--color-surface-3);
  --sand: var(--color-warning-tint);
  --rose: var(--color-accent-tint);
  --red: var(--color-danger);
  --clay: var(--color-surface-3);
  --shadow: var(--shadow-2);
  --font-text: var(--font-ui);
  --font-heading: var(--font-ui);
}

/* ---------------------------------------------------------------- 1b. dark binding */
[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: var(--night-950);
  --color-bg-sunken: #091D18;
  --color-surface: var(--night-900);
  --color-surface-2: var(--night-850);
  --color-surface-3: var(--night-800);
  --color-text: var(--chalk-50);
  --color-text-secondary: var(--chalk-300);
  --color-text-meta: var(--chalk-500);
  --color-text-inverse: var(--night-950);
  --color-border: #2E6456;
  --color-border-strong: #5E9A88;
  --color-primary: var(--lime-300);
  --color-primary-hover: var(--lime-400);
  --color-primary-tint: var(--night-800);
  --color-on-primary: var(--lime-900);
  --color-accent: var(--ember-400);
  --color-accent-tint: #26382E;
  --color-on-accent: #16211C;
  --color-disc: var(--night-800);
  --color-disc-ink: var(--lime-300);
  --color-success: var(--green-300);
  --color-warning: var(--amber-300);
  --color-warning-tint: #33260C;
  --color-danger: var(--red-300);
  --color-focus: var(--focus-dark);
  --color-scrim: rgba(6, 7, 6, .66);
  --color-skeleton: linear-gradient(90deg, #17463C80 0%, #1D514580 50%, #17463C80 100%);
  --shadow-1: var(--shadow-dark-1);
  --shadow-2: var(--shadow-dark-1);
  --shadow-3: 0 24px 56px -20px rgba(0,0,0,.72);
  --ring-focus: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-focus);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: var(--night-950); --color-bg-sunken: #091D18;
    --color-surface: var(--night-900); --color-surface-2: var(--night-850); --color-surface-3: var(--night-800);
    --color-text: var(--chalk-50); --color-text-secondary: var(--chalk-300); --color-text-meta: var(--chalk-500);
    --color-text-inverse: var(--night-950);
    --color-border: #2E6456; --color-border-strong: #5E9A88;
    --color-primary: var(--lime-300); --color-primary-hover: var(--lime-400); --color-primary-tint: var(--night-800);
    --color-on-primary: var(--lime-900);
    --color-accent: var(--ember-400); --color-accent-tint: #26382E;
    --color-on-accent: #16211C; --color-disc: var(--night-800); --color-disc-ink: var(--lime-300);
    --color-success: var(--green-300); --color-warning: var(--amber-300); --color-warning-tint: #33260C;
    --color-danger: var(--red-300); --color-focus: var(--focus-dark);
    --shadow-1: var(--shadow-dark-1); --shadow-2: var(--shadow-dark-1);
  }
}

/* ---------------------------------------------------------------- 2. base */
html { background: var(--color-bg); color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang="ar"] body { line-height: var(--lh-body-ar); }
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: var(--weight-semi);
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
  color: var(--color-text);
}
html[lang="ar"] :is(h1, h2, h3, h4) { line-height: var(--lh-heading-ar); letter-spacing: 0; }
/* display type: printed-atlas serif for Latin, Naskh for Arabic */
.atlas-display, .page-title-row h1, #welcome-title, .opp-plate-title {
  font-family: var(--font-display-latin);
  font-weight: 600;
  letter-spacing: -0.015em;
}
html[lang="ar"] :is(.atlas-display, .page-title-row h1, #welcome-title, .opp-plate-title) {
  font-family: var(--font-display-ar);
  letter-spacing: 0;
}
p { margin: 0 0 var(--space-5); }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
small { font-size: var(--fs-caption); color: var(--color-text-meta); }
hr { border: 0; border-block-start: 1px solid var(--color-border); margin: var(--space-6) 0; }
::selection { background: var(--color-primary-tint); color: var(--color-primary); }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring-focus);
  border-radius: var(--radius-sm);
}
html[lang="ar"] * { letter-spacing: 0 !important; }
.visually-hidden, .sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.u-mono { font-family: var(--font-mono); font-size: var(--fs-code); letter-spacing: .02em; }
.u-tabular { font-variant-numeric: tabular-nums; }
.u-pretty { text-wrap: pretty; }
.u-balance { text-wrap: balance; }
.eyebrow {
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--color-text-meta);
}
html[lang="ar"] .eyebrow { font-family: var(--font-ui); letter-spacing: 0; }
.muted, .field-hint { color: var(--color-text-meta); }

/* ---------------------------------------------------------------- 3. app shell */
.page-wrap {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding: var(--space-8) var(--gutter-mobile) calc(var(--tabbar-h) + var(--safe-bottom) + var(--space-10));
  min-height: 60vh;
}
.page-section { padding: 0; }
.page-title-row {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--space-5); margin: 0 0 var(--space-7);
}
.page-title-row h1 { font-size: var(--fs-display-2); margin: 0 0 var(--space-3); }
.page-intro { max-width: 46ch; margin: 0; color: var(--color-text-meta); font-size: var(--fs-body-sm); }

/* header: compact is a 56px bar, expanded is a 248px rail */
.topbar {
  position: sticky; inset-block-start: 0; z-index: var(--z-sticky);
  background: var(--color-surface);
  border-block-end: 1px solid var(--color-border);
  backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
  transition: transform var(--dur-3) var(--ease-standard);
}
.topbar.is-hidden { transform: translateY(-100%); }
.topbar-inner {
  display: flex; align-items: center; gap: var(--space-5);
  width: 100%; max-width: var(--shell-max);
  min-height: var(--header-h); margin-inline: auto;
  padding: var(--space-2) var(--gutter-mobile);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--space-3);
  direction: ltr; unicode-bidi: isolate;
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--color-text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: var(--radius-sm);
  background: var(--color-primary); color: var(--color-on-primary);
  font-size: 13px; box-shadow: none; transition: none;
}
.main-nav { display: flex; align-items: center; gap: var(--space-1); min-width: 0; }
.main-nav::-webkit-scrollbar { display: none; }
.nav-link {
  position: relative;
  display: inline-flex; align-items: center; gap: var(--space-4);
  min-height: 40px; padding: var(--space-3) var(--space-5);
  border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--color-text-meta);
  font: inherit; font-size: var(--fs-body-sm); font-weight: 500;
  white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-standard), color var(--dur-2) var(--ease-standard);
}
.nav-link:hover { background: var(--color-surface-3); color: var(--color-text); text-decoration: none; }
.nav-link.active, .nav-link[aria-current="page"] {
  background: var(--color-primary-tint); color: var(--color-primary); font-weight: 600;
}
.nav-link .nav-icon { display: inline-flex; }
.nav-link .ico { width: 20px; height: 20px; }
.nav-link.active .ico { stroke-width: 2; }
.nav-link.has-new::after {
  content: ""; position: absolute; inset-block-start: 6px; inset-inline-end: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-accent); border: 2px solid var(--color-surface);
  animation: none;
}
.topbar-user { display: flex; align-items: center; gap: var(--space-2); margin-inline-start: auto; }
.icon-button {
  display: inline-grid; place-items: center;
  width: var(--touch-min); height: var(--touch-min);
  padding: 0; border: 0; border-radius: var(--radius-md);
  background: transparent; color: var(--color-text-meta); cursor: pointer;
  transition: background-color var(--dur-1) var(--ease-standard), color var(--dur-1) var(--ease-standard);
}
.icon-button:hover { background: var(--color-surface-3); color: var(--color-text); }
.icon-button .ico { width: 22px; height: 22px; }
.theme-toggle .theme-ico { display: none; }
.theme-toggle .ico { width: 20px; height: 20px; }
html[data-theme-preference="light"] .theme-ico-light,
html[data-theme-preference="dark"] .theme-ico-dark,
html[data-theme-preference="system"] .theme-ico-system { display: inline-block; }
html:not([data-theme-preference]) .theme-ico-system { display: inline-block; }
.language-select {
  height: 36px; padding-inline: var(--space-4) var(--space-2);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text-secondary);
  font: inherit; font-size: var(--fs-label); font-weight: 500;
}
.profile-shortcut {
  display: inline-flex; align-items: center; gap: var(--space-3);
  min-height: var(--touch-min); padding: var(--space-1) var(--space-2);
  border: 0; border-radius: var(--radius-pill); background: transparent;
  color: var(--color-text); cursor: pointer;
}
.profile-shortcut:hover { background: var(--color-surface-3); }
.user-avatar {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-pill);
  background: var(--color-primary-tint); color: var(--color-primary);
  font-size: var(--fs-label); font-weight: 600;
}
.user-greeting { font-size: var(--fs-body-sm); font-weight: 500; }
.notification-badge {
  position: absolute; inset-block-start: 4px; inset-inline-end: 4px;
  min-width: 16px; height: 16px; padding-inline: 4px;
  border-radius: var(--radius-pill); background: var(--color-accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notification-control { position: relative; }
.notification-menu {
  position: fixed; z-index: var(--z-sheet);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface); box-shadow: var(--shadow-3); overflow: auto;
}
.nav-menu-toggle { display: none; }
.mobile-menu {
  border-block-start: 1px solid var(--color-border);
  background: var(--color-surface); padding: var(--space-4) var(--gutter-mobile) var(--space-6);
}
.mobile-menu-links { display: grid; gap: var(--space-1); }
.mobile-menu-links .nav-link { justify-content: flex-start; width: 100%; }
.mobile-menu-row { display: flex; align-items: center; gap: var(--space-4); margin-block-start: var(--space-4); }
.mobile-menu-language { display: inline-flex; align-items: center; gap: var(--space-3); font-size: var(--fs-label); color: var(--color-text-meta); }
.mobile-menu-item { display: flex; align-items: center; gap: var(--space-4); width: 100%; min-height: var(--touch-min); padding: var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--color-text); font: inherit; text-align: start; }

/* bottom tab bar (compact) */
.bottom-nav {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  position: fixed; inset-inline: 0; inset-block-end: 0; z-index: var(--z-tabbar);
  background: var(--color-surface);
  border-block-start: 1px solid var(--color-border);
  padding-block-end: var(--safe-bottom); box-shadow: none;
}
.bottom-link {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: var(--tabbar-h); padding: 5px 2px;
  border: 0; border-radius: 0; background: transparent;
  color: var(--color-text-meta);
  font: inherit; font-size: 11px; font-weight: 500; line-height: 1.2; cursor: pointer;
}
.bottom-link .ico { width: 24px; height: 24px; }
/* Russian and English tab labels run long: one line, no wrap, no clipped second line */
.bottom-link span { max-width: 100%; font-size: 10px; line-height: 1.1; text-align: center; text-wrap: balance; }
.bottom-link.active { color: var(--color-primary); font-weight: 600; }
.bottom-link.active .ico { stroke-width: 2; }
.bottom-link.active::before {
  content: ""; position: absolute; inset-block-start: 0; inset-inline: 22%;
  height: 2px; border-radius: 0 0 2px 2px; background: var(--color-primary);
}
.bottom-link.has-new::after { inset-block-start: 8px; inset-inline-end: calc(50% - 18px); }

/* ---------------------------------------------------------------- 4. buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-4);
  min-height: var(--control-h); padding: var(--space-3) var(--space-6);
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: var(--color-primary); color: var(--color-on-primary);
  font: inherit; font-size: var(--fs-body-sm); font-weight: 600; line-height: 1.2;
  text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard),
              color var(--dur-2) var(--ease-standard), transform var(--dur-1) var(--ease-standard);
}
.button:hover { background: var(--color-primary-hover); text-decoration: none; }
.button:active { transform: scale(.98); }
.button[disabled], .button[aria-disabled="true"] { opacity: .4; box-shadow: none; cursor: not-allowed; transform: none; }
.button .ico { width: 18px; height: 18px; }
.button-primary { background: var(--color-primary); color: var(--color-on-primary); border-color: transparent; }
.button-primary:hover { background: var(--color-primary-hover); }
.button-secondary {
  background: transparent; color: var(--color-primary);
  border: 1px solid var(--color-border-strong);
}
.button-secondary:hover { background: var(--color-primary-tint); border-color: var(--color-primary); }
.button-text, .text-button {
  min-height: var(--touch-min); padding: var(--space-2) var(--space-3);
  background: transparent; border: 0; border-radius: var(--radius-sm);
  color: var(--color-primary); font: inherit; font-size: var(--fs-body-sm); font-weight: 600;
  cursor: pointer;
}
.button-text:hover, .text-button:hover { background: var(--color-primary-tint); text-decoration: none; }
.button-danger-text { background: transparent; border: 1px solid currentColor; color: var(--color-danger); }
.button-danger-text:hover { background: var(--color-accent-tint); }
.button-small { min-height: 40px; padding: var(--space-2) var(--space-5); font-size: var(--fs-label); }
.button-block { width: 100%; }
html[data-theme="dark"] .button-secondary { background: transparent; color: var(--color-primary); border-color: var(--color-border-strong); }
html[data-theme="dark"] .button-secondary:hover { background: var(--color-primary-tint); border-color: var(--color-primary); }

/* ---------------------------------------------------------------- 5. chips + tags */
.filter-chip, .chip, .relax-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 32px; padding: 0 var(--space-5);
  border: 1px solid var(--color-border); border-radius: var(--radius-pill);
  background: var(--color-surface); color: var(--color-text-secondary);
  font: inherit; font-size: var(--fs-label); font-weight: 500;
  white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard), color var(--dur-2);
}
.filter-chip:hover, .chip:hover, .relax-chip:hover { border-color: var(--color-border-strong); color: var(--color-text); }
.filter-chip[aria-pressed="true"], .relax-chip.active, .chip.is-on {
  background: var(--color-primary-tint); border-color: var(--color-primary); color: var(--color-primary);
}
.filter-chip[aria-pressed="true"]::before, .relax-chip.active::before { content: "✓"; font-size: 11px; line-height: 1; }
.chip-row, .filter-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 24px; padding: 0 var(--space-3);
  border: 1px solid transparent; border-radius: var(--radius-xs);
  background: var(--color-surface-3); color: var(--color-text-secondary);
  font-size: var(--fs-caption); font-weight: 500; line-height: 1.2;
  white-space: nowrap;
}
.tag-new { background: var(--color-primary-tint); color: var(--color-primary); }
.tag-demo { background: var(--color-warning-tint); color: var(--color-warning); }
.tag-verified { background: transparent; color: var(--color-success); border-color: currentColor; }

/* ---------------------------------------------------------------- 6. forms */
.field { display: block; margin-block-end: var(--space-5); }
.field > span, .field > label > span, .filter-select > span, .search-field > span:not(.visually-hidden) {
  display: block; margin-block-end: var(--space-3);
  font-size: var(--fs-label); font-weight: 500; color: var(--color-text-secondary);
}
.field input, .field select, .field textarea,
.select-field select, .filter-select select {
  width: 100%; min-height: var(--control-h);
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface-3); color: var(--color-text);
  font: inherit; font-size: var(--fs-body);
  box-shadow: none;
  transition: border-color var(--dur-2) var(--ease-standard), background-color var(--dur-2);
}
.field textarea { min-height: 120px; line-height: var(--lh-body); resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-text-meta); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-tint);
}
.field input::placeholder, .field textarea::placeholder { color: var(--color-text-meta); opacity: 1; }
.field-hint { display: block; margin-block-start: var(--space-2); font-size: var(--fs-caption); color: var(--color-text-meta); }
.inline-error { margin-block-start: var(--space-2); font-size: var(--fs-caption); color: var(--color-danger); }
.field-hint.inline-error, .inline-error { color: var(--color-danger); }

.search-field {
  display: flex; align-items: center; gap: var(--space-3);
  flex: 1 1 240px; min-width: 0; min-height: var(--control-h);
  padding-inline: var(--space-4);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
  background: var(--color-surface-3); color: var(--color-text-meta);
}
.search-field input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0;
  border: 0; background: transparent; color: var(--color-text);
  font: inherit; font-size: var(--fs-body); box-shadow: none;
}
.search-field input:focus { outline: none; box-shadow: none; }
.search-field:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-tint); }
.search-field .ico { width: 20px; height: 20px; }

.filter-bar {
  display: grid; grid-template-columns: 1fr; gap: var(--space-4);
  padding: var(--space-5); margin-block-end: var(--space-7);
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
}
.filter-selects { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.filter-select { display: block; }
.filter-status { display: flex; align-items: center; gap: var(--space-4); font-size: var(--fs-caption); color: var(--color-text-meta); }
.result-count {
  font-family: var(--font-mono); font-size: var(--fs-caption); font-weight: 500;
  color: var(--color-text-meta); white-space: nowrap;
}

/* ---------------------------------------------------------------- 7. opportunity card (Atlas) */
.opportunity-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-block-start: 0; }
.atlas-card, .opportunity-card.atlas-card {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 0; padding: var(--space-6) var(--space-6) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
  transform: none !important;
  transition: border-color var(--dur-2) var(--ease-standard), box-shadow var(--dur-2) var(--ease-standard);
  overflow: hidden;
}
.atlas-card:hover, .opportunity-card.atlas-card:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-3); }
.atlas-card:active, .opportunity-card.atlas-card:active,
.atlas-card.is-tilting, .opportunity-card.is-tilting { transform: none !important; box-shadow: var(--shadow-2); }
.opportunity-card.reveal-pending, .atlas-card.reveal-pending { opacity: 1; transform: none; }
.atlas-card .card-rail {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding-block-end: var(--space-4); margin-block-end: var(--space-5);
  border-block-end: 1px solid var(--color-border);
}
.atlas-card .card-code {
  font-family: var(--font-mono); font-size: var(--fs-code); letter-spacing: .06em;
  color: var(--color-text-meta); direction: ltr; unicode-bidi: isolate;
}
.atlas-card .card-head { display: flex; align-items: flex-start; gap: var(--space-4); }
.atlas-card .org-mark {
  flex: none; display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--color-surface-3); color: var(--color-text-secondary);
  font-size: var(--fs-body-sm); font-weight: 600; object-fit: contain;
}
.atlas-card .org-logo { padding: 3px; background: var(--color-surface); border: 1px solid var(--color-border); }
.atlas-card .card-id { min-width: 0; display: grid; gap: 2px; }
.atlas-card .card-org {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-body-sm); font-weight: 600; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.atlas-card .card-meta {
  font-size: var(--fs-label); color: var(--color-text-meta);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.atlas-card .card-title {
  margin: var(--space-4) 0;
  font-size: 1.125rem; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em;
  color: var(--color-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
html[lang="ar"] .atlas-card .card-title { line-height: 1.5; }
.atlas-card .card-title a { color: inherit; }
.atlas-card .card-title a:hover { color: var(--color-primary); text-decoration: none; }
.atlas-card .card-note { margin: 0 0 var(--space-4); font-size: var(--fs-caption); color: var(--color-text-meta); }

/* deadline ruler: four ticks at 30 / 14 / 7 / 3 days, fill from the inline-start edge */
.ruler { margin-block: 0 var(--space-4); }
.ruler-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4);
  margin-block-end: var(--space-2);
}
.ruler-label { font-size: var(--fs-label); font-weight: 600; color: var(--color-text); font-variant-numeric: tabular-nums; }
.ruler-scale { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; color: var(--color-text-meta); }
.ruler-track { position: relative; height: 4px; border-radius: 2px; background: var(--color-border); overflow: hidden; }
.ruler-fill {
  position: absolute; inset-block: 0; inset-inline-start: 0;
  width: var(--fill, 0%);
  background: var(--color-primary);
  border-radius: 2px;
  transform-origin: left center;
}
@media (prefers-reduced-motion: no-preference) {
  .ruler-fill { animation: atlas-ruler var(--dur-5) var(--ease-out) 1 both; }
}
[dir="rtl"] .ruler-fill { transform-origin: right center; }
.ruler-ticks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.ruler-ticks i { position: absolute; inset-block: -1px; width: 1px; background: var(--color-surface); }
.ruler-ticks i:nth-child(1) { inset-inline-start: 53.33%; }
.ruler-ticks i:nth-child(2) { inset-inline-start: 76.67%; }
.ruler-ticks i:nth-child(3) { inset-inline-start: 90%; }
.ruler-ticks i:nth-child(4) { inset-inline-start: 99%; }
.ruler.is-soon .ruler-fill { background: var(--color-warning); }
.ruler.is-soon .ruler-label { color: var(--color-warning); }
.ruler.is-urgent .ruler-fill { background: var(--color-accent); }
.ruler.is-urgent .ruler-label { color: var(--color-accent); }
.ruler.is-critical .ruler-fill { background: var(--color-danger); }
.ruler.is-critical .ruler-label { color: var(--color-danger); }
.ruler.is-closed .ruler-fill { width: 100%; background: var(--color-border-strong); }
.ruler.is-unverified .ruler-track {
  background: repeating-linear-gradient(90deg, var(--color-surface-3) 0 4px, transparent 4px 8px);
  border: 1px dashed var(--color-border-strong);
}
.ruler.is-unverified .ruler-fill { display: none; }
.ruler.is-unverified .ruler-label { color: var(--color-warning); }
@keyframes atlas-ruler { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* why this: a margin note, never a tooltip */
.why-note {
  margin: 0 0 var(--space-4);
  padding-inline-start: var(--space-5);
  border-inline-start: 3px solid var(--color-accent);
  font-size: var(--fs-label); line-height: 1.6; color: var(--color-text-secondary);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.why-note .why-label {
  display: block; margin-block-end: 1px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--color-accent);
}
html[lang="ar"] .why-note .why-label { letter-spacing: 0; }
.why-note.is-conflict { border-inline-start-color: var(--color-warning); }
.why-note.is-conflict .why-label { color: var(--color-warning); }

.atlas-card .card-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-4); padding: 0; list-style: none; }
.atlas-card .card-chips .tag { min-height: 22px; }
.atlas-card .card-foot {
  display: flex; align-items: center; gap: var(--space-2);
  margin-block-start: auto; padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--color-border);
}
.card-action {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--touch-min); padding: var(--space-2) var(--space-3);
  border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--color-text-meta); font: inherit; font-size: var(--fs-label); font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-1), color var(--dur-1), transform var(--dur-1) var(--ease-spring);
}
.card-action:hover { background: var(--color-surface-3); color: var(--color-text); }
.card-action .ico { width: 20px; height: 20px; }
.card-action.saved { color: var(--color-accent); }
.card-action.saved .ico { fill: currentColor; stroke-width: 1.9; }
.card-action.just-saved { transform: scale(1.12); }
.atlas-card .card-foot .button { margin-inline-start: auto; min-height: 40px; }
.atlas-card .opp-verification {
  display: flex; align-items: center; gap: var(--space-2);
  margin: var(--space-3) 0 0; font-size: var(--fs-caption); color: var(--color-text-meta);
}
.atlas-card .opp-verification .ico { width: 14px; height: 14px; }
.atlas-card .opp-verification.is-unverified, .atlas-card .opp-verification.is-expired { color: var(--color-warning); }
.atlas-card .view-count { font-size: var(--fs-caption); color: var(--color-text-meta); font-variant-numeric: tabular-nums; }
.atlas-card .freshness-note { margin-block-start: var(--space-3); font-size: var(--fs-caption); color: var(--color-text-meta); }
.atlas-card .opp-language-note { font-size: var(--fs-caption); color: var(--color-text-meta); }
.atlas-card .match-strong, .atlas-card .match-moderate { color: var(--color-success); }
.atlas-card .match-weak, .atlas-card .match-none { color: var(--color-text-meta); }

/* The badge tip is centred on its badge (legacy styles.css); on a phone near the
   right edge it pushes the whole page wider than the viewport. Clamp it. */
.ofv-badge-tip { max-width: min(240px, calc(100vw - 32px)); }
@media (max-width: 640px) {
  .ofv-badge-tip { inset-inline-start: auto; inset-inline-end: 0; text-align: start; transform: translate(0, 4px); }
  .ofv-badge.is-tip .ofv-badge-tip,
  .ofv-badge[tabindex]:focus .ofv-badge-tip { transform: translate(0, 0); }
}

/* ---------------------------------------------------------------- 8. opportunity page (Atlas plate) */
.opportunity-page-bar { margin-block-end: var(--space-5); }
.opportunity-page-card.atlas-opp {
  display: block;
  max-width: 860px; margin-inline: auto;
  padding: 0;
  background: transparent; border: 0; box-shadow: none;
}
.opp-plate {
  padding: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2);
}
.opp-plate-rail {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2);
  padding-block-end: var(--space-4); margin-block-end: var(--space-5);
  border-block-end: 1px solid var(--color-border);
}
.opp-code {
  margin-inline-start: auto;
  font-family: var(--font-mono); font-size: var(--fs-code); letter-spacing: .06em;
  color: var(--color-text-meta); direction: ltr; unicode-bidi: isolate;
}
.opp-plate-title {
  margin: 0 0 var(--space-4);
  font-size: var(--fs-display-2); line-height: 1.2;
  color: var(--color-text);
}
html[lang="ar"] .opp-plate-title { font-size: 1.625rem; line-height: 1.4; }
.opp-plate-org {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3);
  margin: 0 0 var(--space-6);
  font-size: var(--fs-body-sm); color: var(--color-text-secondary);
}
.opp-plate-org .org-mark {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: var(--radius-sm); background: var(--color-surface-3);
  color: var(--color-text-secondary); font-size: var(--fs-label); font-weight: 600;
}
.opp-plate .ruler { margin-block: 0 var(--space-6); }
.opp-plate .ruler-track { height: 6px; border-radius: 3px; }
.opp-plate .ruler-label { font-size: var(--fs-body-sm); }
.opp-plate-facts {
  display: grid; grid-template-columns: 1fr; gap: var(--space-4);
  margin: 0 0 var(--space-6); padding: 0;
  border-block: 1px solid var(--color-border); padding-block: var(--space-5);
}
.opp-plate-facts div { display: grid; gap: 2px; }
.opp-plate-facts dt { font-size: var(--fs-caption); color: var(--color-text-meta); }
.opp-plate-facts dd { margin: 0; font-size: var(--fs-body-sm); font-weight: 600; color: var(--color-text); }
.opp-plate-facts dd.is-eligible { color: var(--color-success); }
.opp-plate-facts dd.is-ineligible { color: var(--color-danger); }
.opp-plate-facts dd.is-unknown { color: var(--color-warning); }
.opp-actions {
  position: sticky; inset-block-end: calc(var(--tabbar-h) + var(--safe-bottom) + var(--space-2));
  z-index: 5;
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
}
.opp-actions .button { flex: 1 1 auto; }
.opp-actions .card-action { flex: none; }

/* the trust block: what we know, what we have not verified */
.opp-trust {
  display: grid; grid-template-columns: 1fr; gap: var(--space-4);
  margin-block: var(--space-5) 0;
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}
.opp-trust h3 { font-size: var(--fs-body-sm); font-weight: 600; margin: 0 0 var(--space-3); }
.opp-trust-list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.opp-trust-list li { display: flex; align-items: baseline; gap: var(--space-3); font-size: var(--fs-label); color: var(--color-text-secondary); }
.opp-trust-list li .trust-mark { flex: none; width: 14px; color: var(--color-success); font-weight: 700; }
.opp-trust-list li.is-unverified { color: var(--color-warning); }
.opp-trust-list li.is-unverified .trust-mark { color: var(--color-warning); }
.opp-trust .trust-source { margin: var(--space-4) 0 0; font-size: var(--fs-caption); color: var(--color-text-meta); }

/* body panels */
.atlas-opp .dialog-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4); margin-block-start: var(--space-5); }
.atlas-opp .detail-panel, .atlas-opp .apply-panel, .atlas-opp .readiness-panel {
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.atlas-opp .detail-panel h3, .atlas-opp .detail-panel h4 {
  margin: 0 0 var(--space-4); font-size: var(--fs-body-sm); font-weight: 600;
  color: var(--color-text); letter-spacing: 0;
}
.atlas-opp .detail-panel p, .atlas-opp .detail-panel li { font-size: var(--fs-body-sm); line-height: var(--lh-body); }
.atlas-opp .dialog-warning, .atlas-opp .dialog-explain {
  margin-block: var(--space-4) 0; padding: var(--space-4) var(--space-5);
  border-inline-start: 3px solid var(--color-warning);
  background: var(--color-warning-tint); color: var(--color-text-secondary);
  border-radius: var(--radius-sm); font-size: var(--fs-label);
}
.atlas-opp .apply-panel { margin-block: var(--space-5) 0; }
.atlas-opp .apply-panel .apply-mode { font-size: var(--fs-label); color: var(--color-text-meta); margin-block-end: var(--space-2); }
.atlas-opp .apply-cta { width: 100%; }
.atlas-opp .rule-item, .atlas-opp .funding-item {
  display: flex; gap: var(--space-4); padding-block: var(--space-3);
  border-block-start: 1px solid var(--color-border);
}
.atlas-opp .rule-state {
  flex: none; min-width: 84px; font-size: 11px; font-weight: 600;
  color: var(--color-text-meta);
}
.atlas-opp .rule-state.met, .atlas-opp .rule-state.covered { color: var(--color-success); }
.atlas-opp .rule-state.not_met, .atlas-opp .rule-state.not_covered { color: var(--color-danger); }
.atlas-opp .rule-state.unknown, .atlas-opp .rule-state.needs_review { color: var(--color-warning); }
.atlas-opp .source-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4);
  margin-block-start: var(--space-5); padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--color-border);
  font-size: var(--fs-caption); color: var(--color-text-meta);
}
.atlas-opp .dialog-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block-start: var(--space-5); }

/* the content-language note reads as a quiet fact, not as a headline */
.opp-plate > .card-note {
  display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 12px; padding: 4px 10px;
  border-radius: 999px; background: var(--paper-100); color: var(--ink-700);
  font-size: 12.5px; font-weight: 600; line-height: 1.4; letter-spacing: 0;
}
[data-theme="dark"] .opp-plate > .card-note { background: rgba(255, 255, 255, .08); color: var(--color-text-secondary); }

/* ---------------------------------------------------------------- 9. states, skeletons, sheets */
.empty-state {
  display: grid; justify-items: center; gap: var(--space-3);
  padding: var(--space-10) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  text-align: center;
}
.empty-state h3 { font-size: var(--fs-h3); font-weight: 600; margin: 0; }
.empty-state p { margin: 0; max-width: 42ch; color: var(--color-text-meta); font-size: var(--fs-body-sm); }
.empty-symbol {
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: var(--radius-pill); background: var(--color-primary-tint); color: var(--color-primary);
}
.empty-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.skeleton, .skeleton-card {
  border-radius: var(--radius-xl);
  background: var(--color-skeleton);
  background-size: 200% 100%;
  animation: atlas-shimmer 1.4s linear infinite;
  border: 1px solid var(--color-border);
}
@keyframes atlas-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
dialog.opportunity-dialog {
  border: 1px solid var(--color-border); border-radius: var(--radius-3xl);
  background: var(--color-surface); color: var(--color-text);
  box-shadow: var(--shadow-3); padding: 0; max-width: min(560px, calc(100vw - 32px));
}
dialog.opportunity-dialog::backdrop { background: var(--color-scrim); }
.dialog-shell { padding: var(--space-6); }

/* ---------------------------------------------------------------- 10. responsive */
@media (min-width: 600px) {
  .page-wrap { padding-inline: var(--gutter-tablet); }
  .topbar-inner { padding-inline: var(--gutter-tablet); }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar .search-field { grid-column: 1 / -1; }
  .filter-bar .filter-chips { grid-column: 1 / -1; }
  .filter-bar .filter-status { grid-column: 1 / -1; }
  .opp-plate { padding: var(--space-7); }
  .opp-plate-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opp-trust { grid-template-columns: 1fr 1fr; }
  .atlas-opp .dialog-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1024px) {
  /* expanded: the header becomes a 248px nav rail */
  .topbar {
    position: fixed; inset-block: 0; inset-inline-start: 0; inset-inline-end: auto;
    width: var(--nav-rail); height: 100dvh;
    border-block-end: 0; border-inline-end: 1px solid var(--color-border);
    transform: none !important;
  }
  .topbar-inner {
    flex-direction: column; align-items: stretch; gap: var(--space-5);
    height: 100%; min-height: 0; padding: var(--space-5) var(--space-4);
    max-width: none;
  }
  .main-nav { flex-direction: column; align-items: stretch; gap: 2px; margin-block-start: var(--space-4); }
  .main-nav .nav-link { justify-content: flex-start; min-height: var(--touch-min); font-size: var(--fs-body-sm); }
  .topbar-user { margin-inline-start: 0; margin-block-start: auto; flex-wrap: wrap; }
  .topbar-user .user-greeting { display: none; }
  .bottom-nav { display: none; }
  .page-wrap {
    /* the rail is fixed, so the column keeps its own width and only moves */
    width: auto; margin-inline-start: var(--nav-rail); margin-inline-end: 0;
    max-width: none; padding: var(--space-9) var(--gutter-desktop) var(--space-12);
  }
  .page-section { max-width: 1120px; margin-inline: auto; }
  .opportunity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
  .atlas-card { padding: var(--space-7); border-radius: var(--radius-2xl); }
  .opp-actions { position: static; box-shadow: none; border: 0; padding: 0; background: transparent; }
  .opp-actions .button { flex: 0 0 auto; }
  .opportunity-page-card.atlas-opp { max-width: 900px; }
}
@media (max-width: 1023px) {
  .main-nav { display: none; }
  .nav-menu-toggle { display: inline-grid; }
}
@media (max-width: 599px) {
  .page-title-row { flex-direction: column; align-items: flex-start; gap: var(--space-2); }
  /* one scrolling row of chips, like the apps; it starts at the inline-start edge */
  .filter-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-block-end: 2px; }
  .filter-chips::-webkit-scrollbar { display: none; }
  .page-title-row h1 { font-size: 1.5rem; }
  .topbar-user .language-select, .topbar-user > .theme-toggle, #logout-button { display: none; }
}

/* ---------------------------------------------------------------- 11. motion + RTL safety */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .ruler-fill { animation: none; }
}
/* legacy direction leaks: no physical left/right in Atlas components */
.atlas-card, .ruler, .why-note, .opp-plate, .opp-actions, .filter-bar, .page-wrap { direction: inherit; }
html[dir="rtl"] .back-arrow { transform: scaleX(-1); }
html[dir="rtl"] .ico-external { transform: scaleX(-1); }

/* ---------------------------------------------------------------- 12. motion
   Everything below animates transform and opacity only: the compositor does the work, nothing
   in here triggers layout or paint mid-animation. Durations stay under 340ms, entrances are
   capped at 8 staggered items so a long list never feels like it is loading in slow motion. */
:root { --ease-press: cubic-bezier(.2, .8, .2, 1); --stagger: 26ms; }

@media (prefers-reduced-motion: no-preference) {
  /* press feedback: one 100ms scale, nothing moves under the finger */
  .button, .chip, .filter-chip, .bottom-link, .nav-link, .icon-button, .card-action, .tag {
    transition: transform var(--dur-1) var(--ease-press), background-color var(--dur-2) var(--ease-standard),
                color var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard),
                box-shadow var(--dur-2) var(--ease-standard);
    touch-action: manipulation;
  }
  .button:active, .chip:active, .filter-chip:active, .bottom-link:active, .nav-link:active,
  .icon-button:active, .card-action:active, .tag:active { transform: scale(.97); }
  .bottom-link:active .ico { transform: scale(.92); }

  /* card, plate and title entrance: opacity plus a 10px rise, staggered by position */
  .atlas-card, .opp-plate, .page-title-row, .empty-state { animation: atlas-rise var(--dur-4) var(--ease-out) backwards; }
  .atlas-card:nth-child(2), .opp-plate:nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
  .atlas-card:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .atlas-card:nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
  .atlas-card:nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
  .atlas-card:nth-child(6) { animation-delay: calc(var(--stagger) * 5); }
  .atlas-card:nth-child(7) { animation-delay: calc(var(--stagger) * 6); }
  .atlas-card:nth-child(n+8) { animation-delay: calc(var(--stagger) * 7); }

  /* poll answer buttons arrive one after another */
  .poll-answers .button { animation: atlas-rise var(--dur-3) var(--ease-out) backwards; }
  .poll-answers .button:nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
  .poll-answers .button:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .poll-answers .button:nth-child(n+4) { animation-delay: calc(var(--stagger) * 3); }

  /* page changes: View Transitions where they exist, the same rise where they do not */
  @supports not (view-transition-name: page-content) {
    .page-wrap { animation: atlas-rise var(--dur-4) var(--ease-out) backwards; }
  }

  /* dialogs and sheets: the panel rises and settles, the backdrop fades */
  dialog.dialog[open], .dialog-shell { animation: atlas-sheet var(--dur-4) var(--ease-out) backwards; }
  dialog::backdrop { animation: atlas-fade var(--dur-3) linear backwards; }

  .toast { will-change: transform, opacity; }
}

@keyframes atlas-rise { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }
@keyframes atlas-sheet { from { opacity: 0; transform: translate3d(0, 14px, 0) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes atlas-fade { from { opacity: 0; } to { opacity: 1; } }

/* the toast countdown bar draws from the inline start in both directions */
html[dir="rtl"] .toast-timer { transform-origin: left; }
html[dir="ltr"] .toast-timer { transform-origin: right; }

/* ---------------------------------------------------------------- 13. chrome on demand
   No permanent side rail. The same links live behind the menu button at every width, so the
   page owns the whole screen and nothing is reserved for chrome the reader did not ask for. */
.main-nav { display: none !important; }
.nav-menu-toggle { display: inline-grid !important; }
@media (min-width: 1024px) {
  .topbar {
    position: sticky; inset: 0 0 auto 0; width: auto; height: var(--header-h);
    border-block-end: 1px solid var(--color-border); border-inline-end: 0;
  }
  .topbar-inner {
    flex-direction: row; align-items: center; gap: var(--space-4);
    height: var(--header-h); padding: var(--space-2) var(--gutter-desktop);
    max-width: var(--shell-max); margin-inline: auto;
  }
  .topbar-user { margin-inline-start: auto; margin-block-start: 0; flex-wrap: nowrap; }
  .topbar-user .user-greeting { display: inline; }
  .mobile-menu { display: block; }
  .bottom-nav { display: none; }
  .page-wrap {
    width: auto; margin-inline-start: 0; margin-inline-end: 0;
    max-width: var(--shell-max); margin-inline: auto;
    padding: var(--space-8) var(--gutter-desktop) var(--space-12);
  }
}

/* the bottom bar leaves with the top bar: one transform, no reflow */
.bottom-nav { transition: transform var(--dur-3) var(--ease-out); }
html.chrome-hidden .bottom-nav { transform: translate3d(0, 110%, 0); }
html.chrome-hidden .topbar { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) {
  .bottom-nav { transition: none; }
}

/* The menu panel is anchored under the bar at every width now that the rail is gone. */
.mobile-menu:not([hidden]) {
  display: grid; gap: var(--space-1); position: absolute; z-index: 60;
  inset-block-start: calc(100% + 6px); inset-inline-end: 0;
  width: min(320px, calc(100vw - 24px)); max-height: min(70vh, 560px); overflow-y: auto;
  padding: var(--space-3); background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: 0 18px 44px rgba(6, 20, 31, .18);
  /* its own layer and its own layout island: opening the panel never re-lays the page behind it */
  contain: layout paint; transform: translateZ(0); backface-visibility: hidden;
  will-change: transform;
}

/* ---------------------------------------------------------------- 14. paint budget
   The hero's background-size drift repaints a full gradient forever on a page nobody is touching, so
   it stops. The Founder's gold seal keeps its original shimmer (owner, 2026-11-30): production shows
   it and it is the one animation people notice, so it is not part of this budget. */
.welcome-grid { animation: none !important; }

/* ---------------------------------------------------------------- 15. notifications
   A feed, not a form: title, tabs with counts, rows that read as a sentence with the object in
   bold, a preview under the row, context and time at the end, a footer bar. Unread rows carry a
   dot, a soft tint and an inline-start accent line. Popover on desktop, bottom sheet on a phone,
   one transform each way, nothing but transform and opacity. */
.notif-scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(8, 20, 16, .34); opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out);
}
.notif-scrim.is-open { opacity: 1; }

.notification-menu.atlas-notif {
  z-index: 71; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  padding: 0; overflow: hidden;
  color: var(--color-text); background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  box-shadow: 0 26px 64px rgba(6, 20, 31, .24);
  max-height: min(74dvh, 640px);
  opacity: 0; transform: translate3d(0, -8px, 0) scale(.985); transform-origin: top right;
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-3) var(--ease-out);
  contain: layout paint;
}
.notification-menu.atlas-notif.is-open { opacity: 1; transform: none; }
[dir="rtl"] .notification-menu.atlas-notif { transform-origin: top left; }
.notif-grab { display: none; }

.notif-head { padding: var(--space-5) var(--space-5) var(--space-3); }
.notif-title { margin: 0; font-size: 1.125rem; font-weight: 650; letter-spacing: -0.01em; }

.notif-filters {
  display: flex; align-items: center; gap: var(--space-4);
  overflow-x: auto; scrollbar-width: none;
  padding: 0 var(--space-5); border-block-end: 1px solid var(--color-border);
}
.notif-filters::-webkit-scrollbar { display: none; }
.notif-tab {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 0 2px 10px; border: 0; background: transparent;
  color: var(--color-text-secondary); font: inherit; font-size: 0.8125rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: color var(--dur-2) var(--ease-standard);
}
.notif-tab:hover { color: var(--color-text); }
.notif-tab[aria-pressed="true"] { color: var(--color-primary); }
.notif-tab[aria-pressed="true"]::after {
  content: ""; position: absolute; inset-inline: 0; inset-block-end: -1px; height: 2px;
  border-radius: 2px 2px 0 0; background: var(--color-primary);
}
.notif-tab-count {
  min-width: 18px; padding: 1px 5px; border-radius: 999px;
  background: rgba(15, 82, 62, .1); color: var(--color-primary);
  font-size: 0.6875rem; font-weight: 700; line-height: 1.5; text-align: center;
}

.notif-items { overflow-y: auto; overscroll-behavior: contain; }
.notif-row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--space-3); align-items: start;
  padding: var(--space-4) var(--space-5);
  border-block-end: 1px solid var(--color-border);
  background: transparent; text-align: start;
  transition: background-color var(--dur-2) var(--ease-standard);
}
.notif-row:last-child { border-block-end: 0; }
.notif-row[role="button"] { cursor: pointer; }
.notif-row:hover { background: var(--paper-50); }
.notif-row:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; }
.notif-row.is-unread { background: rgba(15, 82, 62, .055); }
.notif-row.is-unread:hover { background: rgba(15, 82, 62, .09); }
.notif-row.is-unread::before {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px;
  background: var(--color-primary);
}
.notif-row.is-read .notif-line { color: var(--color-text-secondary); }

.notif-avatar {
  position: relative; display: grid; place-items: center; flex: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(15, 82, 62, .12); color: var(--color-primary);
  font-size: 0.9375rem; font-weight: 700;
}
.notif-avatar-letter { line-height: 1; }
.notif-kind {
  position: absolute; inset-block-end: -1px; inset-inline-end: -1px;
  display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  background: var(--color-primary); color: #fff;
  box-shadow: 0 0 0 2px var(--color-surface);
}
.notif-kind svg { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.notif-kind-follows { background: #3b82f6; }
.notif-kind-comments { background: #0f7b5f; }
.notif-kind-likes { background: #e0574b; }
.notif-kind-posts { background: #7c5cd6; }
.notif-kind-opportunities { background: #0f5257; }
.notif-kind-team { background: #b07d2b; }

.notif-main { display: grid; gap: 8px; min-width: 0; }
.notif-line { display: block; min-width: 0; color: var(--color-text); font-size: 0.875rem; line-height: 1.45; }
.notif-actor { font-weight: 500; }
.notif-action { font-weight: 650; }
.notif-quote {
  padding: 10px 12px; border-radius: 12px;
  background: var(--paper-50); border: 1px solid var(--color-border);
  color: var(--color-text-secondary); font-size: 0.8125rem; line-height: 1.5;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.notif-mini {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--color-border); border-radius: 12px;
  background: var(--color-surface);
}
.notif-mini-mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--paper-100); color: var(--color-primary); }
.notif-mini-mark svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.notif-mini-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8125rem; font-weight: 600; color: var(--color-text); }
.notif-mini::after {
  content: ""; width: 8px; height: 8px; flex: none;
  border-inline-end: 2px solid var(--color-text-meta); border-block-start: 2px solid var(--color-text-meta);
  transform: rotate(45deg); margin-inline-end: 2px;
}
.notif-inline-actions { display: flex; gap: 8px; }
.notif-inline-actions .button { min-height: 32px; padding: 0 14px; font-size: 0.8125rem; }

.notif-aside { display: grid; justify-items: end; gap: 4px; min-width: 0; padding-block-start: 2px; }
.notif-context { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text); font-size: 0.75rem; font-weight: 600; }
.notif-time { color: var(--color-text-meta); font-size: 0.75rem; white-space: nowrap; }
.notif-dot { width: 8px; height: 8px; margin-block-start: 2px; border-radius: 50%; background: var(--color-primary); }

.notif-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-5); border-block-start: 1px solid var(--color-border);
  background: var(--color-surface);
}
.notif-foot-action {
  padding: 6px 2px; border: 0; background: transparent; color: var(--color-primary);
  font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  transition: opacity var(--dur-2) var(--ease-standard), transform var(--dur-1) var(--ease-press);
}
.notif-foot-action:active { transform: scale(.97); }
.notif-foot-action:disabled { color: var(--color-text-meta); cursor: default; }
.notif-foot-link { margin-inline-start: auto; }

.notif-empty { display: grid; justify-items: center; gap: 6px; padding: var(--space-9) var(--space-6); text-align: center; }
.notif-empty-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-block-end: 4px; border-radius: 50%; background: var(--paper-100); color: var(--color-primary); }
.notif-empty-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.notif-empty strong { font-size: 0.9375rem; }
.notif-empty p { margin: 0; max-width: 30ch; color: var(--color-text-meta); font-size: 0.8125rem; line-height: 1.5; }

[data-theme="dark"] .notif-row:hover { background: rgba(255, 255, 255, .05); }
[data-theme="dark"] .notif-row.is-unread { background: rgba(255, 255, 255, .07); }
[data-theme="dark"] .notif-row.is-unread:hover { background: rgba(255, 255, 255, .1); }
[data-theme="dark"] .notif-avatar { background: rgba(255, 255, 255, .1); }
[data-theme="dark"] .notif-quote, [data-theme="dark"] .notif-mini { background: rgba(255, 255, 255, .04); }
[data-theme="dark"] .notif-tab-count { background: rgba(255, 255, 255, .12); }

@media (max-width: 740px) {
  .notification-menu.atlas-notif {
    position: fixed !important; inset: auto 0 0 0 !important; width: auto !important;
    max-height: 84dvh !important; border-radius: 20px 20px 0 0; border-inline: 0; border-block-end: 0;
    transform: translate3d(0, 100%, 0); transform-origin: bottom center;
    padding-block-end: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -18px 50px rgba(6, 20, 31, .28);
  }
  .notification-menu.atlas-notif.is-open { transform: none; }
  .notif-grab { display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 999px; background: var(--color-border); }
  .notif-head { padding-block: var(--space-3) var(--space-2); }
  .notif-row { padding-block: var(--space-3); }
  .notif-context { max-width: 6.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .notification-menu.atlas-notif, .notif-scrim { transition: none; }
  .notification-menu.atlas-notif { transform: none; opacity: 1; }
}

/* the full notifications page: the same rows, on a surface, grouped New then Earlier */
.notif-page-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.notif-page-list .notif-group + .notif-group { border-block-start: 1px solid var(--color-border); }
.notif-page-list .notif-group-title { padding: var(--space-4) var(--space-5) var(--space-2); }
.notif-page-list .notif-row { padding-inline: var(--space-5); }
.notif-page-list .notif-empty { padding-block: var(--space-10); }
.notif-mini-poll { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.notif-mini-poll .notif-mini-count {
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: rgba(15, 82, 62, .1); color: var(--color-primary);
  font-size: 0.6875rem; font-weight: 700; text-align: center;
}
@media (max-width: 599px) {
  .notif-page-list { border-radius: var(--radius-lg); }
  #page-notifications .page-title-row { align-items: flex-start; }
}


/* ---------------------------------------------------------------- 16. palette B: components that hard-coded a colour
   Palette B "Ink & brass" (owner, 2026-11-30). The token layer above does most of the work;
   these rules cover the places where styles.css wrote a literal instead of reading a token,
   which is how a pale fill ended up with white text and how the lime survived the token swap.
   Nothing here changes a shape, a size or a layout. */

/* the initial disc: warm neutral, ink initial, no lime and no green wash */
.avatar, .user-avatar { background: var(--color-disc); color: var(--color-disc-ink); }
.profile-shortcut.active .user-avatar { box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary); }

/* the current page in the nav is a tinted plate with ink-green text, not a pale lime block */
.nav-link.active { color: var(--color-primary); background: var(--color-bg-sunken); }
.nav-indicator { background: var(--color-bg-sunken); }
html[data-theme="dark"] .nav-link.active { color: #E6E2D5; background: var(--color-surface-2); }
html[data-theme="dark"] .nav-indicator { background: var(--color-surface-2); }

/* selected pills: the fill and its text are a pair, so dark mode can never put white on sage */
.filter-chip[aria-pressed="true"],
.filter-chips-quick .filter-chip[aria-pressed="true"],
.community-tabs button[aria-pressed="true"] {
  color: var(--color-on-primary);
  background: var(--color-primary);
  border-color: var(--color-primary);
}
html[data-theme="dark"] .filter-chip[aria-pressed="true"],
html[data-theme="dark"] .filter-chips-quick .filter-chip[aria-pressed="true"],
html[data-theme="dark"] .community-tabs button[aria-pressed="true"] {
  color: var(--color-primary);
  background: var(--color-primary-tint);
  border-color: var(--color-primary);
}

/* primary action: ink-green in light, brass in dark, where green would sit too close to the paper */
.button-primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); box-shadow: none; }
.button-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
html[data-theme="dark"] .button-primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-on-accent); }
html[data-theme="dark"] .button-primary:hover { background: #D6B274; border-color: #D6B274; }

/* the small lime chips that carried the old brand colour by literal */
.point-check, .float-chip, .get-app-icon { background: var(--color-disc); color: var(--color-disc-ink); }
.notif-mini-poll .notif-mini-count { background: var(--color-primary-tint); color: var(--color-primary); }

/* the legacy names, dark: styles.css pins these on :root[data-theme="dark"], which outranks the
   plain [data-theme="dark"] remap at the top of this file, so the old green-black surfaces survived
   the token swap. Same specificity, later file: the dark theme now reads from the palette too. */
:root[data-theme="dark"] {
  --ink: var(--color-text);
  --ink-soft: var(--color-text-secondary);
  --muted: var(--color-text-meta);
  --line: var(--color-border);
  --paper: var(--color-surface);
  --canvas: var(--color-bg);
  --navy: var(--color-primary);
  --blue: var(--color-primary);
  --blue-deep: var(--color-primary-hover);
  --mint: var(--color-primary-tint);
  --mint-deep: var(--color-success);
  --lilac: var(--color-surface-3);
  --sand: var(--color-warning-tint);
  --rose: var(--color-accent-tint);
  --red: var(--color-danger);
  --clay: var(--color-surface-3);
  --lime: var(--color-disc);
  --shadow: var(--shadow-2);
}
html[data-theme="dark"] .profile-shortcut.active .user-avatar { box-shadow: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-primary); }


/* dark chrome that pinned its own green-black surface instead of reading a token */
html[data-theme="dark"] .topbar { background: rgba(12, 38, 32, .94); border-color: var(--color-border); }
html[data-theme="dark"] .user-avatar { color: var(--color-disc-ink); background: var(--color-disc); }
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .search-field input,
html[data-theme="dark"] .select-field select { background: var(--color-surface-2); border-color: var(--color-border); color: var(--color-text); }
html[data-theme="dark"] .button-secondary { color: var(--color-text); background: var(--color-surface-2); border-color: var(--color-border-strong); }
html[data-theme="dark"] .icon-button:hover { color: var(--color-text); background: var(--color-surface-2); border-color: var(--color-border); }

/* the unread count sits on brass in dark, so its text has to be ink */
html[data-theme="dark"] .notification-badge { color: var(--color-on-accent); }

/* the notification kind badge: the green and the teal move onto the palette, the rest stay */
.notif-kind-comments { background: var(--color-primary); color: var(--color-on-primary); }
.notif-kind-opportunities { background: var(--color-accent); color: var(--color-on-accent); }
html[data-theme="dark"] .notif-kind { color: var(--color-on-primary); }
html[data-theme="dark"] .notif-kind-comments { background: var(--color-primary); color: var(--color-on-primary); }
html[data-theme="dark"] .notif-kind-opportunities { background: var(--color-accent); color: var(--color-on-accent); }

/* the page glow: paper is flat now, and dark is a warm near-black rather than a green haze */
body { background: var(--color-bg); }
html[data-theme="dark"] body { background: var(--color-bg); }

/* Tabular digits: counts, stats and badges must not jitter as the number changes.
   Arabic leading (1.8 body / 1.45 headings) and letter-spacing 0 already come from
   the --lh-*-ar tokens and html[lang="ar"] rules above; Cairo needs no extra override. */
.stat-value,
.view-count,
.count-chip,
.result-count,
.notification-badge,
.countdown-chip,
.pf-stat,
.admin-stat,
#filter-result-count,
[data-count],
time { font-variant-numeric: tabular-nums; }
