/* =========================================================
   تمكين — «مبهج + بريميوم» (مراجعة 3 — معاينة مش معتمدة)
   - الوضع الفاتح: شريط علوي أبيض زجاجي بهوية تمكين (الكحلي للداكن بس)
   - ألوان pastel مبهجة للأرقام، ترحيب + كروت KPI
   - حركة الأرقام (بتعد) والاحتفال بالإنجاز
   ========================================================= */
:root:not(.is-dark) {
  --bg: #F5F7FC;
  --mint: #12B76A; --mint-bg: #E7F8EF;
  --sky: #0BA5EC; --sky-bg: #E6F6FE;
  --lav: #7A5AF8; --lav-bg: #F0EDFF;
  --peach: #F79009; --peach-bg: #FFF4E5;
  --rose: #F04438; --rose-bg: #FEECEB;
}
.is-dark {
  --mint: #32D583; --mint-bg: rgba(50, 213, 131, .12); --sky: #36BFFA; --sky-bg: rgba(54, 191, 250, .12);
  --lav: #9B8AFB; --lav-bg: rgba(155, 138, 251, .14); --peach: #FDB022; --peach-bg: rgba(253, 176, 34, .12);
  --rose: #F97066; --rose-bg: rgba(249, 112, 102, .12);
}

/* --- الشريط العلوي في الفاتح: أبيض زجاجي + هوية تمكين --- */
:root:not(.is-dark) .topbar {
  background: rgba(255, 255, 255, .84); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(17, 24, 39, .06), 0 8px 24px -16px rgba(26, 68, 181, .25);
}
:root:not(.is-dark) .topbar::after { background: none; }
:root:not(.is-dark) .topbar::before { background: linear-gradient(90deg, transparent, #1A44B5 30%, #F39200 70%, transparent); opacity: .55; height: 2px; }
:root:not(.is-dark) .topbar .brand-name { color: #1A44B5; }
:root:not(.is-dark) .topbar .brand-sub { color: #F39200; }
:root:not(.is-dark) .topbar .brand-divider { background: rgba(17, 24, 39, .12); }
:root:not(.is-dark) .topbar .brand-title { color: #121826; }
:root:not(.is-dark) .tb-nav a, :root:not(.is-dark) .tb-nav .btn-ghost, :root:not(.is-dark) .tb-nav .btn-mytasks { color: #3B4457 !important; }
:root:not(.is-dark) .tb-nav a:hover { background: #EEF2FC !important; color: #1A44B5 !important; }
:root:not(.is-dark) .tb-nav a.active { background: #E6ECFD !important; color: #1A44B5 !important; box-shadow: 0 0 0 1px rgba(26, 68, 181, .14) inset; }
:root:not(.is-dark) .tb-nav .tb-home { background: linear-gradient(135deg, #1A44B5, #2E5BE6) !important; color: #fff !important; box-shadow: var(--glow-brand); }
:root:not(.is-dark) .acct-btn, :root:not(.is-dark) .tb-menu-btn, :root:not(.is-dark) .tb-tools .notif-btn { background: #F1F4FA !important; color: #121826 !important; box-shadow: 0 0 0 1px rgba(17, 24, 39, .06) inset; }
:root:not(.is-dark) .acct-btn:hover { background: #E6ECFD !important; }
:root:not(.is-dark) .acct-btn .av { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(243, 146, 0, .6); }
@media (max-width: 1100px) { :root:not(.is-dark) .tb-nav { background: rgba(255, 255, 255, .97) !important; border-bottom: 1px solid var(--line); } }

/* --- رؤوس الجداول في الفاتح: فاتحة بلون الهوية بدل الكحلي --- */
:root:not(.is-dark) .rp-table th, :root:not(.is-dark) .board thead th, :root:not(.is-dark) .pl-grid thead th {
  background: linear-gradient(180deg, #F4F7FF, #E9EFFD) !important; color: #1A44B5 !important; border-color: rgba(26, 68, 181, .1) !important;
}
:root:not(.is-dark) .pl-season-box .rp-table th { background: linear-gradient(180deg, #F6F3FF, #ECE6FF) !important; color: #6941C6 !important; }
:root:not(.is-dark) .pl-grid thead th.today { background: linear-gradient(180deg, #FFF4E5, #FFE7C2) !important; color: #B54708 !important; }

/* --- الترحيب + كروت الأرقام --- */
.hero { display: flex; align-items: stretch; gap: 14px; flex-wrap: wrap; padding: 14px 24px 4px; }
.hero-hello { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.hero-hello h1 { margin: 0; font-size: 21px; font-weight: 800; color: var(--text); }
.hero-hello h1 .wave { display: inline-block; transform-origin: 70% 70%; animation: tk-wave 1.6s var(--ease) 1 .5s; }
.hero-hello p { margin: 0; color: var(--muted); font-size: 13px; }
.hero-kpis { flex: 3 1 560px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.kpi {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-2); overflow: hidden;
  animation: tk-rise .5s var(--ease-out) both; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.kpi::after { content: ''; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--k-bg); opacity: .9; }
.kpi:nth-child(2) { animation-delay: .06s; } .kpi:nth-child(3) { animation-delay: .12s; } .kpi:nth-child(4) { animation-delay: .18s; }
.kpi-ic { position: relative; z-index: 1; width: 40px; height: 40px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 19px; background: var(--k-bg); color: var(--k); }
.kpi-tx { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.kpi-num { font-size: 24px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; display: inline-block; }
.kpi-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.k-blue { --k: #1A44B5; --k-bg: #E6ECFD; } .kpi.k-mint { --k: var(--mint); --k-bg: var(--mint-bg); }
.kpi.k-peach { --k: var(--peach); --k-bg: var(--peach-bg); } .kpi.k-lav { --k: var(--lav); --k-bg: var(--lav-bg); }
.kpi.k-rose { --k: var(--rose); --k-bg: var(--rose-bg); } .kpi.k-sky { --k: var(--sky); --k-bg: var(--sky-bg); }
.is-dark .kpi.k-blue { --k: #8EA8FF; --k-bg: rgba(111, 149, 255, .14); }
/* حلقة النسبة */
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }
.kpi-ring { --p: 0; position: relative; z-index: 1; width: 46px; height: 46px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--k) calc(var(--p) * 1%), var(--k-bg) 0); transition: --p 1.1s var(--ease-out); }
.kpi-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--card); }
/* الأرقام وهي بتتحرك */
.num-bump { animation: tk-bump .45s var(--ease-out); }
@keyframes tk-bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes tk-wave { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-10deg); } 45% { transform: rotate(14deg); } 60% { transform: rotate(-4deg); } }
/* لما الترحيب ظاهر، سطر الإحصائيات القديم بيختفي (نفس الأرقام فوق) */
.has-hero #stats { display: none !important; }

/* --- كروت الخطة: bento pastel --- */
.pl-cards .pl-card { position: relative; overflow: hidden; text-align: start !important; padding: 14px 16px 12px !important; display: flex !important; flex-direction: column; gap: 2px; }
.pl-cards .pl-card::before { content: attr(data-ic); position: absolute; inset-inline-end: 12px; top: 12px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 17px; background: var(--k-bg, #E6ECFD); }
.pl-cards .pl-card b { font-size: 28px !important; line-height: 1.15; color: var(--k, var(--text)) !important; display: inline-block; }
.pl-cards .pl-card span { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.pl-cards .pl-card.k-mint { --k: var(--mint); --k-bg: var(--mint-bg); }
.pl-cards .pl-card.k-blue { --k: #1A44B5; --k-bg: #E6ECFD; }
.pl-cards .pl-card.k-lav { --k: var(--lav); --k-bg: var(--lav-bg); }
.pl-cards .pl-card.k-rose { --k: var(--rose); --k-bg: var(--rose-bg); }
.pl-cards .pl-card.k-peach { --k: var(--peach); --k-bg: var(--peach-bg); }
.is-dark .pl-cards .pl-card.k-blue { --k: #8EA8FF; --k-bg: rgba(111, 149, 255, .14); }
.pl-card-bar { margin-top: 8px; height: 6px; border-radius: 999px; background: var(--k-bg); overflow: hidden; }
.pl-card-bar i { display: block; height: 100%; border-radius: inherit; background: var(--k); transform-origin: right; animation: tk-fill 1.1s var(--ease-out) both .2s; }
/* أشرطة تقدّم المديرين: بتتملى بحركة */
.pl-ov-bar i { animation: tk-fill 1.1s var(--ease-out) both; transform-origin: right; }
@keyframes tk-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- الاحتفال --- */
.tk-confetti { position: fixed; z-index: 9999; pointer-events: none; width: 8px; height: 12px; border-radius: 2px; top: 0; left: 0; will-change: transform, opacity; }
.tk-cheer {
  position: fixed; z-index: 9998; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 14px; border-radius: 999px; white-space: nowrap;
  background: linear-gradient(135deg, #1A44B5, #2E5BE6 60%, #7A5AF8); color: #fff; font-weight: 800; font-size: 14.5px;
  box-shadow: 0 18px 40px -12px rgba(26, 68, 181, .6); animation: tk-cheer-in .45s var(--ease-out) both;
}
.tk-cheer .e { font-size: 22px; display: inline-block; animation: tk-bump .6s var(--ease-out) .15s both; }
.tk-cheer.big { background: linear-gradient(135deg, #F39200, #FFB547 45%, #12B76A); }
.tk-cheer.out { animation: tk-cheer-out .35s var(--ease) both; }
@keyframes tk-cheer-in { from { opacity: 0; transform: translate(-50%, 24px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes tk-cheer-out { to { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }

@media (max-width: 1100px) { .hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .hero { padding: 10px 12px 2px; gap: 10px; }
  .hero-hello h1 { font-size: 18px; }
  .hero-kpis { flex-basis: 100%; gap: 8px; }
  .kpi { padding: 10px; gap: 8px; border-radius: 14px; }
  .kpi-ic { width: 34px; height: 34px; font-size: 16px; }
  .kpi-num { font-size: 20px; }
  .kpi-ring { width: 40px; height: 40px; }
  .tk-cheer { bottom: 96px; max-width: calc(100vw - 24px); white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .tk-confetti { display: none !important; } }

/* كروت الخطة: محاذاة + لمسة لون ناعمة زي كروت الترحيب */
.pl-cards .pl-card { align-items: stretch !important; background: linear-gradient(135deg, var(--k-bg, transparent) -60%, var(--surface, #fff) 55%) !important; }
.pl-cards .pl-card b, .pl-cards .pl-card span { align-self: flex-start; }
.pl-cards .pl-card::after { content: ""; position: absolute; inset-inline-start: -30px; bottom: -40px; width: 110px; height: 110px; border-radius: 50%; background: var(--k-bg); opacity: .55; pointer-events: none; }
.pl-cards .pl-card > * { position: relative; z-index: 1; }
.pl-card-bar { width: 100%; }

/* =========================================================
   مراجعة 4: ترحيب مضغوط (سطر واحد) + شعار ملون في الفاتح + داكن جديد (رمادي فحمي هادي)
   ========================================================= */
/* الشعار: الأزرق/البرتقالي في الفاتح، الأبيض/البرتقالي في الداكن */
.brand .logo-d { display: none; }
.is-dark .brand .logo-l { display: none; }
.is-dark .brand .logo-d { display: inline-block; }

/* الترحيب: سطر واحد رفيع — التحية يمين والأرقام شرايح صغيرة شمال */
.hero { align-items: center !important; gap: 10px 18px !important; padding: 10px 24px 2px !important; }
.hero-hello { flex: 0 1 auto !important; }
.hero-hello h1 { font-size: 18px !important; line-height: 1.3; }
.hero-hello p { font-size: 12px !important; }
.hero-kpis { flex: 1 1 auto !important; display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: 8px !important; }
.kpi { padding: 5px 12px 5px 6px !important; gap: 8px !important; border-radius: 999px !important; box-shadow: var(--shadow-1) !important; background: var(--card) !important; }
.kpi::after, .kpi::before { display: none !important; }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-2) !important; }
.kpi-ic { width: 28px !important; height: 28px !important; border-radius: 50% !important; font-size: 14px !important; }
.kpi-ring { width: 28px !important; height: 28px !important; }
.kpi-ring::before { inset: 4px !important; }
.kpi-tx { flex-direction: row !important; align-items: baseline; gap: 6px; }
.kpi-num { font-size: 17px !important; color: var(--k, var(--text)) !important; }
.kpi-lbl { font-size: 12px !important; }
@media (max-width: 760px) {
  .hero { padding: 8px 12px 0 !important; }
  .hero-hello h1 { font-size: 16px !important; }
  .hero-kpis { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .hero-kpis::-webkit-scrollbar { display: none; }
  .kpi { flex: none; }
}

/* اختيار الشهور */
.dp-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 4px; }
.dp-count { font-size: 12px; color: var(--muted); font-weight: 700; }

/* ---------- الداكن الجديد: فحمي محايد + لمسات الهوية بس ---------- */
.is-dark {
  --brand: #4C6FF5; --brand-2: #141821; --brand-3: #7D97FF;
  --grad-brand: linear-gradient(135deg, #3657D9 0%, #4C6FF5 100%);
  --bg: #0E1015; --card: #15181F; --surface: #1A1E26; --tint: #222836; --input: #11141A;
  --text: #ECEEF2; --text-2: #C4C9D4; --muted: #8C94A5; --faint: #5E6677;
  --line: rgba(255, 255, 255, .075); --line-soft: rgba(255, 255, 255, .045); --hover: rgba(255, 255, 255, .045);
  --blue: #8DA6FF;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-2: 0 0 0 1px rgba(255, 255, 255, .04) inset, 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-3: 0 0 0 1px rgba(255, 255, 255, .05) inset, 0 24px 60px -20px rgba(0, 0, 0, .8);
}
.is-dark body { background: radial-gradient(900px 380px at 100% -8%, rgba(76, 111, 245, .08), transparent 60%), var(--bg) !important; }
/* الشريط العلوي */
.is-dark .topbar { background: rgba(17, 19, 25, .86) !important; backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); box-shadow: 0 1px 0 var(--line) !important; }
.is-dark .topbar::after { background: none !important; }
.is-dark .topbar::before { background: linear-gradient(90deg, transparent, #4C6FF5 30%, #F39200 70%, transparent) !important; opacity: .45; height: 1px !important; }
.is-dark .tb-nav a, .is-dark .tb-nav .btn-ghost { color: var(--text-2) !important; background: transparent !important; }
.is-dark .tb-nav a:hover { background: var(--hover) !important; color: #fff !important; }
.is-dark .tb-nav a.active { background: rgba(141, 166, 255, .12) !important; color: #B9C8FF !important; box-shadow: none !important; }
.is-dark .acct-btn, .is-dark .tb-menu-btn, .is-dark .tb-tools .notif-btn { background: var(--surface) !important; color: var(--text) !important; box-shadow: 0 0 0 1px var(--line) inset !important; }
@media (max-width: 1100px) { .is-dark .tb-nav { background: rgba(17, 19, 25, .98) !important; border-bottom: 1px solid var(--line); } }
/* رؤوس الجداول: هادية بدل الأزرق الصارخ */
.is-dark .rp-table th, .is-dark .board thead th, .is-dark .pl-grid thead th, .is-dark .board th {
  background: var(--surface) !important; color: var(--text-2) !important; border-color: var(--line) !important; text-shadow: none !important;
}
.is-dark .pl-grid thead th.today { background: rgba(243, 146, 0, .14) !important; color: #FDB022 !important; }
/* الكروت والأسطح */
.is-dark .card, .is-dark .panel, .is-dark .pl-card, .is-dark .kpi, .is-dark .modal, .is-dark .date-pick, .is-dark .acct-menu, .is-dark .notif-panel { background: var(--card) !important; border-color: var(--line) !important; }
.is-dark .board td, .is-dark .m-day { border-color: var(--line) !important; }
.is-dark .board .week-col, .is-dark .board td.wk, .is-dark .board th.wk { background: var(--surface) !important; }
.is-dark .pl-cell.done { background: rgba(50, 213, 131, .22) !important; color: #6CE9A6 !important; }
.is-dark .pl-cell.gap { background: rgba(249, 112, 102, .2) !important; color: #FDA29B !important; }
.is-dark .pl-cards .pl-card { background: linear-gradient(135deg, var(--k-bg) -40%, var(--card) 60%) !important; }
.is-dark input, .is-dark select, .is-dark textarea { background: var(--input) !important; border-color: var(--line) !important; color: var(--text) !important; }
.is-dark .task.prio-2:not(.colored) { background: color-mix(in srgb, var(--prio) 14%, var(--surface)) !important; }
.is-dark .board tbody .week, .is-dark .board td.week, .is-dark .board th.week { background: var(--surface) !important; }
.quick-link.ql-more-btn { background: var(--card) !important; color: var(--text-2) !important; box-shadow: 0 0 0 1px var(--line) inset, var(--shadow-1) !important; }
.is-dark .prio-opt.active { background: color-mix(in srgb, var(--prio) 18%, var(--surface)) !important; }
/* بقايا خلفيات فاتحة في الداكن */
.is-dark .auto-mark.shared-mark { background: rgba(54, 191, 250, .14) !important; color: #7CD4FD !important; }
.is-dark .pl-season-left { background: rgba(253, 176, 34, .14) !important; color: #FEC84B !important; }
.is-dark .pl-cell.today { background: rgba(243, 146, 0, .1) !important; }
.is-dark .pl-sum.gap { background: rgba(249, 112, 102, .14) !important; color: #FDA29B !important; }
.is-dark .rq-status { background: rgba(255, 255, 255, .07) !important; color: var(--text-2) !important; filter: none !important; }
.is-dark .rq-status.s-new { background: rgba(141, 166, 255, .16) !important; color: #B9C8FF !important; }
.is-dark .rq-status.s-progress { background: rgba(253, 176, 34, .15) !important; color: #FEC84B !important; }
.is-dark .rq-status.s-delivered, .is-dark .rq-status.s-done { background: rgba(50, 213, 131, .15) !important; color: #6CE9A6 !important; }
.is-dark .mt-card-date { background: var(--surface) !important; color: var(--text) !important; }
.is-dark .mt-card.active { background: rgba(141, 166, 255, .12) !important; color: var(--text) !important; border-color: rgba(141, 166, 255, .35) !important; }
.is-dark .chip-item { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; }
.is-dark .st-smtp.ok { background: rgba(50, 213, 131, .12) !important; color: #6CE9A6 !important; }
.is-dark .st-area { background: rgba(255, 255, 255, .07) !important; color: var(--text-2) !important; }
.is-dark .pl-season-box .rp-table th, .is-dark .pl-season-box .pl-grid thead th { background: rgba(155, 138, 251, .12) !important; color: #C9BEFF !important; filter: none !important; border-color: var(--line) !important; }

/* الموسم: اختيار الشهور بالضغط (ميلادي + هجري) */
.gl-season-form { align-items: flex-start !important; }
.gl-season-form .sn-months { flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; }
.gl-season-form .sn-lbl { font-size: 13px; font-weight: 700; }
.gl-season-form .sn-actions { display: flex; gap: 8px; align-items: center; }
.mp { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; max-width: 640px; }
.mp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.mp-year { display: flex; align-items: center; gap: 8px; }
.mp-year b { min-width: 72px; text-align: center; }
.mp-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mp-m { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface, #fff); color: var(--text); cursor: pointer; transition: background .15s, transform .15s; font: inherit; }
.mp-m:hover { background: var(--hover); transform: translateY(-1px); }
.mp-m b { font-size: 13.5px; }
.mp-m small { font-size: 10.5px; color: var(--muted); line-height: 1.3; text-align: center; }
.mp-m.sel { background: linear-gradient(135deg, #6941C6, #7A5AF8); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -8px rgba(105, 65, 198, .7); }
.mp-m.sel small { color: rgba(255, 255, 255, .85); }
.mp-sum { margin: 8px 0 0; font-weight: 700; font-size: 13px; color: var(--lav, #6941C6); }
.mp-hint { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }
@media (max-width: 560px) { .mp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.is-dark .gl-season-form { background: rgba(155, 138, 251, .07) !important; border-color: rgba(155, 138, 251, .2) !important; }

/* =========================================================
   مراجعة 5: منطقة التحكم فوق التقويم = لوحة واحدة منظمة
   فوق: العرض + الشهر + اليوم ····· البحث + الفلتر + إضافة مهمة
   تحت: الأدوات · الدليل ····· أزرار المنصة
   ========================================================= */
.stats-row > .quick-links { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; padding: 2px; }
.stats-row > .quick-links .quick-link { flex: none; height: 28px; padding: 0 12px; font-size: 12.5px; }
@media (min-width: 761px) {
  .has-hero .toolbar {
    margin: 10px 24px 0; padding: 10px 12px; gap: 8px; justify-content: flex-start; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0;
    box-shadow: var(--shadow-1);
  }
  .has-hero .toolbar .month-nav, .has-hero .toolbar .filters { display: contents; }
  .has-hero .toolbar .view-menu { order: 1; }
  .has-hero .toolbar #modeSeg { order: 2; }
  .has-hero .toolbar #prevBtn { order: 3; }
  .has-hero .toolbar #titleBtn { order: 4; min-width: 0; }
  .has-hero .toolbar #nextBtn { order: 5; }
  .has-hero .toolbar #todayBtn { order: 6; }
  .has-hero .toolbar #fSearch { order: 7; margin-inline-start: auto; width: clamp(180px, 22vw, 320px) !important; height: 38px; border-radius: 12px; }
  .has-hero .toolbar .filter-menu { order: 8; }
  .has-hero .toolbar #newTaskBtn { order: 9; height: 38px; }
  .has-hero .toolbar #selModeBtn { order: 10; }
  .has-hero .toolbar .view-btn, .has-hero .toolbar #todayBtn, .has-hero .toolbar .filter-btn { height: 38px; border-radius: 12px; }

  .has-hero .stats-row {
    margin: 0 24px 14px; padding: 6px 12px; gap: 6px 10px; flex-wrap: wrap; align-items: center;
    background: color-mix(in srgb, var(--card) 70%, var(--bg)); border: 1px solid var(--line); border-top: 1px dashed var(--line);
    border-radius: 0 0 16px 16px; box-shadow: var(--shadow-1);
  }
  .has-hero .stats-row .view-opts { order: -10; padding-inline-end: 10px; border-inline-end: 1px solid var(--line); }
  .has-hero .stats-row .view-opts .btn-ghost { height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12.5px; }
  .has-hero .stats-row .legend-inline { flex: 1 1 260px; }
  .has-hero .stats-row > .quick-links { flex: 0 1 auto; max-width: 52%; margin-inline-start: auto; }
}
@media (max-width: 760px) {
  .stats-row > .quick-links { flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .stats-row > .quick-links::-webkit-scrollbar { display: none; }
}

/* =========================================================
   مراجعة 6: التقويم هو الأساس — التحكم بقى «رأس» كارت التقويم نفسه
   ========================================================= */
@media (min-width: 761px) {
  /* التحية: سطر واحد (التاريخ جنبها مش تحتها) */
  .has-hero .hero { padding: 8px 24px 0 !important; }
  .has-hero .hero-hello { flex-direction: row !important; align-items: baseline; gap: 10px !important; flex-wrap: wrap; }
  .has-hero .hero-hello h1 { font-size: 16px !important; }
  .has-hero .hero-hello p { font-size: 12px !important; }
  .has-hero .kpi { padding: 3px 10px 3px 4px !important; }
  .has-hero .kpi-ic, .has-hero .kpi-ring { width: 26px !important; height: 26px !important; font-size: 13px !important; }
  .has-hero .kpi-num { font-size: 15px !important; }

  /* كارت واحد: رأس (تحكم) + شريط أدوات + التقويم */
  .has-hero .toolbar { margin-top: 8px; padding: 8px 12px; box-shadow: none; }
  .has-hero .toolbar .view-btn, .has-hero .toolbar #todayBtn, .has-hero .toolbar .filter-btn,
  .has-hero .toolbar #fSearch, .has-hero .toolbar #newTaskBtn { height: 36px !important; }
  .has-hero .toolbar .month-title h1 { font-size: 19px; }
  .has-hero .stats-row {
    margin: 0 24px; padding: 4px 12px; border-radius: 0; box-shadow: none;
    background: var(--card); border-top: 1px solid var(--line-soft, var(--line)); border-bottom: 1px solid var(--line);
  }
  .has-hero .board-wrap {
    margin: 0 24px 24px; padding: 0; background: var(--card);
    border: 1px solid var(--line); border-top: 0; border-radius: 0 0 16px 16px; box-shadow: var(--shadow-2);
  }
  .has-hero .board-wrap > .board, .has-hero .board-wrap > #altView { border: 0 !important; border-radius: 0 !important; box-shadow: none !important; margin: 0 !important; }
  .has-hero .board-wrap.hours-wrap { margin: 0 24px 24px; border-radius: 0 0 16px 16px; }

  /* أزرار المنصة: ناعمة بلونها (مش بلوكات صارخة) عشان العين تروح للتقويم */
  .has-hero .stats-row > .quick-links .quick-link {
    height: 26px !important; padding: 0 11px !important; font-size: 12px !important; box-shadow: none !important;
    background: color-mix(in srgb, var(--ql, #1A44B5) 11%, var(--card)) !important; color: color-mix(in srgb, var(--ql, #1A44B5) 85%, var(--text)) !important;
  }
  .has-hero .stats-row > .quick-links .quick-link:hover { background: var(--ql, #1A44B5) !important; color: #fff !important; }
  .is-dark.has-hero .stats-row > .quick-links .quick-link, .is-dark .has-hero .stats-row > .quick-links .quick-link { color: color-mix(in srgb, var(--ql, #8DA6FF) 55%, #fff) !important; background: color-mix(in srgb, var(--ql, #4C6FF5) 18%, var(--card)) !important; }
}
/* عرض المواعيد في الفاتح: أسماء الأيام كانت بيضا على رأس فاتح */
:root:not(.is-dark) .hday-name .n, :root:not(.is-dark) .hday-name .h { color: #3B4A7A; opacity: 1; }
:root:not(.is-dark) .hday-name .g { color: #1A44B5; }
:root:not(.is-dark) .hday-name:hover .g { background: rgba(26, 68, 181, .08); }
:root:not(.is-dark) .hday.today .hday-name .g { background: #1A44B5; color: #fff; }
:root:not(.is-dark) .hday .day-tools button { background: rgba(26, 68, 181, .08); color: #1A44B5; }
.is-dark .hday-name .n, .is-dark .hday-name .h, .is-dark .hday-name .g { color: var(--text-2); }
.is-dark .hday.today .hday-name .g { background: #4C6FF5; color: #fff; }

/* =========================================================
   مراجعة 7: أزرار المنصة مكان البحث · البحث أيقونة جنب الإشعارات
   ========================================================= */
.tb-search-btn {
  position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, .12); color: #fff; transition: background .15s, transform .15s;
}
:root:not(.is-dark) .tb-search-btn { background: #F1F4FA; color: #121826; box-shadow: 0 0 0 1px rgba(17, 24, 39, .06) inset; }
.is-dark .tb-search-btn { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line) inset; }
.tb-search-btn:hover { transform: translateY(-1px); }
:root:not(.is-dark) .tb-search-btn:hover, :root:not(.is-dark) .tb-search-btn.on { background: #E6ECFD; color: #1A44B5; }
.tb-search-btn .dot { position: absolute; top: 6px; inset-inline-end: 6px; width: 8px; height: 8px; border-radius: 50%; background: #F39200; box-shadow: 0 0 0 2px var(--card); }
.tb-search-pop {
  position: fixed; z-index: 90; display: flex; align-items: center; gap: 6px; padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3);
  animation: tk-rise .18s var(--ease-out) both;
}
.tb-search-pop #fSearch { flex: 1; width: auto !important; height: 40px; border-radius: 10px; font-size: 14px; }
.tb-search-clear { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--hover); color: var(--muted); cursor: pointer; flex: none; }

@media (min-width: 761px) {
  .has-hero .toolbar > .quick-links {
    order: 7 !important; flex: 1 1 auto; min-width: 0; margin-inline-start: auto; justify-content: center;
    display: flex; align-items: center; gap: 8px; overflow: hidden; padding: 3px 2px;
  }
  .has-hero .toolbar > .quick-links .quick-link { height: 34px; padding: 0 16px; font-size: 13px; }
  .has-hero .toolbar .filter-menu { order: 8; }
}
@media (max-width: 760px) {
  .tb-search-btn { width: 34px; height: 34px; }
}
@media (max-width: 760px) {
  /* الفلتر جنب «اليوم/تحديد» بدل سطر لوحده */
  .has-hero .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .has-hero .toolbar .month-nav { display: contents; }
  .has-hero .toolbar .filters { display: contents; }
  .has-hero .toolbar #titleBtn { order: 1; flex: 1 1 100%; }
  .has-hero .toolbar .view-menu { order: 2; }
  .has-hero .toolbar #modeSeg { order: 3; }
  .has-hero .toolbar #prevBtn { order: 4; }
  .has-hero .toolbar #nextBtn { order: 5; }
  .has-hero .toolbar #todayBtn { order: 6; }
  .has-hero .toolbar #selModeBtn { order: 7; }
  .has-hero .toolbar .filter-menu { order: 8; }
  .has-hero .toolbar > .quick-links { order: 9 !important; flex: 1 1 100%; }
}
@media (max-width: 760px) {
  /* السطر الأول: الشهر + الفلتر · التاني: العرض والأسهم واليوم */
  .has-hero .toolbar #titleBtn { order: 1; flex: 1 1 0; min-width: 0; }
  .has-hero .toolbar .filter-menu { order: 2; }
  .has-hero .toolbar .view-menu { order: 3; }
  .has-hero .toolbar #modeSeg { order: 4; }
  .has-hero .toolbar #prevBtn { order: 5; }
  .has-hero .toolbar #nextBtn { order: 6; }
  .has-hero .toolbar #todayBtn { order: 7; }
  .has-hero .toolbar #selModeBtn { order: 8; }
  /* الفلتر على الموبايل: لوحة من تحت (مش بتخرج برّه الشاشة) */
  .filter-pop {
    position: fixed !important; left: 12px !important; right: 12px !important; top: auto !important; bottom: 12px !important;
    max-width: none !important; width: auto !important; max-height: 72vh; overflow: auto; z-index: 95;
    border-radius: 18px !important; box-shadow: 0 -10px 40px -10px rgba(0, 0, 0, .35) !important;
  }
}
@media (max-width: 760px) {
  .has-hero .toolbar #titleBtn { flex: 1 1 calc(100% - 120px) !important; }
  .has-hero .toolbar .filter-menu { flex: none; }
}

/* كروت الأرقام بقت أزرار: دوسة = تعرض المهام دي */
button.kpi { font: inherit; text-align: start; cursor: pointer; color: inherit; }
button.kpi:focus-visible { outline: none; box-shadow: var(--ring) !important; }
button.kpi:disabled { cursor: default; }
button.kpi.on { box-shadow: 0 0 0 2px var(--k, #1A44B5) !important; background: color-mix(in srgb, var(--k-bg, #E6ECFD) 70%, var(--card)) !important; }
.kpi.k-rose { --k: var(--rose); --k-bg: var(--rose-bg); }

/* صفحة الدخول: كلمة تشجيعية */
.auth-cheer {
  display: flex; flex-direction: column; gap: 2px; margin: -4px 0 16px; padding: 10px 14px; border-radius: 14px; text-align: center;
  background: linear-gradient(135deg, rgba(26, 68, 181, .07), rgba(243, 146, 0, .09)); border: 1px solid rgba(26, 68, 181, .1);
  animation: tk-rise .5s var(--ease-out, ease) both .1s;
}
.auth-cheer b { font-size: 14px; color: #1A44B5; }
.auth-cheer span { font-size: 13px; color: var(--text-2, #3B4457); font-weight: 600; }
.is-dark .auth-cheer b { color: #B9C8FF; }
.st-dir-opts .st-dir-lbl { font-weight: 700; color: var(--muted); }
.st-dir-opts + .st-dir-opts { margin-top: 4px; }
