/* =============================================================
   محمد محيي - منصة القضايا والوثائق القانونية
   نظام تصميم: ورق دافئ + حبر كحلي واحد + حدود هادئة وظلال خفيفة.
   قواعد ثابتة: لا تدرجات لونية على الأزرار، أيقونات SVG فقط،
   تباين عال، واحترام prefers-reduced-motion.
   ============================================================= */

:root {
  /* ألوان الورق والحبر */
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #26231f;
  --muted: #605c56;
  --faint: #a19c94;
  --border: rgba(38, 35, 31, 0.12);
  --border-strong: rgba(38, 35, 31, 0.20);

  /* لون مميز واحد: كحلي قانوني */
  --accent: #1f3d7a;
  --accent-strong: #17305e;
  --accent-soft: #eef2fa;

  /* ذهبي للتفاصيل الوثائقية فقط */
  --gold: #b08a3e;
  --gold-ink: #8a6b28;

  --ok: #15803d;
  --err: #b3261e;
  --warn-bg: #fdf7ea;
  --warn-border: #eedaab;

  /* أنصاف الأقطار: 6 للشرائح، 8 للعناصر التفاعلية، 14 للأسطح */
  --r-chip: 6px;
  --r-ctl: 8px;
  --r-card: 14px;

  /* ظلال هادئة متعددة الطبقات */
  --sh-1: 0 1px 2px rgba(38, 35, 31, 0.04), 0 1px 3px rgba(38, 35, 31, 0.03);
  --sh-2: 0 1px 2px rgba(38, 35, 31, 0.03), 0 6px 18px rgba(38, 35, 31, 0.05);
  --sh-3: 0 2px 4px rgba(38, 35, 31, 0.05), 0 16px 44px rgba(38, 35, 31, 0.13);

  --font-ui: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-display: "Noto Naskh Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16.5px;
  line-height: 1.85;
  -webkit-text-size-adjust: 100%;
}

body { padding: 0 16px 56px; }
body.modal-open { overflow: hidden; }

::selection { background: #f3e6c2; color: #3d2f0a; }

/* ===== الترويسة ===== */
header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -16px 16px;
  background: rgba(252, 251, 249, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.hdr-inner {
  max-width: 1012px;
  margin: 0 auto;
  padding: 11px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hdr-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.logo {
  width: 42px;
  height: 42px;
  border-radius: var(--r-ctl);
  background: var(--accent);
  color: #ecdcb4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
}
.logo svg { width: 23px; height: 23px; }
h1 { margin: 0; font-family: var(--font-display); font-size: 20.5px; font-weight: 700; letter-spacing: 0.1px; }
.sub { margin: 0; color: var(--gold-ink); font-size: 12.5px; font-weight: 600; }
h2 { margin: 0 0 10px; font-size: 18px; font-family: var(--font-display); font-weight: 700; }

.pill {
  background: var(--warn-bg);
  color: #7a5312;
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 3px 11px;
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 6px;
  box-shadow: var(--sh-1);
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.u-name {
  font-weight: 700;
  font-size: 14.5px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#btnSwitchUser { border: 0; background: transparent; color: var(--accent); padding: 4px 8px; }
#btnSwitchUser:hover { background: var(--accent-soft); }

main, footer { max-width: 1012px; margin: 0 auto; }
footer { padding-top: 18px; }
footer p { text-align: center; font-size: 13px; margin: 6px 0; }
.foot-brand {
  font-size: 12.5px !important;
  color: var(--faint);
  letter-spacing: 0.3px;
  user-select: none;
}
.foot-dot { color: var(--gold); }

/* ===== البطاقات ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px 20px;
  margin: 14px 0;
  box-shadow: var(--sh-2);
  scroll-margin-top: 96px;
}

.card h2 { display: inline-flex; align-items: center; gap: 9px; }
.card h2::before {
  content: "";
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--accent);
  flex: 0 0 auto;
  opacity: 0.85;
}

.hidden { display: none !important; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row + .row { margin-top: 8px; }
.head-ltr { direction: ltr; }

.card-hint { margin: 0 0 10px; }

/* ===== الحقول والأزرار ===== */
.field { display: block; margin: 12px 0; font-weight: 600; }
.field select, .field input { width: 100%; margin-top: 6px; }
.field .row select { flex: 1; width: auto; }

input[type="password"], input[type="text"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-ctl);
  padding: 10px 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input[type="password"]:focus, input[type="text"]:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 61, 122, 0.14);
}
input::placeholder, textarea::placeholder { color: var(--faint); }

textarea {
  width: 100%;
  resize: vertical;
  min-height: 170px;
  line-height: 1.9;
  margin-bottom: 10px;
  text-align: right;
}

select { cursor: pointer; }

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.14s ease;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 11px 22px;
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: 0.6; cursor: wait; }
button.primary.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  margin-inline-end: 9px;
  vertical-align: -2px;
  animation: qa-spin 0.8s linear infinite;
}
@keyframes qa-spin { to { transform: rotate(360deg); } }

button.big { width: 100%; font-size: 18px; padding: 13px; margin-top: 6px; }

button.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
  padding: 9px 16px;
}
button.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
button.ghost:disabled { opacity: 0.45; cursor: default; border-color: var(--border); color: var(--faint); }
button.small { padding: 6px 12px; font-size: 14px; }
button.ghost.danger { color: var(--err); }
button.ghost.danger:hover { border-color: var(--err); color: var(--err); background: #fdf1f0; }

button:focus-visible, .filebtn:focus-within, summary:focus-visible, .linkbtn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.linkbtn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 6px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--accent); }

.filebtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px dashed var(--faint);
  border-radius: var(--r-ctl);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 15px;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.filebtn:hover { border-color: var(--accent); color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.muted { color: var(--muted); font-size: 14px; }
.status { margin-top: 8px; min-height: 22px; font-size: 15px; }
.status.err, .err { color: var(--err) !important; }

/* ===== عرض الملخص والترجمة ===== */
.out {
  line-height: 2;
  font-size: 16.5px;
  word-break: break-word;
}
.out p { margin: 0 0 10px; }
.out h2.out-h2 { font-size: 19px; margin: 4px 0 10px; font-family: var(--font-display); }
.out h3 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 18px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e6ddc8;
  color: var(--accent);
}
.out ul, .out ol { margin: 0 0 12px; padding-right: 24px; }
.out ul { list-style: disc; }
.out ol { list-style: decimal; }
.out li { margin: 0 0 7px; }
.out strong { font-weight: 700; }
.out em { font-style: italic; }
.out code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 14.5px; }
.out hr.out-hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* أرقام المصادر */
.cite {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  vertical-align: super;
  line-height: 1;
  background: var(--accent-soft);
  color: var(--accent);
  border: 0;
  border-radius: 999px;
  padding: 1px 7px;
  margin-inline-start: 5px;
  cursor: pointer;
}
.cite:hover { background: #e0e8f7; }

.cite-hint { margin: 0 0 12px; }

.bubble {
  display: block;
  margin: 6px 0 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-right: 3px solid var(--accent);
  border-radius: var(--r-ctl);
  font-size: 14.5px;
  line-height: 1.85;
  color: #4b463f;
}
.bubble-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 2px; }

/* النص الأصلي */
#sourceCard h2 { margin-bottom: 6px; }
.srctext {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.95;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  font-size: 15.5px;
}
mark.hl { background: #fdeeb5; border-radius: 4px; padding: 0 2px; }
mark.hl.flash { animation: hlflash 1.1s ease 2; }
@keyframes hlflash {
  0%, 100% { background: #fdeeb5; box-shadow: none; }
  50% { background: #f8dd83; box-shadow: 0 0 0 3px #fdeeb5; }
}
.srcpdf { width: 100%; height: 520px; border: 1px solid var(--border); border-radius: var(--r-ctl); background: #fff; }
.srcpdf-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-ctl);
  padding: 14px 16px;
}
.srcpdf-note svg { width: 22px; height: 22px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.srcpdf-note div { display: flex; flex-direction: column; gap: 3px; }
.srcpdf-note b { font-size: 15px; }
.srcpdf-note span { color: var(--muted); font-size: 13.5px; line-height: 1.8; }
.srcimg { max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-ctl); }

/* ===== مركز التحميل ===== */
.dl-hint { margin: 0 0 8px; }
.dl-list { display: flex; flex-direction: column; }
.dl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-ctl);
  flex-wrap: wrap;
  transition: background 0.18s ease;
}
.dl-row:hover { background: var(--surface-2); }
.dl-row:last-child { border-bottom: 0; }
.dl-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dl-name { font-weight: 700; font-size: 15.5px; }
.dl-sub { color: var(--muted); font-size: 13px; line-height: 1.7; }
.dl-acts { display: flex; gap: 8px; }

/* ===== العارض الكبير ===== */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(28, 26, 23, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.viewer-panel {
  background: var(--surface);
  border-radius: var(--r-card);
  width: min(1150px, 100%);
  height: min(92vh, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 14, 12, 0.45);
}
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.vw-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vw-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vw-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vw-group { display: flex; align-items: center; gap: 6px; }
.vw-page { font-size: 14px; color: var(--muted); min-width: 96px; text-align: center; }
.viewer-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  text-align: center;
  background: #efece6;
}
.vw-stage {
  position: relative;
  display: inline-block;
  background: #fff;
  box-shadow: 0 2px 14px rgba(38, 35, 31, 0.18);
  border-radius: 4px;
}
.vwcv { display: block; border-radius: 4px; }
.vwhl {
  position: absolute;
  background: rgba(255, 214, 10, 0.32);
  border: 1px solid rgba(217, 165, 0, 0.65);
  border-radius: 4px;
  pointer-events: none;
}
.vwimg { max-width: 100%; border-radius: 8px; }
.viewer-quote {
  padding: 10px 14px;
  background: #fdf8e7;
  border-top: 1px solid #efe2b8;
  font-size: 14.5px;
  line-height: 1.8;
  color: #4d3f12;
}
.viewer-note {
  padding: 8px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}

/* ===== السجل ===== */
#historyList { list-style: none; margin: 0; padding: 0; }
#historyList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
}
#historyList li:last-child { border-bottom: 0; }
#historyList button.link {
  background: none;
  border: 0;
  color: var(--accent);
  text-align: right;
  padding: 0;
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 7px; }
summary::-webkit-details-marker { display: none; }
summary::before { content: "\25B8"; color: var(--gold); transition: transform 0.18s ease; display: inline-block; }
details[open] summary::before { transform: rotate(90deg); }
details ol { margin: 8px 0 0; padding-right: 20px; }

/* ===== وضع المدير والإعدادات ===== */
.settings-actions { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 12px; }
.key-note { margin: -4px 0 10px; }
#modelSel { text-align: right; }

.admin-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--r-ctl);
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.8;
  color: #6d4a0f;
}

.set-h3 {
  margin: 22px 0 6px;
  font-family: var(--font-display);
  font-size: 17px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.set-note { margin: 0 0 10px; }
.users-admin { display: flex; flex-direction: column; }
.ua-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
}
.ua-row:last-child { border-bottom: 0; }
.ua-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ua-name { font-weight: 700; font-size: 15px; }
.ua-meta { color: var(--muted); font-size: 12.5px; }
.add-user { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border-strong); }

/* ===== شاشة الدخول ===== */
.login {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  overflow: auto;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--sh-3);
  width: min(440px, 100%);
  padding: 26px 24px 18px;
  margin: auto;
}
.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: var(--accent);
  color: #ecdcb4;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.login-logo svg { width: 32px; height: 32px; }
.login h2 { text-align: center; margin: 0 0 2px; font-size: 22px; font-family: var(--font-display); }
.login-brand {
  text-align: center;
  color: var(--gold-ink);
  font-weight: 600;
  font-size: 13.5px;
  margin: 0 0 10px;
  letter-spacing: 0.3px;
}
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 16px; line-height: 1.85; text-wrap: balance; }
.login-users { display: flex; flex-direction: column; gap: 8px; }
.login-user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-ctl);
  padding: 10px 12px;
  font-size: 15.5px;
  font-weight: 600;
  text-align: right;
  color: var(--ink);
}
.login-user:hover { border-color: var(--accent); background: var(--surface); }
.lu-name { flex: 1; text-align: right; }
.lu-lock { font-size: 12px; color: var(--muted); font-weight: 600; }
.lu-chev { width: 15px; height: 15px; color: var(--faint); flex: 0 0 auto; }
.login-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0;
}
.login-sep::before, .login-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-msg { margin-top: 10px; font-size: 14px; min-height: 20px; color: var(--muted); }
.login-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); text-align: center; }
.login-empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.9;
  padding: 14px 16px;
  text-align: center;
  margin-bottom: 8px;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .field { margin: 0; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-left: 46px; }
.pw-eye {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  padding: 0;
}
.pw-eye:hover { color: var(--ink); background: var(--surface-2); }
.pw-eye svg { width: 19px; height: 19px; }
.pw-eye .ic-off { display: none; }
.pw-eye.on .ic-on { display: none; }
.pw-eye.on .ic-off { display: block; }
.ua-row { flex-wrap: wrap; }
.ua-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.ua-reset { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; margin-top: 8px; }
.ua-reset input { flex: 1 1 170px; min-width: 120px; }
.gate-card { width: min(400px, 100%); }

/* ===== الطباعة ===== */
.print-root { display: none; }

@media print {
  @page {
    size: A4;
    margin: 16mm 15mm 19mm;
    @bottom-center {
      content: counter(page) " / " counter(pages);
      font-family: "Noto Naskh Arabic", serif;
      font-size: 9pt;
      color: #6b665f;
    }
  }
  html, body { background: #fff !important; padding: 0; margin: 0; font-size: 11.5pt; }
  body > *:not(.print-root) { display: none !important; }
  .print-root {
    display: block !important;
    color: #17140f;
    font-family: "Noto Naskh Arabic", "Noto Sans Arabic", serif;
    font-size: 11.5pt;
    line-height: 1.95;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .print-root .pr-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8mm;
  }
  .print-root .pr-head-id { text-align: start; }
  .print-root .pr-brand {
    font-family: "Noto Naskh Arabic", serif;
    font-size: 16pt;
    font-weight: 700;
    color: #1f3d7a;
    margin: 0 0 0.6mm;
  }
  .print-root .pr-tag {
    font-size: 9.5pt;
    color: #6d4a0f;
    margin: 0;
    letter-spacing: 0.4px;
  }
  .print-root .pr-head-date {
    font-size: 10pt;
    color: #605c56;
    text-align: end;
    white-space: nowrap;
    padding-bottom: 0.4mm;
  }
  .print-root .pr-rule {
    height: 1.6mm;
    border-top: 2.2pt solid #1f3d7a;
    border-bottom: 1pt solid #b08a3e;
    margin: 2.8mm 0 5mm;
  }
  .print-root .pr-title {
    font-family: "Noto Naskh Arabic", serif;
    font-size: 16.5pt;
    font-weight: 700;
    color: #17140f;
    margin: 0 0 1.5mm;
    text-align: center;
  }
  .print-root .pr-meta {
    font-size: 10pt;
    color: #605c56;
    margin: 0 0 7mm;
    text-align: center;
  }
  .print-root .pr-h3 {
    font-family: "Noto Naskh Arabic", serif;
    font-size: 14.5pt;
    font-weight: 700;
    color: #1f3d7a;
    margin: 7mm 0 3mm;
    padding-bottom: 1.5mm;
    border-bottom: 1.2pt solid #d9c9a3;
    page-break-after: avoid;
  }
  .print-root .pr-h4 { font-size: 12.5pt; font-weight: 700; color: #33302a; margin: 5mm 0 2mm; page-break-after: avoid; }
  .print-root .pr-h5 { font-size: 11.5pt; font-weight: 700; color: #4b463f; margin: 6mm 0 2mm; page-break-after: avoid; }
  .print-root .pr-p { margin: 0 0 2.6mm; text-align: justify; }
  .print-root .pr-li {
    margin: 0 0 2.2mm;
    padding-inline-start: 6mm;
    text-indent: -6mm;
    text-align: justify;
    page-break-inside: avoid;
  }
  .print-root .pr-b { font-weight: 700; margin-inline-end: 1.6mm; }
  .print-root .pr-ref {
    margin: 0 0 2mm;
    padding-inline-start: 6mm;
    text-indent: -6mm;
    font-size: 10.5pt;
    color: #33302a;
    page-break-inside: avoid;
  }
  .print-root .pr-rn { font-weight: 700; color: #1f3d7a; }
  .print-root .pr-rpg { color: #605c56; font-size: 9.5pt; }
  .print-root .pr-sep { border: 0; border-top: 0.8pt solid #cfc9c0; margin: 6mm 0; }
  .print-root .pr-newpage { page-break-before: always; }
  .print-root.pr-ltr { direction: ltr; font-family: "Times New Roman", "Tinos", "Liberation Serif", serif; }
  .print-root.pr-ltr .pr-brand,
  .print-root.pr-ltr .pr-title,
  .print-root.pr-ltr .pr-h3 { font-family: "Times New Roman", "Tinos", "Liberation Serif", serif; }
  .print-root sup.refn { font-size: 0.72em; }
}

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

@media (max-width: 700px) {
  body { font-size: 16px; }
  h1 { font-size: 19px; }
  .sub { font-size: 12px; }
  .logo { width: 40px; height: 40px; }
  .logo svg { width: 21px; height: 21px; }
  .u-name { display: none; }
  .card { scroll-margin-top: 88px; }
  .srcpdf { height: 380px; }
  .viewer { padding: 0; }
  .viewer-panel { border-radius: 0; height: 100%; width: 100%; }
  .vw-title { max-width: 150px; }
  .vw-page { min-width: 74px; }
  .login-card { padding: 22px 18px 16px; }
  .dl-acts { width: 100%; justify-content: flex-start; }
  .card { padding: 16px 15px; }
  .cite { padding: 2px 9px; }
  button.ghost.small { padding: 8px 14px; }
}

/* ===== إضافات: التحقق من الاقتباسات، الإرفاق، التثبيت ===== */
.filebtn svg { width: 15px; height: 15px; }
.filebtn.cam { display: none; }
@media (pointer: coarse) { .filebtn.cam { display: inline-flex; } }
.card.drop { outline: 2px dashed var(--accent); outline-offset: -8px; }

button.cite.cite-v { background: #e3efe6; color: #1f6a43; }
button.cite.cite-w { background: #fbeedd; color: #8a4b10; box-shadow: inset 0 0 0 1px #e2b57c; }
.checkline { margin: 10px 0 0; font-size: 13.5px; }
.checkline.warn { color: var(--gold-2); }

.attach-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.fileinfo { margin: 8px 0 0; font-size: 13.5px; }
.fileinfo:empty { display: none; }

/* ===== شريط التحديث ورقم الإصدار ===== */
.updbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 6000;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: var(--accent, #1f3d7a);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 14px;
  cursor: pointer;
  box-shadow: 0 -6px 18px rgba(15, 23, 42, 0.18);
}
.ver-line { font-size: 12.5px; margin-top: 6px; }

/* نقاط بدون اقتباس من النص الأصلي */
#summaryOut li.li-noq { border-inline-start: 3px solid #d9a94e; padding-inline-start: 9px; }

/* ==== البحث القانوني ==== */
#lawQuery { width: 100%; margin-top: 2px; }
.law-srcs { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.law-src { display: block; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.law-src:hover { border-color: var(--accent); background: var(--surface-2); }
.law-src b { display: block; font-size: 14.5px; color: var(--ink); font-weight: 600; }
.law-src-h { margin: 14px 0 6px; font-size: 14px; }
.law-note { margin: 12px 0 0; font-size: 13px; line-height: 1.8; }
.law-note a { color: var(--accent); }

/* شرائح تخصيص الأحكام */
.law-chips-h { margin: 12px 0 6px; font-size: 13px; }
.law-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 13.5px; color: var(--muted); cursor: pointer; font-family: inherit; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { border-color: var(--accent); color: var(--accent); background: rgba(31, 61, 122, 0.07); font-weight: 600; }
