/* المكتبة النظامية — visual identity (web-build.md §6), v2
   Themes: light (default) · dark · follow the device. html[data-theme] is set by js/theme.js;
   with no attribute the device preference decides. */
:root {
  --bg: #F3F4F1; --bg-2: #E9ECE6; --surface: #FFFFFF; --surface-2: #EEF1EC; --surface-3: #F7F8F5;
  --ink: #12181C; --ink-2: #2B343A; --muted: #5E6870; --line: #DCE0DA; --line-2: #C9CFC7;
  --accent: #2C5B4E; --accent-2: #1F4439; --accent-soft: #E2EDE8; --on-accent: #FFFFFF;
  --brass: #8A6A2F; --brass-soft: #F4ECDC; --danger: #8C3A34; --danger-soft: #F6E4E2;
  --hero-1: #E5EEE9; --hero-2: #F4EEDF;
  --shadow-sm: 0 1px 2px rgba(18, 24, 28, .05);
  --shadow: 0 1px 2px rgba(18, 24, 28, .04), 0 6px 18px -8px rgba(18, 24, 28, .14);
  --shadow-lg: 0 2px 4px rgba(18, 24, 28, .04), 0 18px 40px -18px rgba(18, 24, 28, .25);
  --header-bg: rgba(255, 255, 255, .82);
  --radius: 12px; --radius-sm: 8px; --radius-lg: 18px;
  --f-head: "Noto Kufi Arabic", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --f-mono: "IBM Plex Mono", "IBM Plex Sans Arabic", ui-monospace, monospace;
  color-scheme: light;
}
/* dark: chosen explicitly, or by the device when nothing is chosen */
:root[data-theme="dark"] {
  --bg: #0D1214; --bg-2: #111A1D; --surface: #151D21; --surface-2: #1C262B; --surface-3: #12191C;
  --ink: #E7EBEC; --ink-2: #C9D1D4; --muted: #96A3AA; --line: #263137; --line-2: #33414A;
  --accent: #7CC0AB; --accent-2: #9AD3C1; --accent-soft: #17302A; --on-accent: #0C1714;
  --brass: #D6B474; --brass-soft: #2B2416; --danger: #E5928A; --danger-soft: #36201D;
  --hero-1: #13241F; --hero-2: #211D14;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 22px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 44px -18px rgba(0, 0, 0, .7);
  --header-bg: rgba(16, 23, 26, .82);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1214; --bg-2: #111A1D; --surface: #151D21; --surface-2: #1C262B; --surface-3: #12191C;
    --ink: #E7EBEC; --ink-2: #C9D1D4; --muted: #96A3AA; --line: #263137; --line-2: #33414A;
    --accent: #7CC0AB; --accent-2: #9AD3C1; --accent-soft: #17302A; --on-accent: #0C1714;
    --brass: #D6B474; --brass-soft: #2B2416; --danger: #E5928A; --danger-soft: #36201D;
    --hero-1: #13241F; --hero-2: #211D14;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 22px -10px rgba(0, 0, 0, .55);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 44px -18px rgba(0, 0, 0, .7);
    --header-bg: rgba(16, 23, 26, .82);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 17px; line-height: 1.85;
  overflow-wrap: anywhere; -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3, h4, .brand, .section-title { font-family: var(--f-head); line-height: 1.5; color: var(--ink); }
h1 { font-size: 1.7rem; margin: .4em 0; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-2); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}
::selection { background: var(--accent-soft); color: var(--ink); }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; right: 8px; background: var(--surface); padding: 8px 12px; z-index: 30; border-radius: var(--radius-sm); }
svg { flex-shrink: 0; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 26px; padding-bottom: 56px; min-height: 62vh; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-height: 64px; padding-top: 6px; padding-bottom: 6px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.12rem; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: none; stroke: var(--on-accent); stroke-width: 1.6; stroke-linejoin: round; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav > a:not(.btn), .nav .link { color: var(--ink-2); text-decoration: none; padding: 6px 12px; border-radius: 999px; font-weight: 500; transition: background-color .15s, color .15s; }
.nav > a:not(.btn):hover, .nav .link:hover { background: var(--surface-2); color: var(--ink); }
.nav > a.active { background: var(--accent-soft); color: var(--accent); }
.nav .btn-small { margin-inline-start: 6px; }
.btn-login svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: scaleX(-1); }
.inline { display: inline; margin: 0; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

/* Theme switch (header) */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; margin-inline-start: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.theme-switch button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted); cursor: pointer; transition: background-color .15s, color .15s; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.theme-switch svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Account circle + menu (header) */
.user-menu { position: relative; margin-inline-start: 6px; }
.user-menu > summary { list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; user-select: none;
  background: var(--accent); color: var(--on-accent); font-family: var(--f-head); font-weight: 700; font-size: 1rem; line-height: 1;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line-2); transition: box-shadow .15s; }
.user-menu[open] > .avatar, .avatar:hover { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.avatar-lg { width: 64px; height: 64px; font-size: 1.6rem; cursor: default; }
.user-menu-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 10px); min-width: 230px; z-index: 40;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.user-menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); line-height: 1.6; }
.user-menu-head .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: end; }
.user-menu-panel a, .user-menu-panel button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink-2); font: inherit; text-decoration: none; cursor: pointer; text-align: start; }
.user-menu-panel a:hover, .user-menu-panel button:hover, .user-menu-panel a.active { background: var(--surface-2); color: var(--ink); }
.user-menu-panel form { margin: 0; }
.user-menu-panel button { color: var(--danger); }
.user-menu-panel svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Account page */
.account { max-width: 760px; margin: 0 auto; }
.account-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.account-head h1 { margin: 0; }
.account-head p { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.panel h2 { margin: 0 0 14px; font-size: 1.1rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; padding: 28px 0 24px; }
.footer-grid { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.footer-grid p { margin: 8px 0 0; }
.brand-footer { font-size: 1rem; }
.brand-footer .brand-mark { width: 28px; height: 28px; }
.footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.footer-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.footer-side p { margin: 0; }
.credit { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 10px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-family: var(--f-mono); font-size: .85rem; letter-spacing: .02em; transition: border-color .15s, color .15s; }
.credit b { color: var(--accent); font-weight: 600; }
.credit svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.credit:hover { border-color: var(--accent); color: var(--ink); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--on-accent);
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; box-shadow: var(--shadow-sm); transition: background-color .15s, transform .15s, box-shadow .15s; }
.btn:hover { background: var(--accent-2); color: var(--on-accent); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn-small { padding: 5px 16px; border-radius: 999px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--accent); border-color: var(--line-2); box-shadow: none; }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 9px 12px; width: 100%; max-width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: var(--muted); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
input::placeholder { color: var(--muted); opacity: .85; }
label { display: block; font-weight: 500; margin-bottom: 14px; }
label input, label select { margin-top: 5px; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { width: auto; margin: 0; accent-color: var(--accent); }
.notice { background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; }
.errors { background: var(--danger-soft); border: 1px solid var(--danger); color: var(--danger); border-radius: var(--radius-sm); padding: 6px 14px; margin-bottom: 14px; }

/* Home */
.page-home .main { padding-top: 0; }
.hero { position: relative; text-align: center; padding: 56px 20px 40px; margin: 22px 0 0; border-radius: var(--radius-lg);
  background:
    radial-gradient(1100px 380px at 85% -10%, var(--hero-1), transparent 60%),
    radial-gradient(900px 360px at 10% 110%, var(--hero-2), transparent 60%),
    var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 75%); mask-image: linear-gradient(to bottom, #000, transparent 75%); }
.hero > * { position: relative; }
.eyebrow { display: inline-block; margin: 0 0 6px; padding: 2px 14px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: .85rem; font-weight: 600; }
.hero h1 { font-size: 2.5rem; margin: .15em 0 .2em; }
.lead { color: var(--muted); max-width: 640px; margin: 0 auto 24px; font-size: 1.06rem; }
.search-big { display: flex; gap: 8px; max-width: 760px; margin: 0 auto 12px; flex-wrap: wrap; }
.search-big input { flex: 1 1 260px; font-size: 1.08rem; padding: 13px 16px; }
.search-big select { flex: 0 1 180px; width: auto; }
.search-big .btn { flex: 0 0 auto; padding-inline: 26px; }
.search-hero { background: var(--surface); padding: 6px; border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow-lg); flex-wrap: nowrap; }
.search-field { position: relative; flex: 1 1 auto; display: flex; }
.search-hero .search-field input { border: 0; box-shadow: none; padding-inline-start: 44px; background: transparent; }
.search-hero .search-field input:focus { box-shadow: none; }
.search-hero:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lg); }
.search-icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 16px auto 4px; max-width: 760px; }
.chip { padding: 3px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  font-size: .9rem; text-decoration: none; transition: border-color .15s, color .15s, background-color .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.hint { color: var(--muted); font-size: .92rem; margin-bottom: 0; }
.section-title { margin: 38px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--brass); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 16px;
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); color: var(--ink); }
.card-title { font-family: var(--f-head); font-weight: 700; }
.card-num { color: var(--accent); font-size: 1.45rem; line-height: 1.2; }
.card-arrow { position: absolute; inset-inline-end: 14px; bottom: 16px; width: 18px; height: 18px; fill: none; stroke: var(--muted);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: translateX(4px); transition: opacity .18s, transform .18s; }
.card:hover .card-arrow { opacity: 1; transform: none; stroke: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.stat { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 18px 18px;
  font-weight: 600; box-shadow: var(--shadow-sm); transition: transform .18s, box-shadow .18s, border-color .18s; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.stat-icon { display: grid; place-items: center; width: 74px; height: 74px; margin-bottom: 8px; border-radius: 20px;
  background: radial-gradient(circle at 30% 25%, var(--surface), var(--accent-soft) 75%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent), 0 6px 16px -10px var(--accent); }
.stat-icon svg { width: 52px; height: 52px; overflow: visible; }
.stat-icon .d { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.stat-icon .s { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon .fill-surface { fill: var(--surface); }
.stat-icon .a { fill: var(--brass); }
.stat-icon .s-on { fill: none; stroke: var(--surface); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.stat-icon .a-stroke { stroke: var(--brass); }
.stat-icon .t { fill: var(--brass); font: 700 19px var(--f-head); }
.stat:nth-child(2) .stat-icon { background: radial-gradient(circle at 30% 25%, var(--surface), var(--brass-soft) 75%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brass) 20%, transparent), 0 6px 16px -10px var(--brass); }
.stat .num { color: var(--ink); font-size: 1.9rem; line-height: 1.15; }
.stat-label { color: var(--muted); font-size: .95rem; font-weight: 500; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.svc-grid > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.svc-grid h3 { margin: 10px 0 4px; }
.svc-grid p { margin: 0; color: var(--muted); font-size: .95rem; line-height: 1.75; }
.svc-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.svc-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Prose pages */
.prose { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; max-width: 820px; box-shadow: var(--shadow-sm); }
.prose blockquote { margin: 0 0 16px; padding: 10px 14px; background: var(--brass-soft); border-inline-start: 4px solid var(--brass); border-radius: var(--radius-sm); }
.prose blockquote p { margin: 0; }

/* Auth */
.auth { max-width: 460px; margin: 18px auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 28px; box-shadow: var(--shadow); }
.auth h1 { margin-top: 0; text-align: center; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.consent { font-size: .88rem; color: var(--muted); text-align: center; margin: 12px 0 0; }
.auth-alt { text-align: center; color: var(--muted); margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.auth-alt a { font-weight: 600; }

/* Badges */
.badge { display: inline-block; border-radius: 999px; padding: 0 10px; font-size: .8rem; font-weight: 600;
  line-height: 1.9; border: 1px solid currentColor; white-space: nowrap; }
.badge-ok { color: var(--accent); background: var(--accent-soft); }
.badge-amended { color: var(--brass); background: var(--brass-soft); }
.badge-repealed { color: var(--danger); background: var(--danger-soft); }
.badge-neutral { color: var(--muted); background: var(--surface-2); }
.tag { display: inline-block; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; font-size: .8rem; line-height: 1.9; }

/* Lists */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.filters label { margin: 0; font-size: .92rem; color: var(--muted); }
.filters select { color: var(--ink); }
.law-list { list-style: none; padding: 0; margin: 0; }
.law-list > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 18px; margin-bottom: 8px;
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
.law-list > li:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.law-list.compact > li { padding: 8px 14px; }
.law-name { font-weight: 600; text-decoration: none; color: var(--ink); font-size: 1.04rem; }
.law-name:hover { color: var(--accent); }
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .9rem; margin-top: 4px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pager a, .pager span { min-width: 38px; text-align: center; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); text-decoration: none; }
.pager a:hover { border-color: var(--accent); }
.pager .current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.pager .disabled { color: var(--muted); }

/* Law page */
.law-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px 24px 20px;
  box-shadow: var(--shadow); overflow: hidden; }
.law-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--brass), var(--accent)); }
.law-card h1 { margin-top: 0; font-size: 1.8rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; margin: 16px 0 0; }
.facts div { min-width: 0; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.facts dt { color: var(--muted); font-size: .82rem; }
.facts dd { margin: 0; font-weight: 500; }
.disclaimer { display: flex; align-items: center; gap: 8px; background: var(--brass-soft); border: 1px solid color-mix(in srgb, var(--brass) 45%, transparent);
  color: var(--ink); border-radius: var(--radius); padding: 8px 14px; margin: 14px 0; font-size: .9rem; }
.disclaimer::before { content: "!"; display: grid; place-items: center; flex: 0 0 20px; height: 20px; border-radius: 50%; background: var(--brass);
  color: var(--surface); font-weight: 700; font-size: .8rem; line-height: 1; }
.actions { margin: 0 0 16px; }
.law-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }
.law-layout > .law-main:only-child { grid-column: 1 / -1; }
.toc { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; box-shadow: var(--shadow-sm); }
.toc ul { list-style: none; padding-inline-start: 12px; margin: 4px 0; border-inline-start: 1px solid var(--line); }
.toc > details > ul { padding-inline-start: 0; border: 0; }
.toc li { margin: 2px 0; }
.toc summary { cursor: pointer; border-radius: 6px; padding: 1px 4px; }
.toc summary:hover { background: var(--surface-2); }
.toc-title { font-family: var(--f-head); font-weight: 700; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a:hover { color: var(--accent); }
.struct { color: var(--accent); margin: 30px 0 10px; scroll-margin-top: 84px; display: flex; align-items: center; gap: 10px; }
.struct::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.struct-1 { color: var(--ink); }
.struct-2 { color: var(--muted); }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 10px;
  scroll-margin-top: 84px; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.article:hover { border-color: var(--line-2); }
.article:target { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.article-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.article-head h1 { margin: 0; }
.article-label { font-family: var(--f-head); font-weight: 700; text-decoration: none; color: var(--accent); }
.article-label:hover { text-decoration: underline; }
.article-text { margin-top: 6px; color: var(--ink-2); }
.article-text.big { font-size: 1.1rem; line-height: 2; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px 24px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--accent); }
.doc-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin-top: 12px; box-shadow: var(--shadow-sm); }
.crumbs { font-size: .9rem; margin-bottom: 8px; color: var(--muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.alert { border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; font-weight: 600; }
.alert-brass { background: var(--brass-soft); border: 1px solid var(--brass); color: var(--brass); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; box-shadow: var(--shadow-sm); }
.compare-col h3 { margin: 0 0 6px; }
.timeline { margin-top: 30px; }
.tl-item { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; border-inline-start: 3px solid var(--brass); padding: 8px 14px;
  margin-bottom: 10px; background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow-sm); }
.tl-date { color: var(--brass); font-weight: 500; }
.tl-body details summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.article-page { margin-bottom: 30px; }
.article-page > .muted { margin-top: 2px; }

/* Search */
.results { padding-inline-start: 22px; }
.results > li::marker { color: var(--muted); font-family: var(--f-mono); font-size: .85rem; }
.result { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.result-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-weight: 600; }
.result-text { margin: 6px 0 2px; color: var(--ink-2); }
mark { background: var(--brass-soft); color: inherit; border-bottom: 2px solid var(--brass); padding: 0 2px; border-radius: 3px; }
.print-footer { display: none; }

/* Phones (360px and up) */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .site-header { position: static; }          /* two rows on phones: do not pin it over the text */
  .header-row { min-height: 56px; }
  .toc, .struct, .article { scroll-margin-top: 12px; }
  .brand span { font-size: 1rem; }
  .nav > a:not(.btn), .nav .link { padding: 5px 9px; }
  .theme-switch { margin-inline-start: 2px; }
  .footer-side { align-items: flex-start; }
  .panel { padding: 16px; }
  .user-menu-panel { position: fixed; inset-inline: 12px; top: 64px; min-width: 0; }
  .theme-switch button { width: 28px; height: 28px; }
  .law-layout { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; max-height: none; }
  .compare { grid-template-columns: minmax(0, 1fr); }
  .row2 { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hero { padding: 36px 14px 28px; margin-top: 14px; }
  .hero h1 { font-size: 1.85rem; }
  .search-hero { flex-wrap: wrap; }
  .search-hero .btn { flex: 1 1 100%; }
  .search-big select { flex: 1 1 100%; }
  .prose, .auth { padding: 18px; }
  .law-card { padding: 18px; }
  .law-card h1 { font-size: 1.45rem; }
  .article-text.big { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Print (web-build.md §7) */
@media print {
  @page { margin: 18mm 16mm 22mm; }
  :root, :root[data-theme] { --bg: #fff; --surface: #fff; --surface-3: #fff; --ink: #000; --ink-2: #000; --muted: #333; --line: #bbb; color-scheme: light; }
  body { background: #fff !important; color: #000; font-size: 12.5pt; line-height: 1.7; }
  .site-header, .site-footer, .nav, .no-print, .toc, .actions, .crumbs, .pager, .filters, .skip, .theme-switch { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .article, .law-card, .doc-body, .article-text.big, .facts div { border: 0; padding: 0; background: #fff; box-shadow: none; }
  .law-card::before, .struct::after { display: none; }
  .article { break-inside: avoid-page; margin-bottom: 8pt; }
  .struct.bab { break-before: page; }
  .print-first + .articles .struct.bab:first-child { break-before: auto; }
  .badge { border: 1px solid #000; color: #000 !important; background: #fff !important; }
  a { color: #000; text-decoration: none; }
  .print-first { border-bottom: 1px solid #000; margin-bottom: 12pt; }
  .print-footer { display: block; position: fixed; bottom: 0; left: 0; right: 0; font-size: 9pt; color: #333;
    border-top: 1px solid #999; padding-top: 3pt; text-align: center; background: #fff; }
  main { padding-bottom: 14mm; }
}

/* ---- الفريق الرقمي ---- */
.team-section { margin-top: 8px; }
.team-intro { color: var(--muted); margin: -4px 0 18px; line-height: 1.8; }
.team-page h1 { margin: 26px 0 8px; }
.team-page .lead { color: var(--ink-2); max-width: 62ch; line-height: 1.9; margin: 0 0 26px; }
.team-owner { display: flex; justify-content: center; }
.team-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 14px 16px; box-shadow: var(--shadow-sm); }
.team-card-owner { width: min(100%, 240px); border-color: var(--line-2); box-shadow: var(--shadow); }
.team-photo { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; background: var(--surface-2);
  border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); margin-bottom: 8px; }
.team-card-owner .team-photo { width: 120px; height: 120px; }
.team-photo-empty { display: grid; place-items: center; font-family: var(--f-head); font-size: 2.6rem; font-weight: 700;
  color: var(--accent); background: var(--accent-soft); }
.team-name { font-family: var(--f-head); font-weight: 700; font-size: 1.08rem; color: var(--ink); }
.team-role { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.team-duty { color: var(--ink-2); font-size: .88rem; line-height: 1.7; margin-top: 6px; }
.team-ai { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 1px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 600; color: var(--brass); background: var(--brass-soft); }
.team-ai svg { width: 13px; height: 13px; fill: currentColor; }
.team-divider { display: flex; align-items: center; gap: 14px; margin: 28px 0 16px; color: var(--ink-2);
  font-family: var(--f-head); font-weight: 600; font-size: .98rem; }
.team-divider::before, .team-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.team-note { margin: 18px 0 0; color: var(--muted); font-size: .85rem; line-height: 1.8; text-align: center; }
.team-more { text-align: center; margin: 16px 0 0; }
@media (max-width: 760px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .team-photo { width: 84px; height: 84px; }
  .team-card { padding: 14px 8px 12px; }
}

.team-icon { display: grid; place-items: center; background: var(--accent-soft); box-shadow: 0 0 0 1px var(--line-2); }
.team-icon svg { width: 60%; height: 60%; overflow: visible; }
.team-icon .f  { fill: var(--surface); stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.team-icon .fb { fill: var(--surface); stroke: var(--brass); stroke-width: 2.4; }
.team-icon .s  { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.team-icon .b  { fill: none; stroke: var(--brass); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.team-icon .b-thick { stroke-width: 3.4; }
.team-icon .bf { fill: var(--brass); }
.team-icon .db { fill: var(--brass-soft); stroke: var(--brass); stroke-width: 1.8; }
.team-icon .w  { fill: none; stroke: var(--surface); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* beta label under the site name */
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.15; }
.brand-beta { font-family: var(--f-body); font-size: .7rem; font-weight: 500; color: var(--accent); letter-spacing: 0; }
.brand-footer .brand-beta { font-size: .66rem; }
.hero-beta { margin: -.4rem 0 .9rem; }
.hero-beta span { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: .85rem; font-weight: 500;
  color: var(--accent); border: 1px solid currentColor; }
