/* Halal Research — Thmanyah-inspired editorial styling, light + dark themes */

/* Colour, shadow and surface tokens live in tokens.css (loaded first). */

html, body {
  overscroll-behavior-y: contain;
  -webkit-tap-highlight-color: transparent;
  font-family: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  letter-spacing: -0.011em;
  background-color: var(--bg-base);
  color: var(--text-base);
}

/* Tabular figures */
.tabular { font-variant-numeric: tabular-nums; }

/* Safe area — !important because the Tailwind CDN injects its utilities
   AFTER this sheet, so the header's py-3 silently beat .safe-top and in
   installed (standalone) mode the header slid under the iOS status bar
   (battery/clock), making the toggles untappable. The calc keeps the
   header's own 0.75rem breathing room on top of the notch inset. */
.safe-top    { padding-top: calc(env(safe-area-inset-top, 0px) + 0.75rem) !important; }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px) !important; }

/* ---------- App header ---------------------------------------------------
   The header is a quiet elevated surface; bronze communicates state through
   the depth-mode pill instead of becoming a decorative full-width stripe. */
.pwa-header {
  border-bottom: 1px solid var(--border-warm-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sticky);
}
.header-bar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.header-identity {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 9px;
}
.header-separator { color: var(--text-dim); flex: none; }
.header-page-title {
  min-width: 0;
  margin: 0;
  color: var(--text-muted);
  font-size: .83rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
html[lang="ar"] .header-page-title { letter-spacing: 0; }
.header-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.header-mode-btn,
.header-icon-btn,
.header-menu-close,
.header-setting-action,
.header-setting-danger {
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, transform .1s ease;
}
.header-mode-btn {
  min-width: 48px;
  height: 44px;
  padding-inline: 11px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--border-warm));
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
}
.header-icon-btn,
.header-menu-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}
.header-icon-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border-warm));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.header-mode-btn:active,
.header-icon-btn:active,
.header-menu-close:active,
.header-setting-action:active,
.header-setting-danger:active { transform: scale(.97); }
.header-mode-btn:focus-visible,
.header-icon-btn:focus-visible,
.header-menu-close:focus-visible,
.header-setting-action:focus-visible,
.header-setting-danger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: transparent;
}
.header-menu {
  position: fixed;
  z-index: 50;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  inset-inline-end: 12px;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid var(--border-warm-2);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-pop);
  color: var(--text-base);
}
.header-menu-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline-start: 10px;
  border-bottom: 1px solid var(--border-warm);
}
.header-menu-title {
  font-family: 'IBM Plex Serif', 'IBM Plex Sans Arabic', serif;
  font-size: 1rem;
  font-weight: 600;
}
.header-setting-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-inline: 10px 4px;
  border-bottom: 1px solid var(--border-warm);
}
.header-setting-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.header-setting-label { font-size: .84rem; font-weight: 500; }
.header-setting-action {
  min-width: 96px;
  min-height: 44px;
  padding-inline: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 10px;
  border: 1px solid var(--border-warm);
  background: var(--bg-inset);
  color: var(--text-base);
  font-size: .78rem;
  font-weight: 600;
}
.header-setting-danger {
  width: 100%;
  min-height: 52px;
  padding-inline: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--bad);
  font-size: .84rem;
  font-weight: 600;
  text-align: start;
}
.header-setting-danger:active {
  background: color-mix(in srgb, var(--bad) 9%, transparent);
}

/* ---------- Global finder ------------------------------------------------
   A compact command sheet, not an AI prompt. Results are deterministic links
   to company dossiers and learning surfaces. */
.global-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 54;
  background: rgba(20, 16, 13, .38);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.global-search {
  position: fixed;
  z-index: 60;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  inset-inline: 12px;
  width: min(620px, calc(100vw - 24px));
  max-height: min(78dvh, 680px);
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--border-warm-2);
  border-radius: 16px;
  background: var(--bg-elev);
  color: var(--text-base);
  box-shadow: var(--shadow-pop);
}
.global-search-head {
  min-height: 64px;
  padding: 8px 8px 8px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-warm);
}
[dir="rtl"] .global-search-head { padding: 8px 14px 8px 8px; }
.global-search-head input {
  width: 100%;
  height: 48px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-base);
  font-size: .95rem;
}
.global-search-head input::placeholder { color: var(--text-dim); }
.global-search-close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  color: var(--text-muted);
  background: transparent;
}
.global-search-close:active { background: var(--bg-elev-2); transform: scale(.97); }
.global-search-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.global-search-status {
  min-height: 32px;
  padding: 8px 14px 5px;
  color: var(--text-muted);
  font-size: .7rem;
  line-height: 1.35;
}
.global-search-results {
  max-height: calc(min(78dvh, 680px) - 96px);
  padding: 0 8px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.search-group-label {
  padding: 8px 8px 5px;
  color: var(--text-dim);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
[lang="ar"] .search-group-label { letter-spacing: 0; }
.search-result {
  width: 100%;
  min-height: 60px;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-base);
  text-align: start;
}
.search-result:active,
.search-result:focus-visible { background: var(--bg-elev-2); }
.search-result:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.search-result-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.search-result-copy { min-width: 0; }
.search-result-title {
  overflow: hidden;
  color: var(--text-base);
  font-size: .84rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-result-meta {
  margin-top: 2px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: .68rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Candidate brief + watch command centre --------------------- */
.marsad-brief {
  border-inline-start: 3px solid var(--accent);
  background:
    radial-gradient(100% 80% at 100% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 65%),
    var(--card-gradient);
}
[dir="rtl"] .marsad-brief {
  background:
    radial-gradient(100% 80% at 0% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 65%),
    var(--card-gradient);
}
.brief-business {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.brief-reason {
  min-height: 54px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding-block: 7px;
  border-top: 1px solid var(--border-warm);
}
.brief-reason:first-child { border-top: 0; }
.brief-reason-score {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--bg-inset);
  font-family: 'IBM Plex Mono', monospace;
  font-size: .72rem;
  font-weight: 700;
}
.watch-section-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-inline: 4px;
  margin-top: 6px;
}
.watch-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin-top: 7px;
  color: var(--text-muted);
  font-size: .68rem;
}

@media (max-width: 360px) {
  .header-separator,
  .header-page-title { display: none; }
  .header-actions { gap: 4px; }
  .global-search { inset-inline: 8px; width: calc(100vw - 16px); }
}

/* ---------- Honesty strip + reliability chip (mirror desktop) ---------- */
.honesty { display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px;
  margin: 8px 0; border-radius: 11px; font-size: .8rem; line-height: 1.5; color: var(--text-muted);
  background: color-mix(in srgb, var(--gold) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent); }
.honesty-tag { font-family: 'IBM Plex Mono', monospace; font-weight: 600; color: var(--gold);
  font-size: .6rem; letter-spacing: .06em; text-transform: uppercase; flex: none; margin-top: 2px; }
[dir=rtl] .honesty-tag { letter-spacing: 0; }
.rel { display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-family: 'IBM Plex Mono', monospace; font-size: .6rem; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; }
[dir=rtl] .rel { letter-spacing: 0; }
.rel-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.rel-anecdotal { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.rel-anecdotal .rel-dot { background: var(--bad); }
.rel-directional { background: color-mix(in srgb, var(--gold) 14%, transparent); color: var(--gold); }
.rel-directional .rel-dot { background: var(--gold); }
.rel-indicative { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.rel-indicative .rel-dot { background: var(--success); }

/* ---------- More overflow sheet rows ---------- */
.more-item { border-radius: 10px; color: var(--text-base); font-size: .92rem;
  min-height: 48px; font-weight: 500; background: transparent; border: 0; }
.more-item:active { background: var(--bg-elev-2); transform: scale(0.99); }

/* ---------- Cards ---------- */
.card-elev {
  background: var(--card-radial), var(--card-gradient);
  border: 1px solid var(--border-warm);
  box-shadow: var(--shadow-card);
  border-radius: 16px;
  transition: border-color 0.12s ease, transform 0.12s ease,
              box-shadow 0.12s ease;
}
.card-elev:hover { border-color: rgba(168, 156, 145, 0.20); box-shadow: var(--shadow-card-hover); }
.card-elev:focus-within { box-shadow: var(--shadow-card-hover); }
.card-elev:active { transform: scale(0.985); }

:root[data-theme="dark"] .card-elev:hover { border-color: rgba(168, 156, 145, 0.20); }
:root[data-theme="light"] .card-elev:hover { border-color: rgba(58, 50, 44, 0.18); }

/* Feature card with extra gold-radial accent */
.card-feature {
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(200, 156, 64, 0.10) 0%, transparent 55%),
    var(--card-gradient);
}

/* ---------- Market tape (parity with the desktop masthead band) ----------
   Slow CSS marquee: the track holds the cell sequence twice; -50% translate
   loops seamlessly, so cells carry their own trailing border+padding (no
   flex gap). Scroller pinned ltr keeps tickers/signed numbers bidi-stable
   under Arabic. Pauses on touch/hover. */
.tape { display: flex; align-items: stretch; overflow: hidden;
  border: 1px solid var(--border-warm); border-radius: 10px;
  background: var(--bg-elev); }
.tape-cap { flex: 0 0 auto; display: flex; align-items: center;
  padding: 5px 10px; font-size: 10px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
  border-inline-end: 1px solid var(--border-warm);
  background: var(--bg-elev-2); }
html[lang="ar"] .tape-cap { letter-spacing: 0; }
.tape-scroll { flex: 1 1 auto; overflow: hidden; direction: ltr; }
.tape-track { display: inline-flex; align-items: center; white-space: nowrap;
  animation: tape-scroll 90s linear infinite; will-change: transform; }
.tape:hover .tape-track, .tape:active .tape-track {
  animation-play-state: paused; }
.tape-item { display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 12px; border-inline-end: 1px solid var(--border-warm);
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 11px; }
.tape-item .tk  { font-weight: 600; color: var(--text-base); }
.tape-item .px  { color: var(--text-muted); }
.tape-item .chg.pos  { color: var(--success); }
.tape-item .chg.neg  { color: var(--bad); }
.tape-item .chg.flat { color: var(--text-dim); }
.tape-item.macro .tk { color: var(--gold); }
@keyframes tape-scroll { from { transform: translateX(0); }
  to { transform: translateX(-50%); } }
/* No prefers-reduced-motion freeze, matching the desktop call (slow,
   pausable, and the demo machine has Windows animation effects off). */

/* ETF/fund tag — distinguishes funds from single-stock tickers. */
.etf-tag {
  font-size: 7.5px; font-weight: 700; letter-spacing: .05em;
  color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-radius: 4px; padding: 0 3px; margin-inline-start: 3px;
  vertical-align: 2px;
}

/* ---------- Tint utilities (second-accent system) ----------
   Role map: accent = brand/nav/primary CTAs · emerald = education, progress,
   completion, positive confirmation · gold = highlights/caution ·
   coral = negative · forest = quiet green (brand underline family). */
.tint-accent  { background: color-mix(in srgb, var(--accent) 13%, transparent);  color: var(--accent); }
.tint-emerald { background: color-mix(in srgb, var(--emerald) 13%, transparent); color: var(--emerald); }
.tint-gold    { background: color-mix(in srgb, var(--gold) 13%, transparent);    color: var(--gold); }
.tint-forest  { background: color-mix(in srgb, var(--forest) 13%, transparent);  color: var(--forest); }
.tint-coral   { background: color-mix(in srgb, var(--coral) 13%, transparent);   color: var(--coral); }

/* ---------- Buttons ---------- */
/* Filled emerald variant — education / positive-confirmation CTAs. */
.btn-emerald {
  background: linear-gradient(135deg, var(--emerald) 0%, var(--emerald-dim) 100%);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--emerald) 28%, transparent),
              0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-emerald:active { transform: scale(0.97); filter: brightness(0.94); }

/* Ghost button that doesn't vanish into the page: accent ink + accent
   border, accent-tinted bg on press. Replaces border-warm outlines. */
.btn-ghost {
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: transparent;
  border-radius: 10px;
  font-weight: 600;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.btn-ghost:active {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  transform: scale(0.97);
}

/* ---------- Kicker (mono small-caps section head, desktop nm-kicker) ------ */
.kicker-m {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}
html[lang="ar"] .kicker-m {
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  letter-spacing: 0;
}

/* ---------- Progress (emerald→gold gradient fill) ---------- */
.progress-track {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emerald) 0%, var(--gold) 100%);
  transition: width 0.35s ease;
}
html[dir="rtl"] .progress-fill {
  background: linear-gradient(270deg, var(--emerald) 0%, var(--gold) 100%);
}

/* ---------- Bootcamp teaching-section card ----------
   Breaks the text walls: each section sits on a card with an emerald
   inline-start rule (logical property — RTL-safe). */
.bc-section {
  background: var(--card-gradient);
  border: 1px solid var(--border-warm);
  border-inline-start: 2px solid var(--emerald);
  border-radius: 14px;
  padding: 14px 16px 10px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.bc-section > :last-child { margin-bottom: 0.25rem; }

/* ---------- Bilingual learning curriculum ---------- */
.curriculum-entry {
  border-inline-start: 3px solid var(--coral);
}

.curriculum-hero {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border-warm);
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--coral) 18%, transparent), transparent 42%),
    var(--card-gradient);
  box-shadow: var(--shadow-card);
}
.curriculum-hero h2 {
  margin-top: 6px;
  font-family: 'IBM Plex Serif', 'IBM Plex Sans Arabic', serif;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.45;
}
.curriculum-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.curriculum-hero-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--border-warm);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  color: var(--text-muted);
  font-size: 0.72rem;
}
.curriculum-hero-stats strong {
  color: var(--text-base);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.82rem;
}

.curriculum-heading {
  margin: 16px 4px 7px;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
.curriculum-track-strip {
  display: flex;
  gap: 8px;
  margin-inline: -12px;
  padding: 0 12px 4px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.curriculum-track-strip::-webkit-scrollbar { display: none; }
.curriculum-track {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 min(76vw, 280px);
  min-height: 66px;
  padding: 10px 12px;
  scroll-snap-align: start;
  text-align: start;
  border: 1px solid var(--border-warm);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
}
.curriculum-track.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev));
}
.curriculum-track-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 700;
}
.curriculum-track strong,
.curriculum-track small {
  display: block;
}
.curriculum-track strong {
  font-size: 0.78rem;
  line-height: 1.3;
}
.curriculum-track small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 0.65rem;
}

.curriculum-track-intro {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 2px 4px;
}
.curriculum-track-kicker {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--forest);
  color: #fff;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 700;
}
.curriculum-track-intro h2 {
  font-family: 'IBM Plex Serif', 'IBM Plex Sans Arabic', serif;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.35;
}
.curriculum-track-intro p {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.curriculum-module {
  margin-bottom: 13px;
}
.curriculum-module-head {
  display: flex;
  gap: 7px;
  align-items: baseline;
  margin: 0 4px 6px;
  color: var(--text-muted);
  font-size: 0.7rem;
}
.curriculum-module-head > span {
  color: var(--accent);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.65rem;
  font-weight: 700;
}
.curriculum-lesson-list {
  display: grid;
  gap: 7px;
}
.curriculum-lesson {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 11px 12px;
  text-align: start;
  border: 1px solid var(--border-warm);
  border-radius: 13px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
}
.curriculum-lesson.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev));
}
.curriculum-lesson-play {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--coral) 12%, transparent);
  color: var(--coral);
}
.curriculum-lesson.is-active .curriculum-lesson-play {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.curriculum-lesson strong,
.curriculum-lesson small {
  display: block;
}
.curriculum-lesson strong {
  font-size: 0.82rem;
  line-height: 1.35;
}
.curriculum-lesson small {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.curriculum-lesson-time {
  white-space: nowrap;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.65rem;
}

.curriculum-detail {
  margin-top: 20px;
  scroll-margin-top: 74px;
  border-top: 1px solid var(--border-warm);
  padding-top: 18px;
}
.curriculum-detail-head {
  padding-inline: 3px;
}
.curriculum-detail-head h2 {
  margin-top: 5px;
  font-family: 'IBM Plex Serif', 'IBM Plex Sans Arabic', serif;
  font-size: 1.48rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.018em;
}
.curriculum-detail-head > p {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.62;
}
.curriculum-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.curriculum-meta span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  font-size: 0.67rem;
}

/* Objective as a standfirst: the intro voice under the lesson title. */
.curriculum-standfirst {
  margin-top: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-warm);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}
html[lang="ar"] .curriculum-standfirst { line-height: 1.85; }

/* Numbered stage header — the five-part loop is a genuine sequence, so the
   marker carries real order. The trailing hairline closes each stage. */
.curriculum-stage-head {
  display: flex;
  gap: 9px;
  align-items: center;
  margin: 18px 2px 8px;
}
.curriculum-stage-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-warm);
}
.curriculum-stage-num {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 50%;
  color: var(--accent);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  font-weight: 700;
}
.curriculum-stage-label {
  color: var(--text-muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
html[lang="ar"] .curriculum-stage-label { letter-spacing: 0; text-transform: none; }

/* The authored segment identifier is each step's bolded lead phrase. */
.curriculum-step-lead {
  display: inline-block;
  margin-bottom: 3px;
  color: var(--accent-dim, var(--accent));
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Concept animation framed as a figure with a caption voice. */
.curriculum-figure {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--border-warm);
  border-radius: 14px;
  background: var(--bg-elev);
  box-shadow: var(--shadow-card);
}
.curriculum-figure img {
  display: block;
  width: 100%;
}
.curriculum-figure figcaption {
  padding: 8px 12px;
  border-top: 1px solid var(--border-warm);
  color: var(--text-dim);
  font-size: 0.68rem;
  line-height: 1.55;
}
/* GIFs auto-play and cannot be paused by CSS — under reduced motion the
   figure swaps to its static first-frame poster (never reduced content). */
.curriculum-figure .curriculum-media-poster { display: none; }
@media (prefers-reduced-motion: reduce) {
  .curriculum-figure .curriculum-media-anim { display: none; }
  .curriculum-figure .curriculum-media-poster { display: block; }
}

/* Show-stage pointer chips: the Adaad pages where the concept lives. */
.curriculum-page-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 10px;
  padding: 2px 2px 0;
}
.curriculum-page-chips-lbl {
  color: var(--text-muted);
  font-size: 0.72rem;
}
.curriculum-page-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid var(--border-warm);
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-muted);
  font-size: 0.66rem;
  font-weight: 600;
}
.curriculum-exercise-target {
  margin-bottom: 8px;
}
.curriculum-honesty {
  margin-top: 0;
}

.curriculum-section,
.curriculum-exercise {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border-warm);
  border-radius: 15px;
  background: var(--card-gradient);
  box-shadow: var(--shadow-card);
}
.curriculum-section-label {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.curriculum-outline {
  display: grid;
  gap: 9px;
}
.curriculum-outline-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.curriculum-step-num {
  color: var(--gold);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  font-weight: 700;
}
.curriculum-outline-step p {
  font-size: 0.84rem;
  line-height: 1.68;
}
.curriculum-data-lab {
  border-color: color-mix(in srgb, var(--gold) 44%, var(--border-warm));
  background: color-mix(in srgb, var(--gold) 4%, var(--bg-elev));
}
.curriculum-evidence-label,
.curriculum-failed > span {
  color: var(--text-muted);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}
.curriculum-artifacts {
  display: grid;
  margin-top: 5px;
}
.curriculum-artifact {
  display: grid;
  gap: 5px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-warm);
}
.curriculum-artifact-head {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.curriculum-role {
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--border-warm));
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.61rem;
  font-weight: 700;
}
.curriculum-artifact code,
.curriculum-failed code {
  overflow-wrap: anywhere;
  color: var(--text-dim);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.61rem;
}
.curriculum-artifact p,
.curriculum-claim p {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.5;
}
.curriculum-claim-grid {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}
.curriculum-claim {
  padding: 10px 11px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-elev-2));
}
/* Evidence clock bounds what the data can claim — same cool ctx surface
   temperature as other zero-weight context furniture. */
.curriculum-claim.is-clock {
  border: 1px solid var(--ctx-border, var(--border-warm));
  background: var(--ctx-bg, var(--bg-elev-2));
}
.curriculum-claim.is-allowed {
  background: color-mix(in srgb, var(--emerald) 8%, var(--bg-elev-2));
}
.curriculum-claim.is-forbidden {
  background: color-mix(in srgb, var(--coral) 8%, var(--bg-elev-2));
}
.curriculum-claim > span {
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
}
.curriculum-claim p {
  margin-top: 4px;
}
.curriculum-failed {
  display: grid;
  gap: 5px;
  margin-top: 11px;
}
.curriculum-checklist {
  display: grid;
  gap: 9px;
}
.curriculum-checklist li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}
.curriculum-checklist li svg {
  flex: none;
  margin-top: 2px;
  color: var(--emerald);
}
.curriculum-exercise {
  border-inline-start: 3px solid var(--emerald);
}
.curriculum-exercise > p {
  color: var(--text-base);
}
.curriculum-completion {
  display: grid;
  gap: 3px;
  margin-top: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--emerald) 8%, var(--bg-elev-2));
}
.curriculum-completion span {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}
.curriculum-completion strong {
  font-size: 0.76rem;
  line-height: 1.45;
}
.curriculum-exercise-btn {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  margin-top: 11px;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 700;
}
.curriculum-sources {
  display: grid;
  gap: 7px;
}
.curriculum-source {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border-warm);
  border-radius: 11px;
  background: var(--bg-elev);
}
.curriculum-source-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  color: var(--gold);
}
.curriculum-source strong,
.curriculum-source small {
  display: block;
}
.curriculum-source strong {
  font-size: 0.72rem;
  line-height: 1.35;
}
.curriculum-source small {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 0.62rem;
}
.curriculum-reviewed {
  margin-top: 9px;
  color: var(--text-dim);
  font-size: 0.62rem;
}
.curriculum-error {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  border: 1px solid var(--border-warm);
  border-radius: 16px;
  background: var(--bg-elev);
}
.curriculum-error svg { color: var(--coral); }
.curriculum-error strong { color: var(--text-base); }
.curriculum-error span { font-size: 0.72rem; }

html[lang="ar"] .curriculum-heading,
html[lang="ar"] .curriculum-section-label,
html[lang="ar"] .curriculum-completion span,
html[lang="ar"] .curriculum-evidence-label,
html[lang="ar"] .curriculum-failed > span {
  letter-spacing: 0;
  text-transform: none;
}
/* Arabic body copy runs tighter than Latin-tuned line boxes — raise the
   lesson reading rhythm. */
html[lang="ar"] .curriculum-outline-step p,
html[lang="ar"] .curriculum-checklist li,
html[lang="ar"] .curriculum-exercise > p {
  line-height: 1.8;
}

@media (min-width: 700px) {
  .curriculum-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
  .curriculum-lesson-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .curriculum-claim-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  /* A real reading measure once the viewport allows lines to run long. */
  .curriculum-detail {
    max-width: 66ch;
  }
  html[lang="ar"] .curriculum-detail {
    max-width: 74ch;
  }
}

/* ---------- Bottom nav ---------- */
.nav-btn {
  min-width: 0;
  padding-inline: 4px !important;
  transition: color 0.15s ease, transform 0.1s ease;
}
.nav-btn > span:last-child {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-btn:active { transform: scale(0.92); }

/* Active tab: accent ink + a tinted pill behind the icon. */
.nav-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 26px;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}
.nav-btn.nav-active { color: var(--accent); }
.nav-btn.nav-active .nav-ico {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Bottom nav contrast varies by theme */
:root[data-theme="light"] nav {
  background-color: rgba(255, 255, 255, 0.95) !important;
}
:root[data-theme="dark"] nav {
  background-color: rgba(37, 32, 29, 0.95) !important;
}

/* Header surface is deliberately one elevation above the page field. */
:root[data-theme="light"] .pwa-header {
  background-color: rgba(255, 255, 255, 0.96) !important;
}
:root[data-theme="dark"] .pwa-header {
  background-color: rgba(37, 32, 29, 0.96) !important;
}

/* ---------- Editorial prose ---------- */
.prose-warm {
  color: var(--text-base);
  line-height: 1.65;
}
.prose-warm p { margin-block: 0.75rem; }
.prose-warm h1, .prose-warm h2 {
  font-family: 'IBM Plex Serif', Georgia, serif;
  color: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.prose-warm h2 { font-size: 1.05rem; margin-top: 1rem; }
.prose-warm h3 { font-size: 0.95rem; margin-top: 0.75rem; font-weight: 600; }
.prose-warm code {
  background: rgba(156, 107, 46, 0.10);
  color: var(--accent);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
}
.prose-warm ul { padding-inline-start: 1.25rem; list-style: disc; }
.prose-warm strong { color: var(--text-base); font-weight: 600; }

/* ---------- Lucide icons ---------- */
[data-lucide] {
  display: inline-block;
  vertical-align: -2px;
  stroke-width: 1.75;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-warm); border-radius: 3px; }

/* ---------- Arabic / RTL ---------- */
html[lang="ar"], html[dir="rtl"] {
  font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', sans-serif;
}
html[lang="ar"] body { letter-spacing: 0; }
html[lang="ar"] .tracking-tight, html[lang="ar"] .tracking-wide,
html[lang="ar"] .tracking-wider { letter-spacing: 0; }
html[lang="ar"] h1, html[lang="ar"] h2, html[lang="ar"] h3 {
  font-family: 'IBM Plex Sans Arabic', 'IBM Plex Serif', serif;
  font-weight: 700;
}
html[lang="ar"] .uppercase { text-transform: none; letter-spacing: 0; }

html[dir="rtl"] [data-lucide="chevron-left"]    { transform: scaleX(-1); }
html[dir="rtl"] [data-lucide="chevron-right"]   { transform: scaleX(-1); }
html[dir="rtl"] [data-lucide="arrow-up-right"]  { transform: scaleX(-1); }
html[dir="rtl"] [data-lucide="arrow-down-right"]{ transform: scaleX(-1); }
html[dir="rtl"] [data-lucide="log-out"]         { transform: scaleX(-1); }

/* Physical-class RTL flips removed — templates now use Tailwind logical
   utilities (ms-/me-/ps-/text-start/text-end/border-s/rounded-e) directly. */

.num { direction: ltr; unicode-bidi: embed; display: inline-block; }
/* inline-block on a td/th ejects the cell from the table's column grid —
   every row then computes its own widths and columns drift apart. */
td.num, th.num { display: table-cell; }
html[lang="ar"] .num { font-family: 'IBM Plex Sans', sans-serif; }

/* ---------- Brand wordmark (Thmanyah-style) ---------- */
/* The Arabic wordmark IS the logo. .brand-mark is the big auth-screen
   treatment; .brand-mark-sm is the inline header-bar version. */
.brand-mark {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.01em;
  display: inline-block;
  border-bottom: 2px solid var(--forest);
  padding-bottom: 0.15rem;
}
.brand-mark-sm {
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.005em;
  /* The underline is part of the logo (same as the auth-screen mark). */
  display: inline-block;
  border-bottom: 2px solid var(--forest);
  padding-bottom: 0.1rem;
}

/* ---------- Primary accent button (filled, unmistakable) ---------- */
/* Tailwind's `shadow-accent/20` and gradient opacity utilities can't alpha
   a var()-driven color, so spell out the gradient and shadow here. */
.btn-primary-accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent),
              0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-primary-accent:active { transform: scale(0.97); filter: brightness(0.94); }

/* ---------- F5: business-summary clamp (Read more / Show less) ---------- */
.biz-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Theme transition ---------- */
* { transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }

/* ======================================================================
   v86 design polish — elevation, context temperature, type rhythm, motion
   ====================================================================== */

/* Bottom nav mirrors the sticky-header treatment (hairline already set). */
body > nav { box-shadow: 0 -2px 10px rgba(60, 40, 20, 0.05); }
:root[data-theme="dark"] body > nav { box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.35); }

/* ---- Production-vs-context temperature coding --------------------------
   Surfaces carrying 0%-weight context shift to a desaturated cool slate;
   the warm accent family stays reserved for the three weighted components. */
.ctx-cool {
  background: var(--ctx-bg);
  border-color: var(--ctx-border);
}
.card-elev.ctx-cool { background: var(--ctx-bg); }
.ctx-ink { color: var(--ctx-ink); }

/* ---- Type rhythm -------------------------------------------------------
   Kickers get firmer letterspacing plus a small marker dot; numeric glyphs
   line up in tables and tiles via tabular figures. */
.uppercase.tracking-wider { letter-spacing: 0.085em; }
.font-semibold.uppercase.tracking-wider:not(.rounded-full):not(.rounded)::before,
.font-bold.uppercase.tracking-wider:not(.rounded-full):not(.rounded)::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  margin-inline-end: 6px;
  vertical-align: 1.5px;
}
.text-text-muted.font-semibold.uppercase.tracking-wider:not(.rounded-full):not(.rounded)::before {
  background: var(--accent);
  opacity: 0.9;
}
.ctx-cool .font-semibold.uppercase.tracking-wider::before { background: currentColor; opacity: 0.55; }

.num, .font-mono, .tabular, td, th { font-variant-numeric: tabular-nums; }

/* Inter-section breathing room on dense pages: ~+25% over the old space-y-3. */
main#content > * + * { margin-top: 0.95rem; }

/* Arabic line-height: Plex Sans Arabic needs more leading than Latin-tuned
   defaults (ascenders/dots clip and dense cards feel cramped). */
html[lang="ar"] body { line-height: 1.62; }
html[lang="ar"] .text-sm { line-height: 1.55; }
html[lang="ar"] .text-xs { line-height: 1.5; }
html[lang="ar"] .leading-relaxed { line-height: 1.74; }
html[lang="ar"] .prose-warm { line-height: 1.76; }

/* ---- Motion (CSS/SVG native, reduced-motion gated) -------------------- */
@media (prefers-reduced-motion: no-preference) {
  /* Entrance: page blocks fade-up with a short stagger, capped at 8. */
  html.nav-anim #content > * { animation: rise-in 0.3s ease-out both; }
  html.nav-anim #content > :nth-child(2) { animation-delay: 45ms; }
  html.nav-anim #content > :nth-child(3) { animation-delay: 90ms; }
  html.nav-anim #content > :nth-child(4) { animation-delay: 135ms; }
  html.nav-anim #content > :nth-child(5) { animation-delay: 180ms; }
  html.nav-anim #content > :nth-child(6) { animation-delay: 225ms; }
  html.nav-anim #content > :nth-child(7) { animation-delay: 270ms; }
  html.nav-anim #content > :nth-child(8) { animation-delay: 315ms; }
  html.nav-anim #content > :nth-child(n+9) { animation-delay: 340ms; }

  /* X-Ray meter fills grow in (geometry pinned LTR, so left origin). */
  .meter-fill {
    transform-origin: 0 50%;
    animation: grow-x 0.5s 0.1s ease-out both;
  }
  /* Progress fills draw in; origin follows writing direction. */
  .progress-fill {
    transform-origin: 0 50%;
    animation: grow-x 0.45s ease-out both;
  }
  html[dir="rtl"] .progress-fill { transform-origin: 100% 50%; }

  /* SVG figures (radar polygon) draw in via pathLength-normalized dash. */
  .draw-in {
    stroke-dasharray: 1;
    animation: svg-draw 0.6s 0.1s ease-out both;
  }
}
/* Utilities the static Tailwind build lacks (2026-10-31): the practice tools
   and the forecast card use them. */
.pb-1 { padding-bottom: .25rem; }
.pe-2 { padding-inline-end: .5rem; }
.w-16 { width: 4rem; }
.gap-x-2 { column-gap: .5rem; }
.gap-y-0\.5 { row-gap: .125rem; }
.border-border-warm\/40 { border-color: color-mix(in srgb, var(--border-warm) 40%, transparent); }
/* Signed out (2026-10-31): the welcome page stands alone, without the tab bar
   or the search and mode buttons, which need a sign-in. */
body.signed-out #bottom-nav, body.signed-out #global-search-btn, body.signed-out #mode-btn { display: none !important; }
/* Glossary terms inside lessons (2026-10-31): a quiet dotted underline. */
.gl-term {
  text-decoration: underline dotted color-mix(in srgb, var(--accent) 70%, transparent);
  text-underline-offset: 3px;
  cursor: pointer;
}
.gl-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
}
@keyframes grow-x {
  from { transform: scaleX(0); }
}
@keyframes svg-draw {
  from { stroke-dashoffset: 1; fill-opacity: 0; }
}

/* =====================================================================
   DESIGN LAYER (style campaign, 2026-10-31)
   One place for the type scale, controls, callouts and layout, so every
   page reads the same and scales with the window. It sits last in this
   file on purpose: it overrides the static Tailwind build's fixed pixel
   sizes without touching the markup.
   ===================================================================== */

/* ---- Type: the root grows with the window (16px on a phone, 17.5px on a
   wide screen), and every size below is rem-based, so text, buttons and
   fields scale together. Nothing reading-sized falls under 11px. ---- */
html { font-size: clamp(16px, 15.2px + 0.2vw, 17.5px); }
.text-\[8px\], .text-\[8\.5px\] { font-size: 0.66rem !important; }
.text-\[9px\]  { font-size: 0.69rem !important; line-height: 1.35; }
.text-\[10px\] { font-size: 0.75rem !important; line-height: 1.4; }
.text-\[11px\] { font-size: 0.8rem !important;  line-height: 1.45; }
.text-\[12px\] { font-size: 0.85rem !important; line-height: 1.5; }
.text-\[13px\] { font-size: 0.9rem !important;  line-height: 1.55; }
.text-\[14px\] { font-size: 0.94rem !important; }
.text-\[15px\] { font-size: 1rem !important; }
.etf-tag { font-size: 0.56rem; }
.tape-item { font-size: 0.75rem; }
.tape-cap { font-size: 0.68rem; }
.honesty-tag, .rel { font-size: 0.66rem; }
.kicker-m { font-size: 0.68rem; }

:root {
  --radius-control: 12px;
  --radius-card: 16px;
  --control-h: 2.75rem;        /* 44px at a 16px root: the touch-target floor */
  --control-h-sm: 2.25rem;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 32%, transparent);
  --field-bg: var(--bg-elev);
  --field-border: var(--border-warm-2);
}

/* ---- Focus: one visible ring for every interactive element. ---- */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Buttons: three roles, two sizes, the same rhythm everywhere.
   Primary (bronze) is the page's main action, emerald is learning and
   confirmation, ghost is everything secondary. Compact text buttons
   (text-xs) keep a 36px floor; full buttons 44px. ---- */
.btn-primary-accent, .btn-emerald, .btn-ghost, .btn-quiet, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: var(--control-h); padding-inline: 1.1rem;
  border-radius: var(--radius-control);
  font-size: 0.9rem; font-weight: 600; line-height: 1.2; text-align: center;
  cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease,
              transform .1s ease, filter .15s ease;
}
.btn-primary-accent.text-xs, .btn-emerald.text-xs, .btn-ghost.text-xs, .btn-quiet.text-xs,
.btn-danger.text-xs { min-height: var(--control-h-sm); padding-inline: 0.8rem; font-size: 0.8rem !important; }
.btn-primary-accent {
  background: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 4px 12px color-mix(in srgb, var(--accent) 22%, transparent);
}
.btn-emerald {
  background: var(--emerald);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .10), 0 4px 12px color-mix(in srgb, var(--emerald) 22%, transparent);
}
@media (hover: hover) {
  .btn-primary-accent:hover { background: var(--accent-dim); }
  .btn-emerald:hover { background: var(--emerald-dim); }
  .btn-ghost:hover { background: color-mix(in srgb, var(--accent) 8%, transparent);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
  .btn-quiet:hover { background: var(--bg-elev-2); }
}
.btn-ghost { border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent); }
.btn-quiet { color: var(--text-base); background: transparent; border: 1px solid var(--border-warm-2); }
.btn-danger { color: var(--bad); background: transparent;
  border: 1px solid color-mix(in srgb, var(--bad) 38%, transparent); }
.btn-danger:active { background: color-mix(in srgb, var(--bad) 10%, transparent); }
:where(.btn-primary-accent, .btn-emerald, .btn-ghost, .btn-quiet, .btn-danger):disabled {
  opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
/* A row of buttons wraps, keeps one gap, and on a phone shares the width. */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
@media (max-width: 480px) { .btn-row > * { flex: 1 1 auto; } }

/* ---- Fields: 16px minimum (iOS zooms into anything smaller), 44px tall,
   one border, one focus treatment. ---- */
main input:not([type=checkbox]):not([type=radio]):not([type=range]),
main select, main textarea,
#auth-screen input, .global-search-head input {
  font-size: max(16px, 1rem) !important;
  min-height: var(--control-h);
  border-radius: var(--radius-control) !important;
  background: var(--field-bg);
  border: 1px solid var(--field-border) !important;
  color: var(--text-base);
  transition: border-color .15s ease, box-shadow .15s ease;
}
main textarea { padding-block: 0.6rem; line-height: 1.5; }
main input:not([type=checkbox]):not([type=radio]):not([type=range]):focus,
main select:focus, main textarea:focus, #auth-screen input:focus {
  outline: none; border-color: var(--accent) !important; box-shadow: var(--focus-ring);
}
main input::placeholder, main textarea::placeholder { color: var(--text-dim); opacity: .8; }
main input[type=checkbox], main input[type=radio] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
main label { font-size: 0.85rem; }

/* ---- Callouts: one component for every notice in the app. A callout is
   an icon, an optional title, the message and optional actions; its tone
   says what kind of notice it is, never where it happens to sit. ---- */
.callout {
  display: flex; gap: 0.7rem; align-items: flex-start;
  padding: 0.85rem 1rem; border-radius: var(--radius-control);
  border: 1px solid var(--border-warm-2);
  background: var(--bg-elev);
  font-size: 0.88rem; line-height: 1.55; color: var(--text-muted);
}
.callout + .callout { margin-top: 0.6rem; }
.callout-icon { flex: none; width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; color: var(--text-muted); }
.callout-body { flex: 1; min-width: 0; }
.callout-title { display: block; font-weight: 600; color: var(--text-base); margin-bottom: 0.15rem; }
.callout-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }
.callout--info { background: color-mix(in srgb, var(--accent) 6%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--accent) 24%, transparent); }
.callout--info .callout-icon { color: var(--accent); }
.callout--warn { background: color-mix(in srgb, var(--gold) 8%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--gold) 32%, transparent); }
.callout--warn .callout-icon { color: var(--gold); }
.callout--bad { background: color-mix(in srgb, var(--bad) 7%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.callout--bad .callout-icon, .callout--bad .callout-title { color: var(--bad); }
.callout--ok { background: color-mix(in srgb, var(--emerald) 7%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--emerald) 28%, transparent); }
.callout--ok .callout-icon { color: var(--emerald); }
.callout--quiet { background: var(--bg-inset); border-color: var(--border-warm); }
/* The honesty strip is Adaad's signature notice: it keeps its gold tag but
   takes the callout's spacing and type. */
.honesty { padding: 0.8rem 1rem; border-radius: var(--radius-control); font-size: 0.85rem; gap: 0.7rem; }

/* ---- Citations: a small number where the claim is; the full source on tap. ---- */
.cite-mark { display: inline-grid; place-items: center; min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem;
  margin-inline-start: .2rem; vertical-align: super; border: 0; border-radius: 999px; cursor: pointer;
  font: 600 .66rem/1 'IBM Plex Sans', sans-serif; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); position: relative; }
.cite-mark::after { content: ""; position: absolute; inset: -.55rem; }   /* a finger-sized target */
.cite-mark:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.cite-pop { position: fixed; z-index: 70; inset-inline: 12px; max-width: 26rem; margin-inline: auto;
  background: var(--bg-elev); border: 1px solid var(--border-warm-2); border-radius: 14px;
  box-shadow: var(--shadow-pop); padding: .85rem 1rem 1rem; font-size: .85rem; line-height: 1.5; }
.cite-pop[hidden] { display: none; }
.cite-pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem;
  font-size: .72rem; font-weight: 600; color: var(--text-muted); }
.cite-pop-x { border: 0; background: none; color: var(--text-muted); font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.cite-pop-gloss { color: var(--text-muted); font-size: .8rem; margin-bottom: .3rem; }
.cite-pop-text { color: var(--text-base); margin-bottom: .75rem; overflow-wrap: anywhere; text-align: start; }

/* ---- Cards: one radius, a padding that breathes with the window, and a
   steady gap between them. ---- */
.card-elev { border-radius: var(--radius-card); }
.card-elev:active { transform: none; }                 /* cards are not buttons */
.card-elev.p-3 { padding: clamp(0.8rem, 0.7rem + 0.4vw, 1rem); }
.card-elev.p-4 { padding: clamp(1rem, 0.88rem + 0.5vw, 1.3rem); }
.card-elev.p-5 { padding: clamp(1.2rem, 1rem + 0.7vw, 1.6rem); }
main#content > * + * { margin-top: 1rem; }

/* ---- Wide screens: a centred reading column instead of edge-to-edge
   cards, with the header and the tab bar aligned to it. ---- */
@media (min-width: 768px) {
  main#content { max-width: 46rem; margin-inline: auto; padding-inline: 1.25rem; padding-top: 1.25rem; }
  .pwa-header .header-bar { max-width: 46rem; margin-inline: auto; }
  #bottom-nav > div { max-width: 46rem; margin-inline: auto; }
}
@media (min-width: 1200px) {
  main#content, .pwa-header .header-bar, #bottom-nav > div { max-width: 52rem; }
}

/* ---- Colour (palette A, owner 2026-10-31) ------------------------------------------
   Score parts keep one colour each; sectors tint their badges and chips;
   each area of the app colours its headings and its feature washes. */
.comp-quality  { --comp: var(--c-quality);  --comp-ink: var(--c-quality-ink); }
.comp-value    { --comp: var(--c-value);    --comp-ink: var(--c-value-ink); }
.comp-momentum { --comp: var(--c-momentum); --comp-ink: var(--c-momentum-ink); }
.comp-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--comp); margin-inline-end: .35rem; vertical-align: .05em; }
.comp-name { color: var(--comp-ink); font-weight: 600; }
.tk-badge { flex: none; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: 10px; font: 600 .78rem/1 'IBM Plex Sans', sans-serif; letter-spacing: .02em;
  color: color-mix(in srgb, var(--sec, var(--sec-other)) 78%, var(--text-base));
  background: color-mix(in srgb, var(--sec, var(--sec-other)) 15%, var(--bg-elev)); }
.sec-chip { display: inline-block; padding: .05rem .45rem; border-radius: 6px; font-size: .75rem;
  color: color-mix(in srgb, var(--sec, var(--sec-other)) 80%, var(--text-base));
  background: color-mix(in srgb, var(--sec, var(--sec-other)) 12%, transparent); }
body { --area: var(--area-research); }
body[data-area="learn"]  { --area: var(--area-learn); }
body[data-area="sharia"] { --area: var(--area-sharia); }
body[data-area="alerts"] { --area: var(--area-alerts); }
.kicker-m { color: var(--area); }
/* The landing page's star pattern on feature cards only, fading downward. */
[dir="rtl"] .card-feature { --wash-x: 0%; }
.card-feature { position: relative; isolation: isolate; overflow: hidden; }
.card-feature::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--accent); opacity: .16;
  -webkit-mask: var(--pattern-star) 0 0 / 64px 64px repeat, radial-gradient(240px circle at var(--wash-x, 100%) 0%, #000, transparent);
  -webkit-mask-composite: source-in;
  mask: var(--pattern-star) 0 0 / 64px 64px repeat, radial-gradient(240px circle at var(--wash-x, 100%) 0%, #000, transparent);
  mask-composite: intersect; }
.card-feature {
  background:
    radial-gradient(110% 90% at 100% 0%, color-mix(in srgb, var(--area) 13%, transparent) 0%, transparent 60%),
    radial-gradient(90% 80% at 0% 100%, color-mix(in srgb, var(--c-value) 7%, transparent) 0%, transparent 60%),
    var(--card-gradient);
}

/* ---- Phone page pass (2026-10-31) -----------------------------------------------
   The desktop's care, on the phone: real section headings, Arabic set in
   Arabic type, readable form controls in dark mode, visible row lines,
   neutral shading where over or under is neither good nor bad, and small
   outlined pills for the buttons under a card. */

/* Arabic type. A monospace stack has no Arabic letters, so they fell back to
   Courier New and lost their joins; Arabic has no true italic either. Latin
   digits keep the mono face. */
html[lang="ar"] :is(.font-mono, .honesty-tag, .rel, .tape-cap, .tape-item, .etf-tag) {
  font-family: 'IBM Plex Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;
  letter-spacing: 0;
}
html[lang="ar"] .italic { font-style: normal; }
html[lang="ar"] .kicker-m { font-size: .78rem; }
html[lang="ar"] .honesty-tag { font-size: .72rem; }
html[lang="ar"] .rel { font-size: .7rem; }

/* Section headings: bold, in the text colour, with the area's accent bar
   where they start. Arabic has no capitals to set a heading apart, so size
   and weight do it. Labels inside cards keep their compact form. */
.sec-h {
  display: flex; align-items: center; gap: .55rem;
  margin: 1.4rem 0 .65rem; padding-inline: .15rem;
  font-size: 1rem; font-weight: 700; line-height: 1.35; color: var(--text-base);
}
html[lang="ar"] .sec-h { font-size: 1.07rem; }
.sec-h::before { content: ""; flex: none; width: 4px; height: 1.05em; border-radius: 2px; background: var(--area); }
.sec-h-aside { margin-inline-start: auto; font-size: .75rem; font-weight: 500; color: var(--text-dim); text-align: end; }
main#content > .sec-h { margin-top: 1.5rem; }
.sec-h:first-child, main#content > .sec-h:first-child { margin-top: .35rem; }
/* A card's own title: the text colour, semibold, its icon in the area colour. */
.card-title { display: flex; align-items: center; gap: .45rem; margin-bottom: .6rem;
  font-size: .86rem; font-weight: 600; line-height: 1.35; color: var(--text-base); }
html[lang="ar"] .card-title { font-size: .92rem; }
.card-title > svg, .card-title > i { flex: none; color: var(--area); }
/* Small labels inside cards stay labels, but readable in Arabic. */
html[lang="ar"] :is(.text-\[9px\], .text-\[10px\]).uppercase { font-size: .76rem !important; }
th.uppercase::before { content: none !important; }

/* Tables: a visible line under the header and between rows. */
main#content table { border-collapse: collapse; }
main#content table thead tr { border-bottom: 1px solid var(--border-warm-2); }
main#content table tbody tr + tr { border-top: 1px solid var(--border-warm-2); }
main#content th { color: var(--text-muted); }

/* Form controls follow the theme, so a dark page never opens a white list
   with pale text. */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
select option, select optgroup { background-color: var(--bg-elev); color: var(--text-base); }

/* A button under a card is its own step: a small outlined pill at the end of
   the row, never a full-width bar fused to the card. */
.pill-row { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.btn-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 2.4rem; padding: .4rem 1.15rem; border-radius: 999px;
  background: transparent; color: var(--accent); font-size: .85rem; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  transition: background-color .15s ease;
}
.btn-pill:active { background: color-mix(in srgb, var(--accent) 10%, transparent); }
@media (hover: hover) { .btn-pill:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); } }

/* Empty states say what is missing and what to do next. */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); font-size: .9rem; }
.empty-state-hint { max-width: 19rem; font-size: .8rem; line-height: 1.55; color: var(--text-dim); }

.tk-badge.tk-sm { width: 1.65rem; height: 1.65rem; border-radius: 7px; font-size: .64rem; }
html[lang="ar"] .font-serif { font-family: 'IBM Plex Sans Arabic', 'IBM Plex Serif', serif; }
/* Utilities the static Tailwind build lacks (phone page pass). */
.mb-0 { margin-bottom: 0; }
.-mt-1 { margin-top: -.25rem; }
.ps-2 { padding-inline-start: .5rem; }
.gap-x-3 { column-gap: .75rem; }
.gap-y-1 { row-gap: .25rem; }
/* A row of score parts: each in its own colour, its name on one line. */
.part-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Price history on the stock screen (chart.js) ----------
   The chart is read by pressing a day, so the card does not shrink under a
   finger, and a sideways drag reads days while an up-or-down one still
   scrolls the page (touch-action). Colours come from tokens.css; the canvas
   reads the same tokens in chart.js. */
.pc-card:active { transform: none; }
/* Figures inside a sentence stay part of their word, so a line never breaks
   between a bracket and its number. */
.pc-card .num { display: inline; unicode-bidi: isolate; }
.pc-controls { display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.pc-seg { display: inline-flex; padding: 2px; border-radius: 10px;
  background: var(--bg-inset); border: 1px solid var(--border-warm); }
.pc-seg-btn { min-width: 2.75rem; min-height: 2.5rem; padding: 0 .7rem; border: 0;
  border-radius: 8px; background: transparent; color: var(--text-muted);
  font-size: .8rem; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.pc-seg-btn[aria-pressed="true"] { background: var(--bg-elev); color: var(--accent);
  box-shadow: var(--shadow-card); }
.pc-period, .pc-hint, .pc-foot, .pc-note, .pc-legend {
  font-size: .78rem; line-height: 1.65; color: var(--text-muted); }
.pc-canvas { height: 264px; margin: .35rem 0 0; border-radius: 8px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; }
.pc-stale { color: var(--attn); font-weight: 500; margin-bottom: .25rem; }
.pc-legend { display: flex; align-items: baseline; gap: .4rem; margin-top: .7rem; }
.pc-legend[hidden] { display: none; }
.pc-legend-dot { flex: none; width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--text-base); }
.pc-read { margin-top: .5rem; padding: .8rem .85rem; border-radius: 12px;
  background: var(--bg-inset); border: 1px solid var(--border-warm); }
.pc-read-head { display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: .25rem .5rem; min-height: 2rem; }
.pc-read-date { font-size: .98rem; font-weight: 700; color: var(--text-base); }
.pc-read-tag { font-size: .72rem; color: var(--text-dim); }
.pc-read-reset { min-height: 2rem; padding: 0 .6rem; border-radius: 999px;
  background: transparent; color: var(--accent); font-size: .74rem; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.pc-read-words { margin: .45rem 0 .75rem; font-size: .88rem; line-height: 1.75;
  color: var(--text-base); }
.pc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem; margin: 0; padding-top: .65rem; border-top: 1px solid var(--border-warm); }
.pc-cell dt { font-size: .7rem; color: var(--text-muted); }
.pc-cell dd { margin: .1rem 0 0; font-size: .88rem; font-weight: 600; color: var(--text-base); }
.pc-cell dd.pc-up { color: var(--success); }
.pc-cell dd.pc-down { color: var(--bad); }
.pc-cell-sub { font-size: .76rem; font-weight: 500; white-space: nowrap; }
.pc-read ~ .pc-hint { margin-top: .5rem; }
.pc-legend + .pc-hint { margin-top: .15rem; }
.pc-foot { margin-top: .5rem; color: var(--text-dim); }
.pc-credit { margin-top: .4rem; font-size: .68rem; color: var(--text-dim); }
.pc-credit a { color: inherit; text-decoration: underline; }
html[dir="rtl"] .pc-credit { text-align: right; }
