/* enhance.css — refinement layer loaded after academy.css + studio.css.
   Reuses the existing design tokens/classes only; no redesign. */

/* --- Hero: founder trust chip (portal.js .hero-founder) --- */
.studio-hero p.hero-founder{display:flex;gap:10px;align-items:center;margin-top:18px;padding-top:14px;border-top:1px solid #b6c8ac8c;font-size:.92rem}
.hero-founder img{border-radius:50%;object-fit:cover;flex:none;border:2px solid var(--lime);width:48px;height:48px}
.hero-founder-text{display:flex;flex-direction:column;gap:2px}
.hero-founder-name{font-weight:700;font-family:var(--head)}
.hero-founder-role{font-size:.85rem;color:#e4eee5}
@media (max-width:650px){.hero-founder img{width:44px;height:44px}}

/* --- Founder presence: hero chip (.hero-founder) + footer (.foot-founder) only.
   The former .founder-card block was removed at the closing deploy (Decision 13 / D-06):
   its markup no longer exists anywhere in the build. --- */
.foot-founder{display:flex;gap:8px;align-items:center}
.foot-founder img{border-radius:50%;object-fit:cover;flex:none}

/* --- Hero: one primary action; roadmap demoted to a text link (portal.js) --- */
.studio-hero p.hero-roadmap-link{margin-top:10px;font-size:.95rem}
.hero-roadmap-link a{color:var(--lime);text-decoration:underline;text-underline-offset:4px}
.hero-links button.action-ghost{padding:8px 20px;font-weight:700;border-radius:8px;cursor:pointer;font:inherit}
/* Strengthen the dark side of the hero so Arabic copy never runs over a faded photo */
.studio-hero{box-shadow:inset 60vw 0 90px -40px #092d25cc}

/* --- Card depth: interactive cards only; .panel stays flat --- */
.photo-card,.directory-item,.tile{box-shadow:0 1px 2px #103f3212,0 10px 28px #103f320d}
.photo-card:hover,.directory-item:hover,.tile:hover{box-shadow:0 14px 34px #103f321c;border-color:var(--primary)}
html[data-theme="dark"] .photo-card,html[data-theme="dark"] .directory-item,html[data-theme="dark"] .tile{box-shadow:0 10px 28px #0006}
.cover{aspect-ratio:1.9}
@media (min-width:651px){.directory-grid-home{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* --- Unified card geometry (16px across adjacent surfaces) --- */
.photo-card,.directory-item,.tile,.ref-card,.doc-row,.home-tail>div,.path-banner,.study-stat,.steps-list article{border-radius:16px}
.directory-item{border-inline-start:4px solid var(--accent)}
.directory-item[data-group="labs"]{border-inline-start-color:#7a9a2e}
.directory-item[data-group="learn"]{border-inline-start-color:var(--gold)}
.directory-item[data-group="pro"]{border-inline-start-color:var(--primary)}
.directory-item[data-group="refs"]{border-inline-start-color:#5b7a8c}
html[data-theme="dark"] .directory-item[data-group="labs"]{border-inline-start-color:#a8c256}
html[data-theme="dark"] .directory-item[data-group="refs"]{border-inline-start-color:#8fb3c7}

/* --- Card meta line (real cues: count / output / level, fed from portal.js) --- */
.card-meta{color:var(--muted);font-size:.82rem;border-top:1px dashed var(--line);padding-top:8px;margin-top:10px}

/* --- Typography hierarchy with the existing two fonts --- */
h1,h2{line-height:1.35}
.studio-hero h1{line-height:1.43}
.view-head h1{font-size:clamp(1.9rem,3.4vw,3rem)}
.cover-body h3,.directory-item h2{font-size:1.08rem;line-height:1.5}
.eyebrow,.hub-heading small,.cover-body small{font-family:var(--head);letter-spacing:0}
.cover-body p,.directory-item p{font-weight:400}

/* --- Fact strip: proof, centred, tabular numerals (Arial numerals, strong colour) --- */
.fact-strip strong{font-family:Arial;color:var(--primary-strong)}
.fact-strip strong,.metric strong,.study-stat strong{font-variant-numeric:tabular-nums}
@media (min-width:651px){.fact-strip>div{flex-direction:column;gap:2px;text-align:center}}
@media (max-width:650px){.fact-strip>div{border-bottom:1px solid var(--line);padding-bottom:10px}.fact-strip>div:last-child{border-bottom:0}}

/* --- Inner-page head band (CSS only, no markup change) --- */
.view-head{border-bottom:2px solid var(--line);padding-bottom:16px;position:relative}
.view-head::after{content:'';position:absolute;bottom:-2px;inset-inline-start:0;width:72px;height:2px;background:var(--lime)}

/* --- Home tail: «continue» outranks «explore» --- */
.home-tail>div:last-child{background:var(--surface);border-color:var(--primary)}

/* --- Hero text width on wide screens (capped at 62% for contrast) --- */
@media (min-width:981px){.hero-text{width:min(680px,62%)}}

/* --- Progress stats: three tiles (roadmap / revenuedesk / learn) fill their grid --- */
@media (min-width:651px){[data-studio-progress]{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* --- Standards index: family colour coding, sticky filter, compact counts --- */
#view-standards .metrics{display:flex;flex-wrap:wrap;gap:6px 18px}
#view-standards .metric{flex:1 1 110px;padding:8px 12px;display:flex;gap:8px;align-items:baseline}
#view-standards .metric strong{font-size:1.05rem}
#view-standards .filter-row{position:sticky;top:80px;z-index:3;background:var(--surface);padding:8px 0;border-bottom:1px solid var(--line)}
@media (max-width:650px){#view-standards .filter-row{top:64px}}
#view-standards .section-head h2{border-inline-start:4px solid var(--primary);padding-inline-start:10px}
#view-standards .doc-row small{font-weight:700;color:var(--primary-strong)}
#std-ifrs+.doc-rows .doc-row{border-inline-start:4px solid var(--primary)}
#std-ias+.doc-rows .doc-row{border-inline-start:4px solid var(--gold)}
#std-framework+.doc-rows .doc-row{border-inline-start:4px solid var(--accent)}
#std-isa+.doc-rows .doc-row{border-inline-start:4px solid #7a9a2e}
#std-isqm+.doc-rows .doc-row,#std-isre+.doc-rows .doc-row{border-inline-start:4px solid #5b7a8c}
#std-isae+.doc-rows .doc-row,#std-isrs+.doc-rows .doc-row,#std-iapn+.doc-rows .doc-row{border-inline-start:4px solid var(--primary-strong)}
html[data-theme="dark"] #std-isa+.doc-rows .doc-row{border-inline-start-color:#a8c256}
html[data-theme="dark"] #std-isqm+.doc-rows .doc-row,html[data-theme="dark"] #std-isre+.doc-rows .doc-row{border-inline-start-color:#8fb3c7}
#std-interp+.doc-rows .doc-row{border-inline-start:4px solid var(--gold)}
#std-issb+.doc-rows .doc-row,#std-issa+.doc-rows .doc-row{border-inline-start:4px solid var(--lime-strong)}
#std-sme+.doc-rows .doc-row,#std-lce+.doc-rows .doc-row{border-inline-start:4px solid var(--accent)}
#std-ethics+.doc-rows .doc-row{border-inline-start:4px solid var(--danger)}

/* --- RTL / Latin polish (cover chips keep dir=ltr + Arial from markup/studio) --- */
.wordmark small{text-align:start}

/* --- Spacing rhythm --- */
.featured{padding-top:40px}
.home-tail{margin-top:32px;gap:20px}
.stack{gap:20px}

/* --- Tasteful motion, reduced-motion safe --- */
@media (prefers-reduced-motion:no-preference){
  @keyframes hero-in{from{opacity:0;transform:translateY(10px)}}
  .hero-text{animation:hero-in .6s ease both}
  .feature-grid>*,.directory-grid>*{animation:hero-in .6s ease both}
  .feature-grid>*:nth-child(2),.directory-grid>*:nth-child(2){animation-delay:.08s}
  .feature-grid>*:nth-child(3),.directory-grid>*:nth-child(3){animation-delay:.16s}
  .directory-grid>*:nth-child(4){animation-delay:.24s}
}

/* --- Print: clean paper output, no chrome; standards links stay visible as URLs --- */
@media print{
  .mast,.rail,.veil,.breadcrumbs,.site-foot,.mast-tools,.filter-row{display:none!important}
  .actions{display:none!important}
  .doc-row .actions{display:block!important}
  .doc-row a::after{content:" (" attr(href) ")";font-size:.72em;word-break:break-all}
  body{background:#fff;color:#000}
  .photo-card,.directory-item,.tile,.panel,.ref-card,.doc-row{box-shadow:none!important;border:1px solid #999}
  .studio-hero{background:#fff;color:#000;box-shadow:none}
  a{color:#000;text-decoration:none}
  .view-head::after{background:#000}
  .hero-founder{display:flex!important}
  .hero-founder img{width:32px;height:32px;filter:grayscale(1)}
  .hero-founder-role{color:#000}
}

/* --- Grand-panel fix pass (fixer 5): tokens, contrast, print, states --- */
:root{--danger:#b54835;--danger-soft:#fbeae6;--control-line:#6f8a7c;--gold-strong:#8a5f14;--lime-strong:#7a9a2e;--latin:Arial,"Segoe UI",Tahoma,sans-serif;--space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:24px;--space-6:32px}
html[data-theme="dark"]{--danger:#ff9d8a;--danger-soft:#3d2320;--control-line:#7d9a8a;--gold-strong:#d9a94f;--lime-strong:#a8c256}
[lang="en"],.ltr{font-family:var(--latin)}
h1,h2,h3,h4{font-family:var(--head);letter-spacing:0}
h1{line-height:1.4}h2{line-height:1.45}h3{line-height:1.55}
input,select,textarea{border-color:var(--control-line)}
.wordmark small{font-size:11px;letter-spacing:.14em}
.nav-heading{font-size:.78rem}
.panel,.metric,.tile{border-radius:16px}
.photo-card,.directory-item{transition:box-shadow .18s,transform .18s,border-color .18s}
.tile{transition:box-shadow .18s,transform .18s,border-color .18s}
.tile:active,.photo-card:active,.directory-item:active{transform:translateY(0)}
.button:active{filter:brightness(.94)}
.button,.nav-link,.filter-chip,.search-result{transition:background-color .13s,color .13s,border-color .13s}
progress{accent-color:var(--primary)}
.calc-metrics strong,.rd-totals b,.table-wrap td{font-variant-numeric:tabular-nums}
.legacy-frame{color-scheme:normal}
.rail.open{box-shadow:-18px 0 40px #0003}
dialog::backdrop{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.search-categories label{padding:8px 12px;min-height:40px}
#view-catalog .directory-grid>*{animation:none}
.feedback-box[data-correct="true"]{background:#e7f4e9;border-color:var(--primary)}
.feedback-box[data-correct="false"]{background:var(--danger-soft);border-color:var(--danger)}
html[data-theme="dark"] .feedback-box[data-correct="true"]{background:#1e3a2a}
html[data-theme="dark"] .feedback-box[data-correct="false"]{background:#3d2320}
.quiz-choices label:has(input:checked){border-color:var(--primary);background:var(--soft)}
.calc-error{border-inline-start:3px solid var(--danger,#b54835)}
.calc-warn{border-inline-start:3px solid var(--danger,#b54835);background:var(--danger-soft,transparent)}
.empty-state{border:1px dashed var(--control-line);border-radius:16px;padding:20px;text-align:center;color:var(--muted)}
[data-ea-breach="true"]{border:1px solid var(--danger);background:var(--danger-soft)}
.table-wrap thead th{position:sticky;top:0;background:var(--surface);z-index:1}
#view-sampling .table-wrap{max-height:65vh;overflow:auto}
.founder-photo{border-radius:50%;object-fit:cover;flex:none}
.view-head::after{background:var(--lime-strong)}
@media (min-width:651px) and (max-width:980px){#view-standards .filter-row{top:67px}}
@media (max-width:650px){
  #view-standards .filter-row{flex-wrap:nowrap;overflow-x:auto}
  .fact-strip>div{border-inline-end:0}
  .fact-strip>div:nth-child(-n+2){border-bottom:1px solid var(--line)}
  .studio-hero{min-height:auto;padding-block:28px}
  .wordmark small{font-size:9px}.cover-body,.path-banner{padding:14px}
}
@media print{
  @page{size:A4;margin:13mm;@bottom-center{content:"صفحة " counter(page);font-size:9pt;color:#555}}
  .studio-hero h1,.studio-hero p,.hero-context{color:#000!important}
  .ref-card a[href^="http"]::after{content:" (" attr(href) ")";font-size:.72em;word-break:break-all}
  html[data-theme="dark"]{--bg:#fff;--surface:#fff;--soft:#eee;--line:#aaa;--ink:#000;--muted:#333;--accent:#eee;--primary:#111;--primary-strong:#111;--danger:#b54835;--danger-soft:#fff;--gold-strong:#8a5f14;--lime-strong:#7a9a2e}
  .studio-hero::before{display:none}
  .studio-hero h1 em{color:#000}
}

/* --- Final grand-panel pass: canonical palette, font weights, spacing, reading --- */
/* Canonical palette = studio.css values, redeclared here (last-loaded sheet) so the
   academy.css/studio.css split can never drift: this block is the single source. */
:root{--bg:#f8faf6;--surface:#fff;--ink:#16352f;--primary:#165844;--primary-strong:#103f32;--soft:#edf3ed;--muted:#52675f;--line:#d6e0d7;--accent:#d6f3e1;--gold:#f2ce82;--alert:#8d451d;--radius:16px}
html[data-theme="dark"]{--bg:#101e1a;--surface:#172820;--ink:#ecf4e8;--primary:#abd8b2;--primary-strong:#d2e9c8;--soft:#22382e;--muted:#b5c8bb;--line:#385144;--accent:#244b37;--gold:#f2ce82;--alert:#ffbd92}
/* Font weights: no @font-face in this sheet — studio.css is authoritative
   (Studio/sans-ar 400 face, Kufi 700 face). Other demanded weights are
   browser-synthesized; that is accepted, not a suppression bug. */
/* Unified panel padding, derived from the --space scale */
.panel,.metric,.tile{padding:var(--space-5)}
.ref-card,.doc-row{padding:var(--space-4) var(--space-5)}
.cover-body,.directory-item{padding:var(--space-4) var(--space-5)}
.home-tail>div,.path-banner{padding:var(--space-4) var(--space-5)}
@media (max-width:650px){.panel,.metric,.tile{padding:var(--space-4)}}
/* Home rhythm: one gap for the home view, no stacked per-child top spacing */
#view-home>.view-body{gap:var(--space-5)}
#view-home>.view-body>*{margin-top:0}
/* Reading column: lesson body text capped at ~68ch at a comfortable size */
#academy-reading .split-reading>div:first-child p,#academy-reading .split-reading>div:first-child li{max-width:68ch}
#academy-reading .split-reading>div:first-child p{font-size:1.05rem;line-height:1.9}
/* Library frame loading state (class toggled by core.js while the iframe loads) */
.legacy-frame{transition:opacity .25s}
.legacy-frame.frame-loading{opacity:.35;cursor:progress}

/* --- Round-3 print rescue (MUST stay last): the final palette block above
   redeclares the dark tokens unconditionally and would otherwise override the
   earlier @media print dark-token block, printing near-white ink on white.
   Re-appended here, after that palette block, so it wins in print. --- */
@media print{
  html[data-theme="dark"]{--bg:#fff;--surface:#fff;--soft:#eee;--line:#aaa;--ink:#000;--muted:#333;--accent:#eee;--primary:#111;--primary-strong:#111;--danger:#b54835;--danger-soft:#fff;--gold-strong:#8a5f14;--lime-strong:#7a9a2e}
}

/* --- FC approved design pass (fc-fix-3): all new CSS lives here only --- */
.cover{aspect-ratio:1.5}
.legacy-frame{color-scheme:normal}
#view-standards .filter-row{flex-wrap:wrap;overflow-x:visible}
#view-standards .filter-row>label{flex:1 0 100%}
.table-wrap thead th{top:80px}
#view-sampling .table-wrap thead th,.calc-table thead th{top:0}
.calc-library div.calc-stale{opacity:1;outline:2px dashed var(--control-line);outline-offset:-2px}
.mode-cards .tile[aria-pressed=true]{padding:calc(var(--space-5) - 1px)}
.mast-tools .mast-icon{width:44px;min-height:44px}.mast-tools .mast-search,.mast-tools .profile-link{min-width:44px;min-height:44px}
.hero-links a{min-height:44px;display:inline-flex;align-items:center}
.directory-item[data-group="learn"]{border-inline-start-color:var(--gold-strong)}
#std-ias+.doc-rows .doc-row{border-inline-start-color:var(--gold-strong)}
#std-interp+.doc-rows .doc-row{border-inline-start-color:var(--gold-strong)}
#std-framework+.doc-rows .doc-row{border-inline-start-color:var(--primary)}
@media (max-width:980px){.table-wrap thead th{top:67px}#view-sampling .table-wrap thead th,.calc-table thead th{top:0}}
@media (max-width:650px){
  .table-wrap thead th{top:64px}#view-sampling .table-wrap thead th,.calc-table thead th{top:0}
  #view-standards .filter-row{flex-wrap:wrap;overflow-x:visible}
  .mode-cards .tile[aria-pressed=true]{padding:calc(var(--space-4) - 1px)}
  .fact-strip>div{border-bottom:0}.fact-strip>div:nth-child(-n+2){border-bottom:1px solid var(--line)}.fact-strip>div:nth-child(even){border-inline-end:0}
}
@media (max-width:370px){.mast-tools .theme-toggle{display:flex}}
@media print{
  html[data-theme="dark"]{--alert:#8d451d}
  html[data-theme="dark"] .feedback-box[data-correct="true"]{background:#e7f4e9}
  a[href^="http"]::after{content:" (" attr(href) ")";font-size:.72em;word-break:break-all}
  .actions{display:none!important}
  .doc-row .actions{display:block!important}
}


/* --- B4: report-as-document model (reporting.js #reportdoc) --- */
.rdoc-doc{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:22px 26px;display:grid;gap:4px}
.rdoc-doctitle{font-family:var(--head);font-weight:700;font-size:1.3rem;text-align:center;margin:0 0 10px;padding-bottom:12px;border-bottom:2px solid var(--line)}
.rdoc-sec{border-inline-start:3px solid var(--line);padding:6px 14px 10px;margin:2px 0}
.rdoc-sec h3{margin:.3rem 0 .4rem;font-size:1.02rem}
.rdoc-sec ul{margin:.2rem 0 .4rem;padding-inline-start:1.2rem;display:grid;gap:.25rem}
.rdoc-num,.rdoc-order li::before{display:inline-flex;align-items:center;justify-content:center;width:1.7em;height:1.7em;border-radius:999px;background:var(--primary-strong);color:var(--surface);font-size:.85em}
.rdoc-num{margin-inline-end:.35rem}
.rdoc-ref{color:var(--muted);font-size:.82rem;margin:.1rem 0 0}
.rdoc-sign{border-top:1px dashed var(--line);padding-top:12px;margin:10px 0 0;color:var(--muted);font-size:.9rem;text-align:center}
.rdoc-spec{border:1.5px dashed var(--control-line,var(--line));border-radius:16px;padding:18px 22px;background:var(--surface)}
.rdoc-spec h3{margin-top:0}
@media (max-width:650px){.rdoc-doc{padding:16px}.rdoc-spec{padding:14px 16px}}
@media print{.rdoc-nav,.rdoc-wording-label{display:none}.rdoc-sec{break-inside:avoid}.rdoc-num{print-color-adjust:exact;-webkit-print-color-adjust:exact}}
.rdoc-nav{display:flex;flex-wrap:wrap;gap:.55rem;margin-block:0 1rem}
.rdoc-nav a{border:1px solid var(--line);border-radius:99px;padding:.55rem .9rem;min-height:44px;display:inline-flex;align-items:center;text-decoration:none}

/* --- B2: report types + anatomy (reporting.js #reportdoc-types / #reportdoc-anatomy) --- */
.rdoc-order{list-style:none;counter-reset:rdocord;margin:0;padding:0;display:grid;gap:.45rem}
.rdoc-order li{counter-increment:rdocord;display:flex;gap:.7rem;align-items:flex-start;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:.55rem .8rem}
.rdoc-order li::before{content:counter(rdocord);flex:none;font-weight:700}
.rdoc-wide-table{min-width:760px}
@media print{.rdoc-spec{break-inside:avoid}.rdoc-order li{break-inside:avoid}.rdoc-order li::before{print-color-adjust:exact;-webkit-print-color-adjust:exact}}


/* --- Companies section (assets/companies.js #companies) --- */
.co-doc-meta{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:.5rem 1rem;margin:.8rem 0;padding:.8rem 1rem;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface)}
.co-doc-meta div{margin:0}
.co-doc-meta dt{color:var(--muted);font-size:.8rem;font-weight:700}
.co-doc-meta dd{margin:.15rem 0 0}
.tabs .button[aria-current=true]{background:var(--accent);border-color:var(--primary);color:var(--primary-strong)}
.tabs .button[aria-current=true] .pill{background:var(--surface);border:1px solid var(--primary)}
.co-risk-table{min-width:680px}

/* --- Masthead tools fix (2026-11-30, post-delivery, user screenshot): the menu
   button is an icon button, but its «الأقسام» text span was never hidden — it
   inflated the tools row, flex-crushed the neighbouring buttons and clipped
   «تقدّمي» at mid widths. The button's aria-label already names it, so the
   visible span is removed; tool buttons no longer shrink, and the wordmark
   (the flexible element) absorbs any remaining squeeze instead. --- */
.menu-button span{display:none}
.mast-tools{flex:none}
.mast-tools>*{flex:none}
.mast-search,.profile-link{white-space:nowrap}
.wordmark{min-width:0}
.wordmark span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* --- B1: IFRS vs IFRS for SMEs comparison (standards.js #std-sme-compare) --- */
.sme-cmp-table{min-width:860px}
.sme-cmp-table th[scope="row"]{font-family:var(--head);white-space:normal;min-width:130px;position:sticky;inset-inline-start:0;background:var(--surface);z-index:1}
@media print{.sme-cmp-table{min-width:0}.sme-cmp-table tr{break-inside:avoid}}

/* --- Open professional library (documents): per-category heading accents + dark-mode card depth (F-12) --- */
#view-documents .section-head h2{border-inline-start:4px solid var(--primary);padding-inline-start:10px}
#view-documents #lib-guides h2{border-inline-start-color:var(--gold)}
#view-documents #lib-models h2{border-inline-start-color:var(--accent)}
#view-documents #lib-saudi h2{border-inline-start-color:#7a9a2e}
#view-documents #lib-acca h2{border-inline-start-color:#5b7a8c}
html[data-theme="dark"] #view-documents #lib-saudi h2{border-inline-start-color:#a8c256}
html[data-theme="dark"] #view-documents #lib-acca h2{border-inline-start-color:#8fb3c7}
html[data-theme="dark"] #view-documents .ref-card{box-shadow:0 1px 6px rgba(0,0,0,.35)}

/* --- Standards status badges + status filter row (2026-11-30, user decision:
   every entry carries a status badge — ساري / جديد / مستقبلي / مُلغى / مرجعي غير ملزم —
   and the list defaults to effective entries only) --- */
#view-standards .std-badge{border:1px solid var(--primary)}
#view-standards .std-badge--recent{background:var(--gold);border-color:var(--gold);color:#3d2f06}
#view-standards .std-badge--future{background:var(--surface);border-style:dashed}
#view-standards .std-badge--withdrawn{background:var(--soft);border-color:var(--line);color:var(--alert);text-decoration:line-through}
#view-standards .std-badge--reference{background:var(--soft);border-color:var(--line);color:var(--muted)}
#view-standards .std-status-row{position:static;margin-top:10px;border-bottom:0}
#view-standards .std-status-label{font-weight:700;color:var(--muted)}

/* === Nav drawer layout fix (2026-11-30, mobile drawer bug) ===
   Root cause: studio.css `.rail.open{display:flex}` never set flex-direction,
   so the drawer laid .drawer-head and #navigation side-by-side in a row —
   the head stretched full-height (close button floated mid-screen) and the
   nav was crushed to ~127px, wrapping every label and overflowing the
   rail's edge onto the backdrop. The rail is an overlay drawer at every
   width (closed = display:none, unaffected), so stack it as a column:
   fixed head on top, full-width scrolling nav below. */
.rail{flex-direction:column}
.rail .drawer-head{flex:0 0 auto;width:100%}
.rail #navigation{flex:1 1 auto;width:100%;min-width:0;min-height:0;overflow-y:auto;overscroll-behavior:contain}
@media (max-width:340px){.rail{padding-inline:14px}.rail .wordmark{gap:6px;font-size:.8rem}}

/* === Drawer as the complete site index (2026-11-30, user order: «فهرس يوديني
   لكل حاجه جوه الموقع»; content rendered by assets/indexnav.js) ===
   The column layout is now pinned on the OPEN state itself (.rail.open), not
   only on .rail, so the drawer cannot fall back to studio.css's original
   horizontal row (head stretched full-height, nav crushed beside it and
   spilling over the backdrop — the empty-panel bug in the user's 12:41
   screenshots) if any one sheet is served stale. Head stays fixed on top;
   the index scrolls beneath it. */
.rail.open{flex-direction:column;align-items:stretch;overflow:hidden}
.rail .drawer-head{border-bottom:1px solid var(--line);padding-bottom:14px;margin-bottom:14px}
.rail .drawer-head .icon-button{width:44px;height:44px;flex:none;font-size:1.35rem;line-height:1}
.rail #navigation{padding-bottom:12px;-webkit-overflow-scrolling:touch}
.rail .nav-intro{color:var(--muted);font-size:.85rem;margin:0 11px 16px}
.rail .nav-group{margin-bottom:20px}
.rail .nav-group:last-child{margin-bottom:4px}
.rail .nav-heading{display:flex;align-items:center;justify-content:space-between}
.rail .nav-count{background:var(--soft);border:1px solid var(--line);color:var(--muted);border-radius:999px;font-size:.7rem;font-weight:700;padding:0 8px;line-height:1.7}
.rail .nav-link{min-height:44px}
.rail .nav-link .nav-icon{flex:none}
@media print{.rail{display:none!important}}

/* === فحص البنود (itemexam) — expandable item cards, assertion chips, flags === */
#view-itemexam .ix-card{border:1px solid var(--line);border-radius:1rem;margin-block-end:.55rem;scroll-margin-top:6rem;overflow:hidden;background:var(--surface)}
#view-itemexam .ix-card[open]{border-color:var(--primary)}
#view-itemexam .ix-card summary{padding:1rem;cursor:pointer;line-height:1.55}
#view-itemexam .ix-card summary::marker{color:var(--primary)}
#view-itemexam .ix-card-title{font-size:1rem;font-weight:700}
#view-itemexam .ix-body{padding:1rem;border-block-start:1px solid var(--line)}
#view-itemexam .ix-body h4{margin-block:1rem .4rem;color:var(--primary)}
#view-itemexam .ix-body h4:first-child{margin-block-start:0}
#view-itemexam .ix-body :is(ul,ol){margin-block:.3rem;padding-inline-start:1.4rem}
#view-itemexam .ix-body li{margin-block:.25rem;line-height:1.7}
#view-itemexam .ix-asserts{display:flex;flex-wrap:wrap;gap:.6rem .9rem}
#view-itemexam .ix-assert{display:inline-flex;align-items:baseline;gap:.35rem;max-width:100%}
#view-itemexam .ix-assert-chip{border:1px solid var(--primary);border-radius:999px;padding:.1rem .6rem;font-weight:700;font-size:.85rem;white-space:nowrap}
#view-itemexam .ix-assert small{color:var(--muted)}
#view-itemexam .ix-flags li{border-inline-start:3px solid var(--gold);padding-inline-start:.5rem;list-style:none}
#view-itemexam .ix-flags{padding-inline-start:.2rem}
#view-itemexam .ix-links .button{margin-block:.2rem}
#view-itemexam .ix-refs{margin-block-start:1rem}
@media(max-width:560px){#view-itemexam .ix-body{padding:.75rem}#view-itemexam .ix-card summary{padding:.7rem}}
@media print{#view-itemexam .ix-card{overflow:visible}}

/* === Bug-hunt fix pass (2026-11-30, FIXER-A) === */

/* WORDMARK-1: the masthead-tools fix above squeezes .wordmark via an ellipsis
   rule (span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}).
   In the drawer head no tools compete for width and the rail is 300-340px,
   so lift the ellipsis there and let the full name wrap/show. In the
   masthead at <=480px, drop the "AUDIT ACADEMY" sub-line and slightly
   reduce the Arabic name so it fits in full; the ellipsis rule stays as a
   last-resort guard below ~340px. */
.rail .drawer-head .wordmark span{overflow:visible;text-overflow:clip;white-space:normal}
@media (max-width:480px){
  .mast .wordmark small{display:none}
  .mast .wordmark{font-size:.92rem;line-height:1.3}
  /* Deviation from the triage plan, measured locally (headless Chromium,
     real fonts): the plan assumed the name needs 186px at 1rem and that
     hiding <small> + .92rem frees enough room. It actually needs 221px at
     1rem / 205px at .92rem, while the span only gets 125px @390, 95px @360,
     55px @320 — even 11px would need 153px. Shrinking can never fit it, so
     the masthead span wraps like the drawer one; the full name shows on
     2-3 short lines, mast height stays ~67px, no horizontal overflow. */
  .mast .wordmark span{overflow:visible;text-overflow:clip;white-space:normal}
}

/* HOME-4: on #home the .hub-heading action links are inline siblings with
   identical underline styling; at narrow widths they wrap onto one visual
   line with no separator and read as a single link. Stack them as two
   distinct tappable rows at <=650px. */
@media (max-width:650px){
  .hub-heading .actions{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
}

/* XCUT-4: wide tables sit in .table-wrap{overflow-x:auto} with no scroll
   affordance; in RTL the hidden columns are off the left edge with no hint.
   Scroll-shadow (background-attachment technique) at <=768px: the local
   cover gradients hide each edge shadow once that end is reached. */
@media (max-width:768px){
  .table-wrap{background:
    linear-gradient(to left, var(--surface) 30%, transparent) 0 0,
    linear-gradient(to right, var(--surface) 30%, transparent) 0 0,
    radial-gradient(farthest-side at 0 50%, #0003, transparent) 0 0,
    radial-gradient(farthest-side at 100% 50%, #0003, transparent) 100% 0;
    background-repeat:no-repeat;background-size:40px 100%,40px 100%,14px 100%,14px 100%;
    background-attachment:local,local,scroll,scroll}
}

/* === Drawer opens from the LEFT (2026-11-30, user order: «خليها تفتح من
   ناحيه زورارها» — the ☰ menu button sits at the left end of the masthead,
   so the drawer must open from that same side) ===
   studio.css anchors .rail with right:0, and the generic rule earlier in
   this sheet gives the open panel a leftward shadow (-18px 0 40px) suited
   to a right-edge panel. The rail is a fixed overlay at every width
   (closed = display:none; it is never in the page grid, and the desktop
   closed state is untouched), so flip the anchor and the shadow to the
   left edge and slide the panel in from off-screen left. The backdrop
   (.veil), the focus trap, Escape and close-on-navigate are class-driven
   in core.js (.open / body.drawer-open) and are unaffected. The drawer
   head keeps its RTL order — wordmark at inline-start (right), × at
   inline-end — which now puts the × at the panel's screen-edge corner,
   the same corner as the ☰ button itself, at its existing 44px target. */
.rail{left:0;right:auto}
.rail.open{box-shadow:18px 0 40px #0003;animation:rail-in-left .28s ease-out}
@keyframes rail-in-left{from{transform:translateX(-100%)}to{transform:translateX(0)}}
@media (prefers-reduced-motion:reduce){.rail.open{animation:none}}

/* --- OCI module (oci.js): wide master table + group band rows --- */
.oci-table{min-width:860px}
.oci-table th[scope="row"]{white-space:normal;min-width:150px}
.oci-band th{background:var(--surface);font-family:var(--head);border-inline-start:4px solid var(--primary)}
@media print{.oci-table{min-width:0}.oci-table tr{break-inside:avoid}}

/* === Sticky filter bars compacted (2026-11-30, stickyfix) ===
   Bug (user screenshots, #standards): BOTH .filter-row blocks were sticky
   at the same top offset under the sticky masthead, and the fc-fix-3 pass
   had set them to flex-wrap:wrap with the search label on its own
   full-width line — the family row alone wrapped to ~4 chip rows, so
   masthead + filter block ate ~40% of the viewport and the standard
   cards slid unreadably underneath the opaque bar.
   Fix: the two rows stay sticky (a 131-item list needs reachable
   filters) but become compact single-line, horizontally scrollable rows
   stacked at consecutive offsets — row 1 (search + family chips) keeps
   the masthead offset from the rules above; the status row sticks
   directly beneath it (each row's height is pinned at exactly 50px;
   the badges block had also set the status row position:static, which
   is overridden here). Filter bar total = 100px at every width; cards and
   section heads get a matching scroll-margin-top so deep links never
   land hidden under the bar. */
#view-standards .filter-row{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;padding:6px 0;scrollbar-width:thin;height:50px;box-sizing:border-box}
#view-standards .filter-row>label{flex:0 0 auto;white-space:nowrap;display:flex;align-items:center;gap:6px;height:36px}
#view-standards .filter-row>label input{width:190px;height:36px;box-sizing:border-box}
#view-standards .filter-row .filter-chip{flex:0 0 auto;white-space:nowrap;min-height:36px}
#view-standards .filter-row.std-status-row{position:sticky;top:130px;z-index:2;margin-top:0;border-bottom:1px solid var(--line);box-shadow:0 10px 14px -12px #0004}
#view-standards .std-status-label{flex:0 0 auto;white-space:nowrap}
#view-standards .section-head,#view-standards .doc-row{scroll-margin-top:196px}
@media (min-width:651px) and (max-width:980px){
  #view-standards .filter-row.std-status-row{top:117px}
  #view-standards .section-head,#view-standards .doc-row{scroll-margin-top:183px}
}
@media (max-width:650px){
  #view-standards .filter-row>label input{width:150px}
  #view-standards .filter-row.std-status-row{top:114px}
  #view-standards .section-head,#view-standards .doc-row{scroll-margin-top:180px}
}
/* Polish (same fix, measured headlessly 2026-11-30): the offsets above
   assume the masthead is exactly its min-height, but in the 981–1267px
   band the mast-nav squeezes the wordmark into wrapping, so the real
   rendered masthead is 98.7px — not 80px — and row 1 docked ~19px too
   high, its top half hidden under the masthead. Everywhere else the
   masthead measures exactly 80 / 67 / 64px and the offsets above are
   already exact. In this band only: dock row 1 at 99px (98.7 rounded
   up, no sub-pixel overlap), status row directly beneath at 149px,
   scroll-margin follows the same masthead+116 pattern (215px). */
@media (min-width:981px) and (max-width:1267px){
  #view-standards .filter-row{top:99px}
  #view-standards .filter-row.std-status-row{top:149px}
  #view-standards .section-head,#view-standards .doc-row{scroll-margin-top:215px}
}

/* === External-review fixes (2026-11-30, items 1 + 4) ===
   Item 1 — contact: the site carried no contact channel at all. The
   owner's LinkedIn now sits under the footer founder line (.foot-contact,
   index.html) and inside the hero founder chip (.hero-founder-li,
   portal.js), styled with the site's own link treatment (underlined,
   offset) in each surface's accent colour. */
.foot-contact{margin-top:2px}
.foot-contact a{color:var(--primary);font-weight:650;text-decoration:underline;text-underline-offset:4px}
.hero-founder-li{color:var(--lime);font-size:.85rem;font-weight:650;text-decoration:underline;text-underline-offset:4px;align-self:flex-start}

/* Item 4 — wordmark at medium widths (~768–900px): the masthead-tools fix
   earlier in this sheet made .wordmark the flexible element (min-width:0)
   and its span ellipsizes, so in the 651–980px band — mast-nav hidden,
   tool buttons flex:none — the academy name truncated to
   «أكاديمية المراجعة...». In this band only: the wordmark stops being
   the shock absorber (flex:none, marginally smaller) and the span loses
   its ellipsis while keeping nowrap, so the full name always shows on
   one line; the tools keep their fixed size and .mast-inner's auto
   margin absorbs the rest. Desktop (>980, incl. the 981–1267 wrap band
   measured by the stickyfix polish) and mobile (<=650, incl. the
   <=480px wrap rule) are untouched. */
@media (min-width:651px) and (max-width:980px){
  .mast .wordmark{flex:none;font-size:.95rem}
  .mast .wordmark span{overflow:visible;text-overflow:clip}
}

/* === Review fix 2 (2026-11-30, item e) — masthead compression band 981–1320px ===
   Measured headlessly in the current tree: at 1024 and 1200 the wordmark
   ellipsized (span scrollWidth 221 > clientWidth 203/156) and the mast nav
   wrapped to two lines (masthead 99px). At 1320/1440 both were fine.
   Compression only — nothing hidden: the wordmark stops being the flex
   shock absorber (flex:none, ellipsis lifted, same treatment as the
   651–980 band above), the nav takes a tighter gap and a slightly smaller
   size with nowrap links, and the search/profile labels shrink a step.
   Because the masthead returns to its 80px single-line height in the
   981–1267 sub-band, the standards sticky rows pinned for the 99px wrap
   height (stickyfix polish block above) are re-pinned to the 80/130
   offsets and the scroll margin follows. */
@media (min-width:981px) and (max-width:1320px){
  .mast-inner{gap:10px}
  .mast .wordmark{flex:none;gap:8px}
  .mast .wordmark img{width:38px;height:38px}
  .mast .wordmark span{overflow:visible;text-overflow:clip}
  .mast-nav{gap:9px}
  .mast-nav a{font-size:.84rem;white-space:nowrap}
  .mast-tools{gap:5px}
  .mast-search,.profile-link{padding:4px 8px;font-size:.85rem}
}
@media (min-width:981px) and (max-width:1267px){
  #view-standards .filter-row{top:80px}
  #view-standards .filter-row.std-status-row{top:130px}
  #view-standards .section-head,#view-standards .doc-row{scroll-margin-top:196px}
}

/* === Merged from ChatGPT bundle (2026-11-30) — home placeholder + main scroll margin ===
   Styles the no-JS/SEO home placeholder grafted into index.html <main>
   (removed by core.js on start) and gives #main a scroll margin so
   focus jumps do not hide it under the masthead. His .footer-linkedin
   rules were NOT merged: our footer keeps the verified .foot-contact
   LinkedIn line instead. */
#main { scroll-margin-block-start: 20px; }

.home-placeholder {
  max-inline-size: 47rem;
  margin: clamp(1.25rem, 5vw, 3.5rem) auto;
  padding: clamp(1.25rem, 4vw, 2.5rem);
}

.home-placeholder h1 {
  margin-block: 0 .5rem;
  font: 700 clamp(1.6rem, 4vw, 2.4rem)/1.55 var(--head);
}

.home-placeholder a {
  font-weight: 700;
  text-underline-offset: .2em;
}
