/* MuhasabaPro V2 design system. Tokens from the approved brand kit (navy #0B2D58, teal #00A88F, gold #D4AF37).
   Logical properties (inline-start/end) are used throughout so Arabic RTL needs no separate stylesheet. */
:root {
  --navy: #0B2D58; --navy-2: #14508f; --teal: #00A88F; --gold: #D4AF37;
  --bg: #fff; --bg-2: #F5F7FB; --card: #fff; --text: #0E1B2C; --muted: #566579; --line: #E1E6EE;
  --accent: #008C77; /* teal darkened for AA text contrast on white */
  --ok-bg: #E6F6F2; --warn-bg: #FFF6DD; --warn-fg: #6b5200; --err-bg: #FDECEC; --err-fg: #8a1f1f; --info-bg: #E9F0FA;
  --shadow: 0 1px 2px rgba(11,45,88,.06), 0 12px 32px rgba(11,45,88,.08);
  --r: 16px; --r-sm: 10px; --maxw: 1200px;
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Noto Sans", "Noto Sans Arabic", "Segoe UI Variable", Tahoma, sans-serif;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #07172B; --bg-2: #0A1F3A; --card: #0D2644; --text: #EAF0F8; --muted: #A3B3C9; --line: #1E3A5F;
  --accent: #2FD0B5; --ok-bg: #0C3A39; --warn-bg: #3a3000; --warn-fg: #f3d977; --err-bg: #3b1515; --err-fg: #ffb4b4; --info-bg: #0f2c4d;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; }
:lang(ar) body, html[lang="ar"] body { line-height: 1.8; }
main { flex: 1; }
img, svg { max-width: 100%; }
a { color: inherit; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; inset-inline-start: -9999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .container { padding-inline: 32px; } }
bdi, .num { unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---- Header ------------------------------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 68px; }
.brand img { display: block; height: 38px; width: auto; }
.brand .logo-dark { display: none; }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.spacer { flex: 1; }
.nav-links { order: 10; flex-basis: 100%; display: flex; flex-direction: column; gap: 2px; padding-block: 8px 14px; border-top: 1px solid var(--line); }
.js .nav-links { display: none; }
.js .nav-open .nav-links { display: flex; }
.nav-links a { padding: 10px 6px; text-decoration: none; font-weight: 500; border-radius: 8px; }
.nav-links a[aria-current="page"] { color: var(--accent); }
.nav-logout-form { display: contents; }
.nav-logout-link { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 10px 6px; text-decoration: none; font-weight: 500; border-radius: 8px; text-align: start; }
@media (min-width: 1180px) {
  .bar { flex-wrap: nowrap; }
  .nav-links, .js .nav-links { order: 0; flex-basis: auto; display: flex; flex-direction: row; gap: 4px; border: 0; padding: 0; margin-inline-start: 24px; font-size: .95rem; }
  .nav-links a { color: var(--muted); padding: 8px 10px; white-space: nowrap; }
  .nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--accent); }
  .nav-logout-link { color: var(--muted); padding: 8px 10px; }
  .nav-logout-link:hover { color: var(--accent); }
  .nav-toggle { display: none !important; }
}
.icon-btn, .ctl { background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); min-height: 42px; min-width: 42px; padding: 6px 12px; cursor: pointer; font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.date-display { color: var(--muted); font-size: .8rem; white-space: nowrap; order: 10; }
@media (min-width: 560px) { .date-display { font-size: .85rem; } }
.icon-btn:hover, .ctl:hover { border-color: var(--teal); color: var(--text); }
.lang { position: relative; }
.lang summary { list-style: none; }
.lang summary::-webkit-details-marker { display: none; }
.lang-menu { position: absolute; inset-inline-end: 0; top: 48px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 190px; z-index: 40; }
.lang-menu a { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
.lang-menu a:hover, .lang-menu a[aria-current="true"] { background: var(--bg-2); color: var(--accent); }
.lang-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---- SuperAdmin profile dropdown (Pages/Shared/_AdminLayout.cshtml) ------------------------------------------------ */
.profile { position: relative; }
.profile summary { list-style: none; }
.profile summary::-webkit-details-marker { display: none; }
.profile-summary { max-width: 160px; }
.profile-avatar { font-size: 1.05rem; line-height: 1; }
.profile-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 92px; }
.profile-menu { position: absolute; inset-inline-end: 0; top: 48px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 230px; max-width: calc(100vw - 32px); z-index: 40; }
.profile-email { padding: 8px 12px; font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.profile-menu a, .profile-menu button { display: block; width: 100%; text-align: start; padding: 10px 12px; border-radius: 8px; text-decoration: none; background: none; border: none; font: inherit; color: var(--text); cursor: pointer; }
.profile-menu a:hover, .profile-menu button:hover, .profile-menu a:focus-visible, .profile-menu button:focus-visible { background: var(--bg-2); color: var(--accent); }
.profile-menu form { margin: 0; }

/* ---- Typography & layout ------------------------------------------------------------------------------------ */
h1, h2, h3 { line-height: 1.2; }
.display { font-family: var(--serif); font-weight: 700; font-size: clamp(2rem, 6vw, 3.6rem); letter-spacing: -.01em; }
html[lang="ar"] .display, html[lang="ar"] h2.title { font-family: var(--font); font-weight: 800; letter-spacing: 0; }
h2.title { font-family: var(--serif); font-size: clamp(1.5rem, 4vw, 2.1rem); margin-bottom: 8px; }
.lead { color: var(--muted); max-width: 62ch; font-size: 1.05rem; }
.section { padding-block: 56px; }
.section.alt { background: var(--bg-2); }
.section-head { margin-bottom: 28px; }
.crumbs { font-size: .85rem; color: var(--muted); padding-block: 18px 0; }
.crumbs a { text-decoration: none; }
.crumbs span[aria-hidden] { margin-inline: 6px; }
.page-head { padding-block: 10px 28px; }
.page-head h1 { font-family: var(--serif); font-size: clamp(1.7rem, 4.5vw, 2.5rem); margin-block: 8px; }
html[lang="ar"] .page-head h1 { font-family: var(--font); font-weight: 800; }

/* ---- Hero --------------------------------------------------------------------------------------------------- */
.hero { color: #fff; background: radial-gradient(1000px 480px at 85% -10%, rgba(0,168,143,.28), transparent), radial-gradient(700px 400px at 0% 110%, rgba(212,175,55,.14), transparent), linear-gradient(160deg, #0B2D58, #07172B); padding-block: 56px 72px; }
.hero .display em { font-style: normal; color: var(--gold); }
.hero .lead { color: #C8D5E8; margin-top: 16px; }
.hero-search { margin-top: 28px; display: flex; gap: 8px; max-width: 640px; background: #fff; border-radius: 14px; padding: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 12px 14px; font: inherit; color: #0E1B2C; }
.hero-search input:focus-visible { outline: none; }
.hero-search:focus-within { outline: 3px solid var(--gold); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { border: 1px solid rgba(255,255,255,.28); color: #DCE6F5; border-radius: 999px; padding: 6px 14px; font-size: .88rem; text-decoration: none; }
.chip:hover { border-color: var(--gold); color: #fff; }
.badge-free { display: inline-block; margin-top: 22px; border: 1px solid var(--gold); color: var(--gold); padding: 4px 14px; border-radius: 999px; font-size: .82rem; letter-spacing: .04em; }

/* ---- Cards, grids, buttons ---------------------------------------------------------------------------------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.three { grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.grid.two { grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid.two { grid-template-columns: repeat(2, 1fr); } }

/* ---- Analytics dashboard: date filter bar and dependency-free CSS charts (CSP: no chart library, inline <style> is
   also forbidden - every size below is a computed inline "style" attribute's percentage, not a script) ------------- */
.filter-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; margin-block: 14px 20px; }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
.filter-bar input[type="date"] { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; background: var(--card); color: var(--text); }
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; }
.bar-col { flex: 1 0 10px; min-width: 10px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.chart-bar { width: 100%; min-height: 2px; background: var(--teal); border-radius: 3px 3px 0 0; }
.chart-bar.bar-error { background: #C0392B; }
.bar-label { font-size: .62rem; color: var(--muted); margin-top: 4px; writing-mode: vertical-rl; white-space: nowrap; }
.hbar-chart { display: grid; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr 48px; align-items: center; gap: 10px; }
.hbar-label { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--teal); border-radius: 999px; }
.hbar-row .n { font-size: .85rem; }
.placement-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.chk-inline { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; white-space: nowrap; }

/* ---- Responsive ad-slot container (Pages/Shared/_AdSlot.cshtml) - inert by design: see that file's doc comment ---- */
.ad-slot { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 100%; overflow: hidden; }
.ad-slot:empty { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.card-list { display: flex; flex-direction: column; gap: 12px; }
.card.unread { border-inline-start: 4px solid var(--teal); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.btn-sm { padding: 6px 14px; min-height: 36px; font-size: .85rem; }
a.card { display: block; text-decoration: none; transition: transform .2s, border-color .2s; }
a.card:hover { transform: translateY(-3px); border-color: var(--teal); color: inherit; }
@media (prefers-reduced-motion: reduce) { a.card { transition: none; } a.card:hover { transform: none; } html { scroll-behavior: auto; } }
.card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.card p { color: var(--muted); font-size: .92rem; }
.ico { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); display: grid; place-items: center; color: var(--gold); font-weight: 700; font-size: 1.15rem; margin-bottom: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--teal); color: #fff; border: 0; border-radius: var(--r-sm); padding: 10px 20px; font: inherit; font-weight: 600; min-height: 44px; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.94); color: #fff; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.secondary:hover { border-color: var(--teal); color: var(--text); }
.btn.gold { background: var(--gold); color: #241c00; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--ok-bg); color: var(--accent); }
.pill.soon { background: var(--warn-bg); color: var(--warn-fg); }
.pill.dev { background: var(--info-bg); color: var(--navy-2); }
.pill.bad { background: var(--err-bg); color: var(--err-fg); }
:root[data-theme="dark"] .pill.dev { color: #8ec4ff; }
.feature-split { display: grid; gap: 24px; align-items: center; }
@media (min-width: 900px) { .feature-split { grid-template-columns: 1.1fr .9fr; } }
.feature-banner { background: linear-gradient(135deg, var(--navy), #0b3a6e); color: #fff; border-radius: 24px; padding: 28px; }
@media (min-width: 768px) { .feature-banner { padding: 40px; } }
.feature-banner .lead { color: #C8D5E8; }
.checks { list-style: none; padding: 0; display: grid; gap: 8px; margin-top: 16px; }
.checks li::before { content: "✓"; color: var(--gold); margin-inline-end: 10px; font-weight: 700; }

/* ---- Forms -------------------------------------------------------------------------------------------------- */
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .form-grid.three { grid-template-columns: repeat(3, 1fr); } }
.field label, .field .lbl { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.input, select.input { width: 100%; min-height: 46px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; font: inherit; }
.input:focus { outline: 3px solid var(--gold); outline-offset: 1px; border-color: var(--teal); }
.input[aria-invalid="true"] { border-color: #c0392b; }
.field .err { color: var(--err-fg); font-size: .82rem; margin-top: 4px; }
.input-unit { display: flex; align-items: stretch; }
.input-unit .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-unit .unit { display: grid; place-items: center; padding-inline: 12px; background: var(--bg-2); border: 1px solid var(--line); border-inline-start: 0; border-start-end-radius: var(--r-sm); border-end-end-radius: var(--r-sm); color: var(--muted); font-size: .85rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 16px; min-width: 0; }
legend { font-weight: 700; padding-inline: 8px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.alert { border-radius: var(--r-sm); padding: 12px 14px; margin-block: 14px; font-size: .92rem; }
.alert.info { background: var(--info-bg); } .alert.warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert.error { background: var(--err-bg); color: var(--err-fg); } .alert.ok { background: var(--ok-bg); }

/* ---- Calculator layout & results ---------------------------------------------------------------------------- */
.calc-layout { display: grid; gap: 24px; }
@media (min-width: 960px) { .calc-layout { grid-template-columns: 5fr 7fr; align-items: start; } .calc-layout .sticky { position: sticky; top: 90px; } }
.calc-layout > * { min-width: 0; }
.result-list { display: grid; gap: 10px; }
.result-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.result-row:last-child { border-bottom: 0; }
.result-row .v { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-hero .v { font-size: 1.8rem; color: var(--accent); }
.formula { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 1.1rem; background: var(--bg-2); border-radius: var(--r-sm); padding: 12px 14px; unicode-bidi: isolate; overflow-x: auto; text-align: start; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r-sm); }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
table.t th, table.t td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { color: var(--muted); font-weight: 600; font-size: .8rem; background: var(--bg-2); }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: end; font-variant-numeric: tabular-nums; }
.scenario-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .scenario-grid { grid-template-columns: repeat(3, 1fr); } }
.scenario { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; background: var(--card); }
.scenario.balanced { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(0,168,143,.18); }
.scenario .price { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.scenario dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .88rem; margin-top: 10px; }
.scenario dt { color: var(--muted); } .scenario dd { margin: 0; text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; }
.stack { display: block; width: 100%; height: 22px; border-radius: 8px; overflow: hidden; }
.seg-cost { fill: #14508f; } .seg-fees { fill: #8da2bd; } .seg-leak { fill: #D4AF37; } .seg-profit { fill: #00A88F; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .82rem; color: var(--muted); margin-top: 8px; list-style: none; padding: 0; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.explain { display: grid; gap: 12px; padding: 0; list-style: none; }
.explain li { background: var(--bg-2); border-radius: var(--r-sm); padding: 12px 14px; border-inline-start: 4px solid var(--teal); }
.cat-link-row { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 14px; }
.cat-link-row a { text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.cat-link-row a[aria-current="page"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

/* ---- Footer ------------------------------------------------------------------------------------------------- */
.site-footer { background: #07172B; color: #A3B3C9; padding-block: 40px 28px; margin-top: 40px; font-size: .92rem; }
.site-footer a { color: #D5E0EF; text-decoration: none; } .site-footer a:hover { color: var(--gold); }
.foot-grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .foot-grid { grid-template-columns: 1.2fr 1fr 1fr 1fr; } }
.foot-grid ul { list-style: none; padding: 0; display: grid; gap: 6px; }
.foot-grid h2 { color: #fff; font-size: .95rem; margin-bottom: 10px; }
.foot-bottom { border-top: 1px solid #1E3A5F; margin-top: 24px; padding-top: 16px; font-size: .82rem; }

/* ---- Utilities (no inline styles anywhere: the CSP forbids them) --------------------------------------------- */
.mt-s { margin-top: 10px; } .mt-m { margin-top: 20px; } .mt-l { margin-top: 32px; }
.on-dark { color: #fff; border-color: rgba(255,255,255,.4); } .on-dark:hover { color: #fff; border-color: var(--gold); }
.foot-note { margin-top: 12px; max-width: 42ch; }
.chip-static { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .9rem; list-style: none; background: var(--card); }
.lg-cost { background: #14508f; } .lg-fees { background: #8da2bd; } .lg-leak { background: #D4AF37; } .lg-profit { background: #00A88F; }
.login-card { max-width: 460px; margin-inline: auto; }
.btn.secondary.on-dark { color: #fff; border-color: rgba(255,255,255,.45); }
.btn.secondary.on-dark:hover { color: #fff; border-color: var(--gold); }
.demo { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 18px; padding: 18px; display: grid; gap: 10px; }
.demo-head { color: #C8D5E8; font-size: .9rem; }
.demo-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.demo-row.on { background: rgba(0,168,143,.28); outline: 1px solid rgba(0,168,143,.8); }
.demo-row strong { font-size: 1.25rem; text-align: end; font-variant-numeric: tabular-nums; }
.demo-m { grid-column: 1 / -1; color: #C8D5E8; font-size: .82rem; }@media (max-width: 479px) {
  .lang-label { display: none; }
  .brand img { height: 30px; }
  .bar { gap: 8px; }
  .lang-menu { inset-inline-end: -8px; }
  .profile-label { display: none; }
  /* The profile button can land at the start edge of a wrapped header row on narrow screens; anchoring the menu to
     inset-inline-end there pushes it off the opposite edge of the viewport, so open it from the button's own start
     edge instead (inset-inline-start) and let max-width: calc(100vw - 32px) above keep it on-screen. */
  .profile-menu { inset-inline-end: auto; inset-inline-start: -8px; }
}

/* ---- Calculation steps and worked examples ---------------------------------------------------------------- */
ol.steps { list-style-position: inside; padding-inline-start: 0; display: grid; gap: 8px; font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 1.02rem; }
ol.steps li { overflow-x: auto; padding-block: 2px; }
ul.example-inputs { list-style: none; padding: 0; display: grid; gap: 4px; margin-block: 10px; }
ul.example-inputs li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-block: 4px; }

/* ---- Interactive function graph (wwwroot/js/graph.js) ------------------------------------------------------- */
.mp-graph { position: relative; }
.mp-graph-svg { width: 100%; height: 260px; display: block; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); touch-action: none; cursor: grab; }
.mp-graph-svg:active { cursor: grabbing; }
@media (min-width: 560px) { .mp-graph-svg { height: 340px; } }
.mp-graph-axes line { stroke: var(--muted); stroke-width: 1.5; }
.mp-graph-gridline { stroke: var(--line); stroke-width: 1; }
.mp-graph-tick { font-size: 9px; fill: var(--muted); font-family: var(--font); }
.mp-graph-curve { fill: none; stroke: var(--teal); stroke-width: 2.5; }
.mp-graph-shade { fill: var(--gold); opacity: .22; stroke: none; }
.mp-graph-point { fill: var(--gold); stroke: var(--navy); stroke-width: 1.5; }
:root[data-theme="dark"] .mp-graph-point { stroke: var(--bg); }
.mp-graph-pointlabel { font-size: 11px; fill: var(--text); font-family: var(--font); }
.mp-graph-controls { position: absolute; top: 8px; inset-inline-end: 8px; display: flex; gap: 4px; }
.mp-graph-controls .ctl { min-width: 32px; min-height: 32px; padding: 0; font-size: 1rem; line-height: 1; }
.mp-graph-error { margin: 0; }

/* ---- Math typesetting (KaTeX, wwwroot/js/mathrender.js) ------------------------------------------------------ */
.katex-expr { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.katex-expr:empty::before { content: "\00a0"; }

/* ---- Math keyboard (wwwroot/js/mathkeyboard.js) ---------------------------------------------------------------- */
.mp-mathkeyboard { display: grid; gap: 6px; margin-block: 10px; }
.mp-mkey-row { display: flex; flex-wrap: wrap; gap: 6px; }
.mp-mkey {
  min-width: 44px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg-2); color: var(--text); font-size: 0.95rem; font-family: "Cambria Math", "STIX Two Math", Georgia, serif;
  cursor: pointer;
}
.mp-mkey:hover { background: var(--line); }
.mp-mkey:active { transform: translateY(1px); }
.mp-mkey-nav { background: var(--navy); color: #fff; font-family: var(--font); }
:root[data-theme="dark"] .mp-mkey-nav { background: var(--teal); }
.mp-mathexpr-preview { min-height: 2.2em; display: flex; align-items: center; padding: 10px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); }

/* ---- AI tutor answers (wwwroot/js/ai-education.js) --------------------------------------------------------------- */
.ai-answer { white-space: normal; }
.ai-answer p { margin: 0 0 8px; }
.ai-answer[data-ai-loading] { opacity: 0.6; }
.ai-answer-meta { display: block; margin-top: 6px; }
.ai-verify-badge { font-weight: 600; margin: 6px 0; }
.ai-verify-ok { color: var(--teal); }
.ai-verify-bad { color: var(--err-fg); }
.ai-verify-unknown { color: var(--muted); font-weight: 400; }
.ai-stop-btn { margin-top: 8px; }

/* ---- SuperAdmin: MFA ---------------------------------------------------------------------------------------------- */
.mfa-qr { display: flex; justify-content: center; margin: 16px 0; }
.mfa-qr svg { max-width: 220px; height: auto; }
.recovery-codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, monospace; margin: 16px 0; }
.recovery-codes li { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; text-align: center; }
.inline-form { display: inline-block; margin: 0; }
.input-narrow { max-width: 120px; }
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---- Cookie-consent banner (Pages/Shared/_ConsentBanner.cshtml, wwwroot/js/consent.js) ----------------------------- */
.consent-banner { position: fixed; inset-inline: 0; bottom: 0; z-index: 90; display: flex; justify-content: center; padding: 16px; }
.consent-banner[hidden] { display: none; }
.consent-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; max-width: 720px; width: 100%; }
.consent-box h2 { font-size: 1.1rem; margin-bottom: 6px; }
.consent-box p { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.consent-categories { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
.consent-categories[hidden] { display: none; }
.consent-actions .btn[hidden] { display: none; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

/* ---- Health dashboard: 14-day availability strip (Pages/Admin/Health.cshtml) ---------------------------------------- */
.status-strip { display: flex; flex-wrap: wrap; gap: 2px; }
.status-dot { width: 8px; height: 16px; border-radius: 2px; background: var(--teal); }
.status-dot.bad { background: #C0392B; }

/* ---- AI Education lesson pages (Pages/AiEducation/Learn/*) ---------------------------------------------------------- */
.lesson-progress-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-block: 10px 4px; }
.lesson-progress-fill { height: 100%; background: var(--teal); border-radius: 999px; transition: width .3s; }
@media (prefers-reduced-motion: reduce) { .lesson-progress-fill { transition: none; } }
.lesson-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-block: 18px; }
.lesson-nav .btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.example-card { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 16px; margin-block: 10px; background: var(--bg-2); }
.example-card h3 { font-size: .95rem; margin-bottom: 8px; color: var(--muted); }
.exercise-disclosure { margin-block-start: 8px; }
.exercise-disclosure summary { cursor: pointer; color: var(--navy-2); font-size: .88rem; font-weight: 600; }
:root[data-theme="dark"] .exercise-disclosure summary { color: #8ec4ff; }
.exercise-disclosure[open] summary { margin-block-end: 6px; }
.lesson-complete-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lesson-tutor-turn { border-block-start: 1px solid var(--line); padding-block-start: 10px; margin-block-start: 10px; }
.lesson-tutor-turn:first-child { border-block-start: 0; padding-block-start: 0; margin-block-start: 0; }
