:root{
  /* ===== Modernize-style — عصري ناعم فاتح (افتراضي) ===== */
  color-scheme:light;
  --ink:#2a3547; --ink-2:#5a6a85; --muted:#7c8fac;
  --accent:#5d87ff; --accent-2:#4570ea; --accent-soft:#ecf2ff; --accent-shadow:rgba(93,135,255,.30);
  --bg:#f4f7fb; --surface:#ffffff; --surface-2:#f6f9fd; --line:#eaeff5; --line-2:#f1f5f9;
  --green:#13b57e; --green-bg:#e6f7f0; --red:#e35d54; --red-bg:#fbeceb; --amber:#d99a2b; --amber-bg:#fbf3e2;
  --shadow:0 2px 6px rgba(93,135,255,.05),0 8px 24px rgba(37,55,90,.06);
  --shadow-lg:0 24px 60px rgba(37,55,90,.20);
  --radius:14px;
  /* الشريط الجانبي — فاتح */
  --sidebar-bg:#ffffff; --sidebar-text:#5a6a85; --sidebar-brand:#2a3547; --sidebar-muted:#8b97ad;
  --sidebar-active-bg:#ecf2ff; --sidebar-active-text:#5d87ff; --sidebar-active-shadow:none;
  --sidebar-border:#eef2f7; --sidebar-hover:#f4f7fb;
  --topbar-bg:#ffffff;
  --navy:#2a3547; --navy-2:#38455c;
}
/* ===== الوضع الليلي ===== */
[data-theme="dark"]{
  color-scheme:dark;
  --ink:#e8ecf3; --ink-2:#aab4c5; --muted:#7e8aa0;
  --accent:#5d87ff; --accent-2:#6d94ff; --accent-soft:rgba(93,135,255,.16); --accent-shadow:rgba(0,0,0,.4);
  --bg:#0e1621; --surface:#182131; --surface-2:#1f2a3c; --line:#2a3648; --line-2:#232f42;
  --green:#22c58e; --green-bg:rgba(34,197,142,.15); --red:#f0766c; --red-bg:rgba(240,118,108,.15); --amber:#e6ab3f; --amber-bg:rgba(230,171,63,.15);
  --shadow:0 2px 6px rgba(0,0,0,.22),0 8px 24px rgba(0,0,0,.30);
  --shadow-lg:0 24px 60px rgba(0,0,0,.55);
  --sidebar-bg:#141d2b; --sidebar-text:#aeb8ca; --sidebar-brand:#ffffff; --sidebar-muted:#8593a8;
  --sidebar-active-bg:linear-gradient(180deg,var(--accent),var(--accent-2)); --sidebar-active-text:#ffffff;
  --sidebar-active-shadow:0 6px 16px rgba(93,135,255,.4);
  --sidebar-border:rgba(255,255,255,.07); --sidebar-hover:rgba(255,255,255,.06);
  --topbar-bg:#182131;
  --navy:#5d87ff; --navy-2:#4570ea;
}
*{box-sizing:border-box;margin:0;padding:0}
body{font-family:'IBM Plex Sans Arabic',sans-serif;background:var(--bg);color:var(--ink);
  line-height:1.6;min-height:100vh;-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums}

/* ===== App shell ===== */
.app{display:grid;grid-template-columns:250px 1fr;min-height:100vh;align-items:start}

/* Sidebar */
.sidebar{position:sticky;top:0;height:100vh;background:var(--sidebar-bg);
  display:flex;flex-direction:column;color:var(--sidebar-text);border-inline-start:1px solid var(--sidebar-border);z-index:80;transition:background .2s}
.side-brand{display:flex;align-items:center;gap:12px;padding:20px 18px;border-bottom:1px solid var(--sidebar-border)}
.side-logo{width:44px;height:44px;border-radius:11px;object-fit:contain;background:#fff;padding:5px;flex:none}
.side-name{font-size:14px;font-weight:700;color:var(--sidebar-brand);line-height:1.45}
.side-name span{display:block;font-size:11px;font-weight:400;color:var(--sidebar-muted);margin-top:2px}
.side-close{display:none;margin-inline-start:auto;background:transparent;border:none;color:var(--sidebar-muted);font-size:17px;cursor:pointer;width:32px;height:32px;border-radius:8px;flex:none}
.side-close:hover{background:var(--sidebar-hover);color:var(--sidebar-brand)}
.side-backdrop{display:none}
.nav{flex:1;display:flex;flex-direction:column;gap:3px;padding:14px 12px;overflow-y:auto}
.nav .tab{display:flex;align-items:center;gap:12px;width:100%;text-align:right;background:transparent;border:none;
  border-radius:9px;padding:11px 13px;font-family:inherit;font-size:14.5px;font-weight:500;color:var(--sidebar-text);cursor:pointer;
  transition:.15s;position:relative}
.nav .tab .ic{width:20px;height:20px;flex:none;display:grid;place-items:center;opacity:.9}
.nav .tab .ic svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.7}
.nav .tab:hover{background:var(--sidebar-hover);color:var(--sidebar-brand)}
.nav .tab.active{background:var(--sidebar-active-bg);color:var(--sidebar-active-text);box-shadow:var(--sidebar-active-shadow);font-weight:600}
.nav .tab.active .ic{opacity:1}
.side-foot{padding:14px 12px;border-top:1px solid var(--sidebar-border);display:flex;flex-direction:column;gap:2px}
.side-link{background:transparent;border:none;text-align:right;color:var(--sidebar-muted);font-family:inherit;font-size:13.5px;
  padding:9px 13px;border-radius:9px;cursor:pointer;transition:.15s}
.side-link:hover{background:var(--sidebar-hover);color:var(--sidebar-brand)}
.settings-toggle{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;font-weight:600}
.settings-toggle .caret{font-size:10px;opacity:.7;transition:transform .2s}
.settings-toggle.open .caret{transform:rotate(180deg)}
.settings-menu{overflow:hidden;max-height:0;transition:max-height .25s ease;display:flex;flex-direction:column;gap:2px}
.settings-menu.open{max-height:180px}
.side-link.sub{padding-inline-start:26px;font-size:13px}
.side-link.sub.danger:hover{background:var(--red-bg,#fdecec);color:var(--red,#e5484d)}
/* مجموعات القائمة القابلة للطي */
.nav-group{display:flex;flex-direction:column}
/* الأقسام الرئيسية — بلون مميّز (أزرق) عن الأقسام الفرعية المحايدة */
.nav-title{display:flex;align-items:center;justify-content:space-between;width:100%;background:transparent;border:none;
  text-align:right;color:var(--accent-2);font-family:inherit;font-size:13px;font-weight:800;letter-spacing:0;
  padding:13px 13px 7px;cursor:pointer;transition:.15s}
.nav-title:hover{color:var(--accent)}
.nav-title .caret{font-size:11px;opacity:.8;color:var(--accent-2);transition:transform .2s}
.nav-group.collapsed .caret{transform:rotate(-90deg)}
/* الأقسام الفرعية — مُزاحة قليلاً مع خط دليل خفيف لإبراز التبعية */
.nav-items{display:flex;flex-direction:column;gap:3px;overflow:hidden;max-height:600px;transition:max-height .25s ease;
  margin-inline-start:12px;padding-inline-start:6px;border-inline-start:1.5px solid var(--sidebar-border)}
.nav-group.collapsed .nav-items{max-height:0}
/* قائمة المشاريع داخل الشريط الجانبي */
.nav-projects{display:flex;flex-direction:column;gap:2px}
.nav-proj{display:flex;align-items:center;gap:8px;width:100%;text-align:start;background:transparent;border:none;cursor:pointer;
  padding:8px 10px;border-radius:8px;font-family:inherit;font-size:13px;font-weight:500;color:var(--sidebar-text);opacity:.92}
.nav-proj:hover{background:var(--sidebar-hover);color:var(--sidebar-brand);opacity:1}
.nav-proj .np-ic{flex:none;font-size:13px;opacity:.75}
.nav-proj .np-name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* سجل الموظف — الأعمال اليومية */
.el-day{margin-bottom:14px;border:1px solid var(--line,#e6eaf0);border-radius:12px;overflow:hidden;background:var(--card,#fff)}
.el-date{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 14px;font-weight:700;font-size:13.5px;
  background:var(--sidebar-hover,#f4f7fb);color:var(--sidebar-brand,#2a3547);border-bottom:1px solid var(--line,#e6eaf0)}
.el-count{font-weight:600;font-size:12px;color:var(--muted,#8b97ad)}
.el-item{padding:9px 14px;font-size:13.5px;border-top:1px solid var(--line,#eef1f6);line-height:1.7}
.el-item:first-child{border-top:none}

/* تقويم الأداء — بطاقات */
.ev-card{border:1px solid var(--line,#e6eaf0);border-radius:14px;padding:14px 16px;margin-bottom:12px;background:var(--card,#fff)}
.ev-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.ev-band{font-size:12px;font-weight:700;color:var(--accent,#5d87ff);background:var(--sidebar-hover,#eef2ff);padding:2px 10px;border-radius:20px;margin-inline-start:6px}
.ev-score{display:flex;align-items:center;gap:8px;font-size:22px;font-weight:800;color:var(--ok,#39b877)}
.ev-score small{font-size:12px;font-weight:600;color:var(--muted,#8b97ad)}
.ev-crit{display:flex;flex-direction:column;gap:5px;margin-bottom:8px}
.ev-row{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px;padding:2px 0}
.ev-stars{color:#f5a623;letter-spacing:2px;white-space:nowrap;font-size:15px}
.ev-txt{font-size:13px;line-height:1.7;margin-top:4px;padding-top:6px;border-top:1px dashed var(--line,#eef1f6)}
.ev-meta{font-size:11.5px;color:var(--muted,#8b97ad);margin-top:8px}

/* نموذج التقييم — نجوم قابلة للنقر */
.eval-scale-hint{font-size:12.5px;color:var(--muted,#8b97ad);margin:2px 0 10px}
.eval-crit-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line,#eef1f6)}
.ecr-label{font-size:14px;font-weight:600}
.ecr-stars{white-space:nowrap;display:inline-flex;gap:3px}
.ecr-stars .star{cursor:pointer;font-size:24px;line-height:1;color:var(--line,#d5dbe6);transition:color .1s,transform .1s}
.ecr-stars .star:hover{transform:scale(1.15)}
.ecr-stars .star.on{color:#f5a623}
.eval-overall{margin:12px 0 4px;padding:10px 14px;border-radius:10px;background:var(--sidebar-hover,#f4f7fb);font-size:14px;text-align:center}
.eval-overall b{font-size:18px;color:var(--accent,#5d87ff)}
.eval-trainings{font-size:13px;line-height:1.7;background:var(--sidebar-hover,#f4f7fb);border:1px solid var(--line,#e6eaf0);border-radius:10px;padding:9px 12px;margin:0 0 10px}
.eval-trainings:empty{display:none}
.eval-trainings .et-list{color:var(--muted,#8b97ad)}

/* لوحة الموظف المميّز */
.champ-card{text-align:center;border:2px solid #f5c451;border-radius:18px;padding:20px 16px;margin-bottom:18px;
  background:linear-gradient(180deg,rgba(245,196,81,.14),transparent 70%)}
.champ-badge{display:inline-block;background:#f5c451;color:#3a2e00;font-weight:800;font-size:13px;padding:4px 14px;border-radius:20px;margin-bottom:12px}
.champ-av{width:84px;height:84px;border-radius:50%;overflow:hidden;margin:0 auto 10px;border:3px solid #f5c451;display:flex;align-items:center;justify-content:center;background:var(--sidebar-hover,#f4f7fb);font-size:30px;font-weight:700}
.champ-av img{width:100%;height:100%;object-fit:cover}
.champ-name{font-size:20px;font-weight:800;color:var(--sidebar-brand,#2a3547)}
.champ-job{font-size:13px;color:var(--muted,#8b97ad);margin-top:2px}
.champ-score{font-size:22px;font-weight:800;color:var(--ok,#39b877);margin-top:8px}
.champ-score small{font-size:12px;color:var(--muted,#8b97ad);font-weight:600}
.champ-note{margin-top:10px;font-size:13px;color:#b5891f;font-weight:600}
.lb-list{display:flex;flex-direction:column;gap:8px}
.lb-row{display:flex;align-items:center;gap:12px;padding:10px 14px;border:1px solid var(--line,#e6eaf0);border-radius:12px;background:var(--card,#fff)}
.lb-row.top{border-color:#f5c451;background:linear-gradient(90deg,rgba(245,196,81,.1),transparent)}
.lb-rank{font-size:20px;min-width:32px;text-align:center;font-weight:800;color:var(--muted,#8b97ad)}
.lb-av{width:40px;height:40px;border-radius:50%;overflow:hidden;flex:none;display:flex;align-items:center;justify-content:center;background:var(--sidebar-hover,#f4f7fb);font-weight:700;font-size:14px}
.lb-av img{width:100%;height:100%;object-fit:cover}
.lb-info{flex:1;min-width:0;display:flex;flex-direction:column}
.lb-info small{color:var(--muted,#8b97ad);font-size:12px}
.lb-score{font-size:18px;font-weight:800;color:var(--accent,#5d87ff)}
.lb-score small{font-size:11px;color:var(--muted,#8b97ad);font-weight:600}

/* نوع العمل (حضوري/ميداني/عن بُعد) */
.wm-select{border:1px solid var(--line,#e6eaf0);background:var(--card,#fff);color:var(--text,#1b2431);
  border-radius:9px;padding:6px 10px;font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;max-width:150px}
.wm-chip{display:inline-block;background:var(--sidebar-hover,#f4f7fb);border:1px solid var(--line,#e6eaf0);
  border-radius:20px;padding:1px 9px;font-size:11.5px;margin-inline-end:4px}

/* Main + topbar */
.main{min-width:0;display:flex;flex-direction:column;min-height:100vh}
.topbar{position:sticky;top:0;z-index:40;background:var(--topbar-bg);
  border-bottom:1px solid var(--line);padding:14px 30px;display:flex;align-items:center;gap:16px}
.side-toggle{display:none;background:var(--surface);border:1px solid var(--line);border-radius:9px;width:38px;height:38px;
  font-size:17px;cursor:pointer;color:var(--ink-2)}
.greet{font-size:14px;color:var(--muted)}.greet b{color:var(--ink);font-weight:700}
.top-actions{margin-inline-start:auto;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.content{padding:26px 30px 80px;max-width:1180px;width:100%}

/* legacy wrap fallback */
.wrap{max-width:1120px;margin:0 auto;padding:0 20px 80px}

/* Buttons / chips in topbar */
.user-chip{font-size:13px;color:var(--muted)}.user-chip b{color:var(--ink)}
.add-btn{background:linear-gradient(180deg,var(--accent),var(--accent-2));color:#fff;border:none;border-radius:10px;
  padding:11px 20px;font-family:inherit;font-size:14.5px;font-weight:600;cursor:pointer;
  box-shadow:0 4px 14px var(--accent-shadow);transition:.15s;display:flex;align-items:center;gap:8px}
.add-btn:hover{transform:translateY(-1px);box-shadow:0 6px 18px var(--accent-shadow)}
.link-btn{background:none;border:none;color:var(--muted);font-family:inherit;font-size:13px;cursor:pointer;text-decoration:underline}
.link-btn:hover{color:var(--accent)}
#btn-checkout{color:var(--accent-2);font-weight:600;text-decoration:none;border:1px solid var(--line);border-radius:8px;padding:7px 12px}
#btn-checkout:hover{background:var(--accent-soft);border-color:var(--accent)}
.att-chip{font-size:12.5px;font-weight:600;color:var(--ink-2);background:var(--surface-2);border:1px solid var(--line);border-radius:20px;padding:6px 12px;white-space:nowrap}
.banner{background:var(--amber-bg);border:1px solid var(--amber);color:var(--ink);border-radius:12px;padding:12px 18px;margin:20px 30px 0;font-size:14px;font-weight:500}
.banner b{color:var(--red)}
/* الإشعارات */
.notif-wrap{position:relative}
.notif-btn{position:relative;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;width:40px;height:40px;font-size:17px;cursor:pointer;display:grid;place-items:center;color:var(--ink-2)}
.notif-btn:hover{border-color:var(--accent)}
.notif-badge{position:absolute;top:-5px;inset-inline-start:-5px;min-width:18px;height:18px;padding:0 4px;background:var(--red);color:#fff;border-radius:9px;font-size:11px;font-weight:700;display:grid;place-items:center;border:2px solid var(--surface)}
.notif-panel{position:absolute;top:48px;inset-inline-end:0;width:330px;max-width:86vw;background:var(--surface);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow-lg);display:none;z-index:70;overflow:hidden}
.notif-panel.show{display:block}
.notif-head{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line);font-weight:700;font-size:14px}
.notif-list{max-height:62vh;overflow:auto}
.notif-item{padding:12px 16px;border-bottom:1px solid var(--line-2);font-size:13.5px;cursor:pointer;display:flex;gap:10px;align-items:flex-start}
.notif-item:hover{background:var(--surface-2)}
.notif-item.unread{background:var(--accent-soft)}
.notif-item .dot{width:8px;height:8px;border-radius:50%;background:var(--accent);flex:none;margin-top:6px}
.notif-item.read .dot{background:transparent}
.notif-item .nt{flex:1}
.notif-item .nt small{display:block;color:var(--muted);font-size:11.5px;margin-top:3px}
.notif-empty{padding:26px 16px;text-align:center;color:var(--muted);font-size:13px}
/* نشاط النظام */
.act-row{display:flex;gap:12px;align-items:flex-start;padding:11px 18px;border-bottom:1px solid var(--line-2);font-size:13.5px}
.act-row:last-child{border-bottom:none}
.act-ic{width:30px;height:30px;border-radius:8px;flex:none;display:grid;place-items:center;font-size:14px;background:var(--surface-2);border:1px solid var(--line)}
.act-row .at{flex:1}
.act-row .at small{display:block;color:var(--muted);font-size:11.5px;margin-top:2px}
@media(max-width:760px){.notif-panel{inset-inline-end:auto;inset-inline-start:0}}
/* المشاريع */
.proj-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(270px,1fr));gap:16px}
.proj-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px;display:flex;flex-direction:column;gap:10px;border-top:3px solid var(--accent)}
.proj-card.t-admin{border-top-color:var(--accent)}
.proj-card.t-dev{border-top-color:var(--green)}
.proj-card.t-legal{border-top-color:#b8892f}
.proj-top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.proj-type{font-size:11.5px;font-weight:700;padding:3px 11px;border-radius:20px;background:var(--accent-soft);color:var(--accent-2)}
.proj-card h3{font-size:16.5px;font-weight:800;color:var(--ink);line-height:1.4}
.proj-desc{font-size:13px;color:var(--ink-2);flex:1;line-height:1.7;white-space:pre-wrap;word-break:break-word}
.proj-foot{display:flex;justify-content:space-between;align-items:center;font-size:12.5px;color:var(--muted);border-top:1px solid var(--line-2);padding-top:10px}
.proj-status{font-size:11.5px;font-weight:700;padding:3px 11px;border-radius:20px}
.proj-status.st-on{background:var(--green-bg);color:var(--green)}
.proj-status.st-done{background:var(--accent-soft);color:var(--accent-2)}
.proj-status.st-off{background:var(--amber-bg);color:var(--amber)}
.proj-card{cursor:pointer;transition:transform .12s,box-shadow .12s}
.proj-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.proj-card .acts .icon-btn{cursor:pointer}
.proj-meta{font-size:12.5px;color:var(--ink-2);line-height:1.6;word-break:break-word}
.proj-prog{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.proj-prog .pp-bar{flex:1;height:6px;border-radius:6px;background:var(--line-2);overflow:hidden}
.proj-prog .pp-bar i{display:block;height:100%;background:var(--green);border-radius:6px}
/* ===== مساحة عمل المشروع (صفحة مستقلة) ===== */
.pws-bar{display:flex;align-items:center;gap:12px;margin-bottom:14px;flex-wrap:wrap}
.pws-bar h2{font-weight:800;color:var(--ink);word-break:break-word}
.pws-tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);overflow-x:auto;margin-bottom:18px}
.pws-tab{background:none;border:none;padding:12px 16px;font-size:14.5px;font-weight:600;color:var(--muted);cursor:pointer;border-bottom:2.5px solid transparent;white-space:nowrap}
.pws-tab.active{color:var(--accent-2);border-bottom-color:var(--accent)}
.pws-body{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:22px 24px;min-height:340px}
.ov-chips{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.prio-chip{font-size:11.5px;font-weight:700;padding:3px 11px;border-radius:20px}
.prio-chip.pr-hi{background:var(--red-bg,#fdecec);color:var(--red,#d9534f)}
.prio-chip.pr-mid{background:var(--amber-bg);color:var(--amber)}
.prio-chip.pr-lo{background:var(--line-2);color:var(--muted)}
.ov-row{display:flex;gap:12px;padding:10px 0;border-bottom:1px solid var(--line-2);font-size:14px;line-height:1.7}
.ov-lbl{min-width:120px;color:var(--muted);font-weight:600}
.ov-val{color:var(--ink);white-space:pre-wrap;word-break:break-word}
.ov-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:18px 0 8px}
.ovs{background:var(--surface-2);border:1px solid var(--line-2);border-radius:12px;padding:12px;text-align:center}
.ovs b{display:block;font-size:22px;font-weight:800;color:var(--accent-2)}
.ovs small{color:var(--muted);font-size:12px}
/* المهام — تخطيط بطاقة (عنوان في سطر + أدوات تحته) */
.tk-add{display:flex;gap:8px;margin-bottom:16px}
.tk-add input{flex:1;padding:10px 13px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;font-size:14px}
.tk-list{display:flex;flex-direction:column;gap:10px}
.tk-row{display:flex;flex-direction:column;gap:10px;background:var(--surface-2);border:1px solid var(--line-2);border-radius:12px;padding:12px 14px;border-inline-start:4px solid var(--muted)}
.tk-row.ts-todo{border-inline-start-color:var(--muted)}
.tk-row.ts-doing{border-inline-start-color:var(--accent)}
.tk-row.ts-done{border-inline-start-color:var(--green)}
.tk-row.ts-block{border-inline-start-color:var(--red,#d9534f)}
.tk-head{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.tk-title{font-size:15px;font-weight:700;color:var(--ink);line-height:1.6;word-break:break-word;flex:1}
.tk-row.ts-done .tk-title{text-decoration:line-through;color:var(--muted)}
.tk-ctrls{display:flex;flex-wrap:wrap;gap:10px}
.tk-f{display:flex;flex-direction:column;gap:3px;font-size:11px;color:var(--muted);font-weight:600}
.tk-sel,.tk-date{padding:7px 10px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--ink);font:inherit;font-size:13px;min-width:120px}
.tk-date{min-width:150px}
@media(max-width:600px){.tk-f{flex:1 1 calc(50% - 5px)}.tk-sel,.tk-date{min-width:0;width:100%}.ov-stats{grid-template-columns:repeat(2,1fr)}.pws-body{padding:16px}}
/* شارة غير المقروء على عناصر القائمة */
.nav-badge{margin-inline-start:auto;min-width:20px;height:20px;padding:0 6px;background:var(--red,#e5484d);color:#fff;border-radius:11px;font-size:11.5px;font-weight:700;display:inline-flex;align-items:center;justify-content:center;line-height:1}
.nav .tab.active .nav-badge{background:#fff;color:var(--red,#e5484d)}
/* شارة رسائل غير مقروءة على بطاقة المشروع */
.card-unread{font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:20px;background:var(--red,#e5484d);color:#fff}
/* ===== المشاريع الفرعية (هرمية) — تُعرض داخل المشروع الرئيسي ===== */
.sub-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
/* ترويسة قسم موحّدة: العنوان يمين + زر الإضافة يسار */
.ov-sec-head{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px}
.proj-tag{color:var(--accent-2);font-weight:600}
/* ===== اعتماد إضافات الموظفين ===== */
.ap-badge{font-weight:700;font-size:11.5px;padding:2px 8px;border-radius:20px;white-space:nowrap}
.ap-badge.pend{background:var(--amber-bg);color:var(--amber)}
.ap-badge.rej{background:var(--red-bg,#fdecec);color:var(--red,#e5484d)}
.row.is-pending{border-inline-start:3px solid var(--amber)}
.row.is-rejected{opacity:.55}
.chk-row{display:flex;align-items:flex-start;gap:10px;padding:12px 13px;margin-bottom:14px;background:var(--surface-2);border:1px solid var(--line-2);border-radius:10px;font-size:14px;color:var(--ink);cursor:pointer}
.chk-row input{width:18px;height:18px;margin-top:2px;accent-color:var(--accent);flex:none}
.chk-row small{color:var(--muted);font-size:12px;display:block;margin-top:2px;font-weight:400}
.perms-box{border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin-bottom:14px;background:var(--surface)}
.perms-box .chk-row{margin-bottom:6px;padding:8px 10px}
.perms-title{font-weight:700;font-size:14px;color:var(--accent-2);margin-bottom:4px}
/* ربط تيليجرام */
.tg-status.ok{background:var(--green-bg);color:var(--green);font-weight:700;padding:10px 14px;border-radius:10px;margin-bottom:8px}
.tg-steps{margin:10px 18px;line-height:2;font-size:14px;color:var(--ink-2)}
#tg-link-out code,.tg-steps code{background:var(--surface-2);padding:2px 7px;border-radius:6px;font-family:monospace;direction:ltr;display:inline-block}
.proj-card.is-sub{border-top-width:2px;padding:14px}
.proj-card.is-sub h3{font-size:15px}
/* أحجام بطاقات المشاريع (تصغير/تكبير) */
.proj-grid.sz-sm{grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px}
.proj-grid.sz-sm .proj-card{padding:12px;gap:6px}
.proj-grid.sz-sm .proj-card h3{font-size:14px}
.proj-grid.sz-sm .proj-desc,.proj-grid.sz-sm .proj-prog,.proj-grid.sz-sm .proj-meta{display:none}
.proj-grid.sz-lg{grid-template-columns:repeat(auto-fill,minmax(360px,1fr))}
.proj-grid.sz-lg .proj-card h3{font-size:18px}
/* حقل بحث المشاريع + مجموع الملفات */
.proj-search-input{border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:9px;
  padding:8px 12px;font-family:inherit;font-size:13.5px;min-width:180px}
.files-sum{margin:10px 0;padding:8px 12px;border-radius:9px;background:var(--sidebar-hover,#f4f7fb);
  border:1px solid var(--line);font-size:13px}
.lv-days-hint{font-size:13px;color:var(--muted,#8b97ad);margin:-4px 0 10px;min-height:18px}
.lv-days-hint b{color:var(--accent,#5d87ff);font-size:15px}
/* شارة ربط تيليجرام + سجل الإشعارات */
.tg-badge{font-size:11px;font-weight:700;padding:1px 8px;border-radius:20px;white-space:nowrap}
.tg-badge.on{background:rgba(57,184,119,.15);color:#2b8a5c}
.tg-badge.off{background:rgba(229,72,77,.13);color:#c1443f}
.nlog-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 0;border-top:1px solid var(--line,#eef1f6);font-size:12.5px}
.nlog-row:first-child{border-top:none}
.nlog-txt{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nlog-st{font-size:11px;font-weight:600;white-space:nowrap}
.nlog-st.read{color:#2b8a5c}.nlog-st.deliv{color:var(--accent,#5d87ff)}.nlog-st.no{color:var(--muted,#8b97ad)}
/* عرض المشاريع كقائمة (صفوف) — أفضل عند كثرة المشاريع */
.proj-list{display:flex;flex-direction:column;gap:6px}
.proj-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--line);
  border-radius:10px;border-inline-start:4px solid var(--accent);padding:10px 14px;cursor:pointer;transition:background .12s}
.proj-row:hover{background:var(--sidebar-hover,#f4f7fb)}
.proj-row.t-dev{border-inline-start-color:var(--green)}
.proj-row.t-legal{border-inline-start-color:#b8892f}
.proj-row .pr-name{font-weight:800;font-size:14.5px;color:var(--ink);flex:1;min-width:140px}
.proj-row .pr-cell{font-size:12.5px;color:var(--muted)}
.proj-row .proj-type,.proj-row .proj-status{font-size:11.5px;padding:2px 10px}
.proj-row .acts{margin-inline-start:auto;display:flex;gap:2px}
.proj-row.is-sub .pr-name{font-weight:600;opacity:.9}
.sub-add-row{margin-top:12px}
.sub-add{padding:6px 14px;font-size:13px}
.sub-count{font-size:11.5px;font-weight:700;padding:3px 9px;border-radius:20px;background:var(--accent-soft);color:var(--accent-2)}
.ov-parent{margin-bottom:12px;font-size:13.5px;color:var(--muted)}
.ov-parent a{color:var(--accent-2);cursor:pointer;font-weight:600;text-decoration:underline}
/* ===== نوع الاجتماع (اختيار مجزّأ) + بطاقات اجتماعات المشروع ===== */
.seg{display:flex;gap:6px}
.seg-b{flex:1;background:var(--surface);border:1px solid var(--line);border-radius:10px;padding:9px;font:inherit;font-size:13.5px;font-weight:600;color:var(--ink-2);cursor:pointer}
.seg-b.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.mtg-card{background:var(--surface-2);border:1px solid var(--line-2);border-radius:12px;padding:14px;margin-bottom:12px}
.mtg-top{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:6px}
.mtg-top b{font-size:15px;color:var(--ink)}
.mtg-meta{font-size:12.5px;color:var(--muted);line-height:1.7}
.mtg-acts{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:10px}
.mtg-minutes{margin-top:12px;padding-top:12px;border-top:1px dashed var(--line)}
.mtg-minutes textarea{width:100%;min-height:90px;padding:10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink);font:inherit;font-size:13.5px;margin-bottom:8px}
.mtg-files{margin-top:8px;display:flex;flex-direction:column;gap:4px}
.mtg-file{display:flex;align-items:center;gap:8px;font-size:13px}
.mtg-file a{color:var(--accent-2);text-decoration:none}
/* إيصالات قراءة النقاش (للمدير) */
.read-receipts{margin-top:16px;border-top:1px dashed var(--line);padding-top:14px}
.rr-title{font-size:13px;font-weight:700;color:var(--ink-2);margin-bottom:8px}
.rr-title small{font-weight:500;color:var(--muted)}
.rr-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:6px 0;font-size:13px;border-bottom:1px solid var(--line-2)}
.rr-name{font-weight:600;color:var(--ink)}
.rr-seen{color:var(--green);font-size:12.5px}
.rr-unseen{color:var(--muted);font-size:12.5px}
/* ===== بطاقة الملف الشخصي (القائمة الجانبية) + الصور ===== */
.side-profile{display:flex;align-items:center;gap:11px;padding:12px 14px;margin:0 12px 8px;background:var(--sidebar-active-bg,rgba(255,255,255,.06));border:1px solid var(--sidebar-border,rgba(255,255,255,.08));border-radius:14px}
.sp-avatar{width:46px;height:46px;flex:none;border-radius:50%;overflow:hidden;background:var(--accent,#5d87ff);color:#fff;display:grid;place-items:center;font-weight:700;font-size:16px;cursor:pointer;position:relative;border:2px solid rgba(255,255,255,.25)}
.sp-avatar img{width:100%;height:100%;object-fit:cover;display:block}
.sp-avatar.lg{width:76px;height:76px;font-size:26px}
.sp-avatar.sm{width:36px;height:36px;font-size:13px;cursor:default;border-width:1.5px}
.sp-avatar:not(.sm):hover::after{content:'📷';position:absolute;inset:0;display:grid;place-items:center;background:rgba(0,0,0,.4);font-size:15px}
.sp-info{min-width:0}
.sp-name{font-weight:700;font-size:14.5px;color:var(--sidebar-active-text,var(--sidebar-text));white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-job{font-size:12px;color:var(--sidebar-text);opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-no{font-size:11.5px;color:var(--sidebar-text);opacity:.6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sp-no .jobno{direction:ltr;unicode-bidi:isolate;font-weight:600;letter-spacing:.2px}
.emp-avatar-row{display:flex;align-items:center;gap:16px;margin-bottom:16px;padding-bottom:16px;border-bottom:1px solid var(--line)}
/* ===== مركز التقارير ===== */
.rep-types{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px}
.rep-t{background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:8px 16px;font-size:13.5px;font-weight:600;color:var(--ink-2);cursor:pointer}
.rep-t:hover{border-color:var(--accent)}
.rep-t.active{background:var(--accent);color:#fff;border-color:var(--accent)}
.rep-filters{display:flex;flex-wrap:wrap;gap:12px;align-items:flex-end;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:14px 16px;margin-bottom:16px}
.rep-filters .field{margin:0;min-width:150px}
.rep-filters .btn-primary,.rep-filters .btn-ghost{padding:9px 18px}
.rep-output{min-height:200px}
.rep-doc{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:22px 24px}
.rep-head{border-bottom:2px solid var(--accent);padding-bottom:12px;margin-bottom:16px}
.rep-head h2{font-size:19px;font-weight:800;color:var(--ink)}
.rep-head small{color:var(--muted)}
.rep-stats{display:flex;flex-wrap:wrap;gap:12px;margin-bottom:6px}
.rep-stat{flex:1 1 130px;background:var(--surface-2);border:1px solid var(--line-2);border-radius:12px;padding:12px 14px;text-align:center}
.rep-stat b{display:block;font-size:20px;font-weight:800;color:var(--ink)}
.rep-stat small{font-size:12px;color:var(--muted)}
.rep-stat.ok b{color:var(--green)} .rep-stat.warn b{color:var(--amber)}
.rep-sec{margin-top:20px}
.rep-sec h3{font-size:15px;font-weight:700;color:var(--accent-2);margin-bottom:10px}
.rep-table-wrap{overflow-x:auto}
.rep-table{width:100%;border-collapse:collapse;font-size:13px}
.rep-table th,.rep-table td{border:1px solid var(--line-2);padding:8px 10px;text-align:right;white-space:nowrap}
.rep-table th{background:var(--surface-2);color:var(--ink-2);font-weight:700}
.rep-table td{color:var(--ink)}
.rep-emp-head{font-size:16px;margin-bottom:12px}
.rep-prog{display:inline-block;width:70px;height:6px;border-radius:6px;background:var(--line-2);overflow:hidden;vertical-align:middle;margin-inline-end:6px}
.rep-prog i{display:block;height:100%;background:var(--green)}
@media(max-width:700px){.rep-filters .field{min-width:calc(50% - 6px)}}

/* Segmented toggle */
.seg{display:inline-flex;background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:3px;gap:2px}
.seg-btn{background:transparent;border:none;border-radius:8px;padding:7px 16px;font-family:inherit;font-size:13.5px;font-weight:500;color:var(--muted);cursor:pointer;transition:.15s}
.seg-btn.active{background:var(--accent);color:#fff}

/* ===== Stats ===== */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:26px}
.stat{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);position:relative;overflow:hidden}
.stat::before{content:"";position:absolute;inset:0 auto 0 0;width:4px;background:var(--accent)}
.stat.green::before{background:var(--green)}.stat.red::before{background:var(--red)}.stat.amber::before{background:var(--amber)}
.stat .lbl{font-size:13px;color:var(--muted);font-weight:500}
.stat .val{font-size:29px;font-weight:700;margin-top:8px;line-height:1;letter-spacing:-.02em;color:var(--ink)}
.stat .val .cur{font-size:14px;font-weight:600;color:var(--muted);margin-inline-start:4px}
.stat .sub{font-size:12px;color:var(--muted);margin-top:8px}

.sec-head{display:flex;align-items:center;justify-content:space-between;margin:24px 0 14px;gap:12px;flex-wrap:wrap}
.sec-head h2{font-size:19px;font-weight:700;letter-spacing:-.01em}
.sec-head .count{font-size:13px;color:var(--muted)}

/* Panels / rows / tables */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);overflow:hidden}
.row{display:grid;grid-template-columns:1.4fr 1fr .8fr .9fr auto;gap:14px;align-items:center;padding:15px 20px;border-bottom:1px solid var(--line-2);transition:background .15s}
.row:last-child{border-bottom:none}.row:hover{background:var(--surface-2)}
.row .who{font-weight:600;font-size:15px}
.row .who small{display:block;font-weight:400;color:var(--muted);font-size:12.5px;margin-top:1px}
.chip{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;font-weight:600;padding:4px 11px;border-radius:20px;white-space:nowrap;background:var(--surface-2);color:var(--ink-2);border:1px solid var(--line)}
.pay{font-size:12.5px;font-weight:600;padding:4px 11px;border-radius:20px;white-space:nowrap;display:inline-block}
.pay.paid{background:var(--green-bg);color:var(--green)}.pay.unpaid{background:var(--red-bg);color:var(--red)}.pay.partial{background:var(--amber-bg);color:var(--amber)}
.pay-accept{background:linear-gradient(180deg,var(--accent),var(--accent-2));color:#fff;border:none;border-radius:8px;padding:6px 14px;font-family:inherit;font-size:12.5px;font-weight:600;cursor:pointer;white-space:nowrap;box-shadow:0 3px 10px var(--accent-shadow)}
.pay-accept:hover{filter:brightness(1.06)}
.amt{font-weight:700;font-size:16px;letter-spacing:-.01em}
.amt small{font-size:11px;color:var(--muted);font-weight:500}
.acts{display:flex;gap:6px;justify-content:flex-end}
.icon-btn{width:32px;height:32px;border-radius:8px;border:1px solid var(--line);background:var(--surface);cursor:pointer;color:var(--muted);font-size:14px;display:grid;place-items:center;transition:.15s;text-decoration:none}
.icon-btn:hover{color:var(--accent);border-color:var(--accent)}
.icon-btn.del:hover{color:var(--red);border-color:var(--red)}
.due{font-size:12.5px;color:var(--muted)}.due b{color:var(--ink);font-weight:600}
.due.soon b{color:var(--red)}.due.today b{color:var(--amber)}

.filters{display:flex;gap:10px;margin-bottom:14px;flex-wrap:wrap;align-items:center}
.filters input,.filters select{font-family:inherit;font-size:14px;padding:10px 13px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
.filters input{flex:1;min-width:180px}
.filters input:focus,.filters select:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}

.empty{text-align:center;padding:56px 20px;color:var(--muted)}
.empty .big{font-size:20px;font-weight:700;color:var(--ink-2);margin-bottom:6px}

.task{display:grid;grid-template-columns:auto 1fr auto;gap:14px;align-items:center;padding:15px 20px;border-bottom:1px solid var(--line-2)}
.task:last-child{border-bottom:none}
.task .cal{width:48px;height:54px;border-radius:10px;border:1px solid var(--line);overflow:hidden;text-align:center;flex:none}
.task .cal .m{background:var(--navy-2);color:#fff;font-size:11px;padding:3px 0;font-weight:600}
.task .cal .d{font-size:22px;font-weight:700;padding:5px 0}
.task .tt{font-weight:600}.task .tt small{display:block;color:var(--muted);font-weight:400;font-size:13px;margin-top:1px}
.check{width:34px;height:34px;border-radius:50%;border:1.5px solid var(--line);background:var(--surface);cursor:pointer;color:transparent;display:grid;place-items:center;transition:.15s;font-size:15px}
.check:hover{border-color:var(--green);color:var(--green)}

/* ===== Segmented / chat / client-file / sessions ===== */
.chat-wrap{display:grid;grid-template-columns:300px 1fr;gap:16px;align-items:stretch;min-height:520px}
.chat-groups{padding:8px;overflow:auto;max-height:70vh}
.chat-g{padding:12px 14px;border-radius:10px;cursor:pointer;border:1px solid transparent;transition:.12s}
.chat-g:hover{background:var(--surface-2)}
.chat-g.active{background:var(--accent-soft);border-color:var(--accent)}
.chat-g-name{font-weight:600;font-size:14.5px;color:var(--ink)}
.chat-g-sub{font-size:12px;color:var(--muted);margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-conv{display:flex;flex-direction:column;max-height:70vh}
.chat-conv-head{padding:14px 18px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:10px}
.chat-messages{flex:1;overflow:auto;padding:16px 18px;display:flex;flex-direction:column;gap:8px;background:var(--surface-2)}
.msg{display:flex}
.msg.mine{justify-content:flex-start}
.msg:not(.mine){justify-content:flex-end}
.msg-b{max-width:76%;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:9px 13px;font-size:14px;line-height:1.7;position:relative;white-space:pre-wrap;word-break:break-word;box-shadow:0 1px 2px rgba(20,30,50,.04)}
.msg.mine .msg-b{background:var(--accent-soft);border-color:var(--line)}
.msg-who{display:block;font-size:11.5px;font-weight:700;color:var(--accent-2);margin-bottom:2px}
.msg-t{font-size:10.5px;color:var(--muted);margin-right:8px;float:left;margin-top:4px}
.chat-composer{display:flex;gap:8px;padding:12px 14px;border-top:1px solid var(--line)}
.chat-composer input{flex:1;font-family:inherit;font-size:14.5px;padding:11px 13px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
.chat-composer input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.chat-composer .btn-primary{padding:10px 20px}

.cf-clickable{cursor:pointer}
.cf-clickable:hover{background:var(--accent-soft)}
.cf-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:18px}
.cf-stat{background:var(--surface-2);border:1px solid var(--line);border-radius:11px;padding:11px 13px;display:flex;flex-direction:column;gap:3px}
.cf-stat span{font-size:12px;color:var(--muted)}
.cf-stat b{font-size:15px;color:var(--ink)}
.cf-stat.green b{color:var(--green)} .cf-stat.red b{color:var(--red)}
.cf-sec{margin-bottom:18px}
.cf-h{font-size:14px;font-weight:700;color:var(--ink-2);padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
.cf-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:9px 4px;border-bottom:1px dashed var(--line);font-size:13.5px}
.cf-row:last-child{border-bottom:none}
.cf-row span{color:var(--ink)}
.cf-row small{color:var(--muted);white-space:nowrap;display:flex;align-items:center;gap:6px}
.cf-row a{color:var(--accent-2);text-decoration:none;font-weight:600}
.cf-row a:hover{text-decoration:underline}
.cf-empty{font-size:13px;color:var(--muted);padding:8px 4px}
.cf-upload{font-size:12.5px;font-weight:600;color:var(--accent-2);cursor:pointer;border:1px solid var(--line);border-radius:8px;padding:8px 14px;background:var(--surface);white-space:nowrap}
.cf-upload:hover{background:var(--accent-soft);border-color:var(--accent)}
.cf-cnt{font-size:11px;color:var(--muted);font-weight:700}
.pws-tab.active .cf-cnt{color:var(--accent-2)}
.cf-upload-row{display:flex;gap:10px;align-items:center;margin-bottom:14px;flex-wrap:wrap}
.cf-upload-row #cf-case{flex:1;min-width:170px;font-family:inherit;font-size:14px;padding:9px 12px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
/* ===== صف ملف/مستند موحّد (عميل/مشروع/موظف/اجتماع) ===== */
.file-row{display:flex;align-items:center;gap:10px;padding:9px 12px;border:1px solid var(--line-2);border-radius:10px;background:var(--surface-2);margin-bottom:8px;font-size:13.5px}
.file-row:last-child{margin-bottom:0}
.file-name{flex:1;min-width:0;color:var(--accent-2);text-decoration:none;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.file-name:hover{text-decoration:underline}
.file-meta{color:var(--muted);font-size:12px;white-space:nowrap}

/* ===== Modal ===== */
.overlay{position:fixed;inset:0;background:rgba(17,26,44,.55);display:none;z-index:90;align-items:center;justify-content:center;padding:24px 16px;overflow:auto}
.overlay.show{display:flex}
/* النافذة: ارتفاع محدود + تمرير داخلي حتى لا تفيض أو تتداخل عند طولها */
.modal{background:var(--surface);width:100%;max-width:560px;max-height:92vh;display:flex;flex-direction:column;overflow:hidden;
  border-radius:18px;box-shadow:var(--shadow-lg);border:1px solid var(--line);animation:pop .22s ease}
@keyframes pop{from{opacity:0;transform:translateY(12px) scale(.98)}to{opacity:1;transform:none}}
.modal-head{flex:none;padding:20px 26px 14px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;gap:12px}
.modal-head h3{font-size:19px;font-weight:700;line-height:1.4}
.modal-body{padding:20px 26px;overflow:auto;flex:1 1 auto}
.modal-foot{flex:none}
.field{margin-bottom:16px}
.field label{display:block;font-size:13.5px;font-weight:600;margin-bottom:6px;color:var(--ink-2)}
.field input,.field select,.field textarea{width:100%;font-family:inherit;font-size:14.5px;padding:11px 13px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
.field textarea{resize:vertical;min-height:64px}
.field input:focus,.field select:focus,.field textarea:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.hint{font-size:12px;color:var(--muted);margin-top:5px}
.col-hours small{font-size:12px;color:var(--ink-2);white-space:nowrap}
.days-pick{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.days-pick label{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:500;color:var(--ink-2);padding:8px 10px;border:1px solid var(--line);border-radius:9px;background:var(--surface);cursor:pointer;user-select:none}
.days-pick input{width:auto;margin:0;accent-color:var(--accent)}
.days-pick label:has(input:checked){border-color:var(--accent);background:var(--accent-soft);color:var(--ink)}
.modal-foot{padding:16px 26px 24px;display:flex;gap:10px}
.btn-primary{background:linear-gradient(180deg,var(--accent),var(--accent-2));color:#fff;border:none;border-radius:10px;padding:12px 26px;font-family:inherit;font-size:15px;font-weight:600;cursor:pointer;box-shadow:0 4px 14px var(--accent-shadow);transition:filter .15s,box-shadow .15s,transform .1s}
.btn-primary:hover{filter:brightness(1.06);box-shadow:0 6px 18px var(--accent-shadow)}
.btn-ghost{background:var(--surface);border:1px solid var(--line);color:var(--ink-2);border-radius:10px;padding:12px 22px;font-family:inherit;font-size:15px;font-weight:500;cursor:pointer;transition:.15s}
.btn-ghost:hover{background:var(--surface-2);border-color:var(--accent);color:var(--accent-2)}
/* ===== تلميع عام آمن: ضغط الأزرار + تركيز لوحة المفاتيح + أشرطة تمرير أنيقة ===== */
.btn-primary:active,.btn-ghost:active,.add-btn:active,.icon-btn:active,.s-btn:active{transform:translateY(1px)}
.btn-primary:focus-visible,.btn-ghost:focus-visible,.add-btn:focus-visible,.icon-btn:focus-visible,.tab:focus-visible,.pws-tab:focus-visible,.rep-t:focus-visible,.side-link:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--line);border-radius:8px;border:2px solid transparent;background-clip:padding-box}
::-webkit-scrollbar-thumb:hover{background:var(--muted);background-clip:padding-box}
::-webkit-scrollbar-track{background:transparent}
.dashed-sep{border-top:1px dashed var(--line);padding-top:16px;margin-top:4px}

.toast{position:fixed;bottom:24px;right:24px;background:var(--navy-2);color:#fff;padding:13px 20px;border-radius:12px;font-size:14px;box-shadow:0 10px 30px rgba(0,0,0,.25);opacity:0;transform:translateY(10px);transition:.25s;z-index:100;pointer-events:none}
.toast.show{opacity:1;transform:none}

/* ===== Judicial calendar ===== */
.sub-head{color:var(--muted);font-size:14px;font-weight:600;margin:6px 2px 16px;padding-inline-start:12px;border-inline-start:3px solid var(--accent)}
.cal-toggle{display:inline-flex;align-items:center;gap:10px;cursor:pointer;font-size:13.5px;color:var(--ink-2);user-select:none}
.cal-toggle input{display:none}
.cal-slider{width:44px;height:24px;border-radius:20px;background:#c3ccd9;position:relative;transition:.2s;flex:none}
.cal-slider::before{content:"";position:absolute;width:18px;height:18px;border-radius:50%;background:#fff;top:3px;right:3px;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.3)}
.cal-toggle input:checked + .cal-slider{background:var(--accent)}
.cal-toggle input:checked + .cal-slider::before{transform:translateX(-20px)}
.s-card{position:relative;display:flex;gap:16px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:18px;margin-bottom:14px;align-items:flex-start}
.s-acts{position:absolute;top:10px;inset-inline-start:12px;display:flex;gap:5px}
.s-card.s-past{opacity:.72}
.s-card.s-past .s-badge{filter:grayscale(.4)}
.s-badge{flex:none;width:88px;border:1px solid var(--line);border-radius:14px;text-align:center;padding:12px 6px 10px;background:var(--surface-2);position:relative}
.s-badge::before{content:"";position:absolute;top:-1px;left:24px;right:24px;height:4px;background:var(--accent);border-radius:0 0 5px 5px}
.s-badge .d{font-size:31px;font-weight:700;line-height:1;color:var(--ink);letter-spacing:-.02em}
.s-badge .mn{font-size:13px;color:var(--ink);margin-top:5px;font-weight:600}
.s-badge .yr{font-size:12px;color:var(--muted);margin-top:3px}
.s-body{flex:1;text-align:right;min-width:0}
.s-case{font-weight:700;font-size:15.5px;color:var(--ink)}
.s-type{color:var(--muted);font-size:14px;margin:5px 0 8px}
.s-meta{font-size:13.5px;color:var(--ink-2);margin-top:3px;display:flex;gap:7px;align-items:center;justify-content:flex-end;direction:rtl}
.s-meta.sub{font-size:12px;color:var(--muted);margin-top:1px}
/* ===== حقول التاريخ الهجري/الميلادي ===== */
.hijri-hint{font-size:12px;color:var(--muted);margin-top:5px;line-height:1.6}
.hijri-hint b{color:var(--accent-2);font-weight:700}
.hijri-hint .hj-enter{color:var(--accent-2);cursor:pointer;font-weight:600;text-decoration:underline}
.hj-entry{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:4px}
.hj-entry select{padding:6px 8px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font:inherit;font-size:13px}
.hj-entry .btn-ghost{padding:5px 12px;font-size:12.5px}
.tk-date+.hijri-hint{font-size:11px}
.s-parties{font-size:13px;color:var(--muted);margin-top:8px;line-height:1.7}
.s-parties span{color:var(--accent);font-weight:700;margin:0 4px}
.s-btn{display:block;text-align:center;margin-top:14px;background:linear-gradient(180deg,var(--accent),var(--accent-2));color:#fff;text-decoration:none;padding:12px;border-radius:12px;font-weight:600;font-size:14.5px;transition:.15s}
.s-btn:hover{filter:brightness(1.06)}

/* ===== Login ===== */
.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px;
  background:radial-gradient(1000px 600px at 80% -10%,rgba(63,116,184,.14),transparent 60%),
  linear-gradient(180deg,#0f1725,#1b2740)}
.login-card{background:var(--surface);border:1px solid var(--line);border-radius:22px;box-shadow:var(--shadow-lg);padding:42px 40px;width:100%;max-width:400px;text-align:center}
.login-logo{width:112px;height:112px;border-radius:18px;object-fit:contain;background:#fff;padding:10px;margin:0 auto 18px;display:block;box-shadow:inset 0 0 0 1px var(--line),var(--shadow)}
.login-card h1{font-size:22px;font-weight:700;margin-bottom:4px;line-height:1.4;color:var(--ink)}
.login-card p{color:var(--muted);font-size:13.5px;margin-bottom:26px}
.login-card .field{text-align:right}
.login-card .btn-primary{width:100%;margin-top:6px}
.login-err{color:var(--red);font-size:13.5px;margin-top:14px;min-height:18px}

/* ===== Responsive ===== */
@media(max-width:900px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;top:0;bottom:0;right:0;left:auto;width:min(84vw,290px);height:100vh;
    transform:translateX(100%);transition:transform .24s ease;box-shadow:var(--shadow-lg);z-index:82}
  .sidebar.open{transform:translateX(0)}
  .side-close{display:grid;place-items:center}
  .side-backdrop{display:block;position:fixed;inset:0;background:rgba(15,23,37,.5);z-index:78;opacity:0;pointer-events:none;transition:opacity .24s}
  .sidebar.open ~ .side-backdrop{opacity:1;pointer-events:auto}
  .side-toggle{display:grid;place-items:center}
  .topbar{position:sticky;padding:11px 16px;gap:10px}
  .greet{font-size:13px}
  .add-btn{padding:10px 16px;font-size:14px}
  .content{padding:20px 16px 72px}
  .banner{margin:16px 16px 0}
}
@media(max-width:760px){
  .stats{grid-template-columns:1fr 1fr}
  .row{grid-template-columns:1fr auto;row-gap:8px}
  .row .col-type,.row .col-pay,.row .col-hours{grid-column:1}
  .row .acts{grid-column:2;grid-row:1}
  .grid2{grid-template-columns:1fr}
  .chat-wrap{grid-template-columns:1fr}.chat-groups{max-height:none}
  .cf-stats{grid-template-columns:1fr 1fr}
  .s-badge{width:72px}.s-badge .d{font-size:26px}
  .login-logo{width:96px;height:96px}
}

/* ===== العقود ===== */
.ct-card{display:flex;align-items:flex-start;gap:12px;padding:14px 16px;border:1px solid var(--line-2);border-radius:12px;background:var(--surface-2);margin-bottom:10px}
.ct-card:last-child{margin-bottom:0}
.ct-main{flex:1;min-width:0}
.ct-title{font-size:15px;font-weight:700;color:var(--ink);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ct-status{font-size:11.5px;font-weight:700;padding:2px 10px;border-radius:20px}
.ct-meta{display:flex;flex-wrap:wrap;gap:6px 14px;margin-top:6px;font-size:12.5px;color:var(--muted)}
.ct-notes{margin-top:6px;font-size:12.5px;color:var(--ink-2);line-height:1.6}
.ct-badge{display:inline-block;margin-top:9px;font-size:12px;font-weight:700;padding:3px 11px;border-radius:20px}
.ct-badge.ct-ok{background:color-mix(in srgb,var(--green) 15%,transparent);color:var(--green)}
.ct-badge.ct-soon{background:color-mix(in srgb,var(--amber) 18%,transparent);color:var(--amber)}
.ct-badge.ct-exp{background:color-mix(in srgb,var(--red) 15%,transparent);color:var(--red)}
.ct-acts{display:flex;gap:4px;flex-shrink:0}
@media(max-width:640px){.ct-card{flex-direction:column}.ct-acts{align-self:flex-end}}

/* ===== النشر العام: محرّر المقال ===== */
.pub-toolbar{display:flex;gap:4px;flex-wrap:wrap;padding:6px;background:var(--surface-2);border:1px solid var(--line);border-bottom:none;border-radius:10px 10px 0 0}
.pub-toolbar button{min-width:34px;height:30px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink);cursor:pointer;font-size:13px}
.pub-toolbar button:hover{background:var(--accent,#0e7c86);color:#fff}
.pub-editor{min-height:260px;max-height:50vh;overflow-y:auto;padding:14px 16px;border:1px solid var(--line);border-radius:0 0 10px 10px;background:var(--surface);color:var(--ink);line-height:2;font-size:14.5px}
.pub-editor:focus{outline:2px solid var(--accent,#0e7c86);outline-offset:-1px}
.pub-editor h2,.pub-editor h3{color:var(--accent,#0e7c86)}
.pub-editor blockquote{background:var(--surface-2);border-inline-start:3px solid var(--accent,#0e7c86);margin:8px 0;padding:8px 14px;border-radius:8px}

/* ===== لوحة مظهر الموقع ===== */
.th-wrap{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start}
@media(max-width:1000px){.th-wrap{grid-template-columns:1fr}}
.th-controls{display:flex;flex-direction:column;gap:14px}
.th-card{background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:16px 18px;box-shadow:var(--shadow)}
.th-card h3{font-size:14.5px;font-weight:700;color:var(--ink);margin-bottom:12px}
.th-color{display:flex;align-items:center;gap:12px;padding:8px 0;border-bottom:1px solid var(--line-2)}
.th-color:last-child{border-bottom:none}
.th-color input[type=color]{width:42px;height:42px;border:1px solid var(--line);border-radius:10px;background:none;cursor:pointer;padding:2px;flex:none}
.th-color-txt{flex:1;min-width:0}
.th-color-txt b{display:block;font-size:13.5px;color:var(--ink)}
.th-color-txt small{font-size:11.5px;color:var(--muted)}
.th-hex{width:92px;flex:none;text-align:center;font-family:ui-monospace,monospace;font-size:12.5px;text-transform:uppercase;
  border:1px solid var(--line);border-radius:8px;padding:7px 4px;background:var(--surface-2);color:var(--ink)}
.th-presets{margin-top:12px;padding-top:12px;border-top:1px solid var(--line-2);display:flex;flex-wrap:wrap;gap:7px}
.th-preset{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--line);background:var(--surface-2);color:var(--ink);
  border-radius:20px;padding:6px 12px;font-size:12.5px;font-weight:600;cursor:pointer;font-family:inherit}
.th-preset:hover{border-color:var(--accent);transform:translateY(-1px)}
.th-preset i{width:12px;height:12px;border-radius:50%;display:inline-block}
.th-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;background:var(--surface);border:1px solid var(--line);
  border-radius:14px;padding:14px 16px;position:sticky;bottom:12px;box-shadow:var(--shadow-lg)}
/* المعاينة */
.th-preview-wrap{position:sticky;top:14px;border:1px solid var(--line);border-radius:14px;overflow:hidden;background:var(--surface);box-shadow:var(--shadow)}
.th-preview-bar{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;background:var(--surface-2);
  border-bottom:1px solid var(--line);font-size:12.5px;font-weight:700;color:var(--ink)}
.th-preview-bar small{font-weight:400;color:var(--muted);font-size:11px}
.th-preview{--th-scale:1;font-family:var(--font-body,'Cairo',sans-serif)}
.thp-hero{background:linear-gradient(135deg,var(--primary-color) 0%,var(--primary-dark) 100%);padding:26px 20px;display:flex;gap:18px;align-items:center}
.thp-photo{width:96px;height:96px;flex:none;border-radius:50%;border:4px solid var(--accent-color);overflow:hidden}
.thp-photo img{width:100%;height:100%;object-fit:cover;display:block}
.thp-text{flex:1;min-width:0;text-align:right;color:#fff}
.thp-text h1{font-size:calc(19px * var(--th-scale));font-weight:900;line-height:1.3;color:#fff;margin:0 0 5px}
.thp-sub{font-size:calc(13px * var(--th-scale));color:var(--accent-color);font-weight:600;margin:0 0 5px}
.thp-desc{font-size:calc(11.5px * var(--th-scale));color:#E0E0E0;line-height:1.7;margin:0 0 10px}
.thp-cta{display:inline-block;background:var(--accent-color);color:var(--primary-color);padding:7px 18px;border-radius:8px;
  font-weight:700;font-size:calc(12px * var(--th-scale))}
.thp-body{background:var(--bg-light);padding:18px 20px}
.thp-card{background:#fff;border-radius:10px;padding:14px 16px;box-shadow:0 2px 8px rgba(0,0,0,.06)}
.thp-card b{display:block;color:var(--primary-color);font-size:calc(14px * var(--th-scale));margin-bottom:5px}
.thp-card p{color:var(--text-body);font-size:calc(12px * var(--th-scale));line-height:1.8;margin:0}

/* ===== محرّر النصوص (شبيه بالوورد) ===== */
.rte{border:1px solid var(--line);border-radius:10px;overflow:hidden;background:var(--surface)}
.rte-bar{display:flex;flex-wrap:wrap;gap:3px;align-items:center;padding:5px 6px;background:var(--surface-2);border-bottom:1px solid var(--line)}
.rte-bar button{min-width:29px;height:27px;border:1px solid transparent;border-radius:6px;background:transparent;color:var(--ink);
  cursor:pointer;font-size:12.5px;font-family:inherit;line-height:1}
.rte-bar button:hover{background:var(--accent,#0e7c86);color:#fff}
.rte-bar select{height:27px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);
  font-size:11.5px;font-family:inherit;padding:0 4px;margin:0}
.rte-sep{width:1px;height:16px;background:var(--line);margin:0 2px}
.rte-color{display:inline-flex;align-items:center;cursor:pointer;font-size:13px;position:relative;width:27px;height:27px;justify-content:center;border-radius:6px}
.rte-color:hover{background:var(--line-2)}
.rte-color input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.rte-box{min-height:62px;max-height:180px;overflow-y:auto;padding:9px 11px;font-size:13.5px;line-height:1.9;color:var(--ink);outline:none}
.rte-box:focus{box-shadow:inset 0 0 0 2px var(--accent,#0e7c86)}
.rte-box:empty::before{content:attr(data-ph);color:var(--muted);pointer-events:none}
/* صفوف الحقول */
.th-row{display:flex;gap:7px;margin-bottom:8px}
.th-row input{flex:1;min-width:0;border:1px solid var(--line);border-radius:8px;padding:8px 10px;font-size:13px;
  background:var(--surface-2);color:var(--ink);font-family:inherit}
.th-row .th-ico{width:52px;flex:none;text-align:center;font-size:16px}
.th-row .th-num{width:82px;flex:none;text-align:center;font-family:ui-monospace,monospace}
.th-card-edit{border:1px solid var(--line-2);border-radius:10px;padding:10px;margin-bottom:10px;background:var(--surface-2)}
/* المعاينة الموسّعة */
.th-preview{max-height:76vh;overflow-y:auto}
.thp-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;background:#fff;padding:12px 10px}
.thp-stat{text-align:center}
.thp-stat span{font-size:16px;display:block}
.thp-stat b{display:block;font-size:calc(15px * var(--th-scale));font-weight:900;color:var(--accent-color);line-height:1.3}
.thp-stat small{font-size:calc(9px * var(--th-scale));color:var(--text-light,#666)}
.thp-sec-title{display:block;text-align:center;color:var(--primary-color);font-size:calc(15px * var(--th-scale));font-weight:800;margin-bottom:3px}
.thp-sec-sub{text-align:center;color:var(--text-light,#666);font-size:calc(10.5px * var(--th-scale));margin:0 0 12px}
.thp-svcs{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.thp-svc{background:#fff;border-radius:8px;padding:10px 8px;text-align:center;box-shadow:0 2px 8px rgba(0,0,0,.06)}
.thp-svc span{font-size:17px;display:block;margin-bottom:3px}
.thp-svc b{display:block;color:var(--primary-color);font-size:calc(10.5px * var(--th-scale));margin-bottom:3px}
.thp-svc p{color:var(--text-body);font-size:calc(8.5px * var(--th-scale));line-height:1.6;margin:0}
.thp-about-wrap{background:var(--bg-light);padding:16px 20px;text-align:right}
.thp-about-wrap .thp-sec-title{text-align:right}
.thp-about p{color:var(--text-body);font-size:calc(10.5px * var(--th-scale));line-height:1.9;margin:0 0 6px}
.thp-cta2{display:inline-block;background:var(--accent-color);color:var(--primary-color);padding:5px 14px;border-radius:6px;
  font-weight:700;font-size:calc(10px * var(--th-scale));margin-top:6px}
.thp-ctasec{background:linear-gradient(135deg,var(--primary-color),var(--primary-dark));padding:18px;text-align:center}
.thp-ctasec b{display:block;color:#fff;font-size:calc(13px * var(--th-scale));margin-bottom:4px}
.thp-ctasec p{color:#E0E0E0;font-size:calc(10px * var(--th-scale));margin:0 0 8px}

/* ===== صور المظهر ===== */
.th-img-row{display:flex;flex-direction:column;gap:12px}
.th-img-box{display:flex;gap:12px;align-items:flex-start;padding:10px;border:1px solid var(--line-2);border-radius:10px;background:var(--surface-2)}
.th-img-box img{width:86px;height:86px;flex:none;object-fit:contain;border-radius:10px;border:1px solid var(--line);background:#fff}
.th-img-side{flex:1;min-width:0;display:flex;flex-direction:column;gap:5px}
.th-img-side b{font-size:13.5px;color:var(--ink)}
.th-img-side small{font-size:11.5px;color:var(--muted);line-height:1.6}
.th-img-side input[type=file]{font-size:11.5px;color:var(--ink);max-width:100%}
.th-crop-lbl{display:block;font-size:12px;color:var(--ink);margin-top:4px}
.th-crop-lbl input[type=range]{width:100%;margin:4px 0 0}
.th-crop-hint{display:block;font-size:10.5px;color:var(--muted)}

/* ===== ترتيب الأقسام ===== */
.th-sec-row{display:flex;align-items:center;gap:8px;padding:9px 10px;border:1px solid var(--line-2);border-radius:9px;
  background:var(--surface-2);margin-bottom:7px;transition:.15s}
.th-sec-row.off{opacity:.5}
.th-sec-row.off .th-sec-name{text-decoration:line-through}
.th-sec-grip{width:24px;height:24px;flex:none;display:grid;place-items:center;border-radius:6px;background:var(--accent,#0e7c86);
  color:#fff;font-size:11.5px;font-weight:700}
.th-sec-name{flex:1;min-width:0;font-size:13.5px;font-weight:600;color:var(--ink)}
.th-sec-btn{width:29px;height:27px;flex:none;border:1px solid var(--line);border-radius:7px;background:var(--surface);
  color:var(--ink);cursor:pointer;font-size:11.5px;font-family:inherit}
.th-sec-btn:hover:not(:disabled){background:var(--accent,#0e7c86);color:#fff}
.th-sec-btn:disabled{opacity:.3;cursor:not-allowed}
.th-sec-btn.eye.on{border-color:var(--green,#13b57e)}
.thp-test{background:#fff;padding:14px;text-align:center;color:var(--text-light,#666);font-size:calc(10.5px * var(--th-scale))}
.thp-test span{color:var(--accent-color);font-size:16px;display:block}
