/* =========================================================
   تمكين — طبقة «بريميوم» (معاينة — مش معتمدة)
   ألوان أعمق، أسطح بطبقات ظل ناعمة، وحركة هادية وسريعة (150–350ms).
   كل الحركة بتتقفل تلقائي لو الجهاز مفعّل «تقليل الحركة».
   ========================================================= */

/* ---------- اللوحة اللونية ---------- */
:root {
  --brand: #1C3FAA; --brand-2: #0F1F5C; --brand-3: #2E5BE6;
  --accent: #F39200; --accent-2: #FFB547;
  --grad-brand: linear-gradient(135deg, #0E1B52 0%, #1A3596 48%, #2C58DE 100%);
  --grad-accent: linear-gradient(135deg, #FFB23E 0%, #F39200 55%, #E07B00 100%);
  --grad-soft: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .6));
  --bg: #F3F5FA; --card: #FFFFFF; --surface: #F8F9FC; --tint: #EEF2FC;
  --text: #121826; --text-2: #3B4457; --muted: #6A7387; --faint: #9AA3B5;
  --line: rgba(17, 24, 39, .09); --line-soft: rgba(17, 24, 39, .055); --hover: #F1F4FA;
  --blue: #1F48C9;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 1px rgba(16, 24, 40, .03);
  --shadow-2: 0 2px 4px rgba(16, 24, 40, .04), 0 12px 32px -8px rgba(16, 24, 40, .16);
  --shadow-3: 0 24px 64px -16px rgba(14, 27, 82, .35), 0 4px 12px rgba(16, 24, 40, .08);
  --glow-accent: 0 6px 18px -6px rgba(243, 146, 0, .55);
  --glow-brand: 0 6px 18px -6px rgba(31, 72, 201, .5);
  --ring: 0 0 0 3px rgba(46, 91, 230, .28);
  --radius: 14px; --radius-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}
.is-dark {
  --brand: #3A63F0; --brand-2: #0B1440; --brand-3: #5B82FF;
  --grad-brand: linear-gradient(135deg, #070D2A 0%, #0F1F66 55%, #1D3FB8 100%);
  --bg: #0A0F1E; --card: #111829; --surface: #151D31; --tint: #18234A; --input: #0D1424;
  --text: #EAEEF7; --text-2: #C2C9D9; --muted: #8E98AE; --faint: #5F6A82;
  --line: rgba(255, 255, 255, .08); --line-soft: rgba(255, 255, 255, .05); --hover: rgba(255, 255, 255, .04);
  --blue: #7C9BFF;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 40px -12px rgba(0, 0, 0, .7);
  --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, .85);
  --ring: 0 0 0 3px rgba(124, 155, 255, .35);
}

/* ---------- الخلفية والخط ---------- */
body {
  background:
    radial-gradient(1200px 520px at 100% -10%, rgba(46, 91, 230, .07), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(243, 146, 0, .05), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  letter-spacing: -.005em;
}
.is-dark body {
  background:
    radial-gradient(1100px 520px at 100% -10%, rgba(58, 99, 240, .16), transparent 60%),
    radial-gradient(800px 400px at -10% 0%, rgba(243, 146, 0, .06), transparent 55%),
    var(--bg);
}
::selection { background: rgba(46, 91, 230, .22); }
h1, h2, h3 { letter-spacing: -.01em; }
b, strong { font-weight: 800; }

/* شريط تمرير رفيع */
* { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, .35) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .3); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background-color: rgba(100, 116, 139, .5); }

/* ---------- الشريط العلوي: زجاج كحلي ---------- */
.topbar {
  background: var(--grad-brand);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 10px 30px -12px rgba(14, 27, 82, .55);
  isolation: isolate;
}
.topbar::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(600px 120px at 85% 0%, rgba(255, 255, 255, .14), transparent 70%);
}
.topbar::before {
  content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 181, 71, .65), transparent);
}
.tb-nav a { transition: background-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.tb-nav a:hover { transform: translateY(-1px); }
.tb-nav a.active { background: rgba(255, 255, 255, .18) !important; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16) inset; }
.acct-btn { box-shadow: 0 0 0 1px rgba(255, 255, 255, .14) inset; transition: background-color .18s var(--ease), box-shadow .18s var(--ease); }
.acct-btn .av { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 4px rgba(255, 181, 71, .55); }
.av-txt { background: var(--grad-accent); }
.tb-nav .pill, .notif-count { background: var(--grad-accent) !important; box-shadow: var(--glow-accent); animation: tk-pop-badge .5s var(--ease-out) both .3s; }

/* ---------- الأزرار ---------- */
.btn-primary, .btn-outline, .btn-ghost, .btn-danger, .icon-btn, .quick-link, .prio-opt, .seg button, .acct-theme button, .pz-row button, .tk-sz-bar button, .col-groups button {
  transition: transform .14s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), filter .2s var(--ease);
}
.btn-primary {
  background: var(--grad-accent) !important; border-color: transparent !important; color: #fff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, var(--glow-accent);
  font-weight: 800;
}
.btn-primary:hover { transform: translateY(-1px); filter: saturate(1.08) brightness(1.03); box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 10px 24px -8px rgba(243, 146, 0, .65); }
.btn-primary:active, .btn-outline:active, .btn-ghost:active, .quick-link:active, .icon-btn:active, .prio-opt:active { transform: translateY(0) scale(.97); }
.btn-outline { border-color: var(--line); box-shadow: var(--shadow-1); }
.btn-outline:hover { border-color: rgba(46, 91, 230, .35); color: var(--blue); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.quick-link { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 16px -8px var(--ql, rgba(0, 0, 0, .3)); }
.quick-link:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-danger:hover { box-shadow: 0 8px 20px -8px rgba(217, 45, 32, .6); }

/* شرائح الاختيار (seg) — الزر النشط بيرتفع بنعومة */
.seg { background: var(--tint); box-shadow: inset 0 1px 2px rgba(16, 24, 40, .06); }
.seg button.active { background: var(--card); color: var(--blue); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 4px 10px -4px rgba(31, 72, 201, .25); }

/* ---------- الحقول ---------- */
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea {
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background-color .18s var(--ease);
}
input:not([type=checkbox]):not([type=radio]):not([type=color]):hover, select:hover, textarea:hover { border-color: rgba(46, 91, 230, .3); }
input:not([type=checkbox]):not([type=radio]):not([type=color]):focus, select:focus, textarea:focus { border-color: var(--brand-3) !important; box-shadow: var(--ring) !important; outline: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-3); }
:focus-visible { box-shadow: var(--ring) !important; }

/* ---------- الأسطح والكروت ---------- */
.st-card, .pf-card, .rq-list-pane, .rq-detail, .mt-list-pane, .mt-editor, .pl-goals, .pl-overview, .pl-card, .pl-ov-card, .auth-card, .users-page table, .pl-mcard, .rp-card {
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-2) !important;
  border-radius: var(--radius) !important;
}
.st-card h2, .pf-card h2, .pl-goals-head h2 { background: linear-gradient(90deg, var(--blue), var(--brand-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.is-dark .st-card h2, .is-dark .pf-card h2, .is-dark .pl-goals-head h2 { background: linear-gradient(90deg, #A9BEFF, #7C9BFF); -webkit-background-clip: text; background-clip: text; }
.st-group { color: var(--text-2); border-bottom: 0 !important; position: relative; }
.st-group::after { content: ''; position: absolute; inset-inline: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--accent), rgba(243, 146, 0, 0) 40%); border-radius: 2px; }
.pl-card b, .pl-ov-nums b { font-variant-numeric: tabular-nums; }
.pl-card { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.pl-card:hover, .pf-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-3) !important; }

/* ---------- لوحة المهام ---------- */
.board { box-shadow: var(--shadow-2); border-radius: var(--radius); }
.board thead th { background: var(--grad-brand) !important; }
.board td.day { transition: background-color .2s var(--ease); }
.board td.day:hover { background-color: var(--hover); }
.task { transition: transform .16s var(--ease), box-shadow .16s var(--ease), background-color .16s var(--ease); }
.task:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px rgba(16, 24, 40, .35); }
.task.done .title { transition: color .3s var(--ease); }
.request-item { transition: transform .16s var(--ease), box-shadow .16s var(--ease); }
.request-item:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -8px rgba(16, 24, 40, .35); }
.board td.day.today .day-num b, .m-day.today .m-num { box-shadow: 0 0 0 0 rgba(46, 91, 230, .5); animation: tk-today 2.4s var(--ease) 1 .6s; }
.my-shortcuts a { background: linear-gradient(135deg, color-mix(in srgb, var(--sc, var(--brand)) 88%, #fff 12%), var(--sc, var(--brand))) !important; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 18px -10px var(--sc, var(--brand)); transition: transform .16s var(--ease), filter .16s var(--ease); }
.my-shortcuts a:hover { transform: translateY(-2px); }

/* ---------- الجداول ---------- */
.rp-table { border-collapse: separate; border-spacing: 0; }
.rp-table th { background: var(--grad-brand) !important; color: #fff !important; font-weight: 700; letter-spacing: .01em; }
.rp-table thead tr:first-child th:first-child { border-start-start-radius: 10px; }
.rp-table thead tr:first-child th:last-child { border-start-end-radius: 10px; }
.rp-table tbody tr { transition: background-color .15s var(--ease); }
.rp-table tbody tr:hover td { background: var(--hover); }
.pl-season-box .rp-table th { background: linear-gradient(135deg, #3B1A8C, #6D3BE0) !important; }
.day-pct { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset; letter-spacing: .02em; }

/* ---------- القوائم المنسدلة والنوافذ ---------- */
.acct-menu, .notif-pop, .menu, .filter-pop, .link-pop, .color-pop, .prio-pop, .ql-more-pop, .st-vis {
  border: 1px solid var(--line) !important; box-shadow: var(--shadow-3) !important; border-radius: 14px !important;
  animation: tk-pop .18s var(--ease-out) both; transform-origin: top center;
}
.is-dark .acct-menu, .is-dark .notif-pop, .is-dark .menu, .is-dark .filter-pop { background: rgba(17, 24, 41, .96); backdrop-filter: blur(14px); }
dialog.modal[open], dialog.sec-pick[open], dialog.pz-dlg[open] {
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-3);
  animation: tk-dialog .26s var(--ease-out) both;
}
dialog[open]::backdrop { background: rgba(8, 13, 32, .42); backdrop-filter: blur(4px) saturate(1.1); animation: tk-fade .25s var(--ease) both; }
.toast { border-radius: 14px; box-shadow: var(--shadow-3); background: rgba(17, 24, 39, .92) !important; backdrop-filter: blur(10px); animation: tk-toast .32s var(--ease-out) both; }
.acct-theme button[aria-checked="true"] { box-shadow: 0 0 0 1px var(--brand-3) inset, 0 6px 14px -8px rgba(46, 91, 230, .6); }

/* ---------- ظهور المحتوى ---------- */
.st-card, .pf-card, .pl-card, .pl-ov-card, .pl-goals, .rq-card, .mt-card, .pl-mcard, .auth-card {
  animation: tk-rise .42s var(--ease-out) both;
}
.st-card:nth-of-type(2), .pf-card:nth-child(2), .pl-card:nth-child(2), .rq-card:nth-child(2), .mt-card:nth-child(2), .pl-mcard:nth-child(2) { animation-delay: .04s; }
.st-card:nth-of-type(3), .pf-card:nth-child(3), .pl-card:nth-child(3), .rq-card:nth-child(3), .mt-card:nth-child(3), .pl-mcard:nth-child(3) { animation-delay: .08s; }
.st-card:nth-of-type(4), .pf-card:nth-child(4), .pl-card:nth-child(4), .rq-card:nth-child(4), .mt-card:nth-child(4), .pl-mcard:nth-child(4) { animation-delay: .12s; }
.pl-card:nth-child(5), .rq-card:nth-child(5), .mt-card:nth-child(5), .pl-mcard:nth-child(5) { animation-delay: .16s; }
.board, #altView > * { animation: tk-fade .35s var(--ease) both; }

/* انتقال ناعم عند تغيير المظهر (فاتح/داكن) — بيشتغل لحظة التبديل بس */
html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .35s var(--ease), color .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease) !important;
}

/* ---------- الحركات ---------- */
@keyframes tk-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tk-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tk-pop { from { opacity: 0; transform: translateY(-4px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes tk-dialog { from { opacity: 0; transform: translateY(10px) scale(.975); } to { opacity: 1; transform: none; } }
@keyframes tk-toast { from { opacity: 0; transform: translate(-50%, 12px) scale(.98); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes tk-pop-badge { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes tk-today { 0% { box-shadow: 0 0 0 0 rgba(46, 91, 230, .45); } 100% { box-shadow: 0 0 0 12px rgba(46, 91, 230, 0); } }

/* ---------- تسجيل الدخول ---------- */
.auth-page { background: radial-gradient(900px 500px at 80% -10%, rgba(46, 91, 230, .18), transparent 60%), radial-gradient(700px 420px at 0% 110%, rgba(243, 146, 0, .14), transparent 60%), var(--bg) !important; }
.auth-brand { background: var(--grad-brand) !important; box-shadow: var(--glow-brand); }

/* ---------- الموبايل ---------- */
@media (max-width: 760px) {
  .tb-nav.open { animation: tk-pop .2s var(--ease-out) both; background: var(--grad-brand); }
  .pl-mday-days button { transition: transform .15s var(--ease), background-color .2s var(--ease); }
  .pl-mday-days button.on { background: var(--grad-brand); box-shadow: var(--glow-brand); }
  .pl-mcard .v .chk.done { background: linear-gradient(135deg, #22C55E, #15803D); box-shadow: 0 6px 14px -8px rgba(22, 163, 74, .8); }
}

/* احترام «تقليل الحركة» */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* الداكن: عناصر اللوحة الفاتحة (المحاضر، الطلبات المرسلة، أرقام الخطة) */
.is-dark .meeting-item { background: rgba(124, 58, 237, .16) !important; color: #DDD6FE !important; border-color: rgba(167, 139, 250, .45) !important; }
.is-dark .plan-item { background: rgba(22, 163, 74, .12) !important; color: #BBF7D0 !important; }
.is-dark .request-item.sent { background: rgba(8, 145, 178, .1) !important; color: #A5F3FC !important; }
.is-dark .request-item .rq-st, .is-dark .who { background: rgba(255, 255, 255, .08) !important; color: var(--text-2) !important; }
.is-dark .task .time-badge { color: var(--muted); }
