:root {
  --bg: #f7f1e3;
  --surface: #fffdf8;
  --surface-2: #f1eadb;
  --text: #1d1a14;
  --muted: #6b6352;
  --border: #e5dcc8;
  --primary: #8a6420;
  --primary-ink: #ffffff;
  --primary-soft: #f4ead2;
  --accent: #a8812e;
  --accent-soft: #f6eedb;
  --amended: #9a6412;
  --amended-soft: #fbefd9;
  --repealed: #a23b2c;
  --repealed-soft: #f9e3df;
  --mark: #ffe8a3;
  --shadow: 0 1px 2px rgba(28, 36, 33, .06), 0 4px 16px rgba(28, 36, 33, .05);
  --radius: 14px;
  --fs: 18px;
  --ui: "IBM Plex Sans Arabic", system-ui, "Segoe UI", Tahoma, sans-serif;
  --read: "Noto Naskh Arabic", "IBM Plex Sans Arabic", "Traditional Arabic", serif;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0a08; --surface: #15130f; --surface-2: #1d1a14; --text: #ece4d0; --muted: #a39a88;
    --border: #2c271d; --primary: #d8b25a; --primary-ink: #1b1408; --primary-soft: #2a2416;
    --accent: #f0d58c; --accent-soft: #2b2617; --amended: #e2aa55; --amended-soft: #2e2414;
    --repealed: #ec8a7b; --repealed-soft: #33201d; --mark: #5c4a12;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0a08; --surface: #15130f; --surface-2: #1d1a14; --text: #ece4d0; --muted: #a39a88;
  --border: #2c271d; --primary: #d8b25a; --primary-ink: #1b1408; --primary-soft: #2a2416;
  --accent: #f0d58c; --accent-soft: #2b2617; --amended: #e2aa55; --amended-soft: #2e2414;
  --repealed: #ec8a7b; --repealed-soft: #33201d; --mark: #5c4a12;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--ui);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { inset-inline-start: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ------------------------------------------------ navigation */
.nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 20; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: flex; justify-content: space-around; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.nav__brand { display: none; }
.nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11.5px; font-weight: 500; min-width: 0;
}
.nav__item[data-nav="saved"] { display: none; }
.nav__item.is-active { color: var(--primary); }
.nav__item.is-active svg.i { stroke-width: 2.2; }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-inline-start: 248px; }
  .nav {
    inset-inline: 0 auto; inset-inline-start: 0; top: 0; bottom: 0; width: 248px; height: auto; flex-direction: column;
    justify-content: flex-start; gap: 2px; padding: 18px 12px; border-top: 0; border-inline-end: 1px solid var(--border);
  }
  .nav__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; color: var(--text); }
  .nav__brand b { display: block; font-size: 20px; }
  .nav__brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -2px; }
  .nav__item { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 15px; }
  .nav__item[data-nav="saved"] { display: flex; }
  .nav__item:hover { background: var(--surface-2); color: var(--text); }
  .nav__item.is-active { background: var(--primary-soft); color: var(--primary); }
}

/* ------------------------------------------------ layout */
.main { max-width: 780px; margin: 0 auto; padding: 16px 16px 40px; outline: none; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; justify-content: center; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; min-height: 44px; }
.topbar h1 { font-size: 22px; flex: 1; min-width: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.brand-head { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand-head img { width: 40px; height: 40px; }
.brand-head b { font-size: 22px; display: block; line-height: 1.2; }
.brand-head small { color: var(--muted); font-size: 13px; }
@media (min-width: 900px) { .brand-head { display: none; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.is-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); background: var(--accent-soft); }
.icon-btn.is-on svg.i { fill: currentColor; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 16px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn--primary:hover { background: color-mix(in srgb, var(--primary) 88%, black); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn--sm { min-height: 34px; padding: 4px 12px; font-size: 13.5px; border-radius: 10px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .section + .section { margin-top: 14px; }
.section { margin-top: 26px; }
.section > h2 { font-size: 16px; color: var(--muted); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px;
  background: var(--surface-2); color: var(--muted); font-weight: 500; white-space: nowrap;
}
.chip--amended { background: var(--amended-soft); color: var(--amended); }
.chip--repealed { background: var(--repealed-soft); color: var(--repealed); }
.chip--accent { background: var(--accent-soft); color: var(--accent); }
.chip--primary { background: var(--primary-soft); color: var(--primary); }

.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  outline: none;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.searchbox { position: relative; }
.searchbox svg.i { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox .input { padding-inline-start: 44px; font-size: 16px; }
select.input {
  appearance: none; padding-inline-end: 14px; padding-inline-start: 38px; background-repeat: no-repeat; background-position: 14px 50%; background-size: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a948f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
textarea.input { min-height: 140px; resize: vertical; line-height: 1.8; }

.segmented { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: 14px; white-space: nowrap; }
.segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ------------------------------------------------ daily card */
.daily {
  position: relative; overflow: hidden; border-radius: 20px; padding: 20px; color: #f3f7f5;
  background: radial-gradient(120% 120% at 100% 0%, #2c2517 0%, #15130e 48%, #0b0a08 100%); border: 1px solid rgba(216, 178, 90, .32);
  box-shadow: 0 14px 36px -12px rgba(216, 178, 90, .35);
}
.daily::after {
  content: ""; position: absolute; inset-inline-end: -40px; bottom: -50px; width: 200px; height: 200px; opacity: .1;
  background: url("icons/logo.png") center / contain no-repeat;
}
.daily__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.daily__label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #f1d697; font-size: 14px; }
.daily__date { font-size: 12.5px; opacity: .8; }
.daily__law { margin-top: 14px; font-size: 14px; opacity: .85; }
.daily__title { font-size: 21px; margin-top: 2px; }
.daily__text { font-family: var(--read); font-size: calc(var(--fs) + 1px); line-height: 2.05; margin-top: 12px; white-space: pre-line; position: relative; z-index: 1; }
.daily__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; position: relative; z-index: 1; }
.daily .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .18); color: #fff; }
.daily .btn:hover { background: rgba(255, 255, 255, .2); }
.daily .btn--gold { background: #f1d697; border-color: #f1d697; color: #2a2210; }
.daily .btn--gold:hover { background: #f6e2b0; }
.daily .btn.is-done { background: rgba(241, 214, 151, .2); border-color: rgba(241, 214, 151, .5); color: #f1d697; }
:root[data-theme="dark"] .daily, :root:not([data-theme="light"]) .daily { color-scheme: dark; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); }
.tile:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.tile__ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.tile__ic--gold { background: var(--accent-soft); color: var(--accent); }
.tile b { display: block; font-size: 15px; }
.tile span { display: block; font-size: 12.5px; color: var(--muted); }
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr; } }

.history { display: flex; flex-direction: column; }
.history a { display: flex; gap: 10px; align-items: baseline; padding: 10px 2px; border-bottom: 1px dashed var(--border); color: var(--text); }
.history a:last-child { border-bottom: 0; }
.history .d { color: var(--muted); font-size: 12.5px; min-width: 64px; }

/* ------------------------------------------------ law list */
.law-group + .law-group { margin-top: 22px; }
.law-group > h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0 4px 8px; display: flex; justify-content: space-between; }
.law-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.law-item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.law-item:last-child { border-bottom: 0; }
.law-item:hover { background: var(--surface-2); }
.law-item__body { flex: 1; min-width: 0; }
.law-item__name { font-weight: 600; font-size: 15.5px; }
.law-item__meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px 10px; flex-wrap: wrap; margin-top: 2px; }
.law-item > svg.i { color: var(--muted); }

/* ------------------------------------------------ law view */
.law-head h1 { font-size: 24px; }
.law-head .en { color: var(--muted); font-size: 13px; direction: ltr; text-align: end; }
.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin-top: 12px; }
.meta-grid dt { color: var(--muted); }
.meta-grid dd { margin: 0; }
details.more { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
details.more summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 14px; }
details.more .prose { margin-top: 10px; white-space: pre-line; font-family: var(--read); line-height: 2; font-size: 15.5px; }

.toolbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; display: flex; gap: 8px; padding: 10px 0; margin: 10px 0 4px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
}
.toolbar .searchbox { flex: 1; }
.toolbar .input { min-height: 42px; }
.jump { width: 96px; flex: none; text-align: center; }

.sec-head { margin: 26px 4px 10px; font-size: 15px; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 10px; }
.sec-head::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 10px; margin-top: 10px; scroll-margin-top: 76px; }
.article.is-flash { animation: flash 2.2s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.article--repealed .article__text { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--repealed) 50%, transparent); opacity: .75; }
.article__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.article__title { font-size: 16.5px; font-weight: 700; color: var(--primary); }
.article__num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.article__law { font-size: 13px; color: var(--muted); }
.article__text { font-family: var(--read); font-size: var(--fs); line-height: 2.05; margin-top: 8px; white-space: pre-line; overflow-wrap: anywhere; }
.article__text mark, .snippet mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.article__note { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; white-space: pre-line; }
.article__note b { color: var(--accent); font-size: 12.5px; display: block; }
.amend { margin-top: 10px; border-radius: 10px; background: var(--amended-soft); padding: 2px 12px; }
.amend summary { cursor: pointer; padding: 8px 0; color: var(--amended); font-weight: 600; font-size: 14px; }
.amend__item { font-family: var(--read); font-size: calc(var(--fs) - 2px); line-height: 1.95; white-space: pre-line; padding: 8px 0 10px; border-top: 1px dashed color-mix(in srgb, var(--amended) 30%, transparent); }
.amend__doc { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-family: var(--ui); font-size: 12.5px; color: var(--amended); text-decoration: underline; text-underline-offset: 3px; }
.amend__doc svg.i { width: 13px; height: 13px; }

/* المرجع الرسمي أسفل كل مادة */
.ref { margin-top: 12px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; line-height: 1.8; color: var(--muted); display: grid; gap: 2px; }
.ref b { color: var(--text); font-weight: 600; }
.ref a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 3px; }
.ref svg.i { width: 13px; height: 13px; }
.ref__links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ref__note { font-size: 11.5px; }
.daily .ref { background: rgba(255, 255, 255, .1); color: rgba(243, 247, 245, .85); position: relative; z-index: 1; }
.daily .ref b { color: #fff; }
.daily .ref a { color: #f1d697; }

.disclaimer-text { font-size: 14.5px; line-height: 2; }
.disclaimer-text p { margin: 0 0 10px; }

.article__actions { display: flex; gap: 2px; margin-top: 8px; margin-inline-start: -8px; flex-wrap: wrap; }
.act { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted); padding: 7px 9px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.act:hover { background: var(--surface-2); color: var(--text); }
.act.is-on { color: var(--accent); }
.act.is-on svg.i { fill: currentColor; }
.act svg.i { width: 18px; height: 18px; }
@media (max-width: 480px) { .act span { display: none; } .act { padding: 8px 10px; } }

/* ------------------------------------------------ search */
.result { display: block; color: var(--text); padding: 14px 16px; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result:hover { background: var(--surface-2); }
.result__head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.result__title { font-weight: 700; color: var(--primary); }
.result__law { color: var(--muted); font-size: 13px; }
.snippet { font-family: var(--read); line-height: 1.95; margin-top: 4px; font-size: 15.5px; color: var(--text); }
.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty svg.i { width: 40px; height: 40px; stroke-width: 1.4; margin-bottom: 8px; color: var(--border); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }

/* ------------------------------------------------ review / quiz */
.flash-card { min-height: 280px; display: flex; flex-direction: column; }
.flash-card .q { font-size: 14px; color: var(--muted); }
.flash-card h2 { font-size: 22px; margin-top: 4px; color: var(--primary); }
.flash-card .article__text { flex: 1; }
.cloze { display: inline-block; min-width: 3.2em; border-bottom: 2px solid var(--accent); color: transparent; cursor: pointer; line-height: 1.2; user-select: none; }
.cloze.is-shown { color: var(--accent); }
.grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.grade .btn { flex-direction: column; gap: 0; min-height: 56px; }
.grade .btn small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.btn--again { border-color: color-mix(in srgb, var(--repealed) 40%, var(--border)); color: var(--repealed); }
.btn--hard { border-color: color-mix(in srgb, var(--amended) 40%, var(--border)); color: var(--amended); }
.btn--good { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); color: var(--primary); }
.options { display: grid; gap: 8px; margin-top: 14px; }
.option { text-align: start; justify-content: flex-start; white-space: normal; font-weight: 500; }
.option.is-right { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.option.is-wrong { background: var(--repealed-soft); border-color: var(--repealed); color: var(--repealed); }
.boxes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.boxes div { text-align: center; padding: 8px 4px; border-radius: 10px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.boxes b { display: block; font-size: 18px; color: var(--text); }

/* ------------------------------------------------ settings */
.setting { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting__body { flex: 1; min-width: 0; }
.setting__body b { display: block; font-weight: 600; }
.setting__body span { display: block; color: var(--muted); font-size: 13px; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--border); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(-20px); }
.switch input:focus-visible + i { outline: 2px solid var(--primary); outline-offset: 2px; }
.checklist { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px 12px; margin-top: 10px; }
.checklist label { display: flex; gap: 10px; align-items: center; padding: 7px 0; font-size: 14.5px; cursor: pointer; }
.checklist input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
input[type="range"] { accent-color: var(--primary); width: 100%; }
input[type="time"].input { width: 130px; min-height: 40px; text-align: center; }
.note-box { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--muted); line-height: 1.8; }
.note-box b { color: var(--text); }
.disclaimer { margin-top: 30px; font-size: 12.5px; color: var(--muted); text-align: center; line-height: 1.8; }

/* ------------------------------------------------ dialog, toast */
.dialog { border: 0; border-radius: 18px; padding: 0; width: min(560px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.dialog::backdrop { background: rgba(10, 16, 14, .5); backdrop-filter: blur(2px); }
.dialog__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dialog__head h2 { flex: 1; font-size: 17px; }
.dialog__body { padding: 16px; max-height: min(70vh, 640px); overflow: auto; }
.dialog__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); }
.toc a { display: block; padding: 9px 4px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 14.5px; }
.toc a small { color: var(--muted); margin-inline-start: 6px; }
.toast {
  position: fixed; z-index: 60; inset-inline: 0; margin: 0 auto; width: max-content; max-width: calc(100vw - 32px);
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: 14px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s;
}
.toast.is-on { opacity: 1; transform: none; }
@media (min-width: 900px) { .toast { bottom: 24px; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .nav, .toolbar, .article__actions, .topbar .icon-btn { display: none !important; }
  body { padding: 0; background: #fff; }
  .article { box-shadow: none; break-inside: avoid; }
}

/* ---------------------------------------------- هوية مكتب المحامي مشعل النفيعي */
.nav__brand b, .brand-head b { font-family: "Amiri", var(--read); font-size: 1.25em; color: var(--primary); }
.nav__brand img, .brand-head img { object-fit: contain; }
.office { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; border-radius: 18px;
  background: linear-gradient(150deg, #1f1b13, #0b0a08); border: 1px solid rgba(216, 178, 90, .3); color: #ece4d0; }
.office img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.office__txt { flex: 1 1 200px; min-width: 0; }
.office__txt b { display: block; font-family: "Amiri", var(--read); font-size: 19px; color: #f2d891; }
.office__txt span { font-size: 13.5px; color: #b8ae98; }
.office__act { display: flex; gap: 8px; flex-wrap: wrap; }
.office .btn { min-height: 38px; }
.office .btn--gold { background: linear-gradient(135deg, #f4dc97, #d8b25a 45%, #a07a32); border-color: transparent; color: #1b1408; }
.office .btn--line { background: rgba(255, 255, 255, .05); border-color: rgba(216, 178, 90, .35); color: #f2d891; }
.office { margin-bottom: 16px; }
