:root {
    color-scheme: light;
    --bg: #f7fafc;
    --surface: #ffffff;
    --surface-2: #eef8fb;
    --ink: #15202b;
    --muted: #5d6b7c;
    --line: #dce7ee;
    --primary: #06b6d4;
    --primary-dark: #0e7490;
    --green: #16a34a;
    --coral: #f9735b;
    --violet: #7c3aed;
    --shadow: 0 18px 45px rgba(21, 32, 43, .10);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #07111f;
    --surface: #0d1b2e;
    --surface-2: #10243b;
    --ink: #edf7fb;
    --muted: #a8b7c9;
    --line: #233955;
    --primary: #22d3ee;
    --primary-dark: #67e8f9;
    --green: #4ade80;
    --coral: #fb927a;
    --violet: #a78bfa;
    --shadow: 0 18px 45px rgba(0, 0, 0, .34);
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.7; }
html[lang="ar"] body { font-family: "Cairo", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.topbar { position: sticky; top: 0; z-index: 20; height: 72px; display: flex; align-items: center; gap: 18px; padding: 0 28px; border-bottom: 1px solid rgba(220,231,238,.92); background: rgba(255,255,255,.88); backdrop-filter: blur(18px); }
:root[data-theme="dark"] .topbar { border-bottom-color: rgba(35,57,85,.92); background: rgba(7,17,31,.88); }
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 900; font-size: 18px; min-width: max-content; }
.brand-logo-frame { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-logo { max-width: 42px; max-height: 42px; object-fit: contain; }
.brand-logo--dark { display: none; }
:root[data-theme="dark"] .brand-logo--light { display: none; }
:root[data-theme="dark"] .brand-logo--dark { display: block; }
.brand-text { display: grid; gap: 0; line-height: 1.08; }
.brand-text strong { font-size: 17px; }
.brand-text small { color: var(--muted); font-size: 11px; font-weight: 800; }
.brand em { color: var(--primary-dark); font-style: normal; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-inline-start: auto; min-width: 0; flex: 1; }
.search { display: flex; align-items: center; gap: 10px; max-width: 440px; flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 12px; color: var(--muted); }
:root[data-theme="dark"] .search { background: var(--surface); }
.search span { font-size: 13px; font-weight: 700; }
.search input { min-width: 0; width: 100%; border: 0; outline: 0; font: inherit; background: transparent; color: var(--ink); }
.lang-link, .app-link, .hero-actions a { height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; border-radius: 8px; font-weight: 800; font-size: 14px; }
.lang-link { border: 1px solid var(--line); color: var(--primary-dark); background: #fff; }
:root[data-theme="dark"] .lang-link { background: var(--surface); }
.theme-link { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--primary-dark); cursor: pointer; position: relative; flex: 0 0 auto; }
:root[data-theme="dark"] .theme-link { background: var(--surface); }
.theme-link__sun, .theme-link__moon { position: absolute; display: block; transition: opacity .16s ease; }
.theme-link__sun { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 999px; box-shadow: 0 -8px 0 -6px currentColor, 0 8px 0 -6px currentColor, 8px 0 0 -6px currentColor, -8px 0 0 -6px currentColor; }
.theme-link__moon { width: 16px; height: 16px; border-radius: 999px; box-shadow: inset -5px 0 0 currentColor; opacity: 0; }
:root[data-theme="dark"] .theme-link__sun { opacity: 0; }
:root[data-theme="dark"] .theme-link__moon { opacity: 1; }
.app-link, .hero-actions a:first-child { background: var(--ink); color: #fff; }
:root[data-theme="dark"] .app-link, :root[data-theme="dark"] .hero-actions a:first-child { background: #dff8ff; color: #07111f; }
.hero-actions a:last-child { border: 1px solid var(--line); background: #fff; color: var(--primary-dark); }
:root[data-theme="dark"] .hero-actions a:last-child { background: var(--surface); }
.icon-button { display: none; width: 42px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 10px; }
:root[data-theme="dark"] .icon-button { background: var(--surface); }
.icon-button span { display: block; height: 2px; background: var(--ink); margin: 5px 0; }
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); max-width: 1480px; margin: 0 auto; }
.sidebar { position: sticky; top: 72px; height: calc(100dvh - 72px); overflow: auto; border-inline-end: 1px solid var(--line); padding: 24px 20px; background: rgba(247,250,252,.82); }
:root[data-theme="dark"] .sidebar { background: rgba(7,17,31,.82); }
.nav-section { margin-bottom: 24px; }
.nav-section p { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 900; }
[dir="rtl"] .nav-section p { letter-spacing: 0; }
.nav-section a { display: block; padding: 9px 11px; border-radius: 8px; color: #334155; font-size: 14px; font-weight: 700; }
:root[data-theme="dark"] .nav-section a { color: #c8d6e6; }
.nav-section a:hover, .nav-section a[aria-current="page"] { background: #fff; color: var(--primary-dark); box-shadow: 0 8px 20px rgba(6, 182, 212, .10); }
:root[data-theme="dark"] .nav-section a:hover, :root[data-theme="dark"] .nav-section a[aria-current="page"] { background: var(--surface); box-shadow: 0 8px 20px rgba(34, 211, 238, .10); }
.content { min-width: 0; overflow-x: hidden; overflow-x: clip; padding: 34px clamp(20px, 5vw, 72px) 80px; }
.breadcrumbs { color: var(--muted); font-size: 13px; margin-bottom: 18px; display: flex; gap: 8px; align-items: center; }
.breadcrumbs a { color: var(--primary-dark); font-weight: 800; }
.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 28px; align-items: stretch; padding: clamp(26px, 5vw, 56px); border-radius: 8px; background: linear-gradient(135deg, #ffffff 0%, #effafc 56%, #f8f4ff 100%); border: 1px solid var(--line); box-shadow: var(--shadow); }
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #0d1b2e 0%, #0f2a3c 56%, #161b35 100%); }
.eyebrow { margin: 0 0 8px; color: var(--coral); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: .08em; }
[dir="rtl"] .eyebrow { letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 58px); line-height: 1.05; letter-spacing: 0; }
.hero p { max-width: 760px; color: var(--muted); font-size: 18px; margin: 18px 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-panel { background: rgba(255,255,255,.78); border: 1px solid var(--line); border-radius: 8px; padding: 22px; min-height: 260px; display: flex; flex-direction: column; justify-content: space-between; }
:root[data-theme="dark"] .hero-panel { background: rgba(13,27,46,.78); }
.pulse-row { display: flex; gap: 9px; }
.pulse-row span { width: 12px; height: 12px; border-radius: 999px; background: var(--primary); }
.pulse-row span:nth-child(2) { background: var(--green); }
.pulse-row span:nth-child(3) { background: var(--coral); }
.hero-panel strong { font-size: 24px; line-height: 1.25; }
.hero-panel p { font-size: 15px; margin: 8px 0; }
.metric-row { display: flex; align-items: end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.metric-row b { font-size: 42px; color: var(--primary-dark); line-height: 1; }
.metric-row span { color: var(--muted); font-weight: 800; }
.article { max-width: 920px; margin-top: 34px; overflow-x: hidden; overflow-x: clip; }
.article > * { max-width: 100%; }
.article h2 { margin: 38px 0 12px; font-size: 28px; line-height: 1.2; }
.article h3 { margin: 28px 0 10px; font-size: 21px; }
.article h2 { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.article h2::before { content: ''; width: 5px; height: 28px; border-radius: 3px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); flex: 0 0 auto; }
.article h3 { color: var(--primary-dark); }
.article p, .article li { color: #334155; overflow-wrap: anywhere; }
:root[data-theme="dark"] .article p, :root[data-theme="dark"] .article li { color: #c8d6e6; }
.article ul, .article ol { padding-inline-start: 25px; }
.article li { margin: 7px 0; padding-inline-start: 4px; }
.article li::marker { color: var(--primary-dark); font-weight: 900; }
.article blockquote { margin: 22px 0; padding: 15px 18px; border: 1px solid rgba(6,182,212,.24); border-inline-start: 5px solid var(--primary); border-radius: 8px; background: linear-gradient(135deg, rgba(6,182,212,.08), rgba(124,58,237,.04)); }
.article blockquote p { margin: 0; color: #24465d; font-weight: 700; }
:root[data-theme="dark"] .article blockquote { border-color: rgba(34,211,238,.25); border-inline-start-color: var(--primary); background: linear-gradient(135deg, rgba(34,211,238,.10), rgba(167,139,250,.06)); }
:root[data-theme="dark"] .article blockquote p { color: #d8edf5; }
.article code { background: #eaf6f8; color: #0e7490; border-radius: 6px; padding: 2px 6px; }
:root[data-theme="dark"] .article code { background: #10243b; color: #67e8f9; }
.article pre { overflow: auto; background: #111827; color: #e5f8fb; padding: 18px; border-radius: 8px; }
.table-scroll { width: 100%; margin: 22px 0 30px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 12px 30px rgba(15,23,42,.07); scrollbar-width: thin; scrollbar-color: var(--primary) transparent; }
.table-scroll:focus-visible { outline: 3px solid rgba(6,182,212,.25); outline-offset: 3px; }
.article table { width: 100%; min-width: 620px; border-spacing: 0; border-collapse: separate; font-size: 15px; line-height: 1.65; }
.article th, .article td { padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.article th { color: #0b5268; background: linear-gradient(180deg, #e8f8fb, #def3f8); font-size: 14px; font-weight: 900; white-space: nowrap; }
.article th:not(:last-child), .article td:not(:last-child) { border-inline-end: 1px solid var(--line); }
.article tbody tr:nth-child(even) td { background: #f8fbfd; }
.article tbody tr:last-child td { border-bottom: 0; }
.article tbody tr { transition: background-color .14s ease; }
.article tbody tr:hover td { background: #ecf9fc; }
.article td:first-child { color: #102f44; font-weight: 800; }
.article td code { white-space: nowrap; }
:root[data-theme="dark"] .table-scroll { background: var(--surface); box-shadow: 0 12px 30px rgba(0,0,0,.22); }
:root[data-theme="dark"] .article th { color: #bff5ff; background: linear-gradient(180deg, #133149, #102a3f); }
:root[data-theme="dark"] .article tbody tr:nth-child(even) td { background: #0a192a; }
:root[data-theme="dark"] .article tbody tr:hover td { background: #102b3f; }
:root[data-theme="dark"] .article td:first-child { color: #e5f7fb; }
.doc-figure { margin: 0 0 30px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; box-shadow: 0 12px 30px rgba(15,23,42,.08); }
.doc-figure-media { background: #e2e8f0; }
:root[data-theme="dark"] .doc-figure { background: var(--surface); box-shadow: 0 12px 30px rgba(0,0,0,.28); }
:root[data-theme="dark"] .doc-figure-media { background: #07111f; }
.doc-figure img { width: 100%; max-height: 460px; object-fit: cover; object-position: top; }
.theme-image--dark { display: none; }
:root[data-theme="dark"] .theme-image--light { display: none; }
:root[data-theme="dark"] .theme-image--dark { display: block; }
.doc-figure figcaption { padding: 12px 16px; color: var(--muted); font-size: 13px; font-weight: 700; border-top: 1px solid var(--line); }
.related { max-width: 920px; margin-top: 42px; }
.related h2 { font-size: 22px; }
.related > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.related-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px; }
:root[data-theme="dark"] .related-card { background: var(--surface); }
.related-card strong { display: block; color: var(--primary-dark); }
.related-card span { color: var(--muted); font-size: 14px; }
.api-console { margin-top: 30px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
:root[data-theme="dark"] .api-console { background: var(--surface); }
.api-toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
:root[data-theme="dark"] .api-toolbar { background: #0a1728; }
.api-toolbar label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; font-size: 13px; }
.api-toolbar input, .try-body textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; }
:root[data-theme="dark"] .api-toolbar input, :root[data-theme="dark"] .try-body textarea { background: #07111f; color: var(--ink); }
.api-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 540px; }
.api-endpoints { border-inline-end: 1px solid var(--line); padding: 12px; overflow: auto; max-height: 640px; }
.api-endpoints button { width: 100%; text-align: start; border: 0; border-radius: 8px; background: transparent; padding: 10px; margin-bottom: 6px; cursor: pointer; }
.api-endpoints button:hover, .api-endpoints button.active { background: #eef8fb; }
:root[data-theme="dark"] .api-endpoints button:hover, :root[data-theme="dark"] .api-endpoints button.active { background: #10243b; }
.api-endpoints strong { display: block; font-size: 14px; }
.api-method { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: #dcfce7; color: #166534; font-size: 11px; font-weight: 900; margin-inline-end: 8px; text-transform: uppercase; }
.api-method.post { background: #dbeafe; color: #1d4ed8; }
.api-method.put { background: #fef3c7; color: #92400e; }
.api-method.delete { background: #fee2e2; color: #b91c1c; }
.api-detail { padding: 22px; min-width: 0; }
.api-detail h2 { margin-top: 0; }
.try-body { display: grid; gap: 12px; margin-top: 18px; }
.try-body textarea { min-height: 180px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.try-body button { width: max-content; min-height: 42px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--primary-dark); color: #fff; font-weight: 900; cursor: pointer; }
.api-response { white-space: pre-wrap; min-height: 120px; background: #111827; color: #d1fae5; padding: 14px; border-radius: 8px; overflow: auto; }
.muted { color: var(--muted); }
.search-results { position: fixed; top: 68px; inset-inline-end: 28px; width: min(520px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; }
:root[data-theme="dark"] .search-results { background: var(--surface); }
.search-results a { display: block; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.search-results a:last-child { border-bottom: 0; }
.search-results strong { display: block; color: var(--primary-dark); }
.search-results span { color: var(--muted); font-size: 13px; }
@media (max-width: 980px) {
    .topbar { padding: 0 16px; }
    .icon-button { display: inline-block; }
    .top-actions { gap: 8px; }
    .search { display: none; }
    .shell { display: block; }
    .sidebar { position: fixed; top: 72px; bottom: 0; left: 0; right: auto; width: min(86vw, 340px); max-width: calc(100vw - 48px); transform: translate3d(-105%, 0, 0); transition: transform .2s ease; z-index: 30; background: #f8fafc; box-shadow: var(--shadow); }
    :root[data-theme="dark"] .sidebar { background: #07111f; }
    [dir="rtl"] .sidebar { left: auto; right: 0; transform: translate3d(105%, 0, 0); border-inline-end: 0; border-inline-start: 1px solid var(--line); }
    .sidebar.open { transform: translate3d(0, 0, 0); }
    .content { padding: 24px 16px 60px; }
    .hero { grid-template-columns: 1fr; padding: 26px; }
    h1 { font-size: 34px; }
    .hero p { font-size: 16px; }
    .hero-panel { min-height: 210px; }
    .related > div, .api-toolbar, .api-grid { grid-template-columns: 1fr; }
    .api-endpoints { border-inline-end: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
    .app-link { display: none; }
}
@media (max-width: 560px) {
    .brand-logo-frame { width: 38px; height: 38px; }
    .brand-logo { max-width: 38px; max-height: 38px; }
    .brand-text strong { font-size: 15px; }
    .brand-text small { font-size: 10px; }
    .lang-link { padding: 0 10px; }
    .hero { padding: 20px; }
    .hero-actions a { width: 100%; }
    .article h2 { font-size: 24px; }
    .article h2::before { height: 24px; }
    .table-scroll { margin: 18px 0 24px; border-radius: 8px; }
    .article table { min-width: 560px; font-size: 14px; }
    .article th, .article td { padding: 12px; }
}