/* تصميم على نمط لوحات التحكم المألوفة لموظفي الجمعيات: قائمة جانبية فاتحة بأيقونات ملونة،
   وشريط علوي أبيض، ولوحات برؤوس زرقاء فاتحة، وخط كوفي. */
:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-2: #cbd5e1;
  --text: #1e293b;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-dark: #172554;
  --panel-head: #e8f0fc;
  --panel-head-border: #c7d8f3;
  --thead: #d8e6f8;
  --accent: #d97706;
  --accent-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #b45309;
  --warn-soft: #fff7e6;
  --notice: #fff3cd;
  --notice-text: #7a5a00;
  --ok: #059669;
  --ok-soft: #d1fae5;
  --info: #0891b2;
  --info-soft: #cffafe;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sidebar: 250px;
  font-family: "Kufi", "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text-2); font-size: 13.5px; line-height: 1.75; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.5; color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.fa-solid, .fa-regular { line-height: 1; }

/* ---------- ألوان مربعات الأيقونات ---------- */
.ni-blue   { background: #dbeafe; color: #2563eb; }
.ni-green  { background: #d1fae5; color: #059669; }
.ni-indigo { background: #e0e7ff; color: #4338ca; }
.ni-cyan   { background: #cffafe; color: #0891b2; }
.ni-amber  { background: #fef3c7; color: #d97706; }
.ni-teal   { background: #ccfbf1; color: #0d9488; }
.ni-rose   { background: #ffe4e6; color: #e11d48; }
.ni-purple { background: #ede9fe; color: #7c3aed; }
.ni-orange { background: #ffedd5; color: #ea580c; }
.ni-slate  { background: #f1f5f9; color: #475569; }
.ni-red    { background: #fee2e2; color: #dc2626; }
/* المربعات الممتلئة في بطاقات الإجراءات */
.nf-blue   { background: #2563eb; color: #fff; }
.nf-green  { background: #10b981; color: #fff; }
.nf-indigo { background: #4f46e5; color: #fff; }
.nf-cyan   { background: #0891b2; color: #fff; }
.nf-amber  { background: #d97706; color: #fff; }
.nf-teal   { background: #0d9488; color: #fff; }
.nf-rose   { background: #e11d48; color: #fff; }
.nf-purple { background: #8b5cf6; color: #fff; }
.nf-orange { background: #ea580c; color: #fff; }
.nf-slate  { background: #475569; color: #fff; }
.nf-red    { background: #dc2626; color: #fff; }

/* ---------- الهيكل ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: 68px 1fr; min-height: 100vh; }
.topbar {
  grid-column: 1 / -1; height: 68px; background: #fff; border-bottom: 1px solid #f1f5f9;
  box-shadow: 0 2px 8px rgba(15,23,42,.10), 0 1px 2px rgba(15,23,42,.06);
  display: flex; align-items: center; gap: 12px; padding: 0 16px; position: sticky; top: 0; z-index: 40;
}
.topbar .menu-btn { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 46px; width: auto; max-width: 170px; object-fit: contain; }
.brand .mark { width: 42px; height: 42px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.brand .sep { width: 1px; height: 30px; background: var(--border); }
.brand b { font-size: 17px; font-weight: 700; color: var(--text); }
.topbar .spacer { flex: 1; }
.tb-icon { position: relative; width: 38px; height: 38px; border-radius: 10px; background: #f1f5f9; display: grid; place-items: center; color: var(--text-2); border: 0; cursor: pointer; text-decoration: none !important; }
.tb-icon:hover { background: #e2e8f0; }
.tb-icon .dot { position: absolute; top: -4px; inset-inline-start: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.tb-sep { width: 1px; height: 28px; background: var(--border); margin: 0 4px; }
.userchip { display: flex; align-items: center; gap: 8px; background: #f1f5f9; border-radius: 10px; padding: 6px 12px; cursor: pointer; position: relative; border: 0; }
.userchip .ico { color: var(--primary); }
.userchip b { font-size: 13px; font-weight: 500; color: var(--text); }
.user-menu { position: absolute; top: 46px; inset-inline-end: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(15,23,42,.12); min-width: 220px; padding: 8px; z-index: 50; text-align: start; }
.user-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu .who small { display: block; color: var(--muted); }
.user-menu button, .user-menu a { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); text-decoration: none !important; }
.user-menu button:hover, .user-menu a:hover { background: #f1f5f9; }

.sidebar { background: #fff; border-inline-start: 1px solid var(--border); position: sticky; top: 68px; height: calc(100vh - 68px); overflow-y: auto; padding: 14px 10px 30px; }
.nav-group { font-size: 10px; font-weight: 700; color: var(--muted-2); padding: 14px 12px 6px; }
.nav a, .nav span.soon {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px; height: 48px;
  color: #475569; font-size: 13.5px; font-weight: 500; text-decoration: none !important;
}
.nav a:hover { background: #f8fafc; }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav span.soon { opacity: .55; cursor: default; }
.nav .ico { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; font-size: 13.5px; flex: none; }
.nav .tag { margin-inline-start: auto; font-size: 10px; background: #fee2e2; color: #dc2626; padding: 0 8px; border-radius: 10px; line-height: 18px; }
.nav .tag.soon-tag { background: #f1f5f9; color: var(--muted); }
.nav .count { margin-inline-start: auto; font-size: 11px; background: var(--danger); color: #fff; padding: 0 7px; border-radius: 10px; line-height: 18px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.crumbbar { background: #fff; border-bottom: 1px solid var(--border); padding: 0 24px; height: 38px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbbar a { color: var(--muted); }
.crumbbar .home { color: var(--primary); }
.crumbbar b { color: var(--text); font-weight: 700; }
.content { padding: 20px 22px; width: 100%; flex: 1; }
.footer { background: #fff; border-top: 1px solid var(--border); height: 46px; display: flex; align-items: center; padding: 0 22px; gap: 10px; font-size: 13px; color: var(--text-2); }
.footer .ver { background: #f1f5f9; border-radius: 8px; padding: 0 8px; font-size: 11px; color: var(--muted); }
.footer .spacer { flex: 1; }

/* ---------- عناوين الصفحات ---------- */
/* رأس الصفحة لوحة زرقاء فاتحة؛ إن تبعته بطاقة اتصل بها فصارا لوحة واحدة برأسها. */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; background: var(--panel-head); border: 1px solid var(--panel-head-border); border-radius: var(--radius); padding: 12px 18px; }
.page-head:has(+ .card) { border-radius: var(--radius) var(--radius) 0 0; margin-bottom: 0; }
.page-head + .card { border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.page-head + .card > .card-head:first-child, .page-head + .card > .tabs:first-child { border-radius: 0; }
.page-head.bare { background: none; border: 0; padding: 0; }
.page-head.bare + .card { border-top: 1px solid var(--border); border-radius: var(--radius); }
.page-head h1 { font-size: 16px; font-weight: 700; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: none; }

/* ---------- البطاقات واللوحات ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--panel-head-border); background: var(--panel-head); display: flex; align-items: center; gap: 10px; border-radius: var(--radius) var(--radius) 0 0; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .actions { margin-inline-start: auto; display: flex; gap: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-head + .card-body.flush .table th { border-top: 0; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

/* ---------- الأزرار والحقول ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px;
  border: 1px solid var(--border-2); background: #fff; padding: 7px 16px; cursor: pointer;
  font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none !important; color: var(--text-2); min-height: 36px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.accent { background: #10b981; border-color: #10b981; color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 3px 10px; font-size: 12px; min-height: 30px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > .cap { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field > .cap .req { color: var(--danger); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid #ccd6e3; border-radius: 4px; padding: 7px 11px; background: #fff; min-height: 38px; color: var(--text);
}
textarea.input { min-height: 90px; resize: vertical; }
.input::placeholder { color: #9aa7b8; }
.input:focus { outline: 0; border-color: #86b7fe; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.input[readonly] { background: #f1f5f9; }
input[type="date"].input, input[type="time"].input { direction: ltr; text-align: end; }
/* قائمة منسدلة ببحث (Select2) */
.ss { position: relative; min-width: 0; }
.ss-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; text-align: start; }
.ss-box .ph { color: #9aa7b8; }
.ss-box i { font-size: 11px; color: var(--muted); }
.ss-box.open { border-color: #86b7fe; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.ss-menu { position: absolute; inset-inline: 0; top: calc(100% + 2px); z-index: 45; background: #fff; border: 1px solid #aac4ec; border-radius: 4px; box-shadow: 0 8px 24px rgba(15,23,42,.12); }
.ss-search { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.ss-search input { flex: 1; border: 1px solid #ccd6e3; border-radius: 4px; padding: 5px 9px; min-height: 32px; }
.ss-search i { color: var(--muted); font-size: 12px; }
.ss-menu ul { list-style: none; margin: 0; padding: 4px 0; max-height: 260px; overflow-y: auto; }
.ss-menu li { padding: 7px 14px; cursor: pointer; font-size: 13.5px; }
.ss-menu li.hi { background: #3b82f6; color: #fff; }
.ss-menu li.on:not(.hi) { background: var(--primary-soft); }
.ss-menu li.none { color: var(--muted); cursor: default; }
.page-head.bare { min-height: 0; margin-bottom: 12px; }
.page-head.bare:empty { display: none; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3, .form-grid .full { grid-column: 1 / -1; }
.form-section { font-weight: 700; color: var(--primary); grid-column: 1 / -1; padding-top: 8px; border-top: 1px dashed var(--border-2); margin-top: 4px; font-size: 14px; }
.form-section:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.form-actions .btn.primary { min-width: 120px; }

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #fbfcfe; }
.filters .field { width: 200px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.filters-toggle { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; font-weight: 700; color: var(--text); background: #fff; user-select: none; }
.filters-toggle .chev { margin-inline-start: auto; color: var(--muted); }

/* ---------- الجداول ---------- */
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: center; font-weight: 700; color: #1e3a5f; font-size: 12.5px; background: var(--thead); padding: 10px 10px; border: 1px solid #c6d8ef; white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid #edf1f6; vertical-align: middle; text-align: center; }
.table tbody tr:nth-child(even) td { background: #fafbfd; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #f1f6ff; }
.table .num { font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; background: #f1f5f9; }
.table td.start, .table th.start { text-align: start; }
.table-wrap { overflow-x: auto; }
.pager { display: flex; align-items: center; justify-content: center; position: relative; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); background: #f8fafc; }
.pager .cnt { position: absolute; inset-inline-start: 14px; font-size: 12px; }
.pager .pg { display: flex; align-items: center; gap: 4px; }
.pager .pg button { min-width: 28px; height: 28px; border: 0; background: none; color: #94a3b8; cursor: pointer; border-radius: 4px; font: inherit; font-size: 12px; }
.pager .pg button:hover:not(:disabled) { background: #e2e8f0; color: var(--text); }
.pager .pg button:disabled { opacity: .45; cursor: default; }
.pager .pg button.n { color: var(--text-2); }
.pager .pg button.n.on { background: var(--primary); color: #fff; }
.pager .pp { height: 28px; border: 1px solid var(--border-2); border-radius: 4px; padding: 0 6px; margin-inline-start: 8px; font: inherit; font-size: 12px; background: #fff; }
.list-title { text-align: center; color: var(--primary); padding: 8px; font-size: 13px; background: #f8fbff; border-bottom: 1px solid var(--border); }

/* رقائق القيم في الجداول */
.chip-id { display: inline-block; border: 1px solid #3b82f6; color: #1d4ed8; background: #eff6ff; border-radius: 4px; padding: 0 10px; font-size: 12px; min-width: 96px; font-variant-numeric: tabular-nums; }
.chip-mobile { display: inline-block; border: 1px solid #f59e0b; color: #b45309; background: #fff7e6; border-radius: 4px; padding: 0 10px; font-size: 12px; min-width: 96px; font-variant-numeric: tabular-nums; }
.chip-no { display: inline-block; border: 1px solid var(--border-2); background: #f8fafc; border-radius: 4px; padding: 0 10px; font-size: 12px; min-width: 50px; color: var(--text-2); }

.badge { display: inline-block; padding: 0 10px; border-radius: 4px; font-size: 12px; font-weight: 500; white-space: nowrap; background: #fff; color: var(--muted); border: 1px solid var(--border-2); line-height: 22px; }
.badge.ok { color: #059669; border-color: #34d399; background: #ecfdf5; }
.badge.warn { color: #b45309; border-color: #fbbf24; background: #fffbeb; }
.badge.danger { color: #dc2626; border-color: #f87171; background: #fef2f2; }
.badge.info { color: #0369a1; border-color: #7dd3fc; background: #f0f9ff; }
.badge.primary { color: #4338ca; border-color: #a5b4fc; background: #eef2ff; }
.badge.accent { color: #c2410c; border-color: #fdba74; background: #fff7ed; }

/* رقائق التجميع (عرض حسب) */
.groupby { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 12px 16px; }
.groupby .g { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 20px; padding: 2px 12px; font-size: 12px; background: #fff; cursor: pointer; }
.groupby .g.on { border-color: var(--primary); background: var(--primary-soft); }
.groupby .g .dot { width: 8px; height: 8px; border-radius: 50%; }
.groupby .g .pct { color: var(--muted); }

/* ---------- لوحة المعلومات ---------- */
.hero { border-radius: 20px; padding: 30px 30px 26px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--primary-dark, #0c1222) 0%, var(--primary-2, #312e81) 65%, var(--primary, #4338ca) 100%); }
.hero::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 18px 18px; pointer-events: none; }
.hero .top { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
/* الشعار بحجمه الطبيعي: ارتفاع ثابت وعرض حسب نسبة الصورة، فلا يصغر الشعار العريض. */
.hero .logo { min-width: 64px; height: 72px; padding: 6px 10px; border-radius: 14px; background: #fff; display: grid; place-items: center; overflow: hidden; color: #312e81; font-weight: 800; font-size: 24px; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.hero .logo img { height: 60px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.hero h2 { color: #fff; font-size: 22px; font-weight: 800; }
.hero small { color: rgba(255,255,255,.78); font-size: 12.5px; }
.hero .clock { margin-inline-start: auto; text-align: end; }
.hero .clock b { font-size: 22px; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }
.hero .clock small { color: rgba(255,255,255,.7); }
.hero .box { border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 16px; text-align: center; }
.hero .box small { display: block; color: rgba(255,255,255,.7); font-size: 11px; }
.hero .box b { font-size: 18px; color: var(--accent-soft, #fef3c7); }
.hero .quick { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; position: relative; z-index: 1; }
.hero .quick a { border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08); color: #fff; border-radius: 10px; padding: 7px 14px; font-size: 13px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center; text-decoration: none !important; }
.hero .quick a:hover { background: rgba(255,255,255,.16); }

.kpi { border-radius: 16px; color: #fff; padding: 18px 20px; position: relative; overflow: hidden; min-height: 132px; display: flex; flex-direction: column; text-decoration: none !important; }
.kpi .t { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.kpi .t .i { margin-inline-start: auto; width: 28px; height: 28px; border-radius: 8px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 12px; }
.kpi .v { font-size: 30px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 13px; font-weight: 500; opacity: .85; margin-inline-start: 6px; }
.kpi .v { display: flex; align-items: baseline; flex-wrap: wrap; }
.kpi .v .u { font-size: 14px; font-weight: 500; opacity: .75; margin-inline-start: 6px; }
.kpi .v .sep { width: 2px; height: 26px; background: rgba(255,255,255,.45); margin: 0 14px; align-self: center; border-radius: 1px; }
.kpi .v .v2 { font-size: 19px; font-weight: 700; opacity: .8; }
.kpi .v .v2 .u { font-size: 13px; }
.kpi .f { font-weight: 700; }
.kpi .f > i { font-size: 11px; margin-inline-end: 2px; }
.kpi .f { font-size: 12px; opacity: .9; margin-top: auto; }
.kpi .f .pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.2); border-radius: 8px; padding: 2px 10px; font-weight: 700; color: #fff; text-decoration: none !important; }
.kpi .bg { position: absolute; inset-inline-end: 14px; bottom: 6px; font-size: 52px; opacity: .15; }
.k1 { background: linear-gradient(135deg, #0f766e, #2dd4bf); }
.k2 { background: linear-gradient(135deg, #1e40af, #60a5fa); }
.k3 { background: linear-gradient(135deg, #7e22ce, #c084fc); }
.k4 { background: linear-gradient(135deg, #c2410c, #fb923c); }
.k5 { background: linear-gradient(135deg, #be123c, #fb7185); }
.kb { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.kg { background: linear-gradient(135deg, #059669, #10b981); }
.ka { background: linear-gradient(135deg, #d97706, #f59e0b); }
.kr { background: linear-gradient(135deg, #dc2626, #ef4444); }

.feed { background: #fff; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid #edf1f6; display: flex; flex-direction: column; min-height: 200px; }
.feed .h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid #f1f5f9; }
.feed .h .ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; }
.feed .h b { font-size: 14px; font-weight: 700; color: var(--text); }
.feed .h a { margin-inline-start: auto; font-size: 12.5px; }
.feed .empty { margin: auto; }
.feed .empty i { font-size: 28px; color: #cbd5e1; display: block; margin-bottom: 8px; }
.feed ul { list-style: none; margin: 0; padding: 0; }
.feed li a { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid #f8fafc; color: var(--text-2); text-decoration: none !important; }
.feed li a:hover { background: #f8fafc; }
.feed li .r { margin-inline-start: auto; }

/* ---------- صفحات الأقسام ---------- */
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .value { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); }
.stat a.value { color: var(--text); text-decoration: none; }
.stat .foot { font-size: 12px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { display: flex; gap: 14px; align-items: center; padding: 16px 18px; text-decoration: none !important; color: var(--text); min-height: 72px; }
.tile:hover { border-color: #93c5fd; box-shadow: 0 4px 14px rgba(37,99,235,.08); }
.tile .ico { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; font-size: 15px; flex: none; }
.tile b { display: block; font-size: 14px; font-weight: 700; }
.tile small { color: var(--muted); font-size: 12px; }
.tile .count { margin-inline-start: auto; font-weight: 800; color: var(--primary); }

.linkcard .lh { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.linkcard .lh .ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; }
.linkcard .lh b { font-size: 14px; font-weight: 700; color: var(--text); }
.linkcard ul { list-style: none; margin: 0; padding: 6px 0; }
.linkcard li a, .linkcard li span.soon { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--text-2); text-decoration: none !important; font-size: 13px; }
.linkcard li a:hover { background: #f8fafc; }
.linkcard li .ico { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; }
.linkcard li .n { margin-inline-start: auto; font-size: 11px; border-radius: 10px; padding: 0 8px; font-weight: 700; }
.linkcard li span.soon { opacity: .5; }

/* ---------- عناصر متفرقة ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; background: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.tabs button { border: 0; background: none; padding: 12px 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tabs .cnt { font-size: 11px; background: var(--danger); color: #fff; border-radius: 10px; padding: 0 6px; margin-inline-start: 6px; }

dl.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
dl.kv div { min-width: 0; }
dl.kv dt { font-size: 12px; color: var(--muted); }
dl.kv dd { margin: 2px 0 0; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }

.alert { border-radius: 8px; padding: 11px 16px; font-size: 13.5px; display: flex; gap: 8px; align-items: flex-start; border: 1px solid transparent; }
.alert.warn { background: var(--notice); color: var(--notice-text); border-color: #ffe69c; }
.alert.info { background: #e7f1ff; color: #1e40af; border-color: #c7dbff; }
.alert.danger { background: #fdecec; color: #991b1b; border-color: #f8c9c9; }
.alert.ok { background: #e9f9f1; color: #065f46; border-color: #bfeed6; }
.notice-bar { background: var(--notice); color: var(--notice-text); padding: 11px 18px; font-size: 13.5px; border-bottom: 1px solid #ffe69c; }
.notice-bar b { margin-inline-end: 4px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline time { color: var(--muted); font-size: 12.5px; }
.timeline .note { color: var(--muted); font-size: 12.5px; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 16px; }
.right { margin-inline-start: auto; }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 120px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.bar .fill { height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: 6px; }
.bar .n { text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- المحاسبة ---------- */
.acc-select { position: relative; min-width: 0; }
.acc-menu { position: absolute; inset-inline: 0; top: 41px; z-index: 40; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto; min-width: 260px; }
.acc-opt { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 7px 12px; cursor: pointer; font-size: 13px; }
.acc-opt:hover, .acc-opt.on { background: var(--primary-soft); }
.lines-table td { padding: 6px 8px; vertical-align: top; }
.lines-table .input { min-height: 36px; padding: 6px 9px; }
.lines-table .amt { width: 130px; }
.diff-bad { color: var(--danger); font-weight: 700; }
.diff-ok { color: var(--ok); font-weight: 700; }
.tree-row td:first-child { white-space: nowrap; text-align: start; }
.tree-row.g td { font-weight: 700; background: #f8fbff !important; }
.neg { color: var(--danger); }

.voucher-doc { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 26px 30px; max-width: 820px; }
.voucher-doc .vh { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 16px; }
.voucher-doc .vh img { height: 64px; }
.voucher-doc .vh .t { margin-inline-start: auto; text-align: center; }
.voucher-doc .vh .t h2 { font-size: 22px; color: var(--primary); }
.voucher-doc .amount-box { display: inline-block; border: 2px solid var(--text); padding: 6px 16px; font-size: 20px; font-weight: 700; border-radius: 6px; }
.voucher-doc .kvline { display: flex; gap: 8px; padding: 8px 0; border-bottom: 1px dotted #bbb; }
.voucher-doc .kvline b { min-width: 120px; color: var(--muted); font-weight: 500; }
.voucher-doc .sigs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; text-align: center; font-size: 14px; }
.voucher-doc .sigs div { border-top: 1px solid #999; padding-top: 6px; }
.voucher-doc .void { color: var(--danger); border: 3px solid var(--danger); display: inline-block; padding: 2px 14px; transform: rotate(-8deg); font-size: 22px; font-weight: 700; }
.voucher-doc .table td, .voucher-doc .table th { text-align: start; }

/* ---------- النوافذ والتنبيهات ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal.wide { width: min(860px, 100%); }
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--panel-head-border); background: var(--panel-head); display: flex; align-items: center; border-radius: 12px 12px 0 0; }
.modal-head h3 { font-size: 15px; }
.modal-head .x { margin-inline-start: auto; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

.toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 380px; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

/* ---------- الدخول ---------- */
@keyframes tick { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- الجوال ---------- */
@media (max-width: 1100px) {
  .grid.c5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 68px; inset-inline-start: 0; width: 270px; z-index: 60; transform: translateX(100%); transition: transform .2s; box-shadow: -8px 0 24px rgba(0,0,0,.12); }
  .sidebar.open { transform: none; }
  .grid.c3, .grid.c4, .grid.c5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dl.kv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand b { font-size: 15px; }
    }
@media (max-width: 600px) {
  .content { padding: 14px 16px; }
  .grid.c2, .grid.c3, .grid.c4, .grid.c5, .form-grid, dl.kv { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .filters .field { width: 100%; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .userchip b, .brand .sep, .brand b, .tb-sep { display: none; }
  .hero { padding: 22px 18px; }
  .hero .clock { display: none; }
}

/* ---------- الطباعة ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .crumbbar, .footer, .no-print, .tabs, .page-head .actions { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; break-inside: avoid; }
  .print-only { display: block; }
  .voucher-doc { border: 0; padding: 0; max-width: none; }
}

/* أسفل صفحة المحاسبة: الرسم وملخص الحسابات */
.acc-bottom { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.lh-plain { display: flex; align-items: center; gap: 10px; padding: 16px 20px 4px; }
.lh-plain b { font-size: 14.5px; color: var(--text); }
.sum-list { list-style: none; margin: 0; padding: 8px 20px 16px; }
.sum-list li { display: grid; grid-template-columns: 34px auto 1fr auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.sum-list li:last-child { border-bottom: 0; }
.sum-list .ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; }
.sum-list b { color: var(--text); font-size: 13.5px; }
.sum-list small { color: var(--muted); font-size: 11.5px; }
.sum-list .v { font-weight: 800; font-size: 14px; }
@media (max-width: 960px) { .acc-bottom { grid-template-columns: 1fr; } }

/* وسيلة إيضاح الرسوم البيانية */
.chart-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 4px; font-size: 12px; color: #666; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 40px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- صفحات البحث (نمط نظام خير) ---------- */
.klist { padding: 18px 18px 0; }
.klist + .card { margin-top: 16px; }
.klist-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.klist-head h3 { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.klist-head h3 i { color: #0ea5b7; font-size: 15px; }
.klist-head .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.btn.add { background: #f0fdf4; border-color: #22c55e; color: #15803d; }
.btn.add:hover { background: #dcfce7; }
.btn.back { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.btn.teal { background: #0e9aa7; border-color: #0e9aa7; color: #fff; min-width: 96px; }
.btn.teal:hover { background: #0b8792; }
.kfilter { border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; margin-bottom: 14px; }
.kf-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px; cursor: pointer; user-select: none; }
.kf-head > i:first-child { color: #0e9aa7; }
.kf-head .chev { margin-inline-start: auto; color: #475569; font-size: 12px; }
.kfilter.open .kf-head { border-bottom: 1px solid var(--border); margin: 0 14px; padding-inline: 4px; }
.kf-body { padding: 12px 18px 16px; }
.kf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; }
.kf-grid .field > .cap { font-size: 12.5px; }
.kf-grid .field > .cap i { color: #0e9aa7; font-size: 11px; margin-inline-end: 2px; }
.kf-grid .full { grid-column: 1 / -1; }
.kf-actions { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }
.groupsel { display: flex; justify-content: center; margin: 14px 0; }
.groupsel label { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px 4px 12px; box-shadow: 0 1px 3px rgba(15,23,42,.06); font-size: 12px; color: var(--muted); }
.groupsel select { border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--text); cursor: pointer; padding: 4px; }
.klist .table-wrap { border: 1px solid var(--border); border-bottom: 0; border-radius: 6px 6px 0 0; }
.klist .pager { border: 1px solid var(--border); border-radius: 0 0 6px 6px; margin-bottom: 18px; }
.klist .table th { background: #bcd5f1; color: #1e293b; text-align: start; border-color: #fff; border-width: 0 0 0 1px; padding: 12px 10px; }
.klist .table td { text-align: start; }
.klist .table td.num, .klist .table td.c { text-align: center; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable i { font-size: 10px; color: #1e293b; margin-inline-start: 4px; }
.table tr.grp td { background: #eef4fb !important; font-weight: 700; color: #1e3a5f; text-align: start; }
.table tr.grp td i { color: #0e9aa7; margin-inline-end: 4px; }
.table td.acts { white-space: nowrap; }
.btn.xs { padding: 1px 9px; font-size: 11.5px; min-height: 26px; }
.btn.info { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.klist .empty { border: 1px solid var(--border); border-top: 0; }
@media (max-width: 760px) { .kf-grid { grid-template-columns: 1fr; } .pager .cnt { position: static; } .pager { flex-wrap: wrap; } }

/* ===== أدوات الأقسام الجديدة ===== */
.umulti .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.umulti .chip { display: inline-flex; align-items: center; gap: 6px; background: #eef2ff; color: #3730a3; border-radius: 14px; padding: 2px 10px; font-size: 13px; }
.umulti .chip button { border: 0; background: none; cursor: pointer; color: #6366f1; font-size: 11px; padding: 0; }
ul.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
ul.files a { color: var(--primary); }
.timeline { list-style: none; margin: 0; padding: 0 4px; }
.timeline li { display: flex; gap: 12px; position: relative; padding-bottom: 14px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 6px; top: 16px; bottom: 0; width: 2px; background: #e5e7eb; }
.timeline .dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: #93c5fd; border: 3px solid #dbeafe; margin-top: 3px; }
.timeline .dot.ok { background: #34d399; border-color: #d1fae5; }
.timeline .dot.danger { background: #f87171; border-color: #fee2e2; }
.timeline .dot.warn { background: #fbbf24; border-color: #fef3c7; }
.timeline b { font-size: 14px; }
.timeline p { margin: 2px 0; white-space: pre-wrap; color: #334155; }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.msg-body { white-space: pre-wrap; line-height: 1.9; padding: 4px 2px; }
.msg-unread td { font-weight: 700; }
.prio-urgent { color: #dc2626; } .prio-high { color: #d97706; } .prio-normal { color: #2563eb; } .prio-low { color: #64748b; }
.overdue { color: #dc2626; font-weight: 600; }
.vote-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.vote-row:last-child { border-bottom: 0; }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13px; color: #475569; }
.seg button + button { border-inline-start: 1px solid var(--border-2); }
.seg button.on.agree { background: #059669; color: #fff; } .seg button.on.disagree { background: #dc2626; color: #fff; } .seg button.on.abstain { background: #64748b; color: #fff; }
.steps { display: flex; gap: 0; margin: 4px 0 2px; counter-reset: st; flex-wrap: wrap; }
.steps span { flex: 1; min-width: 110px; text-align: center; padding: 8px 6px; font-size: 13px; background: #f1f5f9; color: #64748b; position: relative; }
.steps span.done { background: #dcfce7; color: #166534; } .steps span.cur { background: var(--primary); color: #fff; font-weight: 700; }
.steps span:first-child { border-radius: 0 6px 6px 0; } .steps span:last-child { border-radius: 6px 0 0 6px; }
.gov-std { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.gov-std:last-child { border-bottom: 0; }
.gov-bar { height: 10px; background: #e5e7eb; border-radius: 6px; overflow: hidden; }
.gov-bar i { display: block; height: 100%; border-radius: 6px; }
.grid.c2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.card-body h4.mt { font-size: 14px; color: var(--muted); margin: 16px 0 6px; }
@media (max-width: 960px) { .grid.c2-1 { grid-template-columns: 1fr; } }

/* ===== مجموعات الصلاحيات ===== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { display: inline-flex; align-items: center; background: #eef2ff; color: #3730a3; border-radius: 14px; padding: 2px 10px; font-size: 12.5px; }
.perm-preview { margin-top: 14px; padding: 12px; border: 1px dashed var(--border-2); border-radius: 10px; background: #f8fafc; }
.perm-preview b { display: block; margin-bottom: 8px; font-size: 13.5px; color: #334155; }
.perm-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.perm-mod { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; cursor: pointer; }
.perm-mod.on { border-color: #34d399; background: #f0fdf4; }
.perm-mod.blocked { opacity: .6; cursor: not-allowed; background: #f8fafc; }
.perm-mod input { width: 17px; height: 17px; accent-color: #059669; }
.perm-mod b { font-size: 13.5px; }
.perm-mod small { display: block; color: var(--muted); font-size: 12px; }
.perm-mod.blocked small { color: #b45309; }

/* ===== ترويسة المطبوعات والتوقيعات ===== */
.print-head { border-bottom: 2px solid #1f5f5b; padding-bottom: 10px; margin-bottom: 14px; display: none; justify-content: space-between; align-items: flex-end; gap: 16px; }
.print-head .ph-main { display: flex; align-items: center; gap: 12px; }
.print-head .ph-main.center { flex-direction: column; text-align: center; flex: 1; }
.print-head img { height: 60px; }
.print-head b { font-size: 17px; }
.print-head .ph-main div div { font-size: 12px; color: #444; }
.print-head .ph-meta { font-size: 11px; color: #555; text-align: start; }
.print-foot { position: fixed; bottom: 0; inset-inline: 0; text-align: center; font-size: 11px; color: #555; border-top: 1px solid #ccc; padding-top: 4px; }
.sig-block { margin-top: 36px; position: relative; break-inside: avoid; }
.sig-block .sigs { display: flex; justify-content: space-around; gap: 20px; text-align: center; }
.sig-block .sigs div { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.sig-block .sigs span { min-height: 18px; }
.sig-block .sigs i { font-style: normal; color: #555; font-size: 12px; }
.sig-block .stamp { position: absolute; inset-inline-start: 46%; top: -10px; height: 90px; opacity: .85; }
@media print { .print-head { display: flex !important; } }
.print-preview { border: 1px dashed var(--border-2); border-radius: 10px; padding: 16px; background: #fff; }
.print-preview .print-head, .print-preview .print-foot { display: flex !important; position: static; }
.print-preview .print-foot { display: block !important; margin-top: 14px; }
.sig-rows .row { margin-bottom: 8px; align-items: end; }

/* الخطاب الصادر عند الطباعة: تُخفى بطاقات الشاشة ويظهر الخطاب. */
.letter { font-size: 15px; line-height: 2; }
.letter .letter-meta { display: flex; flex-direction: column; align-items: flex-start; font-size: 13px; margin-bottom: 18px; }
.letter .letter-body { white-space: pre-wrap; min-height: 200px; margin: 14px 0 40px; }
.letter .letter-sign { display: flex; flex-direction: column; align-items: center; margin-inline-start: auto; width: 240px; }
@media print { .letter ~ * {} body:has(.letter) .content > .grid, body:has(.letter) .content > .page-head { display: none !important; } }

/* ===== الاستمارات ===== */
.fk { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.fk .fk-field.wide, .fk .fk-section, .fk .fk-consent { grid-column: 1 / -1; }
.fk-section { border-bottom: 2px solid var(--primary-100, #dbeafe); padding: 10px 0 4px; margin-top: 6px; }
.fk-section b { font-size: 15px; color: var(--primary, #1f5f5b); }
.fk-section small { display: block; color: var(--muted); font-size: 12px; }
.fk-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.fk-opt { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-2, #d1d5db); border-radius: 8px; padding: 7px 12px; cursor: pointer; background: #fff; }
.fk-opt:has(input:checked) { border-color: var(--primary, #1f5f5b); background: #f0fdfa; }
.fk-consent { display: flex; gap: 10px; align-items: flex-start; background: #f8fafc; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: 12px; cursor: pointer; }
.fk-consent input { margin-top: 5px; width: 17px; height: 17px; }
.fk-help { color: var(--muted); font-size: 12px; }
.fk-answers .fk-row { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border, #e5e7eb); }
.fk-answers .fk-row span { color: var(--muted); }
.fk-answers .fk-row b { font-weight: 600; white-space: pre-wrap; }
@media (max-width: 640px) { .fk { grid-template-columns: 1fr; } }
/* محرر الاستمارات */
.fb-field { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; margin-bottom: 8px; }
.fb-field.section { background: #f0fdfa; border-color: #99f6e4; }
.fb-field .ord { display: flex; flex-direction: column; }
.fb-field .ord button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 4px; font-size: 12px; }
.fb-field .meta { font-size: 12px; color: var(--muted); }
.fb-field .acts { display: flex; gap: 6px; }
.form-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.form-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; border: 1.5px solid #8b5e34; border-radius: 12px; padding: 22px 16px; background: #fff; cursor: pointer; transition: box-shadow .15s; }
.form-card:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.form-card i { font-size: 40px; color: #8b5e34; }
.form-card b { font-size: 16px; color: #3f2a14; }
.form-card small { color: #6b7280; font-size: 13px; }
.form-card.off { opacity: .55; border-style: dashed; }

/* مستودع القروض */
.loan-stock { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ls-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; display: flex; flex-direction: column; gap: 6px; }
.ls-card.empty { background: #fef2f2; border-color: #fecaca; }
.ls-amount { font-size: 22px; font-weight: 800; color: #0f766e; }
.ls-amount small { font-size: 13px; color: var(--muted); font-weight: 500; }
.ls-avail b { font-size: 20px; color: #059669; }
.ls-card.empty .ls-avail b { color: #dc2626; }

/* ===== صفحة الدخول ===== */
.lg { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: #fff; }
.lg-brand { position: relative; overflow: hidden; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 48px 56px 28px;
  background: linear-gradient(155deg, var(--primary-dark) 0%, var(--primary-2) 55%, var(--primary) 100%); }
/* نقش هندسي خفيف بلون الهوية. */
.lg-brand::before { content: ""; position: absolute; inset: 0; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23fff' stroke-width='1.2'%3E%3Cpath d='M40 6l10 24 24 10-24 10-10 24-10-24-24-10 24-10z'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3C/g%3E%3C/svg%3E"); background-size: 80px 80px; }
/* توهج خفيف بلون الهوية يتلاشى تدريجيًا، بلا حافة. */
.lg-brand::after { content: ""; position: absolute; width: 560px; height: 560px; inset-inline-end: -220px; bottom: -260px; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent) 0%, transparent 65%); }
.lg-brand-in, .lg-brand-foot { position: relative; z-index: 1; }
.lg-logo { display: inline-grid; place-items: center; background: #fff; border-radius: 22px; padding: 14px 18px; box-shadow: 0 12px 30px rgba(0,0,0,.25); min-width: 110px; min-height: 110px; }
.lg-logo img { height: 110px; width: auto; max-width: 240px; object-fit: contain; display: block; }
.lg-mark { width: 90px; height: 90px; display: grid; place-items: center; font-size: 44px; font-weight: 800; color: var(--primary); }
.lg-brand h1 { color: #fff; font-size: 34px; font-weight: 800; margin: 26px 0 4px; line-height: 1.35; }
.lg-tag { margin: 0; color: rgba(255,255,255,.75); font-size: 15px; }
.lg-notice { display: flex; gap: 10px; align-items: flex-start; margin-top: 26px; max-width: 460px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  border-inline-start: 4px solid var(--accent); border-radius: 12px; padding: 12px 14px; font-size: 14px; backdrop-filter: blur(4px); }
.lg-notice i { color: var(--accent-soft); margin-top: 4px; }
.lg-points { list-style: none; padding: 0; margin: 30px 0 0; display: grid; gap: 12px; }
.lg-points li { display: flex; gap: 12px; align-items: center; color: rgba(255,255,255,.88); font-size: 14px; }
.lg-points i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: var(--accent-soft); }
.lg-brand-foot { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13.5px; color: rgba(255,255,255,.8); }
.lg-brand-foot a { color: #fff; text-decoration: none; font-weight: 700; }
.lg-brand-foot a:hover { text-decoration: underline; }
.lg-form { display: grid; place-items: center; padding: 40px 24px; background: linear-gradient(180deg, #fff, var(--primary-soft)); }
.lg-form-in { width: min(400px, 100%); }
.lg-mobile-head { display: none; }
.lg-form h2 { font-size: 28px; font-weight: 800; color: var(--text); margin: 0; }
.lg-sub { color: var(--muted); margin: 6px 0 28px; font-size: 14.5px; }
.lg-field { display: block; margin-bottom: 18px; }
.lg-field > span { display: block; font-size: 13.5px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.lg-input { display: flex; align-items: center; gap: 10px; background: #fff; border: 1.5px solid var(--border-2); border-radius: 12px; padding: 0 14px; height: 52px; transition: border-color .15s, box-shadow .15s; }
.lg-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.lg-input > i { color: var(--muted-2); }
.lg-input input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 15px; background: transparent; min-width: 0; text-align: start; }
.lg-eye { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; font-size: 15px; }
.lg-err { background: var(--danger-soft); color: var(--danger); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 13.5px; }
.lg-btn { width: 100%; height: 52px; border: 0; border-radius: 12px; background: var(--primary); color: #fff; font: inherit; font-size: 16px; font-weight: 800; cursor: pointer;
  display: flex; gap: 10px; align-items: center; justify-content: center; box-shadow: 0 8px 20px color-mix(in srgb, var(--primary) 35%, transparent); transition: background .15s, transform .1s; }
.lg-btn:hover { background: var(--primary-2); }
.lg-btn:active { transform: translateY(1px); }
.lg-btn:disabled { opacity: .7; cursor: wait; }
.lg-help { color: var(--muted); font-size: 13px; margin: 18px 0 0; text-align: center; }
.lg-copy { margin-top: 36px; text-align: center; color: var(--muted-2); font-size: 12px; }
@media (max-width: 900px) {
  .lg { grid-template-columns: 1fr; }
  .lg-brand { display: none; }
  .lg-form { place-items: start center; padding-top: 32px; background: linear-gradient(180deg, var(--primary-soft), #fff 40%); }
  .lg-mobile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; text-align: center; }
  .lg-mobile-head img { height: 90px; width: auto; max-width: 220px; background: #fff; border-radius: 16px; padding: 8px; box-shadow: var(--shadow); }
  .lg-mobile-head .lg-mark { background: #fff; border-radius: 16px; box-shadow: var(--shadow); }
  .lg-mobile-head b { font-size: 20px; color: var(--text); }
  .lg-form h2, .lg-sub { text-align: center; }
}

/* ألوان الصندوق */
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.palette { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--border); border-radius: 10px; background: #fff; padding: 8px 10px; cursor: pointer; font: inherit; font-size: 13px; text-align: start; }
.palette.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.palette .sw { display: inline-flex; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.palette .sw i { width: 18px; height: 26px; display: block; }
.theme-preview { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; max-width: 520px; }
.tp-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #fff; }
.tp-dot { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); }
.tp-chip { margin-inline-start: auto; background: rgba(255,255,255,.18); border-radius: 8px; padding: 2px 10px; font-size: 12px; }
.tp-body { padding: 12px; background: var(--bg); }
.tp-head { background: var(--panel-head); border: 1px solid var(--panel-head-border); border-radius: 8px; padding: 8px 12px; font-weight: 700; color: var(--text); }
.tp-row { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.tp-row a { color: var(--primary); }

/* ===== البحث السريع ===== */
.tb-search { display: flex; align-items: center; gap: 10px; margin-inline-start: 18px; width: min(440px, 40vw); height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-align: start; }
.tb-search:hover { border-color: var(--primary); background: #fff; }
.tb-search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; background: #fff; color: var(--muted); white-space: nowrap; direction: ltr; }
.gs-back { position: fixed; inset: 0; z-index: 200; background: rgba(15,23,42,.45); backdrop-filter: blur(2px); display: flex; justify-content: center; align-items: flex-start; padding: 9vh 16px 16px; }
.gs { width: min(680px, 100%); max-height: 78vh; display: flex; flex-direction: column; background: #fff; border-radius: 16px; box-shadow: 0 25px 60px rgba(0,0,0,.3); overflow: hidden; }
.gs-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 62px; border-bottom: 1px solid var(--border); }
.gs-input > i { color: var(--primary); font-size: 18px; }
.gs-input input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 16px; background: transparent; min-width: 0; }
.gs-input kbd { cursor: pointer; }
.gs-list { overflow-y: auto; padding: 6px 8px 10px; }
.gs-group + .gs-group { margin-top: 4px; }
.gs-gh { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.gs-gh .ico { width: 24px; height: 24px; font-size: 11px; }
.gs-gh small { font-weight: 400; }
.gs-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer; font: inherit; text-align: start; color: var(--text-2); }
.gs-item > i:first-child { width: 18px; text-align: center; color: var(--muted-2); }
.gs-item.on { background: var(--primary-soft); }
.gs-item.on > i:first-child { color: var(--primary); }
.gs-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gs-t b { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-t small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-go { color: var(--primary); opacity: 0; font-size: 12px; }
.gs-item.on .gs-go { opacity: 1; }
.gs-empty { padding: 30px; text-align: center; color: var(--muted); }
.gs-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
@media (max-width: 760px) { .tb-search span, .tb-search kbd { display: none; } .tb-search { width: 40px; justify-content: center; margin-inline-start: 6px; } .gs-back { padding-top: 12px; } .gs-foot { display: none; } }

/* ===== الجداول بطاقاتٍ على الجوال ===== */
@media (max-width: 700px) {
  .table-wrap { overflow: visible; }
  .table.cardify, .table.cardify tbody, .table.cardify tfoot, .table.cardify tr, .table.cardify td { display: block; width: 100%; }
  .table.cardify thead { display: none; }
  .table.cardify tr { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 10px; padding: 4px 14px; background: var(--surface); box-shadow: var(--shadow); }
  .table.cardify tr.click:hover td { background: transparent; }
  .table.cardify td { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 38px; padding: 7px 0 !important; border: 0; border-bottom: 1px dashed var(--border);
    background: transparent !important; text-align: end !important; word-break: break-word; }
  .table.cardify td::before { content: attr(data-label); flex: none; max-width: 46%; color: var(--muted); font-size: 12px; font-weight: 600; text-align: start; }
  .table.cardify td[data-label=""]::before { display: none; }
  .table.cardify td:empty { display: none; }
  .table.cardify td:last-child { border-bottom: 0; }
  /* أول خلية عنوان البطاقة. */
  .table.cardify tbody tr:not(.grp) td:first-child { font-size: 14.5px; font-weight: 700; color: var(--text); }
  .table.cardify td.acts { justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
  .table.cardify td.acts::before { display: none; }
  .table.cardify tr.grp { background: var(--panel-head); border-color: var(--panel-head-border); box-shadow: none; padding: 2px 12px; }
  .table.cardify tr.grp td { justify-content: flex-start; }
  .table.cardify tfoot tr { background: var(--surface-2); }
  .table.cardify td .input { max-width: 58%; }
  .klist .table.cardify { padding: 0 12px 4px; }
}

/* شبكة خيارات بمربعات اختيار (تُستخدم في النظام واللوحة) */
.mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mod { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #fff; cursor: pointer; }
.mod.on { border-color: #34d399; background: #f0fdf4; }
.mod input { width: 18px; height: 18px; accent-color: #059669; flex: none; }
.mod b { font-size: 14px; }
.mod small { display: block; color: var(--muted); font-size: 12px; }
