/* assets/app.css — هوية «الورق المؤمَّن»: كل التزام تعهّد بتاريخ، مثل شيك مؤجل.
 * حبر بترولي على ورق أمان، وختم عنابي للإنجاز، وخطوط أمان دقيقة في الرؤوس، والتاريخ في خانات.
 * كل شيء محلي: الخطوط (OFL) في assets/fonts، والرسوم SVG في assets/img، والأيقونات مضمّنة.
 * الأقسام: 1 الخطوط، 2 الرموز، 3 الأساس، 4 الإطار، 5 المكونات، 6 الصفحات العامة، 7 صفحات التطبيق، 8 الجوال، 9 الطباعة، 10 المنتقي الهجري. */

/* 1. الخطوط: Noto Kufi Arabic للواجهة، وAmiri (نسخ) للعناوين */
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 400; font-display: swap; src: url(fonts/noto-kufi-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 600; font-display: swap; src: url(fonts/noto-kufi-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 700; font-display: swap; src: url(fonts/noto-kufi-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 400; font-display: swap; src: url(fonts/noto-kufi-arabic-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+2000-206F, U+2116, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 600; font-display: swap; src: url(fonts/noto-kufi-arabic-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+2000-206F, U+2116, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Noto Kufi Arabic'; font-weight: 700; font-display: swap; src: url(fonts/noto-kufi-arabic-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+2000-206F, U+2116, U+20AC, U+2122, U+2212; }
@font-face { font-family: 'Amiri'; font-weight: 400; font-display: swap; src: url(fonts/amiri-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: 'Amiri'; font-weight: 700; font-display: swap; src: url(fonts/amiri-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }

/* 2. الرموز. المشهد: مكتب نهاراً وجوال في الطريق بين الجهات، فالفاتح أساس والداكن يتبع الجهاز */
:root {
  color-scheme: light;
  --paper: #edf1ee;      /* ورق الأمان */
  --sheet: #fafcfb;      /* الورقة المرفوعة */
  --sheet-2: #f2f5f3;    /* رأس الجدول، والصف عند المرور */
  --ink: #0f3b47;        /* الحبر البترولي: كل ما هو بنيوي */
  --ink-hover: #0a2c35;
  --ink-2: #33545d;      /* نص ثانوي على الورق */
  --muted: #536b72;
  --rule: #cdd9d5;       /* خط دقيق */
  --rule-strong: #a8bbb6;
  --seal: #7a1f2b;       /* الختم العنابي: الإنجاز والتوقيع فقط */
  --on-ink: #ffffff;
  --red: #b3261e; --red-bg: #f7e5e2;
  --amber: #8a5300; --amber-bg: #f6ebd6;
  --green: #1d6b46; --green-bg: #e0eee5;
  --blue: #1e5a78; --blue-bg: #e2edf2;
  --gray-bg: #e6ecea;
  --side: #0f3b47; --side-ink: #d6e4e1; --side-muted: #94b0ad; --side-hi: rgba(255,255,255,.09); --side-mark: #e7c4ca;
  --line-art: rgba(15,59,71,.34);  /* خطوط الأمان */
  --line-band: rgba(15,59,71,.55); /* شريط رأس الصفحة */
  --ground-art: rgba(15,59,71,.07); /* نقش أرضية ورق الأمان */
  --focus: #1e6e8c;
  --shadow-float: 0 18px 40px -20px rgba(15,59,71,.38);
  --radius: 6px; --radius-sm: 4px;
  --side-w: 252px;
  --f-ui: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  --f-title: 'Amiri', 'Traditional Arabic', 'Times New Roman', serif;
}
/* الوضع الداكن: يتبع الجهاز ما لم يختر المستخدم من زر الوضع (assets/theme.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0b191e; --sheet: #10242b; --sheet-2: #142e37;
    --ink: #9fd0d8; --ink-hover: #c2e3e8; --ink-2: #b5cbcd; --muted: #93abad;
    --rule: #22404a; --rule-strong: #34565f;
    --seal: #c98a95; --on-ink: #0b191e;
    --red: #ff8f6e; --red-bg: #3a1b12; --amber: #e8b866; --amber-bg: #33260f;
    --green: #74cc9f; --green-bg: #11301f; --blue: #8fc2db; --blue-bg: #132c38; --gray-bg: #1a3038;
    --side: #071317; --side-ink: #cfdfdc; --side-muted: #7f9b99; --side-hi: rgba(255,255,255,.07); --side-mark: #c98a95;
    --line-art: rgba(159,208,216,.24); --line-band: rgba(159,208,216,.42); --ground-art: rgba(159,208,216,.05);
    --focus: #9fd0d8;
    --shadow-float: 0 18px 40px -20px rgba(0,0,0,.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b191e; --sheet: #10242b; --sheet-2: #142e37;
  --ink: #9fd0d8; --ink-hover: #c2e3e8; --ink-2: #b5cbcd; --muted: #93abad;
  --rule: #22404a; --rule-strong: #34565f;
  --seal: #c98a95; --on-ink: #0b191e;
  --red: #ff8f6e; --red-bg: #3a1b12; --amber: #e8b866; --amber-bg: #33260f;
  --green: #74cc9f; --green-bg: #11301f; --blue: #8fc2db; --blue-bg: #132c38; --gray-bg: #1a3038;
  --side: #071317; --side-ink: #cfdfdc; --side-muted: #7f9b99; --side-hi: rgba(255,255,255,.07); --side-mark: #c98a95;
  --line-art: rgba(159,208,216,.24); --line-band: rgba(159,208,216,.42); --ground-art: rgba(159,208,216,.05);
  --focus: #9fd0d8;
  --shadow-float: 0 18px 40px -20px rgba(0,0,0,.7);
}

/* 3. الأساس */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { position: relative; isolation: isolate; margin: 0; font-family: var(--f-ui); font-size: 15px; line-height: 1.85; background: var(--paper); color: var(--ink); caret-color: var(--ink); }
::selection { background: var(--ink); color: var(--on-ink); }
/* أرضية ورق الأمان: نقش موجي خافت ثابت خلف كل الصفحات */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-color: var(--ground-art);
  -webkit-mask: url(img/ground.svg) repeat 0 0 / 160px 40px; mask: url(img/ground.svg) repeat 0 0 / 160px 40px; }
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 4px; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2 { font-family: var(--f-title); font-weight: 700; line-height: 1.35; text-wrap: balance; }
h1 { font-size: 2.15rem; margin: 0 0 18px; }
h2 { font-size: 1.5rem; margin: 34px 0 10px; }
h3 { font-size: 1.02rem; font-weight: 600; margin: 22px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.sub { font-family: var(--f-ui); font-size: .9rem; font-weight: 400; color: var(--muted); }
small.hint { color: var(--muted); display: block; font-size: .8rem; line-height: 1.65; }
.c-red { color: var(--red); } .c-amber { color: var(--amber); } .c-green { color: var(--green); }
.center { text-align: center; }
.icon { width: 19px; height: 19px; flex: 0 0 auto; }
.icon-xs { width: 13px; height: 13px; flex: 0 0 auto; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--ink); color: var(--on-ink); padding: 8px 14px; z-index: 100; }
.skip:focus { top: 8px; }
[hidden] { display: none !important; }
table, .num, .stat b, .datebox, .ref, .price { font-variant-numeric: tabular-nums; }
* { scrollbar-color: var(--rule-strong) transparent; scrollbar-width: thin; }

/* خطوط الأمان: شريط من موجات دقيقة بلون الحبر، يُرسم بـ mask فيتبع الوضعين */
.guilloche, .has-shell .container > h1:first-child::after, .auth::before, .instrument::before, .plan::before {
  -webkit-mask: url(img/guilloche.svg) repeat-x center / 240px 60px; mask: url(img/guilloche.svg) repeat-x center / 240px 60px;
  background-color: var(--line-art);
}

/* 4. الإطار: قائمة جانبية بحبر الشيك + محتوى على الورق */
/* ختم «مُهلة» (assets/img/brand): الحلقتان والمينا داخل الـ SVG، والحبر من لون النص، وعلامة الاستحقاق بلون الختم */
.logo { display: block; width: 42px; height: 42px; flex: 0 0 auto; }
.logo svg { display: block; width: 100%; height: 100%; }
.logo .m-seal { fill: var(--seal); }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 34px 44px; flex: 1; }
.container.narrow { max-width: 640px; }
.narrow-col { max-width: 700px; }
.center-col { margin-inline: auto; }
.foot { text-align: center; padding: 18px; font-size: .78rem; color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 8px; }
.foot-links a { color: inherit; }
.foot-disclaimer { display: block; max-width: 60ch; margin: 6px auto 0; line-height: 1.6; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; font-size: .88rem; }
.legal-nav a[aria-current] { font-weight: 700; text-decoration: none; color: var(--ink); }
.legal h1 { margin-top: 0; }
.strip { border-radius: 0; margin: 0; border-width: 0 0 1px; padding: 8px 34px; font-size: .86rem; }

/* رأس الصفحة في التطبيق: العنوان بخط النسخ، وتحته شريط خطوط أمان كرأس الشيك */
.has-shell .container > h1:first-child { position: relative; padding-bottom: 30px; margin-bottom: 22px; border-bottom: 1px solid var(--rule); }
.has-shell .container > h1:first-child::after { content: ""; position: absolute; inset-inline: 0; bottom: 4px; height: 22px; background-color: var(--line-band); }
.has-shell .container > h1 .sub { display: inline-block; margin-inline-start: 6px; }

/* 5. المكونات */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 10px; }

/* شريط الملخص: خانات متصلة بفواصل مثقّبة كأرومة الشيك، لا بطاقات منفصلة */
.grid:has(> .stat) { gap: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 22px; }
.grid > .stat { background: none; border: 0; border-radius: 0; margin: 0; padding: 14px 20px 16px; border-inline-start: 1px dashed var(--rule-strong); color: var(--muted); font-size: .84rem; line-height: 1.55; }
.grid > .stat:first-child { border-inline-start: 0; }
.stat b { display: block; font-family: var(--f-ui); font-size: 1.85rem; font-weight: 700; line-height: 1.35; color: var(--ink); margin-bottom: 2px; }
.stat b.c-red { color: var(--red); } .stat b.c-amber { color: var(--amber); } .stat b.c-green { color: var(--green); }

/* الجدول: سجلّ بخطوط دقيقة */
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--rule); text-align: right; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { background: var(--sheet-2); color: var(--ink-2); font-weight: 600; font-size: .78rem; white-space: nowrap; border-bottom-color: var(--rule-strong); }
.table-wrap tr:not(.head-row):hover td { background: var(--sheet-2); }

/* التاريخ في خانات، والرقم المرجعي، والختم */
td.nowrap { white-space: nowrap; }
.ref { display: block; margin-top: 4px; font-size: .72rem; color: var(--muted); font-weight: 600; text-align: right; }
.seal { display: inline-grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--seal); box-shadow: inset 0 0 0 3px var(--sheet), inset 0 0 0 4px var(--seal); color: var(--seal); font: 700 .95rem/1 var(--f-title); transform: rotate(-8deg); }

/* الشارة: ختم مستطيل صغير بنص وأيقونة، لا كبسولة ملونة */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border: 1px solid currentColor; border-radius: 3px; font-size: .76rem; font-weight: 600; line-height: 1.85; white-space: nowrap; background: var(--sheet); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.amber { color: var(--amber); background: var(--amber-bg); }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.gray { color: var(--muted); background: var(--gray-bg); border-color: var(--rule-strong); }

.banner { display: flex; align-items: center; gap: 9px; padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid currentColor; font-size: .9rem; }
.banner.ok { background: var(--green-bg); color: var(--green); }
.banner.warn { background: var(--amber-bg); color: var(--amber); }
.banner.err { background: var(--red-bg); color: var(--red); }
.banner.info { background: var(--blue-bg); color: var(--blue); }
.banner .icon { width: 18px; height: 18px; }
.banner a { color: inherit; }

/* النماذج */
form.stack label { display: block; margin: 14px 0 5px; font-weight: 600; font-size: .86rem; color: var(--ink-2); }
input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); font: inherit; font-size: .95rem; background: var(--sheet); color: var(--ink); min-height: 42px; }
textarea { min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--ink); }
input[type=file] { padding: 7px; }
label.check { display: flex !important; gap: 9px; align-items: center; font-weight: 500 !important; color: var(--ink) !important; }

/* الأزرار: حبر مصمت، أو إطار حبر */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--ink); color: var(--on-ink); border: 1px solid var(--ink); border-radius: var(--radius-sm); padding: 7px 18px; min-height: 40px; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s ease-out, color .15s ease-out; }
button:hover, .btn:hover { background: var(--ink-hover); border-color: var(--ink-hover); text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
button.secondary:hover, .btn.secondary:hover { background: var(--ink); color: var(--on-ink); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--ink); font-weight: 500; text-decoration: underline; }
.btn.lg { padding: 11px 26px; font-size: 1rem; min-height: 50px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); border: 0; position: relative; }
.icon-btn:hover { background: var(--sheet-2); }
form.inline { display: inline; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form select { min-width: 8em; }
.grow { flex: 1 1 220px; width: auto; }
details summary.btn-sm { cursor: pointer; color: var(--ink); font-weight: 600; font-size: .86rem; list-style: none; white-space: nowrap; text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 4px; }
details summary.btn-sm::-webkit-details-marker { display: none; }
details[open] summary.btn-sm { margin-bottom: 6px; }
.report-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 20px; }
.report-tools select { width: auto; min-width: 220px; }

/* 6. الصفحات العامة */
.is-public { min-height: 100vh; display: flex; flex-direction: column; }
.is-public .container { display: flex; align-items: center; justify-content: center; }
.auth { position: relative; width: 100%; max-width: 430px; margin: 40px auto; padding: 46px 32px 30px; overflow: hidden; isolation: isolate; box-shadow: var(--shadow-float); border-color: var(--rule-strong); }
.auth.wide { max-width: 540px; }
.auth::before { content: ""; position: absolute; inset-inline: 0; top: 10px; height: 24px; }
.auth::after { content: ""; position: absolute; z-index: -1; inset-block-end: -80px; inset-inline-start: -80px; width: 260px; height: 260px; -webkit-mask: url(img/rosette.svg) center / contain no-repeat; mask: url(img/rosette.svg) center / contain no-repeat; background: var(--line-art); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo { color: var(--ink); }
.auth-brand b { display: block; font-family: var(--f-title); font-size: 1.35rem; line-height: 1.3; }
.auth-brand small { color: var(--muted); font-size: .8rem; }
.auth h1 { font-size: 1.6rem; margin-bottom: 2px; }
.auth .lead { color: var(--muted); margin: 0 0 6px; font-size: .9rem; }
.auth button { width: 100%; margin-top: 10px; min-height: 46px; }
.seg { border: 0; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.seg legend { font-weight: 600; font-size: .86rem; color: var(--ink-2); margin-bottom: 5px; padding: 0; }
.seg-opt { display: flex; gap: 9px; align-items: flex-start; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); padding: 11px; cursor: pointer; margin: 0 !important; font-weight: 400 !important; color: var(--ink) !important; background: var(--sheet); }
.seg-opt:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.seg-opt input { margin-top: 7px; }
.seg-opt b { display: block; font-size: .92rem; } .seg-opt small { color: var(--muted); font-size: .78rem; line-height: 1.55; display: block; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* الصفحة التعريفية */
.is-landing { background: var(--paper); }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-head { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; gap: 22px; min-height: 66px; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.site-brand .logo { width: 38px; height: 38px; color: var(--ink); }
.site-brand b { font-family: var(--f-title); font-size: 1.35rem; }
.site-nav { display: flex; gap: 22px; flex: 1; }
.site-nav a { color: var(--ink-2); font-size: .9rem; text-decoration: none; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }
.site-actions { display: flex; gap: 8px; }
.landing { display: block; overflow-x: clip; }
.section { padding: 76px 24px; }
.band { background: var(--sheet); border-block: 1px solid var(--rule); }
.band .wrap { padding-block: 64px; }
.two { display: grid; gap: 40px; grid-template-columns: 1fr 1fr; align-items: center; }
.hero { padding: 64px 0 76px; border-bottom: 1px solid var(--rule); }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 3.6vw, 3.05rem); line-height: 1.4; margin-bottom: 20px; }
.hero .lead { font-size: 1.04rem; color: var(--ink-2); max-width: 62ch; margin: 0 0 28px; line-height: 2; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; }
.hero-points { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: .86rem; }
.hero-points li { display: flex; gap: 7px; align-items: center; }
.hero-points .icon-xs { color: var(--green); }

/* الأداة: التزام مرسوم كشيك مؤجل (مثال ببيانات اصطناعية) */
.instrument { position: relative; margin: 0; background: var(--sheet); border: 1px solid var(--ink); border-radius: var(--radius-sm); padding: 46px 26px 18px; box-shadow: inset 0 0 0 5px var(--sheet), inset 0 0 0 6px var(--rule-strong), var(--shadow-float); transform: rotate(-1.2deg); isolation: isolate; }
.instrument::before { content: ""; position: absolute; inset-inline: 6px; top: 8px; height: 26px; }
.instrument::after { content: ""; position: absolute; z-index: -1; inset-block-start: 40px; inset-inline-end: -40px; width: 220px; height: 220px; -webkit-mask: url(img/rosette.svg) center / contain no-repeat; mask: url(img/rosette.svg) center / contain no-repeat; background: var(--line-art); }
.ins-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--rule); padding-bottom: 10px; margin-bottom: 6px; }
.ins-head b { font-family: var(--f-title); font-size: 1.45rem; }
.ins-head .ref { margin: 0; font-size: .8rem; }
.ins-body { margin: 0; }
.ins-body > div { display: grid; grid-template-columns: 6.5em 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dotted var(--rule-strong); align-items: baseline; }
.ins-body dt { color: var(--muted); font-size: .8rem; }
.ins-body dd { margin: 0; font-weight: 600; font-size: .95rem; }
.ins-body .due { border-bottom: 0; }
/* أرومة مثقّبة: صف ثقوب على خط متقطع، كما بين الشيك وأرومته */
.perf, .ins-foot { position: relative; }
.ins-foot::before, .perf::before { content: ""; position: absolute; inset-inline: -26px; top: -5px; height: 10px;
  background: radial-gradient(circle at center, var(--paper) 0 2.6px, transparent 3px) 0 50% / 12px 10px repeat-x; border-top: 1px dashed var(--rule-strong); }
.ins-foot { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-top: 14px; padding-top: 16px; }
.ins-foot .sig { display: block; min-width: 10em; border-top: 1px solid var(--ink-2); margin-top: 20px; padding-top: 2px; font-size: .7rem; font-weight: 400; color: var(--muted); }
.ins-foot small { display: block; color: var(--muted); font-size: .74rem; }
.instrument figcaption { position: absolute; bottom: -34px; inset-inline-start: 0; font-size: .74rem; color: var(--muted); transform: rotate(1.2deg); }

.quote { font-family: var(--f-title); font-size: 1.25rem; line-height: 1.9; padding: 26px 28px; position: relative; }
.quote b { font-family: var(--f-title); }

/* البنود: المزايا كبنود عقد، لا شبكة أيقونات */

/* الالتزامات المغطاة: فهرس بنود */
.chips { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 32px; }
.chips li { padding: 11px 0; border-bottom: 1px dotted var(--rule-strong); display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.chips b { font-weight: 600; font-size: .92rem; }
.chips small { color: var(--muted); font-size: .76rem; text-align: left; flex: 0 1 45%; }

/* الباقات: شهادات برأس خطوط أمان */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: stretch; }
.plan { position: relative; display: flex; flex-direction: column; gap: 4px; margin: 0; padding-top: 44px; }
.plan::before { content: ""; position: absolute; inset-inline: 0; top: 10px; height: 22px; }
.plan h3 { margin: 0; font-family: var(--f-title); font-size: 1.4rem; }
.plan .price { font-size: 1.55rem; font-weight: 700; margin: 2px 0 0; color: var(--ink); }
.plan.featured { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink), var(--shadow-float); }
.plan.current { background: var(--sheet-2); }
.plan .badge { position: absolute; top: 14px; inset-inline-end: 14px; }
.ticks { list-style: none; padding: 0; margin: 10px 0 16px; display: grid; gap: 6px; font-size: .88rem; }
.ticks li { display: flex; gap: 8px; align-items: flex-start; }
.ticks .icon-xs { color: var(--green); margin-top: 7px; }
.plan-cta { margin-top: auto; }
#pricing .plans { margin: 30px 0 16px; }

.faq { margin-bottom: 0; padding: 16px 4px; background: none; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.faq[open] summary::after { content: "−"; }
.faq p { margin: 10px 0 0; color: var(--ink-2); font-size: .92rem; }

/* 7. صفحات التطبيق */
/* اللوحة: أقسام زمنية */
h2.sec-overdue { color: var(--red); } h2.sec-week { color: var(--amber); }
details.later > summary { cursor: pointer; list-style: none; }
details.later > summary h2 { display: inline; }
details.later > summary::before { content: "+ "; color: var(--muted); font-family: var(--f-ui); }
details.later[open] > summary::before { content: "− "; }
details.group summary { cursor: pointer; color: var(--ink); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.group summary::-webkit-details-marker { display: none; }
details.group summary::after, details.menu > summary::after { content: ""; width: 10px; height: 10px; background: currentColor; transition: transform .15s ease-out;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 3.5 5 6.5 8 3.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
details.group[open] summary::after, details.menu[open] > summary::after { transform: rotate(180deg); }
/* قائمة «تصدير» */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; z-index: 10; top: calc(100% + 6px); inset-inline-end: 0; min-width: 190px; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-float); padding: 6px; display: grid; }
.menu-list a { padding: 7px 10px; border-radius: 3px; text-decoration: none; font-size: .88rem; }
.menu-list a:hover { background: var(--sheet-2); }
a.assign { display: block; font-size: .78rem; font-weight: 600; }
span.nowrap { white-space: nowrap; }
.site-login { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink); font-weight: 600; font-size: .9rem; padding: 0 10px; text-decoration: none; border-radius: var(--radius-sm); }
.site-login:hover { background: var(--sheet-2); }
ul.plain { list-style: none; padding: 0; margin: 6px 0 0; font-size: .88rem; }
.f-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--ink); box-shadow: inset 0 0 0 3px var(--sheet), inset 0 0 0 4px var(--rule-strong); color: var(--ink); }
.f-icon.ok { color: var(--green); border-color: var(--green); }
.success-card, .empty { text-align: center; padding: 34px 22px; }
.success-card h2, .empty h2 { margin: 12px 0 4px; }

/* التبويبات */
.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--rule-strong); margin: 26px 0 6px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 9px 14px; min-height: 0; font-weight: 600; font-size: .88rem; margin-bottom: -1px; }
.tab:hover { background: none; color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab-panel > h2:first-child { margin-top: 16px; }
details.desc summary { cursor: pointer; color: var(--muted); font-size: .78rem; }

/* معالج الترحيب */
.stepper { list-style: none; padding: 0; margin: 0 0 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: .88rem; }
.stepper li + li::before { content: ""; width: 30px; height: 1px; background: var(--rule-strong); }
.stepper span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--rule-strong); font-size: .82rem; }
.stepper .current { color: var(--ink); } .stepper .current span { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.stepper .done span { border-color: var(--green); color: var(--green); }
.next-steps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 20px; }
.card.next { display: flex; gap: 12px; align-items: flex-start; margin: 0; color: var(--ink); text-decoration: none; }
.card.next:hover { border-color: var(--ink); }
.card.next .icon { color: var(--ink); margin-top: 4px; }
.card.next b { display: block; } .card.next small { color: var(--muted); display: block; line-height: 1.6; font-size: .8rem; }

/* العدادات */
.meter { display: block; height: 4px; background: var(--gray-bg); margin-top: 10px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--ink); }
.meter.amber > span { background: var(--amber); } .meter.red > span { background: var(--red); }
.meter .w0{width:0}.meter .w5{width:5%}.meter .w10{width:10%}.meter .w15{width:15%}.meter .w20{width:20%}.meter .w25{width:25%}.meter .w30{width:30%}.meter .w35{width:35%}.meter .w40{width:40%}.meter .w45{width:45%}.meter .w50{width:50%}.meter .w55{width:55%}.meter .w60{width:60%}.meter .w65{width:65%}.meter .w70{width:70%}.meter .w75{width:75%}.meter .w80{width:80%}.meter .w85{width:85%}.meter .w90{width:90%}.meter .w95{width:95%}.meter .w100{width:100%}

/* التقويم الشهري */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title { flex: 1; text-align: center; min-width: 180px; }
.cal-title b { display: block; font-family: var(--f-title); font-size: 1.45rem; line-height: 1.4; } .cal-title small { color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; margin-bottom: 8px; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.cal-wd { text-align: center; color: var(--ink-2); font-size: .78rem; font-weight: 600; padding: 7px 0; background: var(--sheet-2); border-bottom: 1px solid var(--rule-strong); }
.cal-day { min-height: 92px; padding: 7px 9px; display: flex; flex-direction: column; color: var(--ink); position: relative; border-inline-start: 1px solid var(--rule); border-top: 1px solid var(--rule); text-decoration: none; }
.cal-day.out { background: var(--paper); }
.cal-day.wkend { background: var(--sheet-2); }
.cal-day.today .g { background: var(--ink); color: var(--on-ink); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; margin: -2px; }
a.cal-day:hover { background: var(--paper); }
.cal-day .g { font-weight: 700; font-size: .92rem; } .cal-day .h { color: var(--muted); font-size: .72rem; position: absolute; top: 8px; inset-inline-end: 9px; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.dots i.red { background: var(--red); } .dots i.amber { background: var(--amber); }
.dots em { font-style: normal; font-size: .72rem; color: var(--muted); }
.cal-list { scroll-margin-top: 70px; }
.cal-list h3 { margin: 20px 0 8px; font-size: .98rem; }
.cal-list:target h3 { color: var(--seal); }

/* تقرير جرد الامتثال */
.report-meta { margin-top: -6px; }
.report-sub { margin: -6px 0 8px; font-size: .9rem; }
.report-est { margin-bottom: 18px; }
.report-note { font-size: .86rem; border-top: 1px solid var(--rule); padding-top: 10px; margin-top: 24px; }

/* 8. الجوال والأجهزة اللوحية */
@media (max-width: 1023.98px) {
  .container { padding: 22px 16px 34px; }
  .strip { padding: 8px 16px; }
  .hero-grid { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .hero-copy { display: contents; }
  .hero h1 { order: 0; }
  .instrument { order: 1; max-width: 460px; margin: 6px 0 52px; font-size: .92em; }
  .hero .lead, .hero-cta, .hero-points { order: 2; }
}
@media (prefers-reduced-motion: reduce) { .sidebar, button, .btn { transition: none; } }

@media (max-width: 760px) {
  .site-nav { display: none; }
  .site-head .wrap { justify-content: space-between; gap: 10px; }
  .site-actions .btn { padding: 5px 12px; min-height: 36px; font-size: .84rem; }
  .site-brand b { font-size: 1.15rem; }
  .two { grid-template-columns: 1fr; }
  .hero { padding: 38px 0 60px; }
  .section { padding: 50px 16px; }
  .wrap { padding: 0 16px; }
  .seg { grid-template-columns: 1fr; }
  h1 { font-size: 1.75rem; }
  .instrument { transform: none; padding: 42px 18px 16px; }
  .instrument figcaption { transform: none; }
}

/* الجدول يتحول إلى بطاقات تحت 640px (العناوين من assets/app.js) */
@media (max-width: 639.98px) {
  body { font-size: 14.5px; }
  .table-wrap:has(table.cards) { background: transparent; border: 0; overflow: visible; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; background: transparent; }
  table.cards .head-row { display: none; }
  table.cards tr { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 6px 14px; margin-bottom: 10px; }
  table.cards td { border: 0; border-top: 1px dashed var(--rule); padding: 7px 0; display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; text-align: start; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; flex: 0 0 auto; min-width: 5.5em; }
  table.cards td:first-child { display: block; font-weight: 600; padding-top: 9px; padding-bottom: 12px; border-top: 0; position: relative; }
  /* الأرومة المثقّبة بين عنوان البطاقة وتفاصيلها */
  table.cards td:first-child + td { border-top: 0; position: relative; padding-top: 12px; }
  table.cards td:first-child + td::after { content: ""; position: absolute; inset-inline: -14px; top: -5px; height: 10px; border-top: 1px dashed var(--rule-strong); background: radial-gradient(circle at center, var(--paper) 0 2.6px, transparent 3px) 0 50% / 12px 10px repeat-x; }
  table.cards td:first-child::before, table.cards td.no-label::before { display: none; }
  table.cards td.no-label { justify-content: flex-start; }
  table.cards td:empty { display: none; }
  .table-wrap tr:not(.head-row):hover td { background: transparent; }
  .report-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .report-tools > form, .report-tools > select, .report-tools > input { grid-column: 1 / -1; display: flex; gap: 8px; }
  .report-tools form select, .report-tools form input { flex: 1; width: auto; min-width: 0; }
  .report-tools .btn, .report-tools > button { width: 100%; min-height: 38px; padding: 6px 10px; font-size: .82rem; }
  .grid:has(> .stat) { grid-template-columns: repeat(2, 1fr); }
  .grid > .stat:nth-child(odd) { border-inline-start: 0; }
  .grid > .stat:nth-child(n+3) { border-top: 1px dashed var(--rule-strong); }
  .stat b { font-size: 1.5rem; }
  .cal-day { min-height: 56px; padding: 4px 5px; } .cal-day .h { display: none; } .cal-wd { font-size: .66rem; } .dots i { width: 7px; height: 7px; }
  .has-shell .container > h1:first-child { padding-bottom: 26px; }
}

/* 9. الطباعة */
@media print {
  :root { color-scheme: light; --paper: #fff; --sheet: #fff; --sheet-2: #eee; --ink: #000; --ink-2: #333; --muted: #444; --rule: #bbb; --rule-strong: #999; }
  .tab-panel[hidden] { display: block !important; }
  .shell, .main { display: block; }
  body { background: #fff; font-size: 11pt; }
  .container { max-width: none; padding: 0; }
  .card, .table-wrap { border-color: #bbb; }
  .report .grid { grid-template-columns: repeat(4, 1fr); }
  .report .stat b { font-size: 1.3rem; }
  .report-est h2, .report-sub { break-after: avoid; }
  .report-est h2 { margin-top: 14px; }
  tr { break-inside: avoid; }
  th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .badge, .guilloche, .has-shell .container > h1:first-child::after { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; text-decoration: none; }
}

/* 10. منتقي التاريخ الهجري (assets/hijri.js، منقول من «عدلك») */
.hcal-field { direction: rtl; }
.hcal-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hcal-row select { width: auto; min-width: 0; }
.hcal-row select.hcal-wd { flex: 0 0 auto; width: 84px; color: var(--muted); background-color: var(--sheet-2); }
.hcal-row select.hcal-day { flex: 0 0 auto; width: 68px; }
.hcal-row select.hcal-month { flex: 1 1 130px; }
.hcal-row select.hcal-year { flex: 0 0 auto; width: 88px; }
.hcal-row input.hcal-time { flex: 0 0 auto; width: 100px; }
.hcal-row .hcal-btn { flex: 0 0 auto; padding: 6px 10px; line-height: 1.5; }
.hcal-alt { font-size: .78rem; color: var(--muted); margin-top: 3px; min-height: 14px; }
.hcal-field.hcal-compact .hcal-wd, .hcal-field.hcal-compact .hcal-btn, .hcal-field.hcal-compact .hcal-alt { display: none; }
.hcal-field.hcal-compact .hcal-row { gap: 5px; flex-wrap: nowrap; }
@media (max-width: 575.98px) { .hcal-field.hcal-compact .hcal-row { flex-wrap: wrap; } .hcal-field.hcal-compact .hcal-month { flex: 1 1 100%; order: 3; } }
.table-wrap select { min-width: 7em; }

/* الصورة الرمزية للمستخدم */
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--side-muted); color: #fff; font-weight: 700; font-size: .9rem; flex: 0 0 auto; }
.who { flex: 1; min-width: 0; line-height: 1.45; }
.who b { display: block; color: #fff; font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who small { color: var(--side-muted); font-size: .74rem; }

/* =====================================================================
   11. الإطار: ترويسة وثيقة + ألسنة ملفات (بدل القائمة الجانبية)
   ===================================================================== */
.has-shell .shell { display: block; min-height: 100vh; }
.masthead { position: relative; background: var(--side); color: var(--side-ink); isolation: isolate; overflow: hidden; }
.masthead::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  -webkit-mask: url(img/guilloche.svg) repeat 0 0 / 240px 60px; mask: url(img/guilloche.svg) repeat 0 0 / 240px 60px; background: rgba(255,255,255,.07); }
.masthead::after { content: ""; position: absolute; z-index: -1; top: -120px; inset-inline-start: -60px; width: 340px; height: 340px; pointer-events: none;
  -webkit-mask: url(img/rosette.svg) center / contain no-repeat; mask: url(img/rosette.svg) center / contain no-repeat; background: rgba(255,255,255,.14); }
.is-platform .masthead { --side: #2a1720; }
.mast-top { display: flex; align-items: center; gap: 22px; max-width: 1240px; margin: 0 auto; padding: 14px 28px 12px; }
.mast-brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; }
.mast-brand .logo { color: var(--side-ink); }
.mast-brand .logo .m-seal { fill: var(--side-mark); }
.mast-brand b { display: block; font-family: var(--f-title); font-size: 1.4rem; line-height: 1.2; }
.mast-brand small { display: block; color: var(--side-muted); font-size: .76rem; line-height: 1.5; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mast-doc { display: flex; gap: 0; margin-inline-start: auto; border: 1px solid rgba(255,255,255,.18); border-radius: 3px; }
.mast-doc > span { padding: 4px 14px; line-height: 1.45; }
.mast-doc > span + span { border-inline-start: 1px dashed rgba(255,255,255,.22); }
.mast-doc small { display: block; font-size: .66rem; color: var(--side-muted); }
.mast-doc b { font-size: .84rem; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.mast-actions { display: flex; align-items: center; gap: 4px; }
.is-platform .mast-actions { margin-inline-start: auto; }
.mast-actions .icon-btn { color: var(--side-ink); }
.mast-actions .icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.mast-user { display: flex; align-items: center; gap: 9px; padding-inline: 8px 4px; margin-inline: 4px; border-inline-start: 1px solid rgba(255,255,255,.14); }
a.mast-user { color: inherit; text-decoration: none; border-radius: 4px; }
a.mast-user:hover .who b, a.mast-user:focus-visible .who b { text-decoration: underline; text-underline-offset: 3px; }
.mast-user .avatar { border-color: var(--side-mark); }
.mast-user .who { max-width: 14ch; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 9px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--side-mark); box-shadow: 0 0 0 2px var(--side); }

/* ألسنة الملف: اللسان النشط يلتحم بالورقة تحته */
.folder-tabs { display: flex; gap: 4px; max-width: 1240px; margin: 0 auto; padding: 6px 28px 0; overflow-x: auto; scrollbar-width: none; }
.folder-tabs::-webkit-scrollbar { display: none; }
.folder-tabs a { position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 16px 10px; border-radius: 7px 7px 0 0; color: var(--side-ink); text-decoration: none; font-size: .88rem; font-weight: 600; white-space: nowrap;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-bottom: 0; transform: translateY(3px); transition: transform .2s cubic-bezier(.16,1,.3,1), background-color .2s ease-out, color .2s ease-out; }
.folder-tabs a .icon { width: 17px; height: 17px; opacity: .75; }
.folder-tabs a:hover { background: rgba(255,255,255,.12); color: #fff; transform: translateY(0); }
.folder-tabs a.active { background: var(--paper); color: var(--ink); border-color: var(--paper); transform: translateY(0); }
.folder-tabs a.active .icon { opacity: 1; color: var(--seal); }
.folder-tabs .count { min-width: 20px; padding: 0 6px; border-radius: 3px; background: var(--side-mark); color: #2a0f15; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.7; }
.has-shell .main { min-height: calc(100vh - 120px); }
.has-shell .container { max-width: 1240px; padding: 34px 28px 48px; }
.has-shell .strip { max-width: none; padding-inline: max(28px, calc((100% - 1240px) / 2 + 28px)); }

/* =====================================================================
   12. السجلّ: عناوين الأقسام في الهامش، وخط «اليوم»
   ===================================================================== */
.ledger-sec { display: grid; grid-template-columns: 168px 1fr; gap: 0 28px; margin: 6px 0 26px; }
.margin-label { position: sticky; top: 18px; align-self: start; padding-top: 8px; border-top: 2px solid currentColor; color: var(--ink); }
.margin-label h2 { margin: 2px 0 0; font-size: 1.45rem; }
.ml-count { display: block; font-family: var(--f-ui); font-size: 2.6rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sec-overdue .margin-label { color: var(--red); }
.sec-week .margin-label { color: var(--amber); }
.sec-later .margin-label { color: var(--muted); }
.ledger-body { min-width: 0; padding-inline-start: 28px; border-inline-start: 1px dashed var(--rule-strong); }
.ledger-empty { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border: 1px dashed var(--rule-strong); border-radius: var(--radius); color: var(--muted); margin: 0; }
.ledger-empty .icon-xs { color: var(--green); }
details.later > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--ink); border-radius: var(--radius-sm); font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
details.later > summary::-webkit-details-marker { display: none; }
details.later > summary::before { content: none; }

.today-line { position: relative; display: flex; align-items: center; gap: 14px; margin: 8px 0 34px; }
.today-line::before { content: ""; flex: 1; height: 2px; background: var(--ink); order: 2; }
.today-line::after { content: ""; width: 196px; height: 2px; background: var(--ink); order: 0; }
.today-seal { order: 1; display: inline-grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; border: 2px solid var(--ink); box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px var(--ink); background: var(--paper); color: var(--ink); font: 700 1.05rem/1 var(--f-title); transform: rotate(-6deg); }
.today-date { order: 3; font-weight: 600; font-size: .86rem; color: var(--ink); white-space: nowrap; background: var(--paper); padding-inline: 8px; }

/* =====================================================================
   13. أرومة الشيك: بطاقة الموعد
   ===================================================================== */
.stubs { display: grid; gap: 12px; }
.stub { position: relative; display: grid; grid-template-columns: 178px 1fr; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius);
  transition: transform .22s cubic-bezier(.16,1,.3,1), box-shadow .22s cubic-bezier(.16,1,.3,1), border-color .2s ease-out; }
.stub:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -18px rgba(15,59,71,.45); border-color: var(--ink-2); }
/* علامات القص في الزوايا، كما في المطبوعات المؤمَّنة */
.stub::before, .clause::after, .plan::after { content: ""; position: absolute; inset: -7px; pointer-events: none; opacity: .7;
  background:
    linear-gradient(var(--rule-strong), var(--rule-strong)) 0 0 / 9px 1px no-repeat, linear-gradient(var(--rule-strong), var(--rule-strong)) 0 0 / 1px 9px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) 100% 0 / 9px 1px no-repeat, linear-gradient(var(--rule-strong), var(--rule-strong)) 100% 0 / 1px 9px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) 0 100% / 9px 1px no-repeat, linear-gradient(var(--rule-strong), var(--rule-strong)) 0 100% / 1px 9px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) 100% 100% / 9px 1px no-repeat, linear-gradient(var(--rule-strong), var(--rule-strong)) 100% 100% / 1px 9px no-repeat; }
.stub-date { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; background: var(--paper); border-start-start-radius: var(--radius); border-end-start-radius: var(--radius); }
/* الثقوب بين الأرومة وجسم الشيك */
.stub-date::after { content: ""; position: absolute; top: 6px; bottom: 6px; inset-inline-end: -5px; width: 10px; border-inline-end: 1px dashed var(--rule-strong);
  background: radial-gradient(circle at center, var(--sheet) 0 2.6px, transparent 3px) 50% 0 / 10px 12px repeat-y; }
.stub-red .stub-date { background: var(--red-bg); }
.stub-amber .stub-date { background: var(--amber-bg); }
.stub-left { font-size: .92rem; font-weight: 700; color: var(--ink); }
.stub-red .stub-left { color: var(--red); } .stub-amber .stub-left { color: var(--amber); }
.stub-body { padding: 13px 20px 12px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.stub-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.stub-head h3 { margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.6; }
.stub-head .ref { margin: 0; flex: 0 0 auto; }
.stub-meta { margin: 0; color: var(--muted); font-size: .8rem; }
.unverified { color: var(--amber); font-weight: 600; }
.stub-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px dotted var(--rule-strong); font-size: .86rem; flex-wrap: wrap; }
.stub-est, .stub-owner { display: inline-flex; align-items: center; gap: 7px; }
.stub-est .icon-xs { color: var(--muted); }
.avatar-sm { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: .72rem; font-weight: 700; }
.stub-owner a.assign { display: inline; }

/* =====================================================================
   14. الصفحة التعريفية: بطاقات البنود، والزخرفة الفاصلة
   ===================================================================== */
.clauses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin: 26px 0 0; }
.clause { position: relative; background: var(--sheet); border: 1px solid var(--rule-strong); border-radius: var(--radius); padding: 26px 24px 22px; overflow: visible; isolation: isolate;
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s cubic-bezier(.16,1,.3,1); }
.clause::before { content: ""; position: absolute; z-index: -1; inset-block-start: -40px; inset-inline-end: -40px; width: 150px; height: 150px; opacity: .55;
  -webkit-mask: url(img/rosette.svg) center / contain no-repeat; mask: url(img/rosette.svg) center / contain no-repeat; background: var(--line-art); clip-path: inset(40px 0 0 40px); }
.clause:hover { transform: translateY(-3px); box-shadow: var(--shadow-float); }
.clause h3 { font-family: var(--f-title); font-size: 1.3rem; font-weight: 700; margin: 14px 0 6px; }
.clause p { margin: 0; color: var(--ink-2); font-size: .9rem; line-height: 1.95; }
.emblem { display: inline-grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--ink); box-shadow: inset 0 0 0 3px var(--sheet), inset 0 0 0 4px var(--rule-strong); color: var(--ink); transition: transform .4s cubic-bezier(.16,1,.3,1); }
.clause:hover .emblem { transform: rotate(-12deg); }
.ornament { display: flex; align-items: center; justify-content: center; gap: 14px; margin: -2px 0 8px; }
.ornament::before, .ornament::after { content: ""; width: min(120px, 22vw); height: 1px; background: linear-gradient(to left, transparent, var(--rule-strong)); }
.ornament::after { background: linear-gradient(to right, transparent, var(--rule-strong)); }
.ornament span { width: 26px; height: 26px; -webkit-mask: url(img/rosette.svg) center / contain no-repeat; mask: url(img/rosette.svg) center / contain no-repeat; background: var(--ink); opacity: .7; }
.plan { overflow: visible; transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s cubic-bezier(.16,1,.3,1); }
.plan:hover { transform: translateY(-3px); box-shadow: var(--shadow-float); }

/* زر الوضع */
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.foot .theme-toggle { vertical-align: middle; margin-inline-end: 6px; width: 34px; height: 34px; }
.site-actions .theme-toggle { color: var(--ink); }

/* =====================================================================
   15. الحركة: لحظة واحدة مؤلَّفة (الختم يُضغط، والتاريخ يُكتب) وتغذية راجعة سريعة
   ===================================================================== */
@keyframes hc-stamp { 0% { opacity: 0; transform: scale(1.55) rotate(var(--rot, -8deg)); } 55% { opacity: 1; transform: scale(.94) rotate(var(--rot, -8deg)); } 100% { opacity: 1; transform: scale(1) rotate(var(--rot, -8deg)); } }
@keyframes hc-print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes hc-ink { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes hc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hc-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: no-preference) {
  /* الأداة في الصفحة التعريفية تُطبع، ثم يُكتب التاريخ خانة خانة، ثم يُختم */
  .instrument { animation: hc-print .7s cubic-bezier(.16,1,.3,1) .1s both; }
  .instrument .ins-foot .badge { animation: hc-stamp .45s cubic-bezier(.16,1,.3,1) 1.15s both; --rot: 0deg; }
  .seal { animation: hc-stamp .5s cubic-bezier(.16,1,.3,1) .2s both; }
  .today-seal { animation: hc-stamp .5s cubic-bezier(.16,1,.3,1) .25s both; --rot: -6deg; }
  .today-line::before, .today-line::after { animation: hc-draw .6s cubic-bezier(.16,1,.3,1) both; transform-origin: right; }
  .has-shell .container > h1:first-child::after { animation: hc-fade .8s ease-out both; }
  .tab-panel:not([hidden]) { animation: hc-fade .2s ease-out; }
  .menu-list { animation: hc-ink .18s cubic-bezier(.16,1,.3,1); transform-origin: top; }
  details.group[open] ul.plain, details.later[open] > .stubs { animation: hc-ink .25s cubic-bezier(.16,1,.3,1); }
  /* القوائم تظهر كقوائم: تتابع قصير (assets/app.js يضيف .in، والمحتوى ظاهر بلا JavaScript) */
  .js-motion [data-reveal] > * { opacity: 0; transform: translateY(10px); }
  .js-motion [data-reveal].in > * { opacity: 1; transform: none; transition: opacity .45s ease-out, transform .5s cubic-bezier(.16,1,.3,1); transition-delay: calc(min(var(--i, 0), 6) * 50ms); }
  button:active, .btn:active { transform: scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
  .stub:hover, .clause:hover, .plan:hover, .folder-tabs a { transform: none; }
  .seal, .today-seal { animation: hc-fade .3s ease-out both; }
}

/* =====================================================================
   16. الجوال والأجهزة اللوحية للإطار الجديد
   ===================================================================== */
@media (max-width: 1023.98px) {
  .mast-doc, .mast-user .who { display: none; }
  .mast-top { padding: 10px 14px 8px; gap: 10px; }
  .mast-actions { margin-inline-start: auto; }
  .mast-user { border: 0; padding: 0; margin: 0; }
  .folder-tabs { padding: 4px 14px 0; scroll-snap-type: x proximity; }
  .folder-tabs a { scroll-snap-align: start; padding: 8px 12px 9px; font-size: .84rem; }
  .has-shell .container { padding: 24px 16px 36px; }
  .clauses { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .mast-brand small { display: none; }
  .mast-brand b { font-size: 1.2rem; }
  .ledger-sec { grid-template-columns: 1fr; }
  .margin-label { position: static; display: flex; align-items: baseline; justify-content: space-between; border-top-width: 2px; margin-bottom: 12px; }
  .ml-count { font-size: 1.6rem; }
  .ledger-body { padding: 0; border: 0; }
  .today-line::after { width: 18px; }
  .today-seal { width: 54px; height: 54px; font-size: .95rem; }
  .stub { grid-template-columns: 1fr; }
  .stub-date { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; border-radius: var(--radius) var(--radius) 0 0; }
  .stub-date::after { top: auto; bottom: -5px; inset-inline: 6px; width: auto; height: 10px; border: 0; border-bottom: 1px dashed var(--rule-strong);
    background: radial-gradient(circle at center, var(--sheet) 0 2.6px, transparent 3px) 0 50% / 12px 10px repeat-x; }
  .clauses { grid-template-columns: 1fr; }
}
@media print {
  .masthead, .folder-tabs { display: none !important; }
  .ledger-sec { grid-template-columns: 120px 1fr; }
  .stub { break-inside: avoid; }
}

/* =====================================================================
   17. أسطح مصقولة: زوايا أنعم، وظلال طبقية بدل الحدود الصلبة، ومسافات أرحب
   (يعلو ما سبقه؛ العالم نفسه: حبر بترولي، وختم عنابي، وخطوط أمان)
   ===================================================================== */
:root {
  --radius: 14px; --radius-sm: 10px; --radius-xs: 6px;
  --ring: 0 0 0 1px rgba(15,59,71,.08);
  --e1: 0 0 0 1px rgba(15,59,71,.07), 0 1px 2px rgba(15,59,71,.05), 0 2px 6px -2px rgba(15,59,71,.06);
  --e2: 0 0 0 1px rgba(15,59,71,.07), 0 2px 4px rgba(15,59,71,.05), 0 14px 32px -14px rgba(15,59,71,.28);
  --e3: 0 0 0 1px rgba(15,59,71,.08), 0 6px 12px -4px rgba(15,59,71,.10), 0 28px 56px -24px rgba(15,59,71,.36);
  --tint: color-mix(in srgb, var(--ink) 7%, var(--sheet));
  --tint-2: color-mix(in srgb, var(--ink) 12%, var(--sheet));
}
:root[data-theme="dark"] { --e1: 0 0 0 1px rgba(159,208,216,.10), 0 1px 2px rgba(0,0,0,.4); --e2: 0 0 0 1px rgba(159,208,216,.12), 0 16px 34px -14px rgba(0,0,0,.75); --e3: 0 0 0 1px rgba(159,208,216,.14), 0 30px 60px -24px rgba(0,0,0,.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --e1: 0 0 0 1px rgba(159,208,216,.10), 0 1px 2px rgba(0,0,0,.4); --e2: 0 0 0 1px rgba(159,208,216,.12), 0 16px 34px -14px rgba(0,0,0,.75); --e3: 0 0 0 1px rgba(159,208,216,.14), 0 30px 60px -24px rgba(0,0,0,.85); } }
:root { --ground-art: rgba(15,59,71,.045); }

/* الأسطح: ظل طبقي واحد، بلا حدود */
.card, .table-wrap, .grid:has(> .stat), .stub, .clause, .plan, .cal, .ledger-empty { border: 0; box-shadow: var(--e1); border-radius: var(--radius); }
.card { padding: 22px 24px; }
.card.next:hover, .plan:hover, .clause:hover, .stub:hover { box-shadow: var(--e2); }
.auth { border: 0; box-shadow: var(--e3); border-radius: 18px; }
.instrument { border-radius: 16px; }
.ledger-empty { background: var(--sheet); }

/* علامات القص أُزيلت: الأسطح المصقولة لا تحتاجها */
.stub::before, .clause::after, .plan::after { content: none; }

/* الجدول: صفوف هادئة، ورأس بلا خلفية */
.table-wrap { overflow: hidden; }
th { background: transparent; color: var(--muted); font-size: .74rem; padding-block: 13px 10px; border-bottom: 1px solid var(--rule); }
td { border-bottom-color: color-mix(in srgb, var(--rule) 70%, transparent); }
.table-wrap tr:not(.head-row):hover td { background: color-mix(in srgb, var(--ink) 3.5%, var(--sheet)); }

/* شريط الملخص: أرقام كبيرة بفواصل ناعمة */
.grid > .stat { border-inline-start: 1px solid var(--rule); padding: 18px 22px; }
.grid > .stat:first-child { border-inline-start: 0; }
.stat b { font-size: 2.1rem; letter-spacing: -0.02em; }

/* بطاقة التاريخ */
.datebox { display: inline-flex; flex-direction: row; align-items: center; gap: 10px; }
.dt-tile { display: inline-flex; flex-direction: column; align-items: stretch; min-width: 54px; border-radius: 10px; overflow: hidden; background: var(--sheet); box-shadow: var(--e1); text-align: center; }
.dt-tile i { font-style: normal; font-size: .64rem; font-weight: 700; line-height: 1.9; padding: 0 6px; background: var(--ink); color: var(--on-ink); white-space: nowrap; }
.dt-tile b { font-size: 1.35rem; font-weight: 700; line-height: 1.45; color: var(--ink); font-variant-numeric: tabular-nums; }
.dt-meta { display: flex; flex-direction: column; line-height: 1.45; }
.dt-meta > span { font-size: .82rem; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dt-meta small { font-size: .72rem; color: var(--muted); line-height: 1.5; }
.stub-red .dt-tile i { background: var(--red); }
.stub-amber .dt-tile i { background: var(--amber); }
:root[data-theme="dark"] .stub-red .dt-tile i, :root[data-theme="dark"] .stub-amber .dt-tile i { color: #1a0f0c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stub-red .dt-tile i, :root:not([data-theme="light"]) .stub-amber .dt-tile i { color: #1a0f0c; } }

/* أرومة الموعد: سطح أبيض، وجزء التاريخ بلون خافت، والثقوب خط منقّط رقيق */
.stub { grid-template-columns: 210px 1fr; background: var(--sheet); overflow: hidden; }
.stub-date { gap: 10px; padding: 18px 20px; background: var(--tint); border-radius: 0; }
.stub-red .stub-date { background: color-mix(in srgb, var(--red) 8%, var(--sheet)); }
.stub-amber .stub-date { background: color-mix(in srgb, var(--amber) 9%, var(--sheet)); }
.stub-date::after { top: 0; bottom: 0; inset-inline-end: 0; width: 1px; border: 0; background: none;
  background-image: radial-gradient(circle, var(--paper) 0 3px, transparent 3.5px); background-size: 12px 14px; background-repeat: repeat-y; background-position: center; width: 12px; inset-inline-end: -6px; }
.stub-body { padding: 18px 24px 16px; gap: 4px; }
.stub-head h3 { font-size: 1.04rem; }
.stub-foot { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 10px; }
.stub-left { font-size: .95rem; }
.ref { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--tint); color: var(--ink-2); font-size: .7rem; }
.avatar-sm { width: 26px; height: 26px; box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3px var(--rule); }

/* الشارة: كبسولة صغيرة بنقطة، وهي للتحكم الصغير */
.badge { border: 0; border-radius: 99px; padding: 1px 10px 1px 9px; gap: 6px; font-size: .74rem; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.badge .icon-xs { width: 12px; height: 12px; }
.badge.gray { box-shadow: inset 0 0 0 1px var(--rule-strong); }

/* الأزرار والحقول */
button, .btn { border-radius: var(--radius-sm); min-height: 42px; padding: 8px 20px; }
button:not(.secondary):not(.link):not(.icon-btn):not(.tab), .btn:not(.secondary) { box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 6px 14px -8px color-mix(in srgb, var(--ink) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.12); }
button.secondary, .btn.secondary { border: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 45%, transparent); background: var(--sheet); }
button.secondary:hover, .btn.secondary:hover { box-shadow: inset 0 0 0 1px var(--ink); background: var(--sheet); color: var(--ink); }
.icon-btn { border-radius: var(--radius-sm); }
input, select, textarea { border-radius: var(--radius-sm); min-height: 44px; border-color: transparent; box-shadow: inset 0 0 0 1px var(--rule-strong); background: var(--sheet); }
input:hover, select:hover, textarea:hover { box-shadow: inset 0 0 0 1px var(--ink-2); }
input:focus, select:focus, textarea:focus { border-color: transparent; box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent); }
.seg-opt { border: 0; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.seg-opt:has(input:checked) { box-shadow: inset 0 0 0 1.5px var(--ink); background: var(--tint); }
.banner { border: 0; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 25%, transparent); }
.strip { border-radius: 0; box-shadow: none; }

/* التبويبات: مقطع منزلق ناعم */
.tab-bar { border: 0; gap: 4px; padding: 4px; background: var(--tint); border-radius: 12px; width: max-content; max-width: 100%; }
.tab { border: 0; border-radius: 9px; padding: 7px 14px; margin: 0; }
.tab[aria-selected="true"] { background: var(--sheet); color: var(--ink); box-shadow: var(--e1); }
.folder-tabs a { border-radius: 12px 12px 0 0; }

/* بطاقات البنود والباقات */
.clause { padding: 28px 26px 24px; }
.emblem { width: 52px; height: 52px; border: 0; border-radius: 14px; background: var(--tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.clause:hover .emblem { transform: rotate(-6deg) scale(1.04); }
.plan { border: 0; border-radius: 18px; }
.plan.featured { box-shadow: 0 0 0 2px var(--ink), var(--e3); }
.plan.featured .badge { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.f-icon { border: 0; border-radius: 16px; background: var(--tint); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 10%, transparent); }
.card.next { border: 0; }
.next-steps .card.next .icon { padding: 7px; width: 34px; height: 34px; border-radius: 10px; background: var(--tint); }
.menu-list { border: 0; border-radius: 12px; box-shadow: var(--e3); }
.cal { box-shadow: var(--e1); }
.cal-day { border-color: color-mix(in srgb, var(--rule) 70%, transparent); }
.cal-day.today .g { box-shadow: 0 4px 10px -4px var(--ink); }

/* بطاقة الأداة في الصفحة التعريفية */
.instrument { border: 0; box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 0 6px var(--sheet), inset 0 0 0 7px var(--rule-strong), var(--e3); }
.instrument .due .datebox .dt-tile b { font-size: 1.6rem; }
@media (prefers-reduced-motion: no-preference) {
  .instrument .due .dt-tile { animation: hc-ink .4s cubic-bezier(.16,1,.3,1) .8s both; }
  .instrument .due .dt-meta { animation: hc-ink .4s cubic-bezier(.16,1,.3,1) .95s both; }
}

@media (max-width: 760px) {
  .stub { grid-template-columns: 1fr; }
  .stub-date { padding: 14px 16px; }
  .stub-date::after { top: auto; bottom: -6px; inset-inline: 0; width: auto; height: 12px; background-size: 14px 12px; background-repeat: repeat-x; }
  .tab-bar { width: 100%; }
  .grid > .stat { border-top: 0; }
}
@media (max-width: 639.98px) {
  table.cards tr { border: 0; box-shadow: var(--e1); border-radius: var(--radius); }
  table.cards td { border-top-style: solid; border-top-color: color-mix(in srgb, var(--rule) 70%, transparent); }
}

/* =====================================================================
   17. الجوال: شريط تنقل سفلي، وأهداف لمس 44px، ومنع التمرير الأفقي
   ===================================================================== */
.bottom-nav { display: none; }
@media (max-width: 760px) {
  /* الألسنة العلوية تُخفي نصف الروابط خارج الشاشة بلا إشارة؛ يحل محلها شريط سفلي ثابت */
  .has-shell .folder-tabs { display: none; }
  .has-shell .masthead { padding-bottom: 0; }
  .has-shell .main { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 40; inset-inline: 0; bottom: 0;
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); background: var(--sheet); box-shadow: 0 -1px 0 var(--rule-strong), 0 -10px 24px -18px rgba(15,59,71,.5); }
  .bottom-nav > a, .bottom-nav summary { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 54px; padding: 4px 2px; border-radius: 10px; color: var(--muted); font-size: .7rem; font-weight: 600; text-decoration: none; line-height: 1.25; text-align: center; cursor: pointer; list-style: none; }
  .bottom-nav summary::-webkit-details-marker { display: none; }
  .bottom-nav .icon { width: 22px; height: 22px; }
  .bottom-nav > a.active, .bottom-nav .more.active > summary, .bottom-nav .more[open] > summary { color: var(--ink); background: var(--tint, var(--sheet-2)); }
  .bottom-nav .count { position: absolute; top: 3px; inset-inline-start: calc(50% + 4px); min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .66rem; line-height: 18px; }
  .bottom-nav .more { display: block; }
  .bottom-nav .more > summary { height: 100%; }
  .bottom-nav .more-sheet { position: fixed; inset-inline: 8px; bottom: calc(66px + env(safe-area-inset-bottom)); display: grid; gap: 2px; padding: 8px;
    background: var(--sheet); border-radius: 14px; box-shadow: var(--e3, 0 20px 40px -12px rgba(0,0,0,.4)); }
  .bottom-nav .more-sheet a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
  .bottom-nav .more-sheet a.active { background: var(--sheet-2); }
  .bottom-nav .more-sheet .count { position: static; margin-inline-start: auto; }

  /* سطر «اليوم» في اللوحة: التاريخ بالتقويمين أعرض من الشاشة عند 360px */
  .today-date { white-space: normal; min-width: 0; }
  .today-line::before { min-width: 12px; }
  /* قائمة التصدير تُفتح نحو داخل الشاشة */
  details.menu { position: relative; }
  details.menu .menu-list { inset-inline-end: auto; inset-inline-start: 0; max-width: calc(100vw - 32px); }
  /* ألسنة صفحة المنشأة: تلتف بدل أن تختفي خارج الشاشة */
  .tab-bar { flex-wrap: wrap; overflow: visible; }
}
/* أهداف اللمس: 44px على الأجهزة اللمسية (WCAG 2.5.5) */
@media (pointer: coarse) {
  .btn, button:not(.tab):not(.icon-btn), details summary.btn-sm, details.menu > summary { min-height: 44px; }
  details summary.btn-sm, details.group summary, a.assign { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; }
  .stub-owner a.assign { display: inline-flex; }
  .tab { min-height: 40px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  .report-tools .btn, .report-tools > button, .report-tools summary.btn { min-height: 44px; }
  /* روابط المنشأة في البطاقات، و«اعرض الكل»: أكثر ما يُلمس */
  .stub a:not(.assign), table.cards td > a, .tab-panel p > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
}

/* 11. مساعد الصفحة التعريفية (assets/assistant.js، على نمط «مساعد عدلك» بهوية «الورق المؤمَّن»)
 * زر عائم بختم الحبر البترولي، ونافذة كورقة مرفوعة. كل الأزرار تحمل .secondary لتتجاوز ظل الأزرار العام، ثم تُضبط هنا. */
.hca { --hca-w: 380px; position: fixed; z-index: 60; inset-inline-start: auto; inset-inline-end: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; font-size: .9rem; }
.hca-seal { width: 34px; height: 34px; flex: none; }
.hca-seal__disc { fill: var(--ink); }
.hca-seal__ring { fill: none; stroke: var(--on-ink); stroke-width: 1.2; stroke-dasharray: 2.2 2; opacity: .7; }
.hca-seal__tick { fill: none; stroke: var(--on-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hca .hca-fab { min-height: 52px; padding: 8px 18px 8px 10px; gap: 10px; border-radius: 99px; background: var(--sheet); color: var(--ink); box-shadow: var(--e3, var(--shadow-float)); font-weight: 600; }
.hca .hca-fab:hover { background: var(--sheet-2); color: var(--ink); }
.hca.is-open .hca-fab__lbl { display: none; }
.hca.is-open .hca-fab { padding: 8px; }
.hca-win { width: var(--hca-w); max-width: calc(100vw - 32px); height: min(600px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--sheet); border-radius: 14px; box-shadow: var(--e3, var(--shadow-float)); overflow: hidden; }
.hca-win[hidden] { display: none; }
.hca-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--ink); color: var(--on-ink); }
.hca-head .hca-seal__disc { fill: var(--on-ink); }
.hca-head .hca-seal__ring, .hca-head .hca-seal__tick { stroke: var(--ink); }
.hca-head__t { flex: 1; min-width: 0; }
.hca-head h2 { margin: 0; font-family: var(--f-title); font-size: 1.15rem; line-height: 1.4; color: var(--on-ink); }
.hca-head p { margin: 0; font-size: .76rem; opacity: .82; }
.hca .hca-ic { min-height: 34px; min-width: 34px; padding: 0; background: transparent; color: var(--on-ink); box-shadow: none; font-size: 1.1rem; border-radius: var(--radius-sm); }
.hca .hca-ic:hover { background: rgba(255,255,255,.12); color: var(--on-ink); }
.hca-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); overscroll-behavior: contain; }
.hca-log:focus { outline: none; }
.hca-msg { max-width: 88%; padding: 9px 13px; border-radius: 12px; line-height: 1.8; }
.hca-msg p { margin: 0; }
.hca-msg ul { margin: 6px 0 0; padding-inline-start: 18px; }
.hca-msg li { margin: 2px 0; }
.hca-msg--a { align-self: flex-start; background: var(--sheet); color: var(--ink); box-shadow: var(--e1, 0 0 0 1px var(--rule)); border-start-start-radius: 4px; }
.hca-msg--u { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-start-end-radius: 4px; }
.hca-msg.is-new { animation: hca-in .22s ease-out both; }
@keyframes hca-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.hca-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hca .hca-btn { min-height: 34px; padding: 4px 12px; font-size: .8rem; white-space: normal; }
.hca-qr { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 4px; background: var(--sheet); border-top: 1px solid var(--rule); }
.hca-qr:empty { display: none; }
.hca .hca-chip { min-height: 32px; padding: 3px 12px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: normal; text-align: start; }
.hca-in { display: flex; gap: 6px; padding: 10px 14px; background: var(--sheet); border-top: 1px solid var(--rule); }
.hca-in input { flex: 1; min-width: 0; margin: 0; }
.hca .hca-send { min-height: 40px; padding: 6px 14px; }
.hca-teaser { position: relative; max-width: 270px; padding: 12px 34px 12px 14px; background: var(--sheet); border-radius: 12px; box-shadow: var(--e3, var(--shadow-float)); }
.hca-teaser[hidden] { display: none; }
.hca-teaser p { margin: 0 0 8px; font-size: .84rem; line-height: 1.7; }
.hca .hca-teaser__go { min-height: 34px; padding: 4px 14px; font-size: .8rem; }
.hca .hca-x { position: absolute; top: 6px; inset-inline-end: 6px; min-height: 26px; min-width: 26px; padding: 0; background: transparent; box-shadow: none; color: var(--muted); font-size: 1rem; }
@media (max-width: 640px) {
  .hca { inset-inline-end: 12px; bottom: 12px; }
  .hca .hca-fab__lbl { display: none; }
  .hca .hca-fab { padding: 8px; }
  .hca.is-open { inset: 0; align-items: stretch; gap: 0; }
  .hca.is-open .hca-fab { display: none; }
  .hca-win { width: 100%; max-width: none; height: 100%; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { .hca-msg.is-new { animation: none; } }
@media print { .hca { display: none; } }

/* ثقة بند المكتبة (#77) */
.trust { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.trust .hint { margin: 0; }
.portal-link { display: inline-flex; align-items: center; gap: 4px; font-size: .84rem; font-weight: 600; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* استيراد المنشآت (#47) */
.import-errors { margin: 4px 0 0; padding-inline-start: 18px; color: var(--red); font-size: .85rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }

/* الإنجاز الجماعي (و-3) */
.stub-foot { flex-wrap: wrap; }
.stub-foot .bulk { flex: 1 1 100%; order: 3; }
.bulk fieldset { border: 1px solid var(--rule-strong); border-radius: 6px; padding: 6px 12px 8px; margin: 0; }
.bulk legend { padding: 0 6px; font-weight: 600; font-size: .86rem; }
.bulk label.check { margin: 4px 0; }

/* بوابة العميل (#52) */
.portal-est h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.portal-docs { margin: 0; padding-inline-start: 18px; }
.portal-docs li { margin: 4px 0; }

/* قائمة المستخدم (و-9) */
.user-menu > summary.mast-user { cursor: pointer; }
.user-menu .menu-list { min-width: 200px; z-index: 60; }
.masthead { overflow-x: clip; overflow-y: visible; } /* القائمة تنزل تحت الرأس، والزخرفة تبقى مقصوصة أفقياً */
.masthead .mast-top { position: relative; z-index: 5; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; margin: 0; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* الرسوم البيانية (و-7): SVG من الخادم، والألوان من متغيرات الوضعين */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.chart-card { margin: 0; }
.chart-card figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.chart-card figcaption small { flex-basis: 100%; margin: 0; }
.chart { display: block; width: 100%; height: auto; direction: ltr; font-family: var(--f-ui); }
.chart text { fill: var(--muted); font-size: 12px; }
.chart .val, .chart .lbl { fill: var(--ink); font-size: 13px; }
.chart .val { font-weight: 600; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .axis { stroke: var(--rule-strong); stroke-width: 1; }
.chart .bar { fill: var(--blue); }
.chart .seg.overdue { fill: var(--red); }
.chart .seg.upcoming { fill: var(--muted); opacity: .55; }
.chart .hit { fill: transparent; }
.chart .mark:hover .bar, .chart .mark:hover .seg { opacity: .8; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-start: 6px; }
.legend .key.overdue { background: var(--red); }
.legend .key.upcoming { background: var(--muted); opacity: .55; }
@media (forced-colors: active) { .chart .bar, .chart .seg.overdue { fill: CanvasText; } .chart .seg.upcoming { fill: GrayText; } }

/* الخريطة الحرارية للمخاطر (GRC ح-3): خلفية بلون المستوى، والعدد بنص واضح */
.heatmap td { text-align: center; min-width: 2.5rem; }
.heatmap td.c-red { background: var(--red-bg); }
.heatmap td.c-amber { background: var(--amber-bg); }
.heatmap td.c-green { background: var(--green-bg); }
