/* ══════════════════════════════════════════════════════════════
   خدمات رمز QR — بهوية وزارة التعليم 2025
   الرموز منقولة من «المدرسة المتكاملة» (src/styles/tokens.css) بالقيم نفسها.
   ══════════════════════════════════════════════════════════════ */
@font-face { font-family: 'HNW23'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/HNW23-Regular.woff2') format('woff2'); }
@font-face { font-family: 'HNW23'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/HNW23-Bold.woff2') format('woff2'); }

:root {
  --font: 'HNW23', 'Segoe UI', Tahoma, sans-serif;
  --navy: #12293A; --navy-2: #15445A;
  --teal: #0DA9A6; --teal-ink: #066361; --cyan: #69CEE3;
  --green: #07A869; --green-ink: #056B43;
  --gold: #C9B27C; --gold-ink: #7D6636;
  --amber-ink: #A06A12; --red: #C8483F; --red-ink: #9B2F28;
  --ink: #23404F; --heading: #12293A; --muted: #5A7280; --soft: #8AA0AD;
  --bg: #F3F5F7; --surface: #FFFFFF; --panel: #F4F7F8;
  --line: #E4E9ED; --line-strong: #D3DCE2;
  --fill-ok: #E3F5EC; --fill-warn: #FAF0DC; --fill-bad: #FAE7E5; --tint-teal: #E6F6F5; --tint-navy: #E7ECF0;
  --shadow: 0 1px 2px rgba(18, 41, 58, .04), 0 1px 3px rgba(18, 41, 58, .06);
  --shadow-soft: 0 1px 2px rgba(18, 41, 58, .04), 0 8px 24px rgba(18, 41, 58, .06);
  --shadow-lift: 0 14px 34px rgba(18, 41, 58, .12);
  --accent-bar: linear-gradient(to left, var(--teal), var(--cyan), var(--gold));
  --focus-ring: rgba(13, 169, 166, .28);
  --tap: 44px;
  --radius: 14px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0D1F2D; --surface: #12293A; --panel: #163346;
  --line: #234156; --line-strong: #2F5A76;
  --ink: #E6F1F5; --heading: #F2F8FB; --muted: #9FBACB; --soft: #7B98AA;
  --teal-ink: #4FC8C5; --green-ink: #45C88C; --gold-ink: #D9C592; --amber-ink: #E0A845; --red-ink: #E88B84;
  --fill-ok: #133A2C; --fill-warn: #3A2F18; --fill-bad: #3E2220; --tint-teal: #123F45; --tint-navy: #1B3A4E;
  --shadow: 0 2px 14px rgba(0, 0, 0, .35); --shadow-soft: 0 10px 30px rgba(0, 0, 0, .3); --shadow-lift: 0 14px 34px rgba(0, 0, 0, .45);
  --focus-ring: rgba(79, 200, 197, .3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.65; }
h1, h2, h3 { color: var(--heading); line-height: 1.35; margin: 0; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
code { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: .9em; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; }

/* أيقونات خطّية */
.ic { display: inline-flex; flex: none; width: 1.25em; height: 1.25em; }
.ic svg { width: 100%; height: 100%; }

/* ── الترويسة ── */
/* الشعار والأزرار أعلى الشريط الكحلي نفسه بلا فاصل، والعنوان في وسطه: الشعار أبيض والنصوص فاتحة */
.topbar { position: relative; z-index: 1; }
.topbar.wrap { max-width: 1440px; }
.topbar .brand .brand-org { white-space: nowrap; }
.topbar-in { display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 560px) minmax(max-content, 1fr); align-items: center; gap: 24px; padding-block: 26px 34px; }
.hero-brand { display: flex; align-items: center; gap: 16px; justify-self: start; }
.topbar-in { position: relative; }
.hero-actions { justify-self: end; padding-inline-end: 64px; } /* مكان زرّ الوضع الداكن في الزاوية */
.hero-actions .icon-btn { position: absolute; top: 18px; inset-inline-end: 0; }
.hero-art { width: 150px; height: 150px; color: var(--teal); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); border-radius: 28px; display: grid; place-items: center; }
img.hero-art { width: 128px; height: auto; padding: 0; object-fit: contain; display: block; background: none; border: 0; border-radius: 0; } /* شعار حملة «لا تفتح مجال» مكان صورة الرمز */
.tabs .install-btn { margin-inline-start: auto; align-self: center; flex: none; }
.logo { height: 54px; width: auto; }
:root[data-theme="dark"] .logo { background: #fff; border-radius: 10px; padding: 4px 8px; }
.brand { display: flex; flex-direction: column; border-inline-start: 2px solid var(--line); padding-inline-start: 16px; }
.brand strong { color: var(--heading); font-size: 19px; }
.brand span { color: var(--muted); font-size: 13px; }
.brand .brand-org { color: var(--teal-ink); font-size: 12.5px; font-weight: 700; }
.icon-btn { margin-inline-start: auto; width: var(--tap); height: var(--tap); border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--heading); cursor: pointer; display: grid; place-items: center; }
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--panel); }
.accent-bar { height: 4px; background: var(--accent-bar); }
.topbar .logo { height: 84px; filter: brightness(0) invert(1); background: none !important; padding: 0 !important; }
.topbar .brand { gap: 4px; line-height: 1.35; padding-inline-start: 18px; border-inline-start-color: rgba(255, 255, 255, .22); }
.topbar .brand .brand-org { color: #fff; font-size: 16px; font-weight: 700; }
.topbar .brand strong { color: var(--cyan); font-size: 14px; font-weight: 500; }
.topbar .icon-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .28); color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .16); }
.campaign-logo { border-radius: 14px; flex: none; }

/* ── الواجهة ── */
.hero { background: var(--navy); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(105, 206, 227, .22) 1.6px, transparent 1.7px); background-size: 22px 22px; mask-image: linear-gradient(to left, #000, transparent 70%); -webkit-mask-image: linear-gradient(to left, #000, transparent 70%); }
.hero-main { text-align: center; }
.hero h1 { color: #fff; font-size: 27px; }
.hero p { color: #C9DCE6; font-size: 17px; max-width: 640px; margin: 10px auto 0; }
.hero-points { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.hero-points li { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.hero-points .ic { color: var(--cyan); }

/* ── التبويبات ── */
.tabs-wrap { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 56px; padding: 0 18px; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.tab:hover { color: var(--heading); }
.tab[aria-selected="true"] { color: var(--heading); border-bottom-color: var(--teal); }
.tab[aria-selected="true"] .ic { color: var(--teal-ink); }
:root[data-ext="1"] .tab[data-tab="ext"] { display: none; }

main { padding-block: 28px 48px; }
.sec-title { font-size: 19px; margin-bottom: 12px; }

/* ── شبكة الخدمات ── */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 10px; margin-bottom: 22px; }
.svc { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: start; padding: 14px; min-height: 104px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
.svc:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); border-color: var(--line-strong); }
.svc .ic { width: 28px; height: 28px; color: var(--teal-ink); }
.svc b { color: var(--heading); font-size: 15px; }
.svc small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.svc[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); }
.svc[aria-pressed="true"] b { color: #fff; }
.svc[aria-pressed="true"] small { color: #C9DCE6; }
.svc[aria-pressed="true"] .ic { color: var(--cyan); }
/* في الداكن البطاقات كحليّة أصلاً — فالمختارة تُميَّز بالتركوازي */
:root[data-theme="dark"] .svc[aria-pressed="true"] { background: var(--tint-teal); border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }

/* ── البطاقات ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; gap: 12px; align-items: center; padding: 18px 20px 0; }
.card-h.sub { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 18px; }
.card-h h2 { font-size: 19px; }
.card-h p { color: var(--muted); font-size: 14px; }
.card-ic { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--tint-teal); color: var(--teal-ink); display: grid; place-items: center; }
.card-ic .ic { width: 24px; height: 24px; }
.card-b { padding: 18px 20px 20px; }

.create-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ── النماذج ── */
.qf { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.qf-row { display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.qf-wide { grid-column: 1 / -1; }
.qf-pair { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.qf-pair > .btn { flex: 1 1 160px; }
.qf-map-wrap { position: relative; height: 320px; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--panel); }
.qf-map { position: absolute; inset: 0; font: inherit; z-index: 0; }
.qf-map-note { position: absolute; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; text-align: center; background: var(--panel); color: var(--muted); font-weight: 700; pointer-events: none; }
.qf-map .leaflet-control-attribution { font-size: 10px; }
/* شقوق بيضاء بين المربعات عند تكبير المتصفح أو شاشات بنسبة بكسل كسرية: الجمع اللوني يُكمل حافتي المربعين المتجاورين (ولا يُجمع مع تكبير المربع نصف بكسل — يصير التداخل خطاً فاتحاً) */
.qf-map .leaflet-tile { mix-blend-mode: plus-lighter; }
/* شريط البحث فوق الخريطة — يمين الخريطة، ويترك أزرار التكبير يساراً */
.qf-map-search { position: absolute; z-index: 700; top: 10px; right: 10px; left: 56px; }
.qf-map-search > .ic { position: absolute; top: 11px; right: 11px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.qf-map-search .qf-map-q { width: 100%; height: 40px; padding: 0 38px 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 2px 10px rgba(18, 41, 58, .18); }
.qf-map-list { list-style: none; margin: 4px 0 0; padding: 4px; max-height: 200px; overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 6px 18px rgba(18, 41, 58, .2); }
.qf-map-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1.5; }
.qf-map-list li:hover, .qf-map-list li.on { background: var(--panel); }
.qf-map-list .qf-map-msg { cursor: default; color: var(--muted); }
.qf-map-list .qf-map-msg:hover { background: none; }
/* القطرة تُدوَّر في عنصرٍ داخلي: تدوير .qf-pin نفسه يُدوِّر إزاحة Leaflet (transform) فتنحرف العلامة عن موضعها */
.qf-pin { background: none; border: 0; }
.qf-pin i { display: block; width: 100%; height: 100%; box-sizing: border-box; background: var(--teal-ink); border: 3px solid #fff; border-radius: 50% 50% 50% 0; rotate: -45deg; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.qf-row label, .d-lab { font-weight: 700; color: var(--heading); font-size: 14px; }
.qf-hint { color: var(--muted); font-size: 12.5px; }
.qf-hint.is-ok { color: var(--green-ink); font-weight: 700; }
.qf-hint.is-err { color: var(--red-ink); font-weight: 700; }
.qf-hint .link-btn { color: var(--teal-ink); font-weight: 700; min-height: 0; padding: 0; text-decoration: underline; }
.qf-shorten .btn { align-self: flex-start; }
.qf-hint bdi { word-break: break-all; }
input[type="text"], input[type="url"], input[type="email"], input[type="tel"], input[type="password"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 9px 12px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink);
}
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--soft); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--focus-ring); }
.qf-eye { position: absolute; inset-inline-end: 6px; bottom: 6px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--panel); color: var(--teal-ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.qf-check { display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; font-weight: 700; color: var(--heading); font-size: 14px; }
.qf-check input { width: 20px; height: 20px; accent-color: var(--teal); }

/* ── التصميم ── */
.design { display: flex; flex-direction: column; gap: 16px; }
.d-row { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* الحقلان الثانيان (لون الخلفية والإطار) في عمودٍ واحد يبدأ من الموضع نفسه */
.design:has(.d-pair) { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 16px 64px; align-items: start; }
.design:has(.d-pair) > :not(.d-pair) { grid-column: 1 / -1; }
.d-pair { display: contents; }
.d-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.d-note { color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 14px; }
.seg button:hover { background: var(--panel); }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #06222A; }
.sym-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; margin-top: 10px; }
.sym-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--heading); cursor: pointer; }
.sym-grid button:hover { background: var(--panel); }
.sym-grid button .ic { width: 26px; height: 26px; }
.sym-grid button small { font-size: 11.5px; color: var(--muted); line-height: 1.3; text-align: center; }
.sym-grid button[aria-pressed="true"] { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); background: var(--panel); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sw { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.sw[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--teal); }
input[type="color"] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
input[type="range"] { accent-color: var(--teal); min-height: 32px; }
output { color: var(--teal-ink); font-weight: 700; }

/* ── المعاينة ── */
.preview { position: sticky; top: 76px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.pv-stage { position: relative; display: grid; place-items: center; min-height: 300px; padding: 18px; border-radius: 12px; background: var(--panel); background-image: linear-gradient(45deg, var(--line) 25%, transparent 25%), linear-gradient(-45deg, var(--line) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--line) 75%), linear-gradient(-45deg, transparent 75%, var(--line) 75%); background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; }
.pv-stage canvas { width: 100%; max-width: 300px; height: auto; border-radius: 6px; box-shadow: var(--shadow-soft); background: #fff; }
.pv-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: var(--muted); font-weight: 700; background: var(--panel); border-radius: 12px; }
.pv-empty:empty { display: none; }
.pv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pv-actions .btn-share { grid-column: 1 / -1; }
.pv-sign { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 10px; }
.pv-sign[open] { background: var(--panel); }
.pv-sign summary { cursor: pointer; color: var(--teal-ink); font-weight: 700; font-size: 14px; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.pv-sign .btn { width: 100%; }
.install-btn { margin-inline-start: auto; }
.install-btn:not([hidden]) + .icon-btn { margin-inline-start: 0; }
.install-sm { display: none; }
@media screen and (max-width: 480px) { .install-lg { display: none; } .install-sm { display: inline; } }
.pv-content summary { cursor: pointer; color: var(--teal-ink); font-weight: 700; font-size: 14px; min-height: 32px; }
.pv-content pre { margin: 8px 0 0; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; white-space: pre-wrap; word-break: break-all; font-size: 12.5px; max-height: 180px; overflow: auto; }

.status { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; border-radius: 10px; padding: 10px 12px; }
.status:empty { display: none; }
.status.ok { background: var(--fill-ok); color: var(--green-ink); }
.status.warn { background: var(--fill-warn); color: var(--amber-ink); }
.status.bad { background: var(--fill-bad); color: var(--red-ink); }
.status .ic { margin-top: 2px; }

.history { border-top: 1px solid var(--line); padding-top: 12px; }
.history-h { display: flex; justify-content: space-between; align-items: center; color: var(--heading); font-weight: 700; font-size: 14px; }
.history-h > span { display: inline-flex; gap: 6px; align-items: center; }
.history ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.history li button { width: 100%; display: flex; gap: 8px; align-items: center; text-align: start; min-height: 40px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--ink); font-size: 14px; }
.history li button:hover { background: var(--panel); }
.history li .ic { color: var(--teal-ink); }
.history li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link-btn { border: 0; background: none; color: var(--red-ink); cursor: pointer; font-size: 13px; min-height: 32px; }

/* ── الأزرار ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--heading); font-weight: 700; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--panel); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
:root[data-theme="dark"] .btn-primary { background: var(--teal); border-color: var(--teal); color: #06222A; }
.btn-ghost { background: var(--tint-teal); border-color: transparent; color: var(--teal-ink); }
.btn-sm { min-height: 40px; font-size: 14px; padding: 0 12px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; margin-top: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

/* ── القراءة ── */
.scan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cam { position: relative; aspect-ratio: 4 / 3; background: #0B1A24; border-radius: 12px; overflow: hidden; }
.cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame { position: absolute; inset: 18%; border: 3px solid rgba(105, 206, 227, .9); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }
.cam-idle { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; color: #9FBACB; background: #0B1A24; }
.cam-idle .ic { width: 48px; height: 48px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-height: 240px; padding: 20px; border: 2px dashed var(--line-strong); border-radius: 12px; cursor: pointer; color: var(--muted); background: var(--panel); transition: border-color .15s, background .15s; }
.drop .ic { width: 40px; height: 40px; color: var(--teal-ink); }
.drop strong { color: var(--heading); font-size: 16px; }
.drop.over { border-color: var(--teal); background: var(--tint-teal); }
.scan-preview { display: block; max-height: 220px; margin: 12px auto 0; border-radius: 10px; border: 1px solid var(--line); }
.result { margin-top: 20px; padding: 20px; }
.result h3 { display: flex; gap: 10px; align-items: center; font-size: 18px; }
.result h3 .ic { color: var(--green-ink); }
.result dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 14px 0 0; }
.result dt { color: var(--muted); font-size: 14px; }
.result dd { margin: 0; font-weight: 700; color: var(--heading); word-break: break-word; }
.result pre { margin: 14px 0 0; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto; font-family: var(--font); }
.result .host { display: inline-block; direction: ltr; background: var(--fill-warn); color: var(--amber-ink); padding: 2px 10px; border-radius: 8px; }

/* ── الإنشاء الجماعي ── */
.short-block .card-b { display: grid; gap: 10px; max-width: 760px; }
.short-block .row { margin-top: 0; }
.short-out { display: grid; gap: 10px; }
.short-out[hidden] { display: none; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: var(--red-ink); }
/* صفحة حذف الرابط المختصر (delete.html) */
a.hero-brand { text-decoration: none; }
.del-page { min-height: 100vh; display: flex; flex-direction: column; }
.del-page main { flex: 1; width: 100%; }
.del-card { max-width: 680px; margin-inline: auto; }
.del-card a { color: var(--teal-ink); font-weight: 700; }
.del-card .card-b { display: grid; gap: 10px; }
.del-info { display: grid; gap: 10px; }
.del-info[hidden] { display: none; }
#shortResult { font-weight: 700; color: var(--teal-ink); }
.batch-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; }
.batch-grid textarea { margin-top: 8px; min-height: 220px; direction: ltr; text-align: right; font-size: 14px; }
.batch-side { display: flex; flex-direction: column; gap: 10px; }
.batch-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 16px; }
.bq { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; font-size: 13px; }
.bq img { width: 100%; height: auto; border-radius: 4px; background: #fff; }
.bq b { display: block; color: var(--heading); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bq.bad { border-color: var(--red); color: var(--red-ink); display: grid; place-items: center; min-height: 120px; }

/* ── أداة المتصفح ── */
.ext-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.feat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feat li { display: flex; gap: 10px; align-items: flex-start; }
.feat .ic { color: var(--teal-ink); margin-top: 3px; }
.steps { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 10px; }
.steps li::marker { color: var(--teal-ink); font-weight: 700; }

/* ── التذييل ── */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; padding-block: 18px; font-size: 13.5px; }
.footer-in > span:first-child { display: inline-flex; gap: 8px; align-items: center; color: var(--ink); }
.footer .ic { color: var(--teal-ink); }
.copyright { flex-basis: 100%; margin: 6px 0 0; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; color: var(--heading); font-weight: 700; }

.toast { position: fixed; inset-inline: 16px; bottom: 20px; margin: 0 auto; max-width: 420px; background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-lift); text-align: center; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; pointer-events: none; z-index: 60; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red-ink); }

.print-area { display: none; }

/* ── الشاشات الصغيرة — screen وحدها حتى لا تنطوي صفحات الطباعة ── */
@media screen and (max-width: 1280px) {
  .topbar-in { grid-template-columns: 1fr auto; gap: 16px; }
  .hero-main { grid-column: 1 / -1; grid-row: 2; }
  img.hero-art { width: 96px; } /* يبقى ظاهراً ويصغر حين ينزل العنوان تحت الشعار */
}
@media screen and (max-width: 940px) {
  .create-grid, .scan-grid, .ext-grid, .batch-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media screen and (max-width: 600px) {
  .design:has(.d-pair) { grid-template-columns: minmax(0, 1fr); }
  /* الجوال: الشعار والأزرار وشعار الحملة في صف، واسم الإدارة والصفحة في صفٍّ تحته */
  .topbar-in { padding-block: 12px 28px; }
  .hero-brand { flex-wrap: wrap; gap: 8px; }
  .topbar .brand { order: 5; flex-basis: 100%; border: 0; padding: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
  .qf-map-wrap { height: 260px; }
  .hero h1 { font-size: 21px; }
  .hero p { font-size: 15px; }
  .qf, .d-grid { grid-template-columns: 1fr; }
  .logo, .topbar .logo { height: 60px; }
  img.hero-art { width: 60px; }
  .topbar .brand .brand-org { font-size: 14px; white-space: normal; }
  .topbar .brand strong { font-size: 13px; }
  .tabs { gap: 0; padding-inline: 4px; }
  .tab { flex: 1 1 0; justify-content: center; flex-direction: column; gap: 2px; min-height: 60px; padding: 0 4px; font-size: 12.5px; }
  .svc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .svc small { display: none; }
  .svc { min-height: 0; }
  .card-h, .card-b { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ══ الطباعة ══ */
@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; color: #000; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; }
  .pp { break-after: page; page-break-after: always; display: flex; flex-direction: column; height: 272mm; }
  .pp:last-child { break-after: auto; page-break-after: auto; }
  .pp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid #0DA9A6; padding-bottom: 6mm; margin-bottom: 6mm; }
  .pp-head img { height: 18mm; }
  .pp-head div { text-align: left; color: #12293A; font-size: 11pt; }
  .pp-grid { flex: 1; display: grid; gap: 6mm; align-content: start; }
  .pp-cell { border: 1px solid #D3DCE2; border-radius: 4mm; padding: 4mm; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; break-inside: avoid; }
  .pp-cell img { width: 100%; height: auto; }
  .pp-cell b { font-size: 12pt; color: #12293A; margin-top: 2mm; }
  .pp-cell small { direction: ltr; color: #5A7280; font-size: 8.5pt; word-break: break-all; margin-top: 1mm; }
  .pp-single { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6mm; }
  .pp-single img { width: 110mm; height: auto; }
  .pp-single h2 { font-size: 22pt; color: #12293A; }
  .pp-single p { direction: ltr; color: #5A7280; font-size: 10pt; word-break: break-all; max-width: 150mm; }
  /* لافتة A4 */
  .sign { align-items: center; text-align: center; border: 1.2mm solid #12293A; border-radius: 6mm; padding: 10mm 12mm; box-sizing: border-box; }
  .sg-head img { height: 26mm; }
  .sg-bar { width: 100%; height: 2.2mm; margin: 6mm 0 8mm; border-radius: 2mm; background: linear-gradient(to left, #0DA9A6 0 70%, #C9B27C 70% 100%); }
  .sg-title { margin: 0; color: #12293A; font-size: 34pt; line-height: 1.3; font-weight: 700; max-width: 100%; overflow-wrap: anywhere; }
  .sg-title.long { font-size: 24pt; }
  .sg-qr { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6mm 0; }
  .sg-qr img { width: 125mm; max-height: 100%; height: auto; object-fit: contain; }
  .sg-cta { display: flex; align-items: center; gap: 4mm; color: #066361; font-size: 22pt; font-weight: 700; }
  .sg-cta .ic { width: 12mm; height: 12mm; }
  .sg-foot { min-height: 8mm; margin-top: 6mm; padding-top: 4mm; width: 100%; border-top: 0.4mm solid #D3DCE2; color: #23404F; font-size: 14pt; }
  .sg-foot:empty { border-top: 0; }
}

/* ── تحقق من الروابط (تبويب check): فحصٌ شكليّ + إحالة إلى حصين ── */
.check-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.check-grid textarea { margin-top: 8px; }
.haseen-card .card-b { display: grid; gap: 14px; }
.haseen-card .btn-lg { justify-self: start; }
.small { font-size: 13px; margin: 0; }
.chk-out { display: grid; gap: 12px; margin-top: 14px; }
.chk-out:empty { display: none; }
.chk-item { border: 1px solid var(--line); border-inline-start: 5px solid var(--green); border-radius: 12px; padding: 12px 14px; background: var(--panel); }
.chk-item.lvl-warn { border-inline-start-color: var(--amber-ink); }
.chk-item.lvl-bad { border-inline-start-color: var(--red); }
.chk-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chk-badge { font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--fill-ok); color: var(--green-ink); }
.lvl-warn .chk-badge { background: var(--fill-warn); color: var(--amber-ink); }
.lvl-bad .chk-badge { background: var(--fill-bad); color: var(--red-ink); }
.chk-url { font-weight: 700; color: var(--heading); word-break: break-all; min-width: 0; }
.chk-host { margin: 6px 0 0; font-size: 13.5px; }
.chk-item ul { margin: 8px 0 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: 14px; }
.chk-item .sg-ok::marker { color: var(--green-ink); }
.chk-item .sg-warn { color: var(--amber-ink); }
.chk-item .sg-bad { color: var(--red-ink); font-weight: 700; }
.chk-note { display: flex; gap: 8px; align-items: flex-start; margin: 0; font-size: 13.5px; color: var(--muted); }
.chk-note .ic { color: var(--teal-ink); flex: none; margin-top: 2px; }
@media screen and (max-width: 900px) { .check-grid { grid-template-columns: 1fr; } }
