/* Public docs site. Built from the approved v6 design: the Specimen design system (base.css) followed by the docs layout. */
/* Alphabet Payment Bridge — "Specimen" design system, v1
   Tokens first, then components. Every value on a page comes from here.
   Logical properties only, so html[dir=rtl] mirrors without overrides. */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Readex+Pro:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  /* Neutrals: stone with a faint teal cast (hue 190), built in OKLCH */
  --paper:        oklch(0.985 0.003 190);  /* #f8fafa page */
  --surface:      oklch(1 0 0);            /* #ffffff raised: tables, dialogs */
  --sunken:       oklch(0.962 0.005 190);  /* #eff3f3 wells: code, filters, sidebar */
  --line:         oklch(0.905 0.007 190);  /* #dde3e3 hairline */
  --line-strong:  oklch(0.82 0.01 190);    /* #c3cccc input borders, 3:1 on paper */
  --ink:          oklch(0.22 0.015 200);   /* #172022 body text 15.8:1 */
  --ink-2:        oklch(0.44 0.015 200);   /* #535f61 secondary text 6.6:1 */
  --ink-3:        oklch(0.52 0.012 200);   /* #646f70 tertiary, labels 5.1:1 on paper, 4.7:1 on sunken */

  /* Brand: Tigris ink — a deep teal used for the primary action, links, focus, the selected nav item */
  --brand:        oklch(0.45 0.085 192);   /* #0d6264 on white 6.9:1 */
  --brand-hover:  oklch(0.39 0.08 192);    /* #0a5254 */
  --brand-soft:   oklch(0.95 0.025 192);   /* #e3f3f2 selected row, nav */
  --on-brand:     oklch(0.99 0 0);

  /* Specimen ink — test mode only. Never used for anything else. */
  --specimen:      oklch(0.53 0.2 3);      /* #c0256a rubine, 5.4:1 on white */
  --specimen-soft: oklch(0.96 0.025 3);    /* #fbebf0 */
  --specimen-hatch: oklch(0.53 0.2 3 / 0.16);

  /* Status — text + glyph always; colour is never the only signal */
  --paid:       oklch(0.5 0.12 150);  --paid-soft:     oklch(0.955 0.04 150);  /* #2b7a45 */
  --pending:    oklch(0.5 0.06 240);  --pending-soft:  oklch(0.955 0.015 240); /* #4f6a86 */
  --failed:     oklch(0.52 0.17 32);  --failed-soft:   oklch(0.958 0.03 32);   /* #b8432a brick */
  --warn:       oklch(0.55 0.12 75);  --warn-soft:     oklch(0.96 0.045 85);   /* #93680a ochre */
  --muted-st:   oklch(0.5 0.01 200);  --muted-soft:    oklch(0.95 0.004 200);  /* cancelled/expired */
  --refund:     oklch(0.48 0.1 300);  --refund-soft:   oklch(0.955 0.02 300);  /* #6a4f96 */

  /* JSON syntax, for provider-call bodies */
  --code-key: oklch(0.45 0.085 192); --code-str: oklch(0.47 0.11 150); --code-num: oklch(0.5 0.13 60); --code-mask: oklch(0.53 0.2 3);

  /* Type */
  --font-ui: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;
  --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --t-xs: 0.75rem;   /* 12 — meta, table captions (Latin only; Arabic min 13) */
  --t-sm: 0.8125rem; /* 13 — table cells, labels */
  --t-md: 0.875rem;  /* 14 — UI body, inputs, buttons */
  --t-lg: 1rem;      /* 16 — reading body (docs, checkout) */
  --t-xl: 1.25rem;   /* 20 — section titles */
  --t-2xl: 1.625rem; /* 26 — page titles */
  --t-3xl: 2.5rem;   /* 40 — key amounts */
  --t-4xl: 3.5rem;   /* 56 — checkout amount, docs hero */
  --lh-tight: 1.2; --lh-ui: 1.5; --lh-read: 1.7;

  /* Space: 4 8 12 16 24 32 48 64 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Radius: controls 6, overlays 10, pills full. Tables and sections: 0 (they are rules, not cards). */
  --r-ctl: 6px; --r-ovl: 10px; --r-pill: 999px;

  /* Elevation: only things that float get a shadow */
  --e-pop: 0 1px 2px oklch(0.2 0.02 200 / 0.08), 0 8px 24px -8px oklch(0.2 0.02 200 / 0.18);
  --e-dialog: 0 2px 4px oklch(0.2 0.02 200 / 0.08), 0 24px 64px -16px oklch(0.2 0.02 200 / 0.35);

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1); --d-fast: 120ms; --d-mid: 200ms; --d-slow: 320ms;

  --focus: 0 0 0 2px var(--paper), 0 0 0 4px var(--brand);
  --sidebar-w: 248px; --topbar-h: 56px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper:       oklch(0.19 0.012 200);  /* #121a1b */
  --surface:     oklch(0.225 0.013 200); /* #1a2324 */
  --sunken:      oklch(0.165 0.011 200); /* #0e1516 */
  --line:        oklch(0.3 0.013 200);
  --line-strong: oklch(0.42 0.014 200);
  --ink:         oklch(0.94 0.006 190);
  --ink-2:       oklch(0.76 0.01 190);
  --ink-3:       oklch(0.64 0.012 190);
  --brand:       oklch(0.74 0.1 188);    /* #4fbdb8 on dark 7.8:1 */
  --brand-hover: oklch(0.8 0.1 188);
  --brand-soft:  oklch(0.3 0.04 192);
  --on-brand:    oklch(0.18 0.02 200);
  --specimen:      oklch(0.72 0.17 3);
  --specimen-soft: oklch(0.28 0.06 3);
  --specimen-hatch: oklch(0.72 0.17 3 / 0.14);
  --paid: oklch(0.76 0.13 150);    --paid-soft: oklch(0.29 0.05 150);
  --pending: oklch(0.76 0.06 240); --pending-soft: oklch(0.29 0.03 240);
  --failed: oklch(0.74 0.14 35);   --failed-soft: oklch(0.3 0.06 32);
  --warn: oklch(0.8 0.12 80);      --warn-soft: oklch(0.3 0.05 80);
  --muted-st: oklch(0.72 0.01 200);--muted-soft: oklch(0.28 0.008 200);
  --refund: oklch(0.76 0.09 300);  --refund-soft: oklch(0.3 0.04 300);
  --code-key: oklch(0.78 0.09 188); --code-str: oklch(0.78 0.11 150); --code-num: oklch(0.8 0.11 70); --code-mask: oklch(0.74 0.16 3);
  --e-pop: 0 1px 2px oklch(0 0 0 / 0.3), 0 8px 24px -8px oklch(0 0 0 / 0.6);
  --e-dialog: 0 24px 64px -16px oklch(0 0 0 / 0.7);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: var(--t-md); line-height: var(--lh-ui); -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { line-height: 1.65; letter-spacing: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: var(--lh-tight); }
p { margin: 0; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-ctl); }
.num, .amount, td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); font-size: max(0.92em, 12.5px); letter-spacing: 0; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.i.sm { width: 16px; height: 16px; }
html[dir="rtl"] .flip { transform: scaleX(-1); }

/* bilingual inline copy: <span data-ar>…</span><span data-en>…</span> */
html[lang="ar"] [data-en] { display: none !important; }
html[lang="en"] [data-ar] { display: none !important; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; } }

/* ---------- type roles ---------- */
.t-page { font-family: var(--font-display); font-size: var(--t-2xl); font-weight: 600; letter-spacing: -0.01em; }
html[lang="ar"] .t-page { letter-spacing: 0; }
.t-section { font-size: var(--t-xl); font-weight: 600; }
.t-group { font-size: var(--t-md); font-weight: 600; }
.t-label { font-size: var(--t-sm); color: var(--ink-2); font-weight: 500; }
.t-meta { font-size: var(--t-xs); color: var(--ink-3); }
html[lang="ar"] .t-meta { font-size: var(--t-sm); }
.amount { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; }
.amount .cur { font-family: var(--font-ui); font-size: 0.55em; font-weight: 500; color: var(--ink-3); margin-inline-start: 0.3em; letter-spacing: 0; }
.amount.xl { font-size: var(--t-3xl); line-height: 1; }
.amount.xxl { font-size: var(--t-4xl); line-height: 1; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s4); border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: var(--t-md); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease); }
.btn:hover { background: var(--sunken); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn.danger { color: var(--failed); border-color: color-mix(in oklch, var(--failed) 45%, var(--line)); }
.btn.danger:hover { background: var(--failed-soft); }
.btn.danger.solid { background: var(--failed); color: #fff; border-color: var(--failed); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.sm { min-height: 30px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn.lg { min-height: 48px; padding: 0 var(--s5); font-size: var(--t-lg); }
.btn.icon { padding: 0; width: 36px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn.is-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--on-brand) transparent var(--on-brand) var(--on-brand); animation: spin 700ms linear infinite; }
.btn:not(.primary).is-loading::after { border-color: var(--ink-2) transparent var(--ink-2) var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-size: var(--t-sm); font-weight: 500; color: var(--ink); }
.field .hint { font-size: var(--t-sm); color: var(--ink-3); }
.field .err { font-size: var(--t-sm); color: var(--failed); display: none; }
.field.has-error .err { display: block; }
.input, .select, .textarea { width: 100%; min-height: 38px; padding: 0 var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink); font-size: var(--t-md); transition: border-color var(--d-fast); }
.textarea { padding: var(--s2) var(--s3); min-height: 84px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in oklch, var(--brand) 22%, transparent); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--failed); }
.input[disabled], .select[disabled] { background: var(--sunken); color: var(--ink-3); cursor: not-allowed; }
.input.mono { font-family: var(--font-mono); font-size: var(--t-sm); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon { display: inline-flex; align-items: center; padding: 0 var(--s3); border: 1px solid var(--line-strong); border-inline-start: 0; border-start-end-radius: var(--r-ctl); border-end-end-radius: var(--r-ctl); background: var(--sunken); color: var(--ink-2); font-size: var(--t-sm); }
.select { appearance: none; padding-inline-end: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; }
html[dir="rtl"] .select { background-position: 11px 50%, 16px 50%; }
.check { display: inline-flex; gap: var(--s2); align-items: center; cursor: pointer; font-size: var(--t-md); }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--s2); cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--line-strong); position: relative; transition: background var(--d-fast); }
.switch .track::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start var(--d-fast) var(--ease); }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { inset-inline-start: 16px; }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* segmented control — language, theme, test/live */
.seg { display: inline-flex; gap: 2px; padding: var(--s1); border-radius: var(--r-ctl); background: var(--sunken); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: var(--s1) var(--s3); min-height: 28px; border-radius: 4px; font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 200 / 0.12); }

/* ---------- status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--s2); padding-inline-end: 10px; border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: 500; white-space: nowrap; background: var(--muted-soft); color: var(--muted-st); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status.paid { background: var(--paid-soft); color: var(--paid); }
.status.pending { background: var(--pending-soft); color: var(--pending); }
.status.pending::before { background: transparent; border: 1.5px solid currentColor; width: 8px; height: 8px; }
.status.failed { background: var(--failed-soft); color: var(--failed); }
.status.failed::before { border-radius: 1px; transform: rotate(45deg); }
.status.cancelled, .status.expired { background: var(--muted-soft); color: var(--muted-st); }
.status.cancelled::before, .status.expired::before { height: 2px; border-radius: 1px; }
.status.refunded, .status.partially_refunded { background: var(--refund-soft); color: var(--refund); }
.status.partially_refunded::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); border: 1.5px solid currentColor; }
.status.warn { background: var(--warn-soft); color: var(--warn); }
.status.settled { background: var(--paid-soft); color: var(--paid); }

/* a quiet tag: method, provider, role */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 var(--s2); border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: var(--t-xs); font-weight: 500; white-space: nowrap; }
html[lang="ar"] .tag { font-size: var(--t-sm); }
.http { font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 600; }
.http.ok { color: var(--paid); } .http.cerr { color: var(--warn); } .http.serr { color: var(--failed); }

/* ---------- SPECIMEN: the signature. Test mode only. ---------- */
.specimen-tag { display: inline-flex; align-items: center; min-height: 22px; padding: var(--s1) var(--s2); border: 1.5px solid var(--specimen); color: var(--specimen); border-radius: 3px; font-family: var(--font-display); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; line-height: 1; transform: rotate(-4deg); white-space: nowrap; background: var(--surface); }
html[lang="ar"] .specimen-tag { letter-spacing: 0; font-size: 13px; }
.specimen-band { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--s3); min-height: 32px; padding: var(--s2) var(--s4); color: var(--specimen); font-size: var(--t-sm); font-weight: 600; background: var(--specimen-soft) repeating-linear-gradient(-45deg, var(--specimen-hatch) 0 2px, transparent 2px 9px); border-block-end: 1px solid color-mix(in oklch, var(--specimen) 40%, transparent); }
.specimen-band a { color: var(--specimen); }
.is-specimen { position: relative; }
.is-specimen::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(-45deg, var(--specimen-hatch) 0 1.5px, transparent 1.5px 10px); border: 1.5px dashed color-mix(in oklch, var(--specimen) 55%, transparent); border-radius: inherit; }
.stamp { display: inline-grid; place-items: center; padding: 6px 14px; border: 2.5px solid var(--specimen); color: var(--specimen); border-radius: 4px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.08em; transform: rotate(-8deg); opacity: 0.9; line-height: 1.1; text-align: center; }
html[lang="ar"] .stamp { letter-spacing: 0; }
.stamp small { font-size: 10px; font-weight: 500; letter-spacing: 0.02em; }
tr.test td:first-child { box-shadow: inset 3px 0 0 transparent; }
html[dir="ltr"] tr.test td:first-child { background-image: linear-gradient(90deg, var(--specimen) 0 3px, transparent 3px); }
html[dir="rtl"] tr.test td:first-child { background-image: linear-gradient(270deg, var(--specimen) 0 3px, transparent 3px); }

/* ---------- panel shell (maps to Filament: sidebar + topbar + main) ---------- */
.shell { position: relative; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
/* the sidebar's paper runs the full height of the page, however long the content */
.shell::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); background: var(--sunken); border-inline-end: 1px solid var(--line); pointer-events: none; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sunken); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; padding: var(--s4) var(--s3); gap: var(--s1); }
.sidebar .brandmark { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) var(--s2) var(--s4); text-decoration: none; color: var(--ink); }
.sidebar .nav-group { margin-top: var(--s4); padding: 0 var(--s2) var(--s1); font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); }
html[lang="ar"] .sidebar .nav-group { font-size: var(--t-sm); }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 var(--s2); border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-size: var(--t-md); font-weight: 500; }
.nav-item:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface); color: var(--brand); box-shadow: 0 0 0 1px var(--line); }
.nav-item .count { margin-inline-start: var(--s1); min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--r-pill); background: var(--failed-soft); font-size: var(--t-xs); font-weight: 600; color: var(--failed); font-variant-numeric: tabular-nums; }
.sidebar .foot { margin-top: auto; padding-top: var(--s4); border-top: 1px solid var(--line); display: grid; gap: var(--s2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s6); background: color-mix(in oklch, var(--paper) 92%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: saturate(1.2); }
.topbar .spacer { flex: 1; }
.search { position: relative; width: min(360px, 40vw); }
.search .input { padding-inline-start: 34px; background: var(--surface); }
.search svg { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search kbd, kbd { font-family: var(--font-mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--ink-2); background: var(--surface); }
.search kbd { position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%); }
.content { padding: var(--s6) var(--s6) var(--s8); max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.page-head .crumbs { font-size: var(--t-sm); color: var(--ink-3); margin-bottom: var(--s2); display: flex; gap: 6px; align-items: center; }
.page-head .crumbs a { color: var(--ink-2); text-decoration: none; }
.page-head .actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.menu-btn { display: none; }
@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .shell::before { display: none; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; z-index: 110; transform: translateX(-100%); transition: transform var(--d-mid) var(--ease); box-shadow: none; }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--e-dialog); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--s4); }
  .content { padding: var(--s5) var(--s4) var(--s7); }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
}

/* ---------- sections: rules, not cards ---------- */
.section { border-top: 1px solid var(--line); padding-top: var(--s5); margin-top: var(--s6); }
.section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.section-head p { color: var(--ink-2); font-size: var(--t-md); margin-top: 2px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ovl); }

/* description list (Filament infolist) */
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s4) var(--s5); }
.dl > div { display: grid; gap: 2px; min-width: 0; }
.dl dt { font-size: var(--t-sm); color: var(--ink-3); }
.dl dd { margin: 0; font-size: var(--t-md); color: var(--ink); overflow-wrap: anywhere; }

/* ---------- table (Filament table) ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ovl); overflow: hidden; }
.table-tools { display: flex; align-items: center; gap: var(--s2); padding: var(--s3); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-tools .spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 var(--s3); border: 1px dashed var(--line-strong); border-radius: var(--r-pill); background: transparent; font-size: var(--t-sm); color: var(--ink-2); cursor: pointer; }
.chip[aria-pressed="true"], .chip.on { border-style: solid; border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chip select { border: 0; background: transparent; color: inherit; font-size: inherit; cursor: pointer; padding: 0; }
.scroll-x { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
table.t th { text-align: start; font-weight: 500; color: var(--ink-3); font-size: var(--t-xs); padding: 10px var(--s3); border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
html[lang="ar"] table.t th { font-size: var(--t-sm); }
table.t th button.sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.t th button.sort:focus-visible { box-shadow: var(--focus); }
table.t td { padding: 10px var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { cursor: default; }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover td { background: color-mix(in oklch, var(--brand-soft) 55%, var(--surface)); }
table.t td.num, table.t th.num { text-align: end; }
table.t .sub { display: block; color: var(--ink-3); font-size: var(--t-xs); margin-top: 1px; }
html[lang="ar"] table.t .sub { font-size: var(--t-sm); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s3); border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--ink-2); }
.skeleton { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--sunken) 0%, var(--line) 50%, var(--sunken) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* empty and error states */
.empty { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding: var(--s8) var(--s5); color: var(--ink-2); }
.empty h3 { color: var(--ink); font-size: var(--t-lg); font-weight: 600; }
.empty p { max-width: 44ch; }
.empty .btn { margin-top: var(--s3); }
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--sunken); font-size: var(--t-md); }
.alert.err { background: var(--failed-soft); border-color: color-mix(in oklch, var(--failed) 35%, transparent); color: var(--ink); }
.alert.err svg { color: var(--failed); }
.alert.warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 35%, transparent); }
.alert.warn svg { color: var(--warn); }
.alert.ok { background: var(--paid-soft); border-color: color-mix(in oklch, var(--paid) 35%, transparent); }
.alert.ok svg { color: var(--paid); }

/* tabs */
.tabs { display: flex; gap: var(--s5); border-bottom: 1px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; }
.tabs button, .tabs a { all: unset; cursor: pointer; padding: var(--s3) 0; font-size: var(--t-md); font-weight: 500; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs [aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
.tabs button:focus-visible { box-shadow: var(--focus); }

/* code block */
.code { position: relative; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--r-ctl); direction: ltr; text-align: left; }
.code pre { margin: 0; padding: var(--s3) var(--s4); overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; color: var(--ink); white-space: pre; }
.code .code-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 6px var(--s2) 6px var(--s4); border-bottom: 1px solid var(--line); font-size: var(--t-xs); color: var(--ink-3); font-family: var(--font-ui); }
.code .k { color: var(--code-key); } .code .s { color: var(--code-str); } .code .n { color: var(--code-num); } .code .m { color: var(--code-mask); font-weight: 600; } .code .c { color: var(--ink-3); }

/* timeline (payment history) */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { position: relative; display: grid; grid-template-columns: 20px 1fr auto; gap: var(--s3); padding-bottom: var(--s4); }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 9px; top: 18px; bottom: 0; width: 1.5px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; color: var(--ink-3); }
.timeline .dot.paid { border-color: var(--paid); color: var(--paid); background: var(--paid-soft); }
.timeline .dot.failed { border-color: var(--failed); color: var(--failed); }
.timeline .dot.brand { border-color: var(--brand); color: var(--brand); }
.timeline .what { font-weight: 500; }
.timeline .when { font-size: var(--t-sm); color: var(--ink-3); white-space: nowrap; }

/* overlays: modal + slide-over (Filament modal / slideOver) */
.overlay { position: fixed; inset: 0; z-index: 100; background: oklch(0.2 0.02 200 / 0.42); display: none; }
.overlay.open { display: block; animation: fade var(--d-mid) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal { position: fixed; z-index: 101; inset-inline: 0; top: 10vh; margin-inline: auto; width: min(520px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; background: var(--surface); border-radius: var(--r-ovl); box-shadow: var(--e-dialog); display: none; }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.modal.open { display: block; animation: rise var(--d-mid) var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); padding: var(--s5) var(--s5) var(--s2); }
.modal-head h2 { font-size: var(--t-xl); }
.modal-head p { color: var(--ink-2); margin-top: var(--s1); }
.modal-body { padding: var(--s3) var(--s5) var(--s5); display: grid; gap: var(--s4); }
.modal-foot { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); background: var(--sunken); border-radius: 0 0 var(--r-ovl) var(--r-ovl); }
.slideover { position: fixed; z-index: 101; inset-block: 0; inset-inline-end: 0; width: min(640px, 100vw); background: var(--surface); box-shadow: var(--e-dialog); display: none; flex-direction: column; }
.slideover.open { display: flex; animation: fade var(--d-mid) var(--ease); }
.slideover .modal-body { overflow: auto; flex: 1; }

/* toast */
.toasts { position: fixed; z-index: 200; inset-block-end: var(--s5); inset-inline-end: var(--s5); display: grid; gap: var(--s2); }
.toast { display: flex; gap: var(--s3); align-items: center; min-width: 280px; max-width: 420px; padding: var(--s3) var(--s4); border-radius: var(--r-ovl); background: var(--ink); color: var(--paper); box-shadow: var(--e-pop); font-size: var(--t-md); animation: rise var(--d-mid) var(--ease); }
.toast svg { color: color-mix(in oklch, var(--paid) 60%, var(--paper)); }
.toast.err svg { color: color-mix(in oklch, var(--failed) 60%, var(--paper)); }

/* menu (dropdown) */
.menu { position: absolute; z-index: 60; min-width: 220px; padding: var(--s1); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ovl); box-shadow: var(--e-pop); display: none; }
.menu.open { display: grid; }
.menu button:not(.seg button), .menu a { all: unset; display: flex; gap: var(--s2); align-items: center; padding: var(--s2) var(--s3); border-radius: 4px; font-size: var(--t-md); cursor: pointer; color: var(--ink); }
.menu button:not(.seg button):hover, .menu a:hover, .menu button:not(.seg button):focus-visible { background: var(--sunken); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: var(--s1) 0; }

/* brand mark */
.mark { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--ink); color: transparent; font-size: 0; line-height: 0; overflow: hidden; flex: none; }
.mark::after { content: ""; width: 20px; height: 20px; background: var(--paper); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M2 8h20M5 21V8M19 21V8M5 18.5c2.5-6.5 11.5-6.5 14 0'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M2 8h20M5 21V8M19 21V8M5 18.5c2.5-6.5 11.5-6.5 14 0'/%3E%3C/svg%3E") center / contain no-repeat; }
html[lang="ar"] .mark[data-en], html[lang="en"] .mark[data-ar] { display: none !important; }
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: var(--t-lg); letter-spacing: -0.01em; line-height: 1.1; }
.wordmark small { display: block; font-family: var(--font-ui); font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); letter-spacing: 0; }

/* impersonation banner (Filament render hook: panels::body.start) */
.impersonation { display: flex; align-items: center; justify-content: center; gap: var(--s3); min-height: 40px; padding: var(--s1) var(--s4); background: var(--ink); color: var(--paper); font-size: var(--t-md); flex-wrap: wrap; }
.impersonation .btn { min-height: 28px; background: var(--paper); color: var(--ink); border-color: var(--paper); font-size: var(--t-sm); }

/* ids, keys, references and money never break across lines */
.mono, .ltr, .amount, table.t td.num, .status, .http { white-space: nowrap; }
.code pre, .wrap-ok { white-space: pre; }
.mono.wrap-ok { white-space: normal; overflow-wrap: anywhere; }

/* amount in words: the cheque line under the one key amount on a page (Iraqi cheques and receipts carry it) */
.in-words { display: block; margin-block-start: var(--s2); font-size: var(--t-md); color: var(--ink-2); line-height: 1.6; max-width: 60ch; }
.in-words::before { content: ""; display: inline-block; inline-size: var(--s5); block-size: 0; border-block-start: 1px dashed var(--line-strong); vertical-align: middle; margin-inline-end: var(--s2); }

/* ---------- docs layout (design v6 docs/index.html) ---------- */
  [hidden] { display: none !important; }
  :root { --nav-w: 268px; --toc-w: 216px; }
  body { font-size: var(--t-lg); line-height: var(--lh-read); }
  html[lang="ar"] body { font-size: var(--t-lg); line-height: 1.8; }
  html[lang="ar"] .prose p, html[lang="ar"] .prose li, html[lang="ar"] .callout, html[lang="ar"] .param .d, html[lang="ar"] .walk .bd, html[lang="ar"] .check-list label, html[lang="ar"] .prose table.t, html[lang="ar"] .lede { font-size: var(--t-lg); line-height: 1.8; }
  html[lang="ar"] .prose table.t td { line-height: 1.8; }

  /* ---------- header ---------- */
  .dh { position: sticky; top: 0; z-index: 40; height: var(--topbar-h); background: var(--paper); border-block-end: 1px solid var(--line); }
  .dh-in { height: 100%; display: flex; align-items: center; gap: var(--s3); padding-inline: var(--s5); }
  .brand { display: flex; align-items: center; gap: var(--s2); color: var(--ink); text-decoration: none; flex: none; min-height: 44px; }
  .brand:hover { color: var(--ink); }
  .brand .docs { margin-inline-start: var(--s2); padding-inline-start: var(--s3); border-inline-start: 1px solid var(--line-strong); font-size: var(--t-md); font-weight: 500; color: var(--ink-2); line-height: 1.2; }
  .find { display: inline-flex; align-items: center; gap: var(--s2); width: 320px; min-height: 40px; padding-inline: var(--s3) var(--s2); margin-inline-start: var(--s6); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--ink-3); font-size: var(--t-md); cursor: pointer; }
  .find:hover { border-color: var(--ink-3); color: var(--ink-2); }
  .find .ph { flex: 1; text-align: start; }
  .find kbd { flex: none; }
  .dh .spacer { flex: 1; }
  .dh .seg button { min-height: 40px; }
  .theme-wrap { position: relative; }
  .theme-wrap .menu { inset-inline-end: 0; top: calc(100% + var(--s1)); min-width: 180px; }
  .theme-wrap .menu button { min-height: 40px; box-sizing: border-box; }
  .theme-wrap .menu button[aria-pressed="true"] { color: var(--brand); font-weight: 600; }
  .find-icon { display: none; }

  /* ---------- frame ---------- */
  .frame { position: relative; display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
  .docnav.sidebar { gap: 2px; }
  .docnav .nav-group { margin-top: var(--s5); }
  .docnav .nav-group:first-of-type { margin-top: 0; }
  .docnav .nav-sep { margin: var(--s4) var(--s2) var(--s2); border-top: 1px solid var(--line); }
  .docnav .nav-item { min-height: 44px; font-size: var(--t-md); gap: var(--s2); }
  .docnav .nav-item .verb { margin-inline-start: auto; }
  .docnav .nav-item .specimen-tag { margin-inline-start: auto; }
  .docnav .nav-item.mono-t span:first-child { font-family: var(--font-mono); font-size: var(--t-sm); }
  .drawer-head { display: none; }
  @media (min-width: 1025px) {
    .frame::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--nav-w); border-inline-end: 1px solid var(--line); pointer-events: none; }
    .docnav.sidebar { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-inline-end: 0; padding: var(--s5) var(--s4) var(--s7); }
  }
  @media (max-width: 1024px) {
    .frame { grid-template-columns: minmax(0, 1fr); }
    .docnav.sidebar { padding-top: var(--s3); }
    .drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 0 var(--s2) var(--s3); margin-bottom: var(--s3); border-bottom: 1px solid var(--line); }
    .drawer-head .btn.icon { width: 44px; min-height: 44px; }
  }

  .verb { font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
  .nav-item[aria-current="page"] .verb { color: var(--brand); }

  /* ---------- page grid ---------- */
  .main-col { min-width: 0; display: flex; flex-direction: column; }
  .page { display: grid; column-gap: var(--s7); padding: var(--s7) var(--s7) var(--s7); width: 100%; max-width: 1180px; }
  .page.doc, .page.home { grid-template-columns: minmax(0, 1fr) var(--toc-w); grid-template-areas: "head toc" "flow toc" "body toc" "pager toc"; }
  .page.home { grid-template-areas: "head toc" "flow toc" "body toc" "pager toc"; max-width: 1280px; }
  .page.api { grid-template-columns: minmax(0, 1fr) minmax(420px, 0.92fr); grid-template-areas: "head code" "body code" "pager pager"; max-width: 1340px; }
  .page.single { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "body"; max-width: 860px; }
  .doc-head { grid-area: head; position: relative; min-width: 0; }
  .prose { grid-area: body; min-width: 0; }
  .toc { grid-area: toc; align-self: start; position: sticky; top: calc(var(--topbar-h) + var(--s6)); padding-top: var(--s2); }
  .codecol { grid-area: code; align-self: start; position: sticky; top: calc(var(--topbar-h) + var(--s5)); display: grid; gap: var(--s4); min-width: 0; max-height: calc(100vh - var(--topbar-h) - var(--s7)); overflow-y: auto; overscroll-behavior: contain; }
  .codecol .code pre { overflow-x: auto; white-space: pre; }
  .flow-wrap { grid-area: flow; min-width: 0; }
  .pager { grid-area: pager; }
  @media (max-width: 1199px) {
    .page.doc, .page.home, .page.api { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "flow" "body" "code" "pager"; }
    .toc { display: none; }
    .codecol { position: static; margin-top: var(--s6); max-height: none; overflow: visible; }
  }
  @media (max-width: 1024px) { .page { padding: var(--s6) var(--s5) var(--s6); } }

  /* ---------- page head ---------- */
  .crumb { font-size: var(--t-sm); color: var(--ink-3); margin-bottom: var(--s2); }
  .doc-head h1 { font-family: var(--font-display); font-size: var(--t-3xl); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -0.015em; }
  html[lang="ar"] .doc-head h1 { letter-spacing: 0; }
  .doc-head h1.mono-t { font-family: var(--font-mono); font-weight: 500; }
  .lede { margin-top: var(--s3); color: var(--ink-2); font-size: var(--t-lg); max-width: 64ch; }
  .page.home .doc-head h1 { font-size: var(--t-2xl); color: var(--ink-2); font-weight: 500; }
  .page.home .lede { font-family: var(--font-display); font-size: var(--t-xl); line-height: 1.5; color: var(--ink); max-width: 52ch; margin-top: var(--s2); }
  .page.home .lede-links { margin-top: var(--s3); color: var(--ink-2); font-size: var(--t-md); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
  .page.home .lede-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

  .endpoint { margin-top: var(--s4); display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); padding-block: var(--s2); border-block: 1px solid var(--line); direction: ltr; justify-content: flex-start; }
  html[dir="rtl"] .endpoint { justify-content: flex-end; }
  .endpoint .verb { font-size: var(--t-sm); color: var(--ink); padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; }
  .endpoint .path { flex: 1 1 220px; font-family: var(--font-mono); font-size: var(--t-md); overflow-wrap: anywhere; min-width: 0; }
  .endpoint .path .base { color: var(--ink-3); }
  .endpoint .lab { font-family: var(--font-ui); font-size: var(--t-sm); color: var(--ink-3); }
  .endpoint .btn.icon { width: 36px; min-height: 36px; color: var(--ink-3); }

  /* ---------- prose (rendered from markdown) ---------- */
  .prose > * + * { margin-top: var(--s4); }
  .prose > p, .prose > ul, .prose > ol, .prose > .callout, .prose > h2, .prose > h3 { max-width: 70ch; }
  .prose p, .prose li { color: var(--ink); }
  .prose h2 { position: relative; font-family: var(--font-display); font-size: var(--t-xl); font-weight: 600; margin-top: var(--s7); padding-top: var(--s5); border-top: 1px solid var(--line); scroll-margin-top: calc(var(--topbar-h) + var(--s4)); max-width: none; }
  .prose h3 { position: relative; font-size: var(--t-lg); font-weight: 600; margin-top: var(--s6); scroll-margin-top: calc(var(--topbar-h) + var(--s4)); }
  .prose > h2:first-child { margin-top: var(--s6); }
  .prose > h2 + *, .prose > h3 + * { margin-top: var(--s3); }
  .prose ul, .prose ol { margin: 0; padding-inline-start: 1.4em; }
  .prose li + li { margin-top: var(--s2); }
  .prose li::marker { color: var(--ink-3); }
  .prose ol > li::marker { font-family: var(--font-mono); font-size: var(--t-sm); }
  .prose strong { font-weight: 600; }
  code.ic { font-family: var(--font-mono); font-size: 0.84em; padding: 1px 5px; border-radius: 4px; background: var(--sunken); border: 1px solid var(--line); color: var(--ink); direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
  .hlink { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-inline-start: var(--s2); vertical-align: middle; border-radius: var(--r-ctl); color: var(--ink-3); opacity: 0; transition: opacity var(--d-fast); }
  .hlink svg { width: 16px; height: 16px; }
  h2:hover .hlink, h3:hover .hlink, .hlink:focus-visible { opacity: 1; }
  .hlink:hover { color: var(--brand); background: var(--sunken); }
  .hlink:focus-visible { box-shadow: var(--focus); }
  mark { background: var(--brand-soft); color: var(--ink); border-radius: 2px; padding: 0 1px; }

  /* callouts */
  .callout { font-size: var(--t-md); line-height: var(--lh-ui); }
  html[lang="ar"] .callout { line-height: 1.75; }
  .callout svg { margin-top: 3px; }
  .callout > div { min-width: 0; }
  .callout.rule { background: var(--surface); border-color: var(--ink-3); padding: var(--s4); }
  .callout.rule svg { color: var(--ink); }
  .callout.note svg { color: var(--ink-3); }

  /* tables */
  .prose .table-wrap { max-width: 100%; }
  .prose table.t { font-size: var(--t-md); }
  .prose table.t th { font-size: var(--t-sm); }
  .prose table.t td { vertical-align: top; line-height: var(--lh-ui); }
  html[lang="ar"] .prose table.t td { line-height: 1.7; }
  .prose table.t td:first-child { white-space: nowrap; }
  .prose table.t td code.ic { white-space: nowrap; }
  .prose table.t.wrap1 td:first-child { white-space: normal; }
  .prose table.t code.ic { white-space: nowrap; overflow-wrap: normal; }
  .prose table.t tr.hit td { background: var(--brand-soft); }
  .prose table.t tr[id] { scroll-margin-top: calc(var(--topbar-h) + var(--s5)); }
  .prose table.t td a { font-weight: 500; }
  .prose table.t.plain td:first-child { color: var(--ink-2); width: 32%; }

  /* parameters */
  .params { border-top: 1px solid var(--line); }
  .param { display: grid; gap: var(--s1); padding-block: var(--s3); border-bottom: 1px solid var(--line); }
  .param .sig { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
  .param .name { font-family: var(--font-mono); font-size: var(--t-md); font-weight: 600; direction: ltr; unicode-bidi: isolate; }
  .param .type { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); }
  .param .req { font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
  .param .opt { font-size: var(--t-sm); color: var(--ink-3); }
  .param .d { color: var(--ink-2); font-size: var(--t-md); line-height: var(--lh-ui); max-width: 70ch; }
  html[lang="ar"] .param .d { line-height: 1.75; }

  /* numbered walk-through */
  .walk { list-style: none; padding: 0 !important; margin: 0; display: grid; }
  .walk > li { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--s4); padding-bottom: var(--s5); margin: 0 !important; }
  .walk > li::before { content: ""; position: absolute; inset-inline-start: 15.5px; top: 34px; bottom: 4px; border-inline-start: 1px solid var(--line-strong); }
  .walk > li:last-child { padding-bottom: 0; }
  .walk > li:last-child::before { display: none; }
  .walk .n { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); font-family: var(--font-mono); font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
  .walk .tt { font-weight: 600; padding-top: 3px; }
  .walk .bd { color: var(--ink-2); margin-top: 2px; }

  /* code blocks */
  .code { min-width: 0; }
  .code .code-head { min-height: 40px; padding-block: 0; }
  .code .code-head .lbl { font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .code .code-head .btn.icon { width: 32px; min-height: 32px; color: var(--ink-3); }
  .code .code-head .btn.icon:hover { color: var(--ink); }
  .ctabs { display: flex; gap: var(--s1); align-items: stretch; min-width: 0; overflow-x: auto; align-self: stretch; }
  .ctabs button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--s2); min-height: 40px; font-family: var(--font-ui); font-size: var(--t-sm); font-weight: 500; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
  .ctabs button:hover { color: var(--ink); }
  .ctabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brand); }
  .ctabs button:focus-visible { box-shadow: var(--focus); }
  .ctabs .http { font-size: var(--t-sm); }
  .code .hd-l { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
  .code .hd-t { font-family: var(--font-ui); font-size: var(--t-sm); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
  html[lang="ar"] .code .hd-t { font-size: var(--t-sm); }
  .codecol .code pre { max-height: 46vh; overflow: auto; }
  .codecol .code.res pre { max-height: 38vh; }

  /* ---------- the swimlane ---------- */
  .flow-wrap { margin-inline: 0; margin-bottom: 0; margin-top: var(--s6); border-block: 1px solid var(--line); padding-block: var(--s4) var(--s5); scroll-margin-top: calc(var(--topbar-h) + var(--s4)); }
  .flow-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
  .flow-bar h2 { font-size: var(--t-lg); font-weight: 600; }
  .flow-bar .seg button { min-height: 40px; }
  .flow-scroll { overflow-x: auto; }
  .flow { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 600px; }
  .flow-cap { margin-top: var(--s3); font-size: var(--t-sm); color: var(--ink-2); max-width: 72ch; }
  html[lang="ar"] .flow-cap { font-size: var(--t-md); }
  .flow-cap strong { color: var(--ink); font-weight: 600; }
  .lane-h { grid-row: 1; display: grid; justify-items: center; align-content: end; gap: 2px; padding: var(--s2) var(--s2) var(--s3); text-align: center; border-bottom: 1px solid var(--line-strong); position: relative; z-index: 1; }
  .lane-h .nm { font-family: var(--font-display); font-weight: 600; font-size: var(--t-md); display: inline-flex; align-items: center; gap: var(--s2); flex-wrap: wrap; justify-content: center; }
  .lane-h .sb { font-size: var(--t-sm); color: var(--ink-3); }
  .life { grid-column: var(--c); grid-row: 1 / -1; position: relative; pointer-events: none; }
  .life::before { content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 50%; border-inline-start: 1px dashed var(--line-strong); }
  .life.is-specimen::after { border-radius: 0; }
  .step { grid-column: var(--from) / var(--to); grid-row: var(--r); margin-inline: calc(100% / (2 * var(--n))); position: relative; z-index: 1; display: grid; align-content: center; padding-block: var(--s2) var(--s1); min-height: 64px; color: var(--ink); text-decoration: none; }
  .step:hover { color: var(--brand); }
  .step:focus-visible { box-shadow: var(--focus); }
  .step .lbl { text-align: center; font-size: var(--t-md); line-height: 1.4; padding-inline: var(--s5); }
  .step .ln { position: relative; height: 0; border-top: 1.5px solid var(--ink-3); margin-block: var(--s2) 6px; }
  .step .ln::after { content: ""; position: absolute; top: -6.25px; width: 0; height: 0; border-block: 5.5px solid transparent; }
  .step.fwd .ln::after { inset-inline-end: -2px; border-inline-start: 9px solid var(--ink-3); }
  .step.back .ln::after { inset-inline-start: -2px; border-inline-end: 9px solid var(--ink-3); }
  .step .no { position: absolute; top: -11px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper); font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--ink-2); }
  .step.fwd .no { inset-inline-start: -11px; }
  .step.back .no { inset-inline-end: -11px; }
  .step .det { text-align: center; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); direction: ltr; unicode-bidi: isolate; min-height: 1.2em; }
  .step.proof .lbl { font-weight: 600; }
  .step.proof .ln { border-top: 2.5px solid var(--brand); }
  .step.proof .ln::after { border-inline-start-color: var(--brand); border-inline-end-color: var(--brand); }
  .step.fwd.proof .ln::after { border-inline-end-color: transparent; }
  .step.back.proof .ln::after { border-inline-start-color: transparent; }
  .step.proof .no { border-color: var(--brand); color: var(--brand); }
  .step.hint .ln { border-top-style: dashed; }
  .step.hint .lbl { color: var(--ink-2); }
  .step:hover .ln { border-top-color: var(--brand); }
  .step.fwd:hover .ln::after { border-inline-start-color: var(--brand); }
  .step.back:hover .ln::after { border-inline-end-color: var(--brand); }
  .flow-list { display: none; list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
  .flow-list li { border-bottom: 1px solid var(--line); }
  .flow-list a { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s1) var(--s3); padding-block: var(--s3); min-height: 44px; color: var(--ink); text-decoration: none; }
  .flow-list .no { grid-row: 1 / 3; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); }
  .flow-list .who { font-size: var(--t-sm); color: var(--ink-3); display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
  .flow-list .who svg { width: 14px; height: 14px; }
  .flow-list .lb { font-size: var(--t-md); line-height: 1.5; }
  .flow-list .det { grid-column: 2; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); direction: ltr; unicode-bidi: isolate; text-align: start; }
  .flow-list li.proof .no { border-color: var(--brand); color: var(--brand); border-width: 2px; }
  .flow-list li.proof .lb { font-weight: 600; }
  .flow-list li.hint .lb { color: var(--ink-2); }
  .flow-list li.hint .no { border-style: dashed; }
  @media (max-width: 640px) { .flow-scroll { display: none; } .flow-list { display: block; } .legend i { width: 18px; } }
  .legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-top: var(--s4); font-size: var(--t-sm); color: var(--ink-2); }
  .legend span { display: inline-flex; align-items: center; gap: var(--s2); }
  .legend i { display: inline-block; width: 28px; height: 0; border-top: 1.5px solid var(--ink-3); }
  .legend i.proof { border-top: 2.5px solid var(--brand); }
  .legend i.hint { border-top-style: dashed; }

  /* ---------- lifecycle diagram ---------- */
  .lc-scroll { overflow-x: auto; }
  .lc { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(4, auto); gap: var(--s4) var(--s6); padding-block: var(--s7) var(--s2); min-width: 660px; }
  .lc svg.edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
  .lc svg.edges path.e { fill: none; stroke: var(--ink-3); stroke-width: 1.25; }
  .lc svg.edges path.e.money { stroke: var(--refund); }
  .lc svg.edges .head { fill: var(--ink-3); }
  .lc svg.edges .head.money { fill: var(--refund); }
  .node { position: relative; z-index: 1; display: grid; gap: 2px; justify-items: start; align-self: center; padding: var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-ctl); min-width: 0; }
  .node.final { outline: 1px solid var(--line-strong); outline-offset: 3px; }
  .node .why { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.4; }
  .node .ev { overflow-wrap: anywhere; max-width: 100%; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-3); direction: ltr; unicode-bidi: isolate; }
  .lc-key { grid-column: 3 / 5; grid-row: 2 / 5; align-self: center; display: grid; gap: var(--s3); font-size: var(--t-sm); color: var(--ink-2); padding-inline-start: var(--s4); }
  .lc-key div { display: flex; align-items: center; gap: var(--s3); }
  .lc-key .sw { flex: none; width: 26px; height: 16px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
  .lc-key .sw.final { outline: 1px solid var(--line-strong); outline-offset: 2px; }
  .lc-key .sw.ev { width: auto; height: auto; border: 0; background: none; font-family: var(--font-mono); font-size: var(--t-xs); color: var(--ink-2); }
  .lc-key .sw.line { height: 0; border: 0; border-top: 1.5px solid var(--refund); border-radius: 0; }

  /* ---------- specials ---------- */
  .keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
  .key { position: relative; padding: var(--s4) var(--s5) var(--s5); overflow: hidden; }
  .key.spec { background: var(--specimen-soft); border: 1.5px dashed color-mix(in oklch, var(--specimen) 55%, transparent); }
  .specimen-band.notice { justify-content: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); border: 1px solid color-mix(in oklch, var(--specimen) 40%, transparent); border-radius: var(--r-ctl); font-weight: 500; }
  .specimen-band.notice span { color: var(--ink); font-size: var(--t-md); }
  html[lang="ar"] .specimen-band.notice span { font-size: var(--t-lg); line-height: 1.8; }
  .specimen-band.notice .specimen-tag { flex: none; }
  .key h4 { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-lg); font-family: var(--font-display); margin-bottom: var(--s3); }
  .key dl { margin: 0; display: grid; }
  .key dl > div { display: grid; gap: 0; padding-block: var(--s2); border-top: 1px solid var(--line); position: relative; z-index: 1; }
  .key.spec dl > div { border-top-color: color-mix(in oklch, var(--specimen) 25%, transparent); }
  .key dt { font-size: var(--t-sm); color: var(--ink-3); }
  .key dd { margin: 0; font-size: var(--t-md); display: flex; align-items: center; gap: var(--s2); min-width: 0; }
  .key dd .mono { overflow-wrap: anywhere; }
  .key dd .btn.icon { width: 36px; min-height: 36px; color: var(--ink-3); position: relative; z-index: 2; }
  .key .stamp { position: absolute; inset-inline-end: var(--s4); top: var(--s3); font-size: var(--t-lg); pointer-events: none; }

  .endpoints td .verb { color: var(--ink); }
  .endpoints td.p { font-family: var(--font-mono); font-size: var(--t-sm); }
  .endpoints td.p a { direction: ltr; unicode-bidi: isolate; }
  .endpoints td.p a { text-decoration: none; color: var(--ink); font-weight: 500; display: inline-flex; min-height: 28px; align-items: center; }
  .endpoints td.p a:hover { color: var(--brand); text-decoration: underline; }

  .check-list { list-style: none; padding: 0 !important; margin: 0; border-top: 1px solid var(--line); }
  .check-list li { margin: 0 !important; border-bottom: 1px solid var(--line); }
  .check-list label { display: flex; align-items: flex-start; gap: var(--s3); min-height: 48px; padding-block: var(--s3); cursor: pointer; font-size: var(--t-md); line-height: var(--lh-ui); }
  html[lang="ar"] .check-list label { line-height: 1.75; }
  .check-list input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--brand); flex: none; }
  .check-list input:checked + span { color: var(--ink-3); }
  .check-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s3); font-size: var(--t-md); color: var(--ink-2); }
  .check-foot .btn { min-height: 40px; }

  .changes { display: grid; }
  .change { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s5); padding-block: var(--s5); border-top: 1px solid var(--line); }
  .change time { font-size: var(--t-md); color: var(--ink-3); padding-top: 2px; }
  .change h2 { font-size: var(--t-lg) !important; margin: 0 !important; padding: 0 !important; border: 0 !important; }
  .change p { margin-top: var(--s2); color: var(--ink-2); }
  .change .latest { margin-inline-start: var(--s2); vertical-align: middle; }

  .file .code-head .lbl { font-size: var(--t-sm); }
  .file pre { max-height: 560px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
  .file-url { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; font-size: var(--t-md); }

  /* ---------- toc ---------- */
  .toc h2 { font-size: var(--t-sm); font-weight: 600; color: var(--ink); margin-bottom: var(--s2); }
  .toc ol { list-style: none; margin: 0; padding: 0; display: grid; }
  .toc a { display: block; padding-block: 5px; font-size: var(--t-sm); line-height: 1.4; color: var(--ink-2); text-decoration: none; }
  .toc a.sub { padding-inline-start: var(--s3); color: var(--ink-3); }
  .toc a:hover { color: var(--ink); }
  .toc a.on { color: var(--brand); font-weight: 600; }
  .toc .tools { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--line); display: grid; gap: var(--s1); }
  .toc .tools .btn { justify-content: flex-start; padding-inline: 0; min-height: 36px; font-size: var(--t-sm); color: var(--ink-2); background: transparent; border-color: transparent; }
  .toc .tools .btn:hover { color: var(--brand); }

  /* ---------- pager + foot ---------- */
  .pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); margin-top: var(--s8); padding-top: var(--s5); border-top: 1px solid var(--line); }
  .pager a { display: grid; gap: 2px; padding-block: var(--s2); min-height: 64px; align-content: center; text-decoration: none; color: var(--ink); }
  .pager a .k { font-size: var(--t-sm); color: var(--ink-3); display: inline-flex; align-items: center; gap: var(--s1); }
  .pager a.next .k { justify-content: flex-end; }
  .pager a .v { font-family: var(--font-display); font-size: var(--t-lg); font-weight: 500; }
  .pager a:hover .v { color: var(--brand); }
  .pager a.next { text-align: end; grid-column: 2; }
  .site-foot { margin-top: auto; border-top: 1px solid var(--line); }
  .site-foot .in { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); padding: var(--s4) var(--s7) var(--s6); font-size: var(--t-sm); color: var(--ink-3); }
  .site-foot a { color: var(--ink-2); display: inline-flex; min-height: 44px; align-items: center; }
  .site-foot .who { display: inline-flex; align-items: center; gap: var(--s2); margin-inline-end: auto; }
  .site-foot .mark { width: 20px; height: 20px; font-size: 11px; border-radius: 5px; }

  /* ---------- not found ---------- */
  .nf .code-word { font-family: var(--font-mono); font-size: var(--t-md); }
  .nf-actions { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s5); }
  .nf-actions .btn { min-height: 44px; }
  .nf-guess { margin-top: var(--s6); }
  .nf-guess h2 { font-size: var(--t-md); font-weight: 600; color: var(--ink-2); margin-bottom: var(--s2); }
  .nf-guess ul { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
  .nf-guess li a { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
  .nf-guess li a:hover { color: var(--brand); }

  /* ---------- search dialog ---------- */
  #search { width: min(660px, calc(100vw - 24px)); top: 9vh; overflow: hidden; display: none; }
  #search.open { display: flex; flex-direction: column; }
  .sq { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); }
  .sq svg { color: var(--ink-3); }
  .sq input { flex: 1; min-width: 0; min-height: 48px; border: 0; background: transparent; font-size: var(--t-lg); color: var(--ink); }
  .sq input:focus { outline: none; box-shadow: none; }
  .sq input::placeholder { color: var(--ink-3); }
  .sq .btn { min-height: 36px; }
  .sr { overflow-y: auto; max-height: min(58vh, 520px); padding: var(--s2); }
  .sr .grp { padding: var(--s2) var(--s3) var(--s1); font-size: var(--t-sm); color: var(--ink-3); font-weight: 500; }
  .sr a.hit { display: grid; gap: 2px; padding: var(--s2) var(--s3); min-height: 48px; border-radius: var(--r-ctl); text-decoration: none; color: var(--ink); scroll-margin: var(--s2); }
  .sr a.hit[aria-selected="true"] { background: var(--brand-soft); }
  .sr a.hit[aria-selected="true"] .what { color: var(--brand); }
  .sr .where { font-size: var(--t-sm); color: var(--ink-3); }
  .sr .what { font-weight: 600; font-size: var(--t-md); }
  .sr .snip { font-size: var(--t-sm); color: var(--ink-2); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .sr .empty { padding: var(--s6) var(--s4); }
  .sr .empty h3 { overflow-wrap: anywhere; }
  .sf { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); padding: var(--s2) var(--s4); border-top: 1px solid var(--line); background: var(--sunken); font-size: var(--t-sm); color: var(--ink-3); }
  .sf span { display: inline-flex; align-items: center; gap: var(--s1); }

  /* ---------- small screens ---------- */
  @media (max-width: 1024px) {
    .dh-in { padding-inline: var(--s3); gap: var(--s2); }
    .dh .menu-btn { width: 44px; min-height: 44px; }
    .find { display: none; }
    .find-icon { display: inline-flex; width: 44px; min-height: 44px; }
    .site-foot .in { padding-inline: var(--s5); }
  }
  @media (max-width: 640px) {
    .brand .wordmark { display: none; }
    .brand .docs { margin: 0; padding: 0; border: 0; font-family: var(--font-display); font-weight: 600; color: var(--ink); font-size: var(--t-lg); }
    .dh .seg button { min-height: 44px; padding-inline: var(--s2); }
    .theme-wrap .btn.icon { width: 44px; min-height: 44px; }
    .theme-wrap .menu button { min-height: 44px; }
    .page { padding: var(--s5) var(--s4) var(--s6); }
    .doc-head h1 { font-size: var(--t-2xl); }
    .page.home .lede { font-size: var(--t-lg); }
    .keys { grid-template-columns: minmax(0, 1fr); }
    .change { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
    .pager { grid-template-columns: minmax(0, 1fr); }
    .pager a.next { grid-column: 1; }
    .ctabs button { min-height: 44px; }
    .code .code-head .btn.icon, .endpoint .btn.icon, .key dd .btn.icon { width: 44px; min-height: 44px; }
    .hlink { opacity: 1; width: 44px; height: 44px; margin-block: -8px; }
    .toc { display: none; }
    #search { top: var(--s3); max-height: calc(100vh - 24px); }
    .sf { display: none; }
    .flow-bar .seg button { min-height: 44px; }
    .site-foot .who { width: 100%; }
  }
  .seg button { min-height: 40px; }

/* ---------- server-rendered additions ---------- */
.seg a { display: inline-flex; align-items: center; padding: var(--s1) var(--s3); min-height: 40px; border-radius: 4px; font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); text-decoration: none; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.02 200 / 0.12); }
@media (max-width: 640px) { .seg a { min-height: 44px; padding-inline: var(--s2); } }
.prose pre code { direction: ltr; unicode-bidi: isolate; }
.prose blockquote { margin: 0; padding-inline-start: var(--s4); border-inline-start: 3px solid var(--line-strong); color: var(--ink-2); }
.nav-scrim { display: none; }
@media (max-width: 1024px) { body.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 100; background: oklch(0.2 0.02 200 / 0.35); } }
.page.doc > .prose { margin-top: var(--s5); }
