/* =====================================================================
   منصة التمكين المهني – نظام التصميم
   RTL • Mobile First • الألوان الأساسية تُضبط من الإعدادات (--brand / --accent)
   ===================================================================== */
:root {
  --brand: #0E5C63;
  --accent: #F29F3D;
  --brand-ink: color-mix(in srgb, var(--brand) 78%, black);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, white);
  --brand-soft-2: color-mix(in srgb, var(--brand) 16%, white);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, white);
  --bg: #F4F6F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --text: #1B2733;
  --text-2: #475569;
  --muted: #6B7785;
  --border: #E3E8EC;
  --border-strong: #CBD3DA;
  --success: #15803D; --success-soft: #E8F6EE;
  --warning: #B45309; --warning-soft: #FDF3E4;
  --danger: #B91C1C;  --danger-soft: #FDECEC;
  --info: #1D4ED8;    --info-soft: #EAF0FD;
  --neutral: #475569; --neutral-soft: #EEF1F4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.65; color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.35; font-weight: 700; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); outline-offset: 2px; border-radius: 6px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ------------------------------------------------------------ تخطيط الإدارة والمدرب */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 40;
  background: var(--brand-ink); color: #fff; display: flex; flex-direction: column; padding: 18px 14px;
  transform: translateX(100%); transition: transform .2s ease; overflow-y: auto;
}
.sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop { display: none; }
.sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 30; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 8px 10px; justify-content: space-between; }
.sidebar-brand .logo { height: 38px; width: auto; object-fit: contain; }
.sidebar-title { font-weight: 700; margin: 12px 6px 10px; font-size: .95rem; }
.sidebar-title small { display: block; font-weight: 400; opacity: .75; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-nav a { color: rgba(255, 255, 255, .86); padding: 9px 12px; border-radius: 10px; display: flex; gap: 10px; align-items: center; font-weight: 500; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.sidebar-nav a.active { background: #fff; color: var(--brand-ink); font-weight: 700; }
.nav-icon { width: 22px; text-align: center; opacity: .9; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 12px; margin-top: 12px; }
.sidebar-foot .me { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.sidebar-foot .me small { display: block; opacity: .75; }
.sidebar-links { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.sidebar-links a { color: rgba(255, 255, 255, .8); font-size: .85rem; padding: 2px 4px; }
.sidebar .btn-ghost { color: #fff; border-color: rgba(255, 255, 255, .3); background: transparent; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #1b1b1b; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 56px; }
.topbar-title { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { padding: 16px; width: 100%; max-width: 1280px; margin: 0 auto; }

@media (min-width: 1024px) {
  .sidebar { transform: none; position: sticky; top: 0; height: 100vh; }
  .menu-btn { display: none; }
  .main { padding: 24px 28px; }
}

/* ------------------------------------------------------------ تخطيط المستفيد */
.p-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.p-header-inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { height: 40px; width: auto; }
.brand-sep { width: 1px; height: 28px; background: var(--border-strong); }
.p-topnav { display: none; gap: 4px; margin-inline-start: auto; }
.p-topnav a { padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; }
.p-topnav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.p-topnav .count { background: var(--danger); color: #fff; border-radius: 99px; font-size: .72rem; padding: 0 6px; }
.p-header-actions { display: flex; gap: 4px; margin-inline-start: auto; }
.p-main { max-width: 1040px; margin: 0 auto; padding: 16px 16px 96px; }
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px 9px; color: var(--muted); font-size: .76rem; font-weight: 500; position: relative; }
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a.active { color: var(--brand); font-weight: 700; }
.bottom-nav a.active .bn-icon { background: var(--brand-soft); }
.bn-icon { font-size: 1.15rem; line-height: 1; padding: 4px 16px; border-radius: 99px; }
.bottom-nav .dot-count { top: 2px; inset-inline-end: 22%; }
@media (min-width: 900px) {
  .p-topnav { display: flex; }
  .p-header-actions { margin-inline-start: 0; }
  .p-header-actions a.icon-btn { display: none; }
  .bottom-nav { display: none; }
  .p-main { padding-bottom: 40px; }
}

.icon-btn { position: relative; border: 0; background: transparent; width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; font-size: 1.15rem; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--neutral-soft); text-decoration: none; }
.dot-count { position: absolute; top: 4px; inset-inline-end: 4px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; min-width: 18px; height: 18px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; }

/* ------------------------------------------------------------ صفحة الدخول */
body.bare { background: linear-gradient(160deg, var(--brand-soft) 0%, var(--bg) 55%); min-height: 100vh; }
.center-card { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.center-card > .card { width: 100%; max-width: 420px; }
.login-logos { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 14px; }
.login-logos img { height: 58px; width: auto; }
.login-title { text-align: center; margin-bottom: 18px; }
.login-title h1 { margin-bottom: 2px; }
.login-foot { text-align: center; margin-top: 14px; color: var(--muted); font-size: .85rem; }

/* ------------------------------------------------------------ عناصر عامة */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.page-head .actions { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush > .card-head { padding: 14px 16px 0; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .actions { margin-inline-start: auto; font-size: .88rem; font-weight: 500; }

.grid { display: grid; gap: 14px; }
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .kpis { grid-template-columns: repeat(3, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .kpis { grid-template-columns: repeat(4, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } .grid-2-1 { grid-template-columns: 2fr 1fr; } }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--c, var(--brand)); }
.kpi-label { color: var(--muted); font-size: .84rem; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.kpi-value small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.kpi-foot { font-size: .8rem; color: var(--muted); margin-top: 2px; }
a.kpi:hover { text-decoration: none; border-color: var(--border-strong); }

/* ------------------------------------------------------------ الشارات */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.7; border: 1px solid transparent; }
.badge-icon { font-size: .78em; }
.tone-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 22%, white); }
.tone-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 22%, white); }
.tone-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 22%, white); }
.tone-info    { background: var(--info-soft);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 22%, white); }
.tone-neutral { background: var(--neutral-soft); color: var(--neutral); border-color: var(--border); }
.tone-muted   { background: var(--surface-2);    color: var(--muted);   border-color: var(--border); }
.tone-brand   { background: var(--brand-soft);   color: var(--brand);   border-color: var(--brand-soft-2); }
.badge-status { background: color-mix(in srgb, var(--c) 11%, white); color: color-mix(in srgb, var(--c) 85%, black); border-color: color-mix(in srgb, var(--c) 28%, white); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .84rem; font-weight: 500; }
.chip.active, .chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------ الأزرار */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; line-height: 1.3; min-height: 42px; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1b1b1b; }
.btn-accent:hover { filter: brightness(.95); color: #1b1b1b; border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, white); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 5px 11px; min-height: 34px; font-size: .84rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; font-weight: 600; }
.btn-link.danger { color: var(--danger); }
.btn[disabled] { opacity: .5; pointer-events: none; }
form.inline { display: inline; }

/* ------------------------------------------------------------ النماذج */
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); } .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .form-grid .span-all { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .88rem; color: var(--text-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); min-height: 42px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=color] { width: 56px; height: 42px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 10px; background: #fff; }
input[type=file] { font: inherit; font-size: .88rem; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.input-ltr { direction: ltr; text-align: right; }
.errors { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 25%, white); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.errors ul { margin: 0; padding-inline-start: 18px; }
.filters { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.filters .search { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr repeat(3, 1fr) auto; } .filters .search { grid-column: auto; } }
.check-list { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 6px; display: grid; gap: 2px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .check-list { grid-template-columns: repeat(2, 1fr); } }
.check-list label { padding: 6px 8px; border-radius: 8px; }
.check-list label:hover { background: var(--surface-2); }

/* ------------------------------------------------------------ التنبيهات */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 500; border: 1px solid; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, white); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, white); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, white); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, white); }

/* ------------------------------------------------------------ الجداول */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: .82rem; white-space: nowrap; position: sticky; top: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand) 3%, white); }
.table tr:last-child td { border-bottom: 0; }
.table .t-name { font-weight: 600; color: var(--text); }
.table .t-sub { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; }
.table td.actions { white-space: nowrap; text-align: end; }
.table .cell-center { text-align: center; }
.table-compact th, .table-compact td { padding: 7px 10px; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; position: sticky; inset-inline-start: 0; background: var(--surface); }
.att-dot { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-size: .8rem; font-weight: 700; }
.att-present { background: var(--success-soft); color: var(--success); }
.att-late { background: var(--warning-soft); color: var(--warning); }
.att-excused { background: var(--info-soft); color: var(--info); }
.att-absent { background: var(--danger-soft); color: var(--danger); }
.att-none { background: var(--surface-2); color: var(--muted); }

/* قائمة بطاقات على الجوال بدلاً من الجدول */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .meta { font-size: .82rem; color: var(--muted); }
a.list-item { color: inherit; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }

/* ------------------------------------------------------------ المؤشرات */
.progress { height: 9px; background: var(--neutral-soft); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s ease; }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: #D97706; }
.progress.danger > span { background: var(--danger); }
.progress.muted > span { background: var(--border-strong); }
.progress.lg { height: 12px; }
.rate { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.rate .progress { flex: 1; height: 7px; }
.rate b { font-size: .84rem; min-width: 36px; font-variant-numeric: tabular-nums; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 36px; gap: 10px; align-items: center; font-size: .88rem; }
.bar-row .bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.bar-track { height: 14px; background: var(--neutral-soft); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--c, var(--brand)); border-radius: 6px; min-width: 2px; }
.bar-row b { text-align: end; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--brand)); display: inline-block; flex: none; }

/* قمع البرنامج */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-step { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); position: relative; margin-inline: calc(var(--i) * 4%); }
.funnel-step strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.funnel-step .lbl { font-weight: 600; }
.funnel-step .lbl small { display: block; color: var(--muted); font-weight: 400; }
.funnel-arrow { text-align: center; color: var(--muted); font-size: .8rem; line-height: 1; }
@media (min-width: 900px) {
  .funnel.horizontal { flex-direction: row; align-items: stretch; }
  .funnel.horizontal .funnel-step { flex: 1; margin: 0; grid-template-columns: 1fr; text-align: center; }
  .funnel.horizontal .funnel-arrow { display: grid; place-items: center; font-size: 1.2rem; }
  .funnel.horizontal .funnel-arrow span { transform: rotate(90deg); display: inline-block; }
}

/* ------------------------------------------------------------ الرحلة (Timeline / Stepper) */
.journey { list-style: none; margin: 0; padding: 0; position: relative; }
.journey-item { display: grid; grid-template-columns: 40px 1fr; gap: 12px; position: relative; padding-bottom: 16px; }
.journey-item:last-child { padding-bottom: 0; }
.journey-item::before { content: ""; position: absolute; inset-inline-start: 19px; top: 40px; bottom: 0; width: 2px; background: var(--border); }
.journey-item:last-child::before { display: none; }
.journey-item.done::before { background: var(--success); }
.j-marker { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--border-strong); background: var(--surface); color: var(--muted); z-index: 1; font-size: 1rem; }
.done .j-marker { background: var(--success); border-color: var(--success); color: #fff; }
.current .j-marker { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 5px var(--brand-soft-2); }
.stopped .j-marker { background: var(--surface-2); border-style: dashed; }
.j-body { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; }
.current .j-body { border-color: var(--brand); background: var(--brand-soft); }
.stopped .j-body { opacity: .65; }
.j-title { font-weight: 700; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.j-meta { font-size: .84rem; color: var(--text-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* المسار الأفقي المختصر للإدارة */
.stepper { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1; min-width: 130px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.step .s-top { display: flex; gap: 6px; align-items: center; font-size: .8rem; color: var(--muted); }
.step .s-name { font-weight: 700; font-size: .9rem; margin: 3px 0; }
.step .s-count { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.step.done { border-color: color-mix(in srgb, var(--success) 35%, white); background: var(--success-soft); }
.step.current { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 -3px 0 var(--brand); }

/* ------------------------------------------------------------ بطاقات المستفيد */
.hero { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-ink) 100%); color: #fff; border-radius: 18px; padding: 18px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: var(--accent); opacity: .16; inset-inline-end: -70px; top: -80px; }
.hero h1 { color: #fff; font-size: 1.3rem; margin-bottom: 12px; }
.hero-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; position: relative; z-index: 1; }
.hero-item .lbl { font-size: .8rem; opacity: .8; }
.hero-item .val { font-weight: 700; font-size: 1.02rem; }
.hero .badge-status { background: #fff; }
.hero-progress { grid-column: 1 / -1; }
.hero-progress .progress { background: rgba(255, 255, 255, .22); height: 11px; }
.hero-progress .progress > span { background: var(--accent); }
.hero-progress .row-between { font-size: .85rem; margin-bottom: 4px; }

.next-card { border-inline-start: 5px solid var(--accent); }
.next-date { display: flex; gap: 14px; align-items: center; }
.date-tile { width: 64px; flex: none; text-align: center; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, white); padding: 6px 0; }
.date-tile .d { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.date-tile .m { font-size: .76rem; color: var(--text-2); }
.info-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.info-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .93rem; }
.info-list .ic { width: 22px; text-align: center; color: var(--muted); flex: none; }

.task-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: inherit; }
.task-card + .task-card { margin-top: 8px; }
a.task-card:hover { text-decoration: none; border-color: var(--brand); }
.task-card .grow { flex: 1; min-width: 0; }
.task-card .title { font-weight: 600; }
.task-card .meta { font-size: .82rem; color: var(--muted); }
.task-card.late { border-color: color-mix(in srgb, var(--danger) 35%, white); background: var(--danger-soft); }

.stat-pair { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-pair > div { flex: 1; min-width: 90px; text-align: center; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.stat-pair b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.stat-pair span { font-size: .8rem; color: var(--muted); }

.banner { border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.banner .ic { font-size: 1.6rem; }
.banner.success { background: var(--success-soft); color: var(--success); border: 1px solid color-mix(in srgb, var(--success) 25%, white); }
.banner.neutral { background: var(--neutral-soft); color: var(--text-2); border: 1px solid var(--border); }

/* ------------------------------------------------------------ التبويبات */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin-bottom: 16px; scrollbar-width: none; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; font-size: .92rem; }
.tabs a:hover { text-decoration: none; color: var(--brand); }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .count { background: var(--neutral-soft); border-radius: 99px; padding: 0 7px; font-size: .75rem; margin-inline-start: 4px; }

/* ------------------------------------------------------------ سجل الأحداث */
.events { list-style: none; padding: 0; margin: 0; }
.event { display: grid; grid-template-columns: 34px 1fr; gap: 12px; position: relative; padding-bottom: 14px; }
.event::before { content: ""; position: absolute; inset-inline-start: 16px; top: 34px; bottom: 0; width: 2px; background: var(--border); }
.event:last-child::before { display: none; }
.event .ev-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: .9rem; font-weight: 700; }
.event .ev-title { font-weight: 600; font-size: .93rem; }
.event .ev-body { font-size: .86rem; color: var(--text-2); white-space: pre-line; margin-top: 2px; }
.event .ev-time { font-size: .78rem; color: var(--muted); }

/* ------------------------------------------------------------ الحضور */
.att-row { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.att-row:last-child { border-bottom: 0; }
.att-options { display: flex; gap: 6px; flex-wrap: wrap; }
.att-options label { cursor: pointer; }
.att-options input { position: absolute; opacity: 0; pointer-events: none; }
.att-options span { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--border-strong); font-size: .85rem; font-weight: 600; color: var(--text-2); background: var(--surface); min-height: 36px; }
.att-options input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, white); }
.att-options input[value=present]:checked + span { background: var(--success); border-color: var(--success); color: #fff; }
.att-options input[value=late]:checked + span { background: #D97706; border-color: #D97706; color: #fff; }
.att-options input[value=excused]:checked + span { background: var(--info); border-color: var(--info); color: #fff; }
.att-options input[value=absent]:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.att-extra { display: grid; grid-template-columns: 140px 1fr; gap: 8px; }
.att-extra select, .att-extra input { min-height: 36px; padding: 5px 10px; font-size: .85rem; }
@media (min-width: 900px) { .att-row { grid-template-columns: minmax(180px, 1.2fr) auto 1.4fr; align-items: center; } }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; z-index: 5; }
.role-participant .sticky-actions { bottom: 64px; }

/* ------------------------------------------------------------ متفرقات */
.empty { text-align: center; color: var(--muted); padding: 26px 12px; }
.empty .ic { font-size: 2rem; display: block; margin-bottom: 4px; opacity: .6; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: color-mix(in srgb, var(--brand) 5%, white); }
.notif .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.notif .t { font-weight: 600; }
.notif .b { font-size: .86rem; color: var(--text-2); }
.notif .time { font-size: .76rem; color: var(--muted); }
.credential { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 8px 12px; direction: ltr; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.details summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 6px 0; }
.details[open] summary { margin-bottom: 8px; }
.note-box { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--accent) 30%, white); }
.followup-reasons { display: flex; flex-wrap: wrap; gap: 4px; }
.bulkbar { display: none; position: sticky; top: 56px; z-index: 6; background: var(--brand-ink); color: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; gap: 8px; align-items: center; flex-wrap: wrap; }
.bulkbar.show { display: flex; }
.bulkbar select, .bulkbar input { min-height: 36px; padding: 4px 10px; width: auto; }
.bulkbar .btn { min-height: 36px; padding: 5px 12px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.logo-preview { height: 56px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 6px; }
.color-row { display: flex; align-items: center; gap: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .82rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

@media print {
  .sidebar, .topbar, .bottom-nav, .p-header, .btn, .actions, .filters, .tabs { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
