/* =====================================================================
   نظام إدارة الشركة — الهوية البصرية
   لوحة فاتحة + Sidebar بنفسجي كحلي + لون أساسي Indigo  |  RTL  |  Responsive
   ===================================================================== */

:root{
  --brand:#4f46e5; --brand-600:#4338ca; --brand-700:#3730a3; --brand-50:#eef2ff; --brand-100:#e0e7ff;
  --sidebar:#16172e; --sidebar-2:#1d1f3d; --sidebar-line:#2a2c50;
  --bg:#f4f5fb; --card:#ffffff; --border:#e7e9f3; --border-2:#eef0f7;
  --ink:#1b1c33; --ink-2:#3a3c57; --muted:#71748f; --muted-2:#9aa0bd;
  --green:#16a34a; --green-bg:#e9f7ef; --amber:#d97706; --amber-bg:#fdf3e7;
  --red:#dc2626; --red-bg:#fdecec; --blue:#2563eb; --blue-bg:#e8f0fe;
  --shadow:0 1px 2px rgba(20,22,50,.04), 0 4px 16px rgba(20,22,50,.05);
  --shadow-lg:0 8px 30px rgba(20,22,50,.10);
  --radius:14px; --radius-sm:10px;
  --sidebar-w:264px;
}

*{ margin:0; padding:0; box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  font-family:'Cairo','Tajawal',system-ui,sans-serif;
  background:var(--bg); color:var(--ink); direction:rtl;
  font-size:14.5px; line-height:1.6; -webkit-font-smoothing:antialiased;
}
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; cursor:pointer; }
::selection{ background:var(--brand-100); }

/* ===== Layout shell ===== */
.layout{ display:flex; min-height:100vh; }

/* ===== Sidebar ===== */
.sidebar{
  width:var(--sidebar-w); background:var(--sidebar); color:#c9cbe8;
  position:fixed; inset-block:0; inset-inline-start:0; z-index:50;
  display:flex; flex-direction:column; transition:transform .25s ease;
}
.sidebar__brand{
  display:flex; align-items:center; gap:12px; padding:20px 22px;
  border-bottom:1px solid var(--sidebar-line);
}
.sidebar__logo{
  width:40px; height:40px; border-radius:11px; flex:none;
  background:linear-gradient(135deg,var(--brand),#7c3aed);
  display:grid; place-items:center; color:#fff; font-weight:800; font-size:18px;
  box-shadow:0 6px 18px rgba(79,70,229,.45);
}
.sidebar__title{ font-weight:700; font-size:15px; color:#fff; line-height:1.35; }
.sidebar__title small{ display:block; font-weight:500; font-size:11.5px; color:#8c8fc4; }

.nav{ padding:14px 12px; overflow-y:auto; flex:1; }
.nav__group{ font-size:11px; font-weight:700; color:#6b6e9e; letter-spacing:.4px;
  padding:14px 12px 8px; text-transform:uppercase; }
.nav__item{
  display:flex; align-items:center; gap:12px; padding:11px 13px; border-radius:11px;
  color:#b9bce0; font-weight:600; font-size:13.5px; margin-bottom:2px;
  transition:background .15s, color .15s; position:relative;
}
.nav__item svg{ width:19px; height:19px; flex:none; stroke-width:1.9; }
.nav__item:hover{ background:var(--sidebar-2); color:#fff; }
.nav__item.active{ background:linear-gradient(100deg,rgba(79,70,229,.22),rgba(124,58,237,.10)); color:#fff; }
.nav__item.active::before{
  content:""; position:absolute; inset-inline-start:-12px; top:50%; transform:translateY(-50%);
  width:4px; height:22px; border-radius:0 4px 4px 0; background:var(--brand);
}
.nav__item.active svg{ color:#a5b4fc; }

/* ===== Main ===== */
.main{ flex:1; margin-inline-start:var(--sidebar-w); min-width:0; display:flex; flex-direction:column; }

.topbar{
  height:66px; background:var(--card); border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:16px; padding:0 24px; position:sticky; top:0; z-index:40;
}
.topbar__menu{ display:none; background:none; border:none; color:var(--ink-2); padding:6px; }
.topbar__menu svg{ width:24px; height:24px; }
.search{
  flex:1; max-width:420px; display:flex; align-items:center; gap:10px;
  background:var(--bg); border:1px solid var(--border); border-radius:11px; padding:9px 14px;
}
.search svg{ width:18px; height:18px; color:var(--muted-2); flex:none; }
.search input{ border:none; background:none; outline:none; width:100%; font-family:inherit;
  font-size:13.5px; color:var(--ink); }
.search input::placeholder{ color:var(--muted-2); }
.topbar__spacer{ flex:1; }
.topbar__actions{ display:flex; align-items:center; gap:8px; }
.icon-btn{
  width:42px; height:42px; border-radius:11px; border:1px solid var(--border); background:var(--card);
  display:grid; place-items:center; color:var(--ink-2); position:relative;
}
.icon-btn:hover{ background:var(--bg); }
.icon-btn svg{ width:20px; height:20px; }
.icon-btn .dot{ position:absolute; top:9px; inset-inline-end:10px; width:8px; height:8px;
  background:var(--red); border-radius:50%; border:2px solid var(--card); }
.icon-btn .badge-count{ position:absolute; top:5px; inset-inline-end:5px; min-width:17px; height:17px;
  padding:0 4px; background:var(--red); color:#fff; border-radius:9px; font-size:10px; font-weight:800;
  display:grid; place-items:center; border:2px solid var(--card); line-height:1; }
.user-chip{ display:flex; align-items:center; gap:10px; padding:5px 6px 5px 12px; border-radius:11px;
  border:1px solid var(--border); }
.user-chip:hover{ background:var(--bg); }
.avatar{ width:34px; height:34px; border-radius:9px; background:linear-gradient(135deg,var(--brand),#7c3aed);
  color:#fff; display:grid; place-items:center; font-weight:700; font-size:14px; flex:none; }
.user-chip__name{ font-size:13px; font-weight:700; line-height:1.2; }
.user-chip__name small{ display:block; font-weight:500; color:var(--muted); font-size:11px; }

.content{ padding:26px 24px; flex:1; }

/* ===== Page header ===== */
.page-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:22px; flex-wrap:wrap; }
.page-head h1{ font-size:21px; font-weight:800; color:var(--ink); }
.page-head p{ color:var(--muted); font-size:13px; margin-top:3px; }

/* ===== Buttons ===== */
.btn{ display:inline-flex; align-items:center; gap:8px; padding:10px 18px; border-radius:11px;
  font-weight:700; font-size:13.5px; border:1px solid transparent; transition:.15s; }
.btn svg{ width:17px; height:17px; }
.btn--primary{ background:var(--brand); color:#fff; box-shadow:0 6px 16px rgba(79,70,229,.28); }
.btn--primary:hover{ background:var(--brand-600); }
.btn--light{ background:var(--card); color:var(--ink-2); border-color:var(--border); }
.btn--light:hover{ background:var(--bg); }

/* ===== Stat cards ===== */
.stats{ display:grid; grid-template-columns:repeat(4,1fr); gap:18px; margin-bottom:24px; }
.stat{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; box-shadow:var(--shadow); display:flex; align-items:center; gap:16px; }
.stat__icon{ width:52px; height:52px; border-radius:13px; display:grid; place-items:center; flex:none; }
.stat__icon svg{ width:24px; height:24px; }
.stat__icon.i-indigo{ background:var(--brand-50); color:var(--brand); }
.stat__icon.i-green{ background:var(--green-bg); color:var(--green); }
.stat__icon.i-amber{ background:var(--amber-bg); color:var(--amber); }
.stat__icon.i-blue{ background:var(--blue-bg); color:var(--blue); }
.stat__num{ font-size:24px; font-weight:800; color:var(--ink); line-height:1.1; }
.stat__label{ color:var(--muted); font-size:12.5px; margin-top:3px; }

/* ===== Card ===== */
.card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); }
.card__head{ padding:18px 20px; border-bottom:1px solid var(--border-2); display:flex;
  align-items:center; justify-content:space-between; gap:12px; }
.card__head h2{ font-size:15.5px; font-weight:700; }
.card__body{ padding:20px; }
.grid-2{ display:grid; grid-template-columns:2fr 1fr; gap:18px; }

/* ===== Table ===== */
.table-wrap{ overflow-x:auto; }
table.data{ width:100%; border-collapse:collapse; font-size:13.5px; }
table.data th{ text-align:right; color:var(--muted); font-weight:700; font-size:12px;
  padding:12px 16px; border-bottom:1px solid var(--border); white-space:nowrap; }
table.data td{ padding:14px 16px; border-bottom:1px solid var(--border-2); color:var(--ink-2); }
table.data tr:last-child td{ border-bottom:none; }
table.data tbody tr:hover{ background:var(--bg); }
table.data tfoot td{ border-top:2px solid var(--border); border-bottom:none; padding:14px 16px; }
table.data tfoot tr:hover{ background:transparent; }

/* ===== Items table (package form) ===== */
.items-table th{ font-size:11px; }
.items-table td{ padding:8px 10px; vertical-align:middle; }
.items-table tbody tr:hover{ background:transparent; }
.items-table input, .items-table select{ width:100%; padding:8px 10px; border:1px solid var(--border);
  border-radius:8px; font-family:inherit; font-size:13px; color:var(--ink); background:var(--card); }
.items-table input:focus, .items-table select:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-50); }
.row-del{ width:28px; height:28px; border:none; background:var(--red-bg); color:var(--red); border-radius:8px;
  font-size:17px; font-weight:700; line-height:1; display:grid; place-items:center; }
.row-del:hover{ background:var(--red); color:#fff; }

/* ===== Invoice totals ===== */
.invoice-totals{ max-width:340px; margin-inline-start:auto; display:flex; flex-direction:column; gap:9px; }
.invoice-totals > div{ display:flex; justify-content:space-between; align-items:center; font-size:13.5px; color:var(--ink-2); }
.invoice-totals strong{ color:var(--ink); font-weight:700; }
.invoice-totals__grand{ border-top:2px solid var(--border); padding-top:11px; margin-top:3px; font-size:15px !important; }
.invoice-totals__grand span{ font-weight:700; color:var(--ink); }
.invoice-totals__grand strong{ color:var(--brand); font-weight:800; }

/* ===== Badges ===== */
.badge{ display:inline-flex; align-items:center; gap:6px; padding:4px 11px; border-radius:20px;
  font-size:11.5px; font-weight:700; }
.badge--green{ background:var(--green-bg); color:var(--green); }
.badge--amber{ background:var(--amber-bg); color:var(--amber); }
.badge--red{ background:var(--red-bg); color:var(--red); }
.badge--blue{ background:var(--blue-bg); color:var(--blue); }

/* ===== Empty / placeholder ===== */
.empty{ text-align:center; padding:60px 24px; }
.empty__icon{ width:84px; height:84px; border-radius:22px; background:var(--brand-50); color:var(--brand);
  display:grid; place-items:center; margin:0 auto 18px; }
.empty__icon svg{ width:40px; height:40px; }
.empty h3{ font-size:18px; font-weight:800; color:var(--ink); margin-bottom:8px; }
.empty p{ color:var(--muted); max-width:420px; margin:0 auto; }

/* ===== Auth (login) ===== */
.auth{ min-height:100vh; display:grid; place-items:center; padding:24px;
  background:radial-gradient(900px circle at 80% -10%, #2a2766 0%, var(--bg) 55%); }
.auth__card{ width:100%; max-width:410px; background:var(--card); border:1px solid var(--border);
  border-radius:20px; box-shadow:var(--shadow-lg); padding:36px 32px; }
.auth__logo{ width:58px; height:58px; border-radius:16px; margin:0 auto 18px;
  background:linear-gradient(135deg,var(--brand),#7c3aed); display:grid; place-items:center;
  color:#fff; font-weight:800; font-size:24px; box-shadow:0 10px 28px rgba(79,70,229,.4); }
.auth h1{ text-align:center; font-size:21px; font-weight:800; margin-bottom:4px; }
.auth__sub{ text-align:center; color:var(--muted); font-size:13px; margin-bottom:26px; }
.field{ margin-bottom:16px; }
.field label{ display:block; font-size:12.5px; font-weight:700; color:var(--ink-2); margin-bottom:7px; }
.field input{ width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:11px;
  font-family:inherit; font-size:14px; color:var(--ink); background:var(--card); transition:.15s; }
.field input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }
.btn-block{ width:100%; justify-content:center; padding:13px; font-size:15px; margin-top:6px; }
.alert{ padding:12px 15px; border-radius:11px; font-size:13px; font-weight:600; margin-bottom:18px; }
.alert--error{ background:var(--red-bg); color:var(--red); }
.alert--success{ background:var(--green-bg); color:var(--green); }

/* ===== Forms ===== */
.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 18px; }
.field select{ width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:11px;
  font-family:inherit; font-size:14px; color:var(--ink); background:var(--card); cursor:pointer; }
.field select:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }
/* ===== مفتاح تبديل حديث (تنشيط/تعطيل) ===== */
.switch{ display:inline-flex; align-items:center; gap:10px; cursor:pointer; font-size:13.5px; font-weight:600; color:var(--ink-2); user-select:none; }
.switch input{ position:absolute; opacity:0; width:0; height:0; }
.switch-track{ position:relative; flex:none; width:44px; height:25px; background:var(--border);
  border-radius:99px; transition:background .2s ease; direction:ltr; }
.switch-thumb{ position:absolute; top:3px; left:3px; width:19px; height:19px; background:#fff;
  border-radius:50%; box-shadow:0 1px 3px rgba(16,17,46,.25); transition:transform .2s ease; }
.switch input:checked + .switch-track{ background:var(--green); }
.switch input:checked + .switch-track .switch-thumb{ transform:translateX(19px); }
.switch input:focus-visible + .switch-track{ box-shadow:0 0 0 4px var(--brand-50); }
.switch--sm .switch-track{ width:38px; height:22px; }
.switch--sm .switch-thumb{ width:16px; height:16px; top:3px; left:3px; }
.switch--sm input:checked + .switch-track .switch-thumb{ transform:translateX(16px); }
.inline-toggle{ display:inline-block; }

/* ===== Table actions ===== */
.act{ font-size:12.5px; font-weight:700; color:var(--brand); padding:5px 9px; border-radius:8px; }
.act:hover{ background:var(--brand-50); }
.act--danger{ color:var(--red); }
.act--danger:hover{ background:var(--red-bg); }
.btn--danger{ background:var(--red); color:#fff; }
.btn--danger:hover{ filter:brightness(.95); }

/* ===== Permissions grid ===== */
.perm-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
.perm{ display:flex; align-items:center; gap:8px; padding:11px 13px; border:1px solid var(--border);
  border-radius:10px; font-size:13px; font-weight:600; cursor:pointer; }
.perm:hover{ background:var(--bg); }
.perm input{ width:17px; height:17px; accent-color:var(--brand); }

/* ===== Textarea ===== */
.field textarea{ width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:11px;
  font-family:inherit; font-size:14px; color:var(--ink); background:var(--card); resize:vertical; line-height:1.7; }
.field textarea:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }

/* إخفاء أسهم حقول الأرقام (تتراكب مع الأرقام في RTL) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button{ -webkit-appearance:none; margin:0; }
input[type=number]{ -moz-appearance:textfield; appearance:textfield; }

/* ===== Head tools (search + button) ===== */
.head-tools{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.searchbar{ display:flex; align-items:center; gap:9px; background:var(--card); border:1px solid var(--border);
  border-radius:11px; padding:9px 13px; min-width:240px; }
.searchbar svg{ width:17px; height:17px; color:var(--muted-2); flex:none; }
.searchbar input{ border:none; background:none; outline:none; width:100%; font-family:inherit; font-size:13.5px; color:var(--ink); }

/* ===== Progress bar ===== */
.bar{ height:7px; background:var(--border); border-radius:6px; overflow:hidden; margin-bottom:5px; }
.bar--lg{ height:10px; margin-bottom:0; }
.bar__fill{ height:100%; background:linear-gradient(90deg,var(--brand),#7c3aed); border-radius:6px; }

/* ===== Project overview ===== */
.proj-overview{ display:grid; grid-template-columns:repeat(4,1fr); gap:18px; }
.proj-overview > div{ display:flex; flex-direction:column; gap:6px; }
.ov-label{ font-size:12px; color:var(--muted); }
.proj-overview strong{ font-size:14px; color:var(--ink); }

/* ===== Member list ===== */
.member-list{ display:flex; flex-direction:column; gap:12px; }
.member{ display:flex; align-items:center; gap:12px; }

/* ===== Filters bar ===== */
.filters{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.filters select{ padding:9px 13px; border:1px solid var(--border); border-radius:11px; font-family:inherit;
  font-size:13px; color:var(--ink); background:var(--card); cursor:pointer; }

/* ===== Add row (subtask/comment/file) ===== */
.add-row{ display:flex; gap:8px; align-items:center; margin-top:14px; flex-wrap:wrap; }
.add-row input[type=text], .add-row input:not([type]), .add-row input[name=title], .add-row input[name=body]{
  flex:1; min-width:120px; padding:10px 13px; border:1px solid var(--border); border-radius:10px;
  font-family:inherit; font-size:13.5px; color:var(--ink); background:var(--card); }
.add-row input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-50); }
.add-row select{ padding:10px 12px; border:1px solid var(--border); border-radius:10px; font-family:inherit;
  font-size:13px; color:var(--ink); background:var(--card); }
.add-row .btn{ padding:10px 16px; }

/* ===== Subtasks ===== */
.subtask-list{ display:flex; flex-direction:column; gap:8px; }
.subtask{ display:flex; align-items:center; gap:11px; padding:10px 12px; border:1px solid var(--border-2);
  border-radius:10px; }
.subtask .check{ width:22px; height:22px; border:2px solid var(--border); border-radius:7px; display:grid;
  place-items:center; color:#fff; font-size:13px; font-weight:800; flex:none; }
.subtask.done .check{ background:var(--green); border-color:var(--green); }
.subtask__txt{ flex:1; }
.subtask__txt span{ font-size:13.5px; font-weight:600; color:var(--ink); }
.subtask.done .subtask__txt span{ text-decoration:line-through; color:var(--muted); }
.subtask__txt small{ display:block; font-size:11px; color:var(--muted); }

/* ===== Comments ===== */
.comment-list{ display:flex; flex-direction:column; gap:14px; margin-bottom:4px; }
.comment{ display:flex; gap:11px; }
.comment__body{ flex:1; background:var(--bg); border-radius:12px; padding:10px 13px; }
.comment__head{ display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:3px; }
.comment__head strong{ font-size:13px; color:var(--ink); }
.comment__head small{ font-size:11px; color:var(--muted-2); }
.comment__body p{ font-size:13px; color:var(--ink-2); line-height:1.7; }

/* ===== Files ===== */
.file-list{ display:flex; flex-direction:column; gap:9px; }
.file{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 12px;
  border:1px solid var(--border-2); border-radius:10px; }
.file__main{ display:flex; align-items:center; gap:11px; flex:1; min-width:0; }
.file__main svg{ width:22px; height:22px; color:var(--brand); flex:none; }
.file__main strong{ font-size:13px; color:var(--ink); display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.file__main small{ font-size:11px; color:var(--muted); }

/* ===== Task links ===== */
.task-links{ display:flex; flex-wrap:wrap; gap:9px; margin-top:18px; }
.tlink{ display:inline-flex; align-items:center; gap:6px; padding:8px 13px; border-radius:10px;
  background:var(--brand-50); color:var(--brand); font-size:12.5px; font-weight:700; }
.tlink:hover{ background:var(--brand-100); }
.tlink--static{ background:var(--bg); color:var(--ink-2); }

/* ===== Status select ===== */
.status-select{ padding:9px 14px; border:1px solid var(--border); border-radius:11px; font-family:inherit;
  font-size:13px; font-weight:700; color:var(--ink); background:var(--card); cursor:pointer; }

/* ===== Notifications list ===== */
.notif-list{ display:flex; flex-direction:column; }
.notif-item{ display:flex; align-items:flex-start; gap:12px; padding:15px 20px; border-bottom:1px solid var(--border-2); }
.notif-item:last-child{ border-bottom:none; }
.notif-item:hover{ background:var(--bg); }
.notif-dot{ width:9px; height:9px; border-radius:50%; background:transparent; margin-top:6px; flex:none; }
.notif-item.unread{ background:var(--brand-50); }
.notif-item.unread .notif-dot{ background:var(--brand); }
.notif-item__txt strong{ display:block; font-size:13.5px; color:var(--ink); }
.notif-item__txt span{ display:block; font-size:12.5px; color:var(--ink-2); margin-top:2px; }
.notif-item__txt small{ display:block; font-size:11px; color:var(--muted-2); margin-top:4px; }

/* ===== Notification bar ===== */
.notif-bar{ display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
  background:linear-gradient(100deg,var(--brand-50),#fff); border:1px solid var(--brand-100);
  border-radius:var(--radius); padding:16px 20px; margin-bottom:22px; }
.notif-bar__txt{ display:flex; align-items:center; gap:14px; }
.notif-bar__txt svg{ width:26px; height:26px; color:var(--brand); flex:none; }
.notif-bar__txt strong{ display:block; font-size:14.5px; color:var(--ink); }
.notif-bar__txt span{ font-size:12.5px; color:var(--muted); }
.notif-bar__actions{ display:flex; gap:9px; flex-wrap:wrap; }
.notif-bar .btn{ padding:9px 15px; font-size:13px; }

/* ===== Mobile ===== */
.backdrop{ display:none; position:fixed; inset:0; background:rgba(15,16,40,.5); z-index:45; }
@media (max-width:1024px){
  .sidebar{ transform:translateX(100%); }
  body.nav-open .sidebar{ transform:translateX(0); }
  body.nav-open .backdrop{ display:block; }
  .main{ margin-inline-start:0; }
  .topbar__menu{ display:grid; place-items:center; }
  .stats{ grid-template-columns:repeat(2,1fr); }
  .grid-2{ grid-template-columns:1fr; }
}
@media (max-width:560px){
  .stats{ grid-template-columns:1fr; }
  .search{ display:none; }
  .user-chip__name{ display:none; }
  .content{ padding:18px 14px; }
  .topbar{ padding:0 14px; }
  .form-grid{ grid-template-columns:1fr; }
  .perm-grid{ grid-template-columns:repeat(2,1fr); }
  .proj-overview{ grid-template-columns:repeat(2,1fr); }
  .searchbar{ min-width:0; flex:1; }
}

.items-label{ display:block; font-size:12.5px; font-weight:700; color:var(--ink-2); margin:14px 0 10px; }

/* ===== حقل الهاتف بمفتاح دولة ===== */
.phone-control{ position:relative; display:flex; gap:8px; align-items:stretch; direction:ltr; }
.phone-cc-btn{ display:flex; align-items:center; gap:6px; padding:0 12px; height:auto;
  border:1px solid var(--border); border-radius:11px; background:var(--card); cursor:pointer;
  font-family:inherit; font-size:14px; color:var(--ink); white-space:nowrap; transition:border-color .15s; }
.phone-cc-btn:hover{ border-color:var(--brand); }
.phone-flag{ font-size:18px; line-height:1; }
.phone-dial{ font-weight:700; font-size:13.5px; color:var(--ink-2); direction:ltr; }
.phone-caret{ font-size:10px; color:var(--muted); }
.phone-num{ flex:1; min-width:0; direction:ltr; text-align:left; }
.phone-menu{ position:absolute; z-index:40; top:calc(100% + 6px); inset-inline-start:0; width:300px; max-width:90vw;
  background:var(--card); border:1px solid var(--border); border-radius:13px; box-shadow:0 16px 40px rgba(16,17,46,.16);
  padding:10px; direction:rtl; }
.phone-search{ width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:9px;
  font-family:inherit; font-size:13.5px; margin-bottom:8px; }
.phone-list{ list-style:none; margin:0; padding:0; max-height:240px; overflow-y:auto; }
.phone-item{ display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:9px; cursor:pointer; }
.phone-item:hover{ background:var(--brand-50); }
.phone-item-name{ flex:1; font-size:13.5px; color:var(--ink); }
.phone-item-dial{ font-size:12.5px; color:var(--muted); font-weight:700; direction:ltr; }
@media (max-width:560px){
  .phone-menu{ width:88vw; inset-inline-start:auto; inset-inline-end:0; }
}

/* ===== صفحة الإعدادات (القوائم المُدارة) ===== */
.settings-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:18px; }
.opt-list{ display:flex; flex-direction:column; gap:8px; margin-bottom:14px; }
.opt-row{ display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:9px 12px; border:1px solid var(--border); border-radius:10px; background:var(--card); }
.opt-row--off{ opacity:.55; }
.opt-label{ font-size:13.5px; font-weight:600; color:var(--ink); }
.opt-actions{ display:flex; align-items:center; gap:10px; }
.opt-del{ width:26px; height:26px; display:grid; place-items:center; border-radius:7px;
  font-size:17px; font-weight:700; color:var(--red); background:var(--red-bg); line-height:1; }
.opt-del:hover{ background:var(--red); color:#fff; }
.opt-add{ display:flex; gap:8px; padding-top:14px; border-top:1px solid var(--border-2); }
.opt-add input{ flex:1; min-width:0; padding:10px 12px; border:1px solid var(--border); border-radius:10px;
  font-family:inherit; font-size:13.5px; }
.opt-add input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }

/* ============================================================
   نظام صفحات التفاصيل (أقسام + فواصل + شبكة معلومات منظمة)
   ============================================================ */
.dsection{ padding:22px 0; border-top:1px solid var(--border-2); }
.dsection:first-child{ padding-top:2px; border-top:none; }
.dsection:last-child{ padding-bottom:2px; }
.dsection__title{ display:flex; align-items:center; gap:8px; font-size:11.5px; font-weight:800;
  letter-spacing:.04em; color:var(--muted); margin-bottom:18px; }
.dsection__title svg{ width:15px; height:15px; opacity:.7; flex:none; }

/* شبكة معلومات (تسمية فوق القيمة) */
.info-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(165px,1fr)); gap:20px 26px; }
.info-item{ display:flex; flex-direction:column; gap:6px; min-width:0; }
.info-item__label{ font-size:11.5px; color:var(--muted); font-weight:600; }
.info-item__value{ font-size:14px; color:var(--ink); font-weight:700; word-break:break-word; }
.info-item__value a{ color:var(--brand); font-weight:600; }
.info-item__value.muted{ color:var(--muted-2); font-weight:600; }
.info-item--full{ grid-column:1 / -1; }

/* كتلة نص (وصف/ملاحظات) */
.desc-text{ font-size:13.5px; line-height:1.9; color:var(--ink-2); white-space:pre-line; }

/* صف التقدم */
.progress-row{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.progress-row span{ font-size:12.5px; color:var(--muted); font-weight:600; }
.progress-row strong{ font-size:16px; color:var(--ink); font-weight:800; }

/* تحسين الـ overview القديم: شبكة مرنة بدل 4 أعمدة ثابتة + مسافات أوسع */
.proj-overview{ grid-template-columns:repeat(auto-fit,minmax(165px,1fr)) !important; gap:20px 26px !important; }
.proj-overview > div{ gap:6px; }
.ov-label{ font-size:11.5px; color:var(--muted); font-weight:600; }
.proj-overview strong{ font-size:14px; color:var(--ink); font-weight:700; }

/* صف معلومة أفقي (تسمية ⟷ قيمة) للبطاقات الجانبية */
.kv-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 0; border-top:1px solid var(--border-2); }
.kv-row:first-child{ border-top:none; padding-top:2px; }
.kv-row__label{ font-size:12.5px; color:var(--muted); font-weight:600; }
.kv-row__value{ font-size:13.5px; color:var(--ink); font-weight:700; text-align:left; word-break:break-word; }
.kv-row__value a{ color:var(--brand); font-weight:600; }

/* ============================================================
   أقسام الفورم (عناوين بارزة + فواصل) — للإضافة والتعديل
   ============================================================ */
.fsection{ padding-top:24px; margin-top:24px; border-top:1px solid var(--border); }
.fsection:first-of-type{ padding-top:0; margin-top:0; border-top:none; }
.fsection__head{ display:flex; align-items:center; gap:9px; font-size:15px; font-weight:800;
  color:var(--ink); margin-bottom:16px; }
.fsection__head svg{ width:18px; height:18px; color:var(--brand); flex:none; }
.fsection__hint{ margin-inline-start:auto; font-size:11.5px; color:var(--muted); font-weight:500; }

/* صفوف قابلة للتكرار (مهام فرعية، روابط...) */
.repeat-row{ display:flex; gap:8px; align-items:center; margin-bottom:10px; }
.repeat-row > input,
.repeat-row > select{ padding:12px 14px; border:1px solid var(--border); border-radius:11px;
  font-family:inherit; font-size:14px; color:var(--ink); background:var(--card); transition:.15s; }
.repeat-row > input{ flex:1; min-width:0; }
.repeat-row > select{ width:185px; flex:none; cursor:pointer; }
.repeat-row > input:focus,
.repeat-row > select:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }
@media (max-width:560px){
  .repeat-row{ flex-wrap:wrap; }
  .repeat-row > select{ width:100%; }
}

/* زر حذف صف + زر صغير */
.row-del{ width:34px; height:34px; flex:none; border:1px solid var(--border); background:var(--card);
  border-radius:9px; color:var(--muted); font-size:19px; line-height:1; cursor:pointer; display:flex;
  align-items:center; justify-content:center; transition:.15s; }
.row-del:hover{ border-color:var(--red); color:var(--red); background:var(--red-bg); }
.btn--sm{ padding:7px 14px; font-size:12.5px; }

/* ============================================================
   فورم بكروت منفصلة (كل قسم في كارت) — أبسط وأوضح
   ============================================================ */
.form-cards{ max-width:860px; }
.form-cards .fsection{
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:20px 22px; margin:0 0 14px; border-top:none;
}
.form-cards .fsection:first-of-type{ padding-top:20px; margin-top:0; }
.form-cards .fsection__head{ padding-bottom:14px; margin-bottom:18px; border-bottom:1px solid var(--border-2); }
.form-actions{ max-width:860px; display:flex; justify-content:flex-start; }

/* ============================================================
   بوابة العميل (صفحة المتابعة — قراءة فقط)
   ============================================================ */
body.portal{ background:var(--bg); }
.portal-top{ background:var(--sidebar); border-bottom:1px solid var(--sidebar-line); }
.portal-top__inner{ max-width:980px; margin:0 auto; padding:18px 22px; display:flex;
  align-items:center; justify-content:space-between; gap:14px; }
.portal-brand{ display:flex; align-items:center; gap:12px; }
.portal-brand__logo{ width:42px; height:42px; border-radius:12px; background:var(--brand);
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; font-size:19px; flex:none; }
.portal-brand strong{ display:block; color:#fff; font-size:15.5px; font-weight:800; }
.portal-brand span{ display:block; color:#9aa0c4; font-size:11.5px; margin-top:1px; }
.portal-badge{ font-size:11.5px; color:#cfd3ee; background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12); padding:6px 12px; border-radius:99px; font-weight:600; }
.portal-main{ max-width:980px; margin:0 auto; padding:26px 22px 50px; }
.portal-hero{ margin-bottom:22px; }
.portal-hero h1{ font-size:24px; font-weight:800; color:var(--ink); }
.portal-hero p{ color:var(--muted); font-size:14px; margin-top:4px; }
.portal-foot{ text-align:center; color:var(--muted-2); font-size:12px; margin-top:30px; }
.portal-stats{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:22px; }
.pstat{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:18px; }
.pstat__num{ font-size:26px; font-weight:800; color:var(--ink); line-height:1; }
.pstat__lbl{ font-size:12px; color:var(--muted); margin-top:8px; font-weight:600; }
.pstat__num.green{ color:var(--green); } .pstat__num.amber{ color:var(--amber); }
@media (max-width:760px){ .portal-stats{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .portal-stats{ grid-template-columns:1fr; } .portal-hero h1{ font-size:20px; } }

/* ============================================================
   النقاط — لوحة الترتيب وسجل الحركات
   ============================================================ */
.rank-list{ display:flex; flex-direction:column; }
.rank{ display:flex; align-items:center; gap:12px; padding:13px 20px; border-top:1px solid var(--border-2);
  text-decoration:none; transition:background .12s; }
.rank:first-child{ border-top:none; }
.rank:hover{ background:var(--brand-50); }
.rank__pos{ width:28px; height:28px; flex:none; border-radius:9px; display:flex; align-items:center;
  justify-content:center; font-weight:800; font-size:13px; background:var(--bg); color:var(--muted); }
.rank__pos--1{ background:#fef3c7; color:#b45309; }
.rank__pos--2{ background:#e5e7eb; color:#4b5563; }
.rank__pos--3{ background:#fde2cf; color:#b45309; }
.rank__info{ flex:1; min-width:0; }
.rank__info strong{ display:block; font-size:13.5px; color:var(--ink); }
.rank__info span{ display:block; font-size:11.5px; color:var(--muted); }
.rank__pts{ font-weight:800; font-size:16px; color:var(--brand); flex:none; }
.rank__pts.neg{ color:var(--red); }
.rank__pts small{ font-size:11px; color:var(--muted); font-weight:600; }

.plog-list{ display:flex; flex-direction:column; }
.plog{ display:flex; align-items:center; gap:12px; padding:12px 20px; border-top:1px solid var(--border-2); }
.plog:first-child{ border-top:none; }
.plog__badge{ flex:none; min-width:46px; text-align:center; padding:5px 9px; border-radius:8px;
  font-weight:800; font-size:13px; }
.plog__badge.pos{ background:var(--green-bg); color:var(--green); }
.plog__badge.neg{ background:var(--red-bg); color:var(--red); }
.plog__info{ flex:1; min-width:0; }
.plog__info strong{ display:block; font-size:13px; color:var(--ink); }
.plog__info span{ display:block; font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.plog__date{ flex:none; font-size:11.5px; color:var(--muted-2); }

/* توزيع نقاط المشروع */
.pts-dist{ margin-top:16px; padding-top:14px; border-top:1px solid var(--border-2); }
.pts-dist summary{ cursor:pointer; font-size:12.5px; font-weight:700; color:var(--brand); list-style:none; }
.pts-dist summary::-webkit-details-marker{ display:none; }
.pts-row{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:8px; }
.pts-row span{ font-size:13px; color:var(--ink-2); }
.pts-row input{ width:90px; flex:none; padding:8px 10px; border:1px solid var(--border); border-radius:9px;
  font-family:inherit; font-size:13px; text-align:center; }
.pts-row input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-50); }

/* ============================================================
   الاعتمادات والمراجعات
   ============================================================ */
.appr-stages{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:20px; }
.appr-stage{ border:1px solid var(--border); border-radius:12px; padding:14px; background:var(--bg);
  display:flex; flex-direction:column; gap:8px; align-items:flex-start; }
.appr-stage--approved{ border-color:var(--green); background:var(--green-bg); }
.appr-stage--rejected{ border-color:var(--red); background:var(--red-bg); }
.appr-stage__name{ font-size:12.5px; font-weight:700; color:var(--ink); }
.appr-stage__by{ font-size:11px; color:var(--muted); }
.appr-stage__note{ font-size:12px; color:var(--ink-2); line-height:1.6; margin-top:2px;
  background:var(--card); padding:7px 9px; border-radius:8px; width:100%; }
.appr-form{ padding-top:18px; border-top:1px solid var(--border-2); }
.appr-history{ margin-top:20px; padding-top:16px; border-top:1px solid var(--border-2); }
.appr-history__title{ font-size:11.5px; font-weight:800; color:var(--muted); margin-bottom:12px; }
.appr-hrow{ display:flex; align-items:center; gap:12px; padding:9px 0; border-top:1px solid var(--border-2); }
.appr-hrow:first-of-type{ border-top:none; }
.appr-hrow__info{ flex:1; min-width:0; }
.appr-hrow__info strong{ display:block; font-size:13px; color:var(--ink); }
.appr-hrow__info span{ display:block; font-size:11.5px; color:var(--muted); }
.appr-hrow small{ flex:none; font-size:11px; color:var(--muted-2); }
@media (max-width:760px){ .appr-stages{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:480px){ .appr-stages{ grid-template-columns:1fr; } }

/* ============================================================
   لوحة التحكم — تنبيه الديدلاين + شريط الحالات + النظرة المالية
   ============================================================ */
.dl-alert{ display:flex; gap:13px; align-items:flex-start; background:var(--red-bg);
  border:1px solid #f7c9c9; border-radius:var(--radius); padding:16px 18px; margin-bottom:18px; }
.dl-alert > svg{ width:22px; height:22px; color:var(--red); flex:none; margin-top:1px; }
.dl-alert__body strong{ display:block; font-size:13.5px; color:#b42318; margin-bottom:6px; }
.dl-alert__list{ display:flex; flex-wrap:wrap; gap:8px; }
.dl-alert__list a{ font-size:12px; color:#b42318; background:#fff; border:1px solid #f3b9b9;
  padding:4px 11px; border-radius:99px; text-decoration:none; font-weight:600; }
.dl-alert__list a:hover{ background:#fff5f5; }

.sb-row{ margin-bottom:14px; }
.sb-row:last-child{ margin-bottom:0; }
.sb-row__top{ display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.sb-row__top span{ font-size:13px; color:var(--ink-2); }
.sb-row__top strong{ font-size:13px; color:var(--ink); }

.fin-row{ display:flex; justify-content:space-between; align-items:center; padding:7px 0; font-size:13.5px; }
.fin-row span{ color:var(--ink-2); display:flex; align-items:center; gap:8px; }
.fin-row strong{ color:var(--ink); font-weight:700; }
.dot{ width:9px; height:9px; border-radius:50%; flex:none; display:inline-block; }
.fin-bar{ height:9px; background:var(--border); border-radius:99px; overflow:hidden; margin:10px 0 6px; }
.fin-bar__paid{ height:100%; background:var(--green); border-radius:99px; }
.fin-meta{ display:flex; justify-content:space-between; font-size:12px; color:var(--muted); margin-bottom:16px; }
.fin-meta strong{ color:var(--green); }
.fin-cards{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; padding-top:14px; border-top:1px solid var(--border-2); }
.fin-cards > div{ text-align:center; }
.fin-cards__n{ display:block; font-size:21px; font-weight:800; color:var(--ink); }
.fin-cards__l{ display:block; font-size:11px; color:var(--muted); margin-top:3px; }

/* ============================================================
   بحث منسدل بالاقتراحات (Searchable Select)
   ============================================================ */
.ss{ position:relative; }
.ss__input{ width:100%; padding:12px 14px; border:1px solid var(--border); border-radius:11px;
  font-family:inherit; font-size:14px; color:var(--ink); background:var(--card); transition:.15s; }
.ss__input::placeholder{ color:var(--muted-2); }
.ss__input:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }
.ss__input[data-chosen="1"]{ font-weight:600; }
.ss__menu{ position:absolute; top:calc(100% + 5px); inset-inline:0; background:var(--card);
  border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); z-index:40;
  max-height:260px; overflow-y:auto; display:none; padding:5px; }
.ss__menu.open{ display:block; }
.ss__opt{ padding:10px 12px; border-radius:8px; font-size:13.5px; color:var(--ink-2); cursor:pointer; }
.ss__opt.active{ background:var(--brand-50); color:var(--brand); }
.ss__empty{ padding:12px; text-align:center; font-size:12.5px; color:var(--muted); }

/* ============================================================
   التقارير ومؤشرات الأداء + طباعة
   ============================================================ */
.kpi-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:18px; }
.kpi{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:18px; text-align:center; }
.kpi__n{ display:block; font-size:26px; font-weight:800; color:var(--ink); line-height:1.1; }
.kpi__l{ display:block; font-size:12px; color:var(--muted); margin-top:7px; font-weight:600; }
.report-card{ margin-bottom:18px; }
.rep-empty{ color:var(--muted); font-size:13px; text-align:center; padding:26px 0; }
@media (max-width:880px){ .kpi-grid{ grid-template-columns:repeat(2,1fr); } }

/* طباعة / تصدير PDF عبر المتصفح */
@media print {
  .sidebar, .topbar, .no-print, .notif-bar { display:none !important; }
  .main, .content, body { margin:0 !important; padding:0 !important; background:#fff !important; }
  .print-title{ display:block !important; margin-bottom:16px; }
  .print-title h1{ font-size:20px; color:#111; }
  .print-title p{ font-size:13px; color:#555; }
  .card{ box-shadow:none !important; border:1px solid #ddd !important; break-inside:avoid; }
  .kpi{ box-shadow:none !important; border:1px solid #ddd !important; }
  a[href]:after{ content:""; }
}

/* ============================================================
   سجل النشاطات
   ============================================================ */
.act-feed{ display:flex; flex-direction:column; }
.act-row{ display:flex; align-items:center; gap:13px; padding:13px 20px; border-top:1px solid var(--border-2); }
.act-row:first-child{ border-top:none; }
.act-dot{ width:10px; height:10px; border-radius:50%; flex:none; }
.act-dot--green{ background:var(--green); } .act-dot--blue{ background:var(--blue); }
.act-dot--red{ background:var(--red); } .act-dot--amber{ background:var(--amber); }
.act-dot--indigo{ background:var(--brand); }
.act-row__body{ flex:1; min-width:0; }
.act-row__main{ display:flex; align-items:center; gap:7px; flex-wrap:wrap; font-size:13px; }
.act-row__main strong{ color:var(--ink); }
.act-verb{ color:var(--muted); }
.act-chip{ background:var(--brand-50); color:var(--brand); font-size:11.5px; font-weight:700; padding:2px 9px; border-radius:99px; }
.act-desc{ color:var(--ink-2); }
.act-time{ flex:none; font-size:11.5px; color:var(--muted-2); }

/* فلتر داخل شريط البحث (الموارد) */
.searchbar--filter{ gap:10px; }
.searchbar--filter select{ flex:none; width:auto; border:none; background:var(--bg); border-radius:9px;
  padding:8px 12px; font-family:inherit; font-size:13px; color:var(--ink-2); cursor:pointer; }
.searchbar--filter select:focus{ outline:none; }

/* ============================================================
   التقويم التشغيلي
   ============================================================ */
.cal-top{ display:flex; align-items:center; gap:16px; padding:18px 20px; border-bottom:1px solid var(--border-2); }
.cal-top h2{ font-size:17px; font-weight:800; color:var(--ink); min-width:160px; text-align:center; }
.cal-nav{ width:34px; height:34px; display:grid; place-items:center; border-radius:9px; background:var(--bg);
  color:var(--ink-2); text-decoration:none; font-size:20px; font-weight:700; }
.cal-nav:hover{ background:var(--brand-50); color:var(--brand); }
.cal-legend{ display:flex; gap:16px; flex-wrap:wrap; padding:12px 20px; border-bottom:1px solid var(--border-2); }
.cal-legend span{ font-size:12px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.cal-dot{ width:9px; height:9px; border-radius:50%; display:inline-block; }
.cal-dot--indigo{ background:var(--brand); } .cal-dot--green{ background:var(--green); }
.cal-dot--amber{ background:var(--amber); } .cal-dot--red{ background:var(--red); }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:1px; background:var(--border-2); }
.cal-head{ background:var(--bg); padding:10px 6px; text-align:center; font-size:12px; font-weight:700; color:var(--muted); }
.cal-cell{ background:var(--card); min-height:104px; padding:6px; display:flex; flex-direction:column; gap:4px; }
.cal-cell--empty{ background:var(--bg-subtle, #fafbfd); }
.cal-cell--today{ background:var(--brand-50); }
.cal-cell--today .cal-num{ background:var(--brand); color:#fff; }
.cal-num{ font-size:12.5px; font-weight:700; color:var(--ink-2); width:24px; height:24px; display:grid; place-items:center; border-radius:7px; }
.cal-items{ display:flex; flex-direction:column; gap:3px; overflow:hidden; }
.cal-item{ font-size:10.5px; font-weight:600; padding:2px 6px; border-radius:5px; text-decoration:none;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cal-item--indigo{ background:var(--brand-50); color:var(--brand); }
.cal-item--green{ background:var(--green-bg); color:var(--green); }
.cal-item--amber{ background:var(--amber-bg); color:var(--amber); }
.cal-item--red{ background:var(--red-bg); color:var(--red); }
.cal-more{ font-size:10px; color:var(--muted); padding-inline-start:6px; }
@media (max-width:720px){ .cal-cell{ min-height:72px; } .cal-item{ font-size:9px; } .cal-head{ font-size:10px; } }

/* ============================================================
   الهيكلة الإدارية
   ============================================================ */
.org-top{ display:flex; flex-direction:column; align-items:center; margin-bottom:6px; }
.org-company{ background:var(--sidebar-bg, #16172e); color:#fff; border-radius:14px; padding:16px 26px;
  display:flex; align-items:center; gap:14px; box-shadow:var(--shadow); }
.org-company__icon{ width:42px; height:42px; }
.org-company__icon svg{ width:42px; height:42px; }
.org-company__name{ font-size:17px; font-weight:800; }
.org-company__meta{ font-size:12px; opacity:.75; margin-top:3px; }
.org-connector{ width:2px; height:24px; background:var(--border); }
.org-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; }
.org-dept{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.org-dept__head{ display:flex; align-items:center; justify-content:space-between; padding:14px 16px;
  background:var(--brand-50); border-bottom:1px solid var(--border-2); }
.org-dept__head h3{ font-size:14.5px; font-weight:800; color:var(--brand); }
.org-count{ background:var(--brand); color:#fff; font-size:12px; font-weight:700; min-width:24px; height:24px;
  border-radius:99px; display:grid; place-items:center; padding:0 7px; }
.org-manager{ font-size:12px; color:var(--muted); padding:9px 16px 0; }
.org-manager strong{ color:var(--ink-2); }
.org-empty{ font-size:12px; color:var(--muted-2); padding:18px 16px; text-align:center; }
.org-members{ list-style:none; padding:8px; }
.org-member{ display:flex; align-items:center; gap:10px; padding:7px 8px; border-radius:9px; }
.org-member:hover{ background:var(--bg); }
.org-avatar{ width:30px; height:30px; border-radius:50%; background:var(--brand); color:#fff;
  display:grid; place-items:center; font-size:13px; font-weight:700; flex:none; }
.org-avatar--sm{ width:24px; height:24px; font-size:11px; }
.org-member__info{ display:flex; flex-direction:column; min-width:0; }
.org-member__name{ font-size:13px; font-weight:600; color:var(--ink); }
.org-member__role{ font-size:11.5px; color:var(--muted); }
.org-loose{ display:flex; flex-wrap:wrap; gap:8px; }
.org-chip{ display:flex; align-items:center; gap:7px; background:var(--bg); border:1px solid var(--border-2);
  border-radius:99px; padding:5px 12px 5px 6px; font-size:12.5px; color:var(--ink-2); }
.org-roles{ display:flex; flex-wrap:wrap; gap:14px; }
.org-role{ text-align:center; background:var(--bg); border-radius:12px; padding:14px 22px; min-width:90px; }
.org-role__n{ display:block; font-size:22px; font-weight:800; color:var(--brand); }
.org-role__l{ display:block; font-size:12px; color:var(--muted); margin-top:4px; }

/* ============================================================
   الأصول الإعلامية
   ============================================================ */
.media-filters{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:16px; }
.media-chip{ background:var(--card); border:1px solid var(--border); border-radius:99px; padding:6px 14px;
  font-size:12.5px; color:var(--ink-2); text-decoration:none; font-weight:600; }
.media-chip:hover{ border-color:var(--brand); color:var(--brand); }
.media-chip.active{ background:var(--brand); border-color:var(--brand); color:#fff; }
.media-chip span{ opacity:.7; font-size:11px; }
.media-search{ margin-inline-start:auto; }
.media-search input{ border:1px solid var(--border); border-radius:9px; padding:8px 14px; font-family:inherit; font-size:13px; background:var(--card); }
.media-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:16px; }
.media-card{ background:var(--card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow); }
.media-thumb{ height:140px; display:grid; place-items:center; position:relative; background:var(--bg); overflow:hidden; }
.media-thumb img{ width:100%; height:100%; object-fit:cover; }
.media-thumb svg{ width:46px; height:46px; }
.media-thumb--document{ color:#e0533d; } .media-thumb--video{ color:#7c3aed; }
.media-thumb--audio{ color:#0891b2; } .media-thumb--archive{ color:#d97706; } .media-thumb--other{ color:var(--muted); }
.media-ext{ position:absolute; bottom:8px; inset-inline-end:8px; background:rgba(0,0,0,.55); color:#fff;
  font-size:10px; font-weight:700; padding:2px 7px; border-radius:5px; }
.media-info{ padding:11px 13px; }
.media-title{ font-size:13px; font-weight:600; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.media-meta{ font-size:11.5px; color:var(--muted); margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.media-actions{ display:flex; gap:6px; margin-top:9px; padding-top:9px; border-top:1px solid var(--border-2); }

/* ============================================================
   الحضور والانصراف
   ============================================================ */
.att-card{ background:var(--card); border:1px solid var(--border); border-radius:16px; box-shadow:var(--shadow);
  padding:34px 24px; margin-bottom:18px; display:flex; flex-direction:column; align-items:center; gap:22px; text-align:center; }
.att-card--in{ background:linear-gradient(180deg,var(--green-bg),var(--card)); }
.att-card--done{ background:linear-gradient(180deg,var(--brand-50),var(--card)); }
.att-icon{ font-size:42px; line-height:1; }
.att-state h2{ font-size:20px; font-weight:800; color:var(--ink); }
.att-state p{ font-size:13px; color:var(--muted); margin-top:5px; }
.att-btn{ border:none; border-radius:12px; padding:15px 60px; font-size:16px; font-weight:700; color:#fff;
  cursor:pointer; font-family:inherit; transition:transform .08s, opacity .2s; }
.att-btn:active{ transform:scale(.97); }
.att-btn:disabled{ opacity:.6; cursor:wait; }
.att-btn--in{ background:var(--green); }
.att-btn--out{ background:var(--red); }

/* الملف الشخصي */
.prof-head{ display:flex; align-items:center; gap:14px; }
.prof-avatar{ width:56px; height:56px; border-radius:50%; background:var(--brand); color:#fff;
  display:grid; place-items:center; font-size:24px; font-weight:800; flex:none; }
.prof-name{ font-size:17px; font-weight:800; color:var(--ink); }
.prof-role{ font-size:13px; color:var(--muted); margin-top:2px; }

/* ============================================================
   المساعد الذكي
   ============================================================ */
.ai-search{ display:flex; align-items:center; gap:10px; background:var(--card); border:2px solid var(--brand);
  border-radius:14px; padding:8px 8px 8px 16px; box-shadow:0 4px 18px rgba(79,70,229,.12); margin-bottom:22px; }
.ai-search svg{ width:22px; height:22px; color:var(--brand); flex:none; }
.ai-search input{ flex:1; border:none; background:none; font-family:inherit; font-size:15px; color:var(--ink); padding:8px 0; }
.ai-search input:focus{ outline:none; }
.ai-section-title{ font-size:13px; font-weight:800; color:var(--muted); margin:6px 0 12px; text-transform:none; }
.ai-results-head{ font-size:14px; color:var(--ink-2); margin-bottom:14px; }
.ai-results{ display:grid; grid-template-columns:repeat(auto-fill,minmax(290px,1fr)); gap:16px; align-items:start; }
.ai-badge{ background:var(--brand-50); color:var(--brand); font-size:12px; font-weight:700; padding:1px 9px; border-radius:99px; }
.ai-result{ display:flex; flex-direction:column; padding:11px 16px; border-top:1px solid var(--border-2); text-decoration:none; }
.ai-result:first-child{ border-top:none; } .ai-result:hover{ background:var(--bg); }
.ai-result__title{ font-size:13.5px; font-weight:600; color:var(--ink); }
.ai-result__sub{ font-size:12px; color:var(--muted); margin-top:2px; }
.ai-alerts{ display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:12px; margin-bottom:18px; }
.ai-alert{ background:var(--card); border:1px solid var(--border); border-inline-start:4px solid var(--muted);
  border-radius:12px; padding:14px 16px; text-decoration:none; box-shadow:var(--shadow); display:block; }
.ai-alert__n{ display:block; font-size:24px; font-weight:800; color:var(--ink); }
.ai-alert__l{ display:block; font-size:12px; color:var(--muted); margin-top:3px; font-weight:600; }
.ai-alert--red{ border-inline-start-color:var(--red); } .ai-alert--red .ai-alert__n{ color:var(--red); }
.ai-alert--amber{ border-inline-start-color:var(--amber); } .ai-alert--amber .ai-alert__n{ color:var(--amber); }
.ai-alert--indigo{ border-inline-start-color:var(--brand); } .ai-alert--indigo .ai-alert__n{ color:var(--brand); }
.ai-clear{ background:var(--green-bg); color:var(--green); border-radius:12px; padding:16px 18px; font-size:14px; font-weight:600; margin-bottom:18px; }
.ai-pulse{ display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:18px; }
.ai-pulse__item{ background:var(--card); border:1px solid var(--border); border-radius:12px; padding:15px; text-align:center; box-shadow:var(--shadow); }
.ai-pulse__n{ display:block; font-size:22px; font-weight:800; color:var(--ink); }
.ai-pulse__l{ display:block; font-size:11.5px; color:var(--muted); margin-top:4px; font-weight:600; }
.ai-row{ display:flex; flex-direction:column; gap:2px; padding:11px 16px; border-top:1px solid var(--border-2); text-decoration:none; }
.ai-row:first-child{ border-top:none; } .ai-row:hover{ background:var(--bg); }
.ai-row__title{ font-size:13px; font-weight:600; color:var(--ink); }
.ai-row__meta{ font-size:12px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.ai-empty{ color:var(--muted); font-size:13px; text-align:center; padding:28px 0; }
.ai-overview{ display:grid; grid-template-columns:repeat(8,1fr); gap:12px; margin-bottom:14px; }
.ai-ov{ background:var(--card); border:1px solid var(--border); border-radius:12px; padding:14px 8px; text-align:center; text-decoration:none; box-shadow:var(--shadow); }
.ai-ov:hover{ border-color:var(--brand); }
.ai-ov__n{ display:block; font-size:20px; font-weight:800; color:var(--brand); }
.ai-ov__l{ display:block; font-size:11px; color:var(--muted); margin-top:3px; }
.ai-fin{ display:grid; grid-template-columns:repeat(4,1fr); gap:12px; background:var(--card); border:1px solid var(--border);
  border-radius:12px; padding:16px; box-shadow:var(--shadow); }
.ai-fin__item{ text-align:center; }
.ai-fin__l{ display:block; font-size:12px; color:var(--muted); margin-bottom:5px; }
.ai-fin__n{ display:block; font-size:16px; font-weight:800; color:var(--ink); }
@media (max-width:900px){ .ai-overview{ grid-template-columns:repeat(4,1fr); } .ai-pulse,.ai-fin{ grid-template-columns:repeat(2,1fr); } }

/* ============================================================
   صندوق سؤال المساعد الذكي (AI)
   ============================================================ */
.ai-ask-card{ background:linear-gradient(135deg, var(--brand-50), var(--card));
  border:1px solid var(--brand-100, #e0e7ff); border-radius:16px; padding:16px; margin-bottom:18px; box-shadow:var(--shadow); }
.ai-ask{ display:flex; align-items:flex-end; gap:10px; }
.ai-ask__icon{ font-size:22px; line-height:1; padding-bottom:8px; }
.ai-ask textarea{ flex:1; border:1px solid var(--border); border-radius:11px; padding:11px 14px; font-family:inherit;
  font-size:13.5px; resize:none; min-height:44px; background:var(--card); color:var(--ink); line-height:1.6; }
.ai-ask textarea:focus{ outline:none; border-color:var(--brand); box-shadow:0 0 0 3px var(--brand-50); }
.ai-ask button{ white-space:nowrap; padding:11px 26px; }
.ai-answer{ margin-top:14px; background:var(--card); border:1px solid var(--border-2); border-radius:12px;
  padding:16px 18px; border-inline-start:4px solid var(--brand); }
.ai-answer--note{ border-inline-start-color:var(--amber); }
.ai-answer--err{ border-inline-start-color:var(--red); }
.ai-answer__label{ font-size:12px; font-weight:800; color:var(--brand); margin-bottom:8px; }
.ai-answer--note .ai-answer__label{ color:var(--amber); }
.ai-answer--err .ai-answer__label{ color:var(--red); }
.ai-answer__text{ font-size:13.5px; color:var(--ink-2); line-height:1.85; }
.ai-answer__text code{ background:var(--bg); padding:2px 7px; border-radius:5px; font-size:12px; color:var(--brand); direction:ltr; display:inline-block; }

/* ============================================================
   بحث متعدد بالاقتراحات (Multi Searchable Select - chips)
   ============================================================ */
.mss{ position:relative; }
.mss__box{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; min-height:46px;
  padding:7px 10px; border:1px solid var(--border); border-radius:11px; background:var(--card); cursor:text; transition:.15s; }
.mss__box:focus-within{ border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-50); }
.mss__chip{ display:inline-flex; align-items:center; gap:5px; background:var(--brand-50); color:var(--brand);
  border-radius:8px; padding:4px 6px 4px 11px; font-size:13px; font-weight:600; }
.mss__x{ border:none; background:transparent; color:inherit; cursor:pointer; font-size:17px; line-height:1; padding:0 2px; opacity:.7; }
.mss__x:hover{ opacity:1; }
.mss__input{ flex:1; min-width:130px; border:none; outline:none; background:transparent;
  font-family:inherit; font-size:14px; color:var(--ink); padding:6px 4px; }
.mss__input::placeholder{ color:var(--muted-2); }
.mss__menu{ position:absolute; top:calc(100% + 5px); inset-inline:0; background:var(--card);
  border:1px solid var(--border); border-radius:12px; box-shadow:var(--shadow-lg); z-index:40;
  max-height:260px; overflow-y:auto; display:none; padding:5px; }
.mss__menu.open{ display:block; }
