/* =========================================================
   نظام إدارتي — الورشة الرئيسية للتصميم
   RTL / Glassmorphism / متجاوب بالكامل
   ========================================================= */

:root {
  --primary: #2b59c3;
  --primary-rgb: 43, 89, 195;
  --primary-dark: #1c3f96;
  --gold: #c9a227;
  --bg-1: #eef2fb;
  --bg-2: #e3e9f7;
  --bg-3: #f7f9ff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.55);
  --border: rgba(15, 30, 70, 0.10);
  --border-strong: rgba(15, 30, 70, 0.18);
  --text: #101a33;
  --text-2: #4c5878;
  --text-3: #7c87a6;
  --shadow: 0 10px 30px rgba(20, 40, 90, 0.10);
  --shadow-lg: 0 22px 55px rgba(20, 40, 90, 0.18);
  --radius: 20px;
  --radius-sm: 13px;
  --red: #ef4444;
  --yellow: #f59e0b;
  --green: #10b981;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --pink: #ec4899;
  --sidebar-w: 272px;
  --topbar-h: 70px;
  --font: "Tajawal", "Cairo", "Segoe UI", "Tahoma", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg-1: #0a0f1e;
  --bg-2: #0d1428;
  --bg-3: #111a33;
  --surface: rgba(23, 33, 60, 0.72);
  --surface-solid: #151d36;
  --surface-2: rgba(30, 42, 76, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eaf0ff;
  --text-2: #a9b6d6;
  --text-3: #7b88ab;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1100px 620px at 92% -6%, rgba(var(--primary-rgb), 0.22), transparent 60%),
    radial-gradient(900px 560px at -6% 108%, rgba(201, 162, 39, 0.20), transparent 62%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  pointer-events: none;
}
body::before { width: 340px; height: 340px; background: rgba(var(--primary-rgb), .5); top: 8%; left: 22%; }
body::after { width: 300px; height: 300px; background: rgba(201, 162, 39, .45); bottom: 6%; right: 26%; }

::selection { background: rgba(var(--primary-rgb), .3); }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), .38); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb), .62); background-clip: content-box; }

/* ================= الشريط الجانبي ================= */
.sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border-inline-end: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: transform .38s cubic-bezier(.4, 0, .2, 1);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px dashed var(--border);
}
.brand-logo {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 24px;
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), .38);
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-text h1 { font-size: 16px; font-weight: 800; letter-spacing: -.2px; }
.brand-text span { font-size: 11.5px; color: var(--text-3); font-weight: 600; }

.nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 11px; color: var(--text-3); font-weight: 700; padding: 8px 12px 4px; letter-spacing: .5px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  color: var(--text-2); font-weight: 600; font-size: 14.5px;
  position: relative; transition: all .25s ease;
}
.nav a svg { width: 20px; height: 20px; flex: 0 0 20px; }
.nav a:hover { background: rgba(var(--primary-rgb), .10); color: var(--primary); transform: translateX(-4px); }
.nav a.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 22px rgba(var(--primary-rgb), .34);
}
.nav a .badge {
  margin-inline-start: auto; background: rgba(255,255,255,.22);
  font-size: 11px; padding: 1px 8px; border-radius: 20px; font-weight: 700;
}
.nav a:not(.active) .badge { background: rgba(var(--primary-rgb), .14); color: var(--primary); }

.sidebar-foot {
  padding: 14px 16px; border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-3); text-align: center;
}

/* ================= المحتوى ================= */
.shell { margin-inline-start: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 18px; font-weight: 800; }
.topbar .crumb { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.topbar-spacer { flex: 1; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); transition: all .22s ease;
}
.icon-btn:hover { background: rgba(var(--primary-rgb), .14); color: var(--primary); transform: translateY(-2px); }
.icon-btn svg { width: 20px; height: 20px; }
.burger { display: none; }

.main { padding: 26px 24px 44px; flex: 1; max-width: 1560px; width: 100%; margin: 0 auto; }

/* ================= عناصر عامة ================= */
.glass {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 20px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h3 { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.page-head p { color: var(--text-3); font-size: 13.5px; margin-top: 3px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 13px;
  font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 10px 22px rgba(var(--primary-rgb), .30);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(var(--primary-rgb), .40); filter: brightness(1.05); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); box-shadow: none; }
.btn.ghost:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), .45); background: rgba(var(--primary-rgb), .10); }
.btn.danger { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 10px 22px rgba(239,68,68,.28); }
.btn.success { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 10px 22px rgba(16,185,129,.28); }
.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 30px;
  font-size: 12px; font-weight: 700;
}
.chip.red { background: rgba(239,68,68,.15); color: var(--red); }
.chip.yellow { background: rgba(245,158,11,.16); color: #b45309; }
.chip.green { background: rgba(16,185,129,.16); color: #047857; }
.chip.blue { background: rgba(var(--primary-rgb),.15); color: var(--primary); }
.chip.gray { background: rgba(120,130,160,.16); color: var(--text-2); }
[data-theme="dark"] .chip.yellow { color: #fbbf24; }
[data-theme="dark"] .chip.green { color: #34d399; }
[data-theme="dark"] .chip.red { color: #f87171; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ================= نماذج ================= */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 7px; color: var(--text-2); }
.field label .req { color: var(--red); }
.input, .field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 13px;
  font-size: 14px; font-weight: 600;
  transition: all .2s ease;
  outline: none;
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--primary);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .14);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-3); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }
.field .err { font-size: 12px; color: var(--red); margin-top: 5px; font-weight: 700; display: none; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); box-shadow: 0 0 0 4px rgba(239,68,68,.12); }
.field.invalid .err { display: block; animation: shake .3s; }
.field.valid input { border-color: var(--green); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

.check-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

.switch { position: relative; width: 48px; height: 27px; flex: 0 0 48px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 30px;
  background: var(--border-strong); transition: .28s;
}
.switch i::before {
  content: ""; position: absolute; height: 21px; width: 21px; inset-inline-start: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .28s; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::before { transform: translateX(-21px); }

/* ================= المودال ================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(8, 14, 32, 0.55);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 18px;
}
.modal-overlay.open { display: flex; animation: fadeIn .22s ease; }
.modal {
  width: 100%; max-width: 620px; max-height: 90vh; overflow-y: auto;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  animation: popIn .3s cubic-bezier(.34, 1.4, .64, 1);
}
.modal.sm { max-width: 430px; }
.modal.lg { max-width: 820px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface-solid); z-index: 2;
}
.modal-head h4 { font-size: 17px; font-weight: 800; flex: 1; }
.modal-head .icon-btn { width: 36px; height: 36px; }
.modal-body { padding: 22px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-start;
  padding: 16px 22px; border-top: 1px solid var(--border);
  position: sticky; bottom: 0; background: var(--surface-solid);
}

/* ================= التنبيهات Toast ================= */
#toastStack {
  position: fixed; top: 20px; inset-inline-start: auto; inset-inline-end: 20px;
  z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 15px; border-radius: 15px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-inline-start: 5px solid var(--primary);
  box-shadow: var(--shadow-lg);
  animation: slideIn .4s cubic-bezier(.34, 1.3, .64, 1);
  font-size: 13.5px; font-weight: 600;
}
.toast.out { animation: slideOut .3s forwards; }
.toast .t-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 34px; font-size: 17px; }
.toast .t-txt strong { display: block; font-size: 14px; font-weight: 800; }
.toast .t-txt span { color: var(--text-3); font-weight: 600; font-size: 12.5px; }
.toast.success { border-inline-start-color: var(--green); } .toast.success .t-ico { background: rgba(16,185,129,.16); color: var(--green); }
.toast.error { border-inline-start-color: var(--red); } .toast.error .t-ico { background: rgba(239,68,68,.16); color: var(--red); }
.toast.warn { border-inline-start-color: var(--yellow); } .toast.warn .t-ico { background: rgba(245,158,11,.16); color: var(--yellow); }
.toast.info { border-inline-start-color: var(--primary); } .toast.info .t-ico { background: rgba(var(--primary-rgb),.14); color: var(--primary); }

/* ================= الحالة الفارغة ================= */
.empty {
  text-align: center; padding: 46px 20px;
  color: var(--text-3);
}
.empty .e-ico {
  width: 92px; height: 92px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 44px;
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: 30px; animation: floaty 3.4s ease-in-out infinite;
}
.empty h4 { color: var(--text-2); font-size: 17px; font-weight: 800; margin-bottom: 5px; }
.empty p { font-size: 13.5px; max-width: 420px; margin: 0 auto 16px; }

/* ================= لوحة التحكم ================= */
.dash-sections { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.dash-section {
  flex: 1 1 460px; min-width: 300px;
  display: flex; flex-direction: column;
  animation: fadeUp .45s ease both;
}
.dash-section.sec-notes { flex: 0 0 330px; min-width: 285px; align-self: stretch; }
.dash-section.dragging { opacity: .45; transform: scale(.985); }
.dash-section.drag-over { outline: 2.5px dashed var(--primary); outline-offset: 6px; }

.sec-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.sec-head .grip { cursor: grab; color: var(--text-3); font-size: 17px; padding: 2px 4px; transition: .2s; }
.sec-head .grip:hover { color: var(--primary); }
.sec-head h4 { font-size: 15.5px; font-weight: 800; flex: 1; display: flex; align-items: center; gap: 9px; }
.sec-head h4 .h-ico {
  width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; font-size: 16px;
  background: rgba(var(--primary-rgb), .13); color: var(--primary);
}
.sec-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 13px; }

/* بطاقة تذكير في اللوحة */
.rem-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-inline-start: 5px solid var(--primary);
  border-radius: 16px; padding: 14px 15px;
  transition: all .28s ease; position: relative; overflow: hidden;
}
.rem-card::after {
  content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 46px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35));
  opacity: 0; transition: .3s;
}
.rem-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.rem-card.p-high { border-inline-start-color: var(--red); }
.rem-card.p-med { border-inline-start-color: var(--yellow); }
.rem-card.p-low { border-inline-start-color: var(--green); }
.rem-card.done { opacity: .62; }
.rem-card.done .rem-title { text-decoration: line-through; }
.rem-card.bell { animation: pulseRing 1.8s ease-out infinite; }
.rem-top { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 6px; }
.rem-title { font-size: 14.5px; font-weight: 800; flex: 1; line-height: 1.5; }
.rem-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font-size: 12px; color: var(--text-3); font-weight: 600; }
.rem-note {
  font-size: 12.5px; color: var(--text-2); background: rgba(var(--primary-rgb), .07);
  border: 1px dashed var(--border); padding: 8px 11px; border-radius: 11px; margin-top: 9px;
}
.rem-count {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 20px;
  background: rgba(var(--primary-rgb), .13); color: var(--primary);
}
.rem-count.late { background: rgba(239,68,68,.14); color: var(--red); }
.rem-count.soon { background: rgba(245,158,11,.16); color: #b45309; }
[data-theme="dark"] .rem-count.soon { color: #fbbf24; }
.rem-actions { display: flex; gap: 8px; margin-top: 11px; flex-wrap: wrap; }

/* بطاقة آخر ملف */
.file-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 15px;
  display: flex; gap: 13px; align-items: center;
  transition: all .26s ease; cursor: pointer;
}
.file-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(var(--primary-rgb), .4); }
.file-ava {
  width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.file-info { flex: 1; min-width: 0; }
.file-info h5 { font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info .f-sub { font-size: 12px; color: var(--text-3); font-weight: 600; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.file-last {
  font-size: 12px; color: var(--text-2); background: rgba(var(--primary-rgb), .08);
  border-radius: 10px; padding: 5px 10px; margin-top: 7px; display: inline-block;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* الملاحظات اللاصقة — ورق لاصق حقيقي (دبوس / مشبك / علم) */
.notes-list {
  display: flex; flex-direction: column; gap: 20px;
  max-height: 66vh; overflow-y: auto; overflow-x: hidden;
  padding: 18px 8px 12px;
}
.sticky-note {
  --note: #fff3a3;
  --pin: #ef4444;
  position: relative;
  padding: 24px 18px 14px;
  border-radius: 3px;
  color: #23262e;
  background:
    linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 24%),
    linear-gradient(300deg, rgba(15,23,42,.13), rgba(15,23,42,0) 48%),
    var(--note);
  box-shadow:
    0 16px 26px -12px rgba(15,23,42,.42),
    0 5px 10px -6px rgba(15,23,42,.3),
    inset 0 1px 0 rgba(255,255,255,.75);
  transition: transform .28s cubic-bezier(.2,.8,.3,1), box-shadow .28s ease;
  animation: noteIn .42s cubic-bezier(.34,1.3,.64,1) both;
}
@keyframes noteIn {
  from { opacity: 0; transform: translateY(-14px) rotate(-4deg) scale(.94); }
  to { opacity: 1; }
}
.sticky-note:nth-child(6n+1) { transform: rotate(-1.6deg); }
.sticky-note:nth-child(6n+2) { transform: rotate(1.3deg); }
.sticky-note:nth-child(6n+3) { transform: rotate(-.7deg); }
.sticky-note:nth-child(6n+4) { transform: rotate(1.8deg); }
.sticky-note:nth-child(6n+5) { transform: rotate(-1.2deg); }
.sticky-note:nth-child(6n+6) { transform: rotate(.6deg); }
.sticky-note:hover,
.sticky-note:focus-within {
  transform: rotate(0deg) translateY(-7px) scale(1.02);
  box-shadow:
    0 26px 40px -16px rgba(15,23,42,.5),
    0 10px 18px -10px rgba(15,23,42,.35),
    inset 0 1px 0 rgba(255,255,255,.8);
  z-index: 5;
}
/* ملمس الورق + الوهج */
.sticky-note::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    repeating-linear-gradient(112deg, rgba(255,255,255,.2) 0 7px, rgba(15,23,42,.028) 7px 14px),
    linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,0) 42%);
}
/* الزاوية الملتوية (تجعيدة الورق) */
.sticky-note::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 42px; height: 42px; z-index: 1; pointer-events: none;
  clip-path: polygon(0 100%, 0 0, 100% 100%);
  background: linear-gradient(45deg,
    rgba(255,255,255,.96), rgba(255,255,255,.7) 30%,
    rgba(15,23,42,.22) 56%, rgba(15,23,42,.05));
}
.sticky-note textarea {
  position: relative; z-index: 2;
  display: block; width: 100%;
  background: transparent; border: none; outline: none; resize: none;
  font-size: 13.5px; font-weight: 700; line-height: 1.75;
  color: inherit; min-height: 56px; padding: 0;
}
.sticky-note .n-foot { position: relative; z-index: 2; }

/* أشكال التثبيت: مشبك / علم / دبوس */
.sticky-note .n-deco {
  position: absolute; z-index: 6; pointer-events: none;
  top: -17px; left: 50%;
}
/* مشبكا الورق (أحمر + بنفسجي) */
.sticky-note:nth-child(6n+1) .n-deco,
.sticky-note:nth-child(6n+3) .n-deco {
  --pin: #ef4444;
  width: 26px; height: 54px;
  transform: translateX(-50%) rotate(7deg);
  border: 4.5px solid var(--pin);
  border-top-color: transparent;
  border-radius: 16px;
  filter: drop-shadow(0 5px 6px rgba(15,23,42,.38));
}
.sticky-note:nth-child(6n+3) .n-deco { --pin: #8b5cf6; transform: translateX(-50%) rotate(-6deg); }
.sticky-note:nth-child(6n+1) .n-deco::before,
.sticky-note:nth-child(6n+3) .n-deco::before {
  content: ""; position: absolute; inset: 7px 5px 9px;
  border: 3.5px solid var(--pin);
  border-bottom-color: transparent;
  border-radius: 10px;
}
/* العلم الصغير (أحمر) */
.sticky-note:nth-child(6n+2) .n-deco {
  --pin: #dc2626;
  width: 5px; height: 50px;
  transform: translateX(-50%) rotate(-5deg);
  border-radius: 3px;
  background: linear-gradient(180deg, #eef2f7, #64748b 72%);
  box-shadow: 3px 5px 8px rgba(15,23,42,.35);
}
.sticky-note:nth-child(6n+2) .n-deco::before {
  content: ""; position: absolute; top: 3px; left: 6px;
  width: 27px; height: 18px; background: var(--pin);
  clip-path: polygon(0 0, 100% 0, 76% 50%, 100% 100%, 0 100%);
  box-shadow: 2px 3px 5px rgba(15,23,42,.3);
}
/* دبابيس ملوّنة (سماوي + بنفسجي + أخضر) */
.sticky-note:nth-child(6n+4) .n-deco,
.sticky-note:nth-child(6n+5) .n-deco,
.sticky-note:nth-child(6n+6) .n-deco {
  top: -11px;
  width: 23px; height: 23px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 27%, rgba(255,255,255,.95), rgba(255,255,255,0) 47%),
    radial-gradient(circle at 50% 68%, rgba(0,0,0,.3), rgba(0,0,0,0) 62%),
    var(--pin);
  box-shadow: 0 7px 11px -4px rgba(15,23,42,.55);
}
.sticky-note:nth-child(6n+4) .n-deco { --pin: #22a7e0; }
.sticky-note:nth-child(6n+5) .n-deco { --pin: #7c3aed; }
.sticky-note:nth-child(6n+6) .n-deco { --pin: #22c55e; }
.sticky-note:nth-child(6n+4) .n-deco::after,
.sticky-note:nth-child(6n+5) .n-deco::after,
.sticky-note:nth-child(6n+6) .n-deco::after {
  content: ""; position: absolute; left: 50%; top: 17px;
  transform: translateX(-50%);
  width: 3px; height: 15px; border-radius: 0 0 2px 2px;
  background: linear-gradient(180deg, #475569, #94a3b8);
  box-shadow: 2px 3px 4px rgba(15,23,42,.35);
}

.sticky-note .n-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 11px; font-weight: 700; opacity: .75; }
.sticky-note .n-btns { display: flex; gap: 6px; opacity: 0; transition: .25s; }
.sticky-note:hover .n-btns, .sticky-note:focus-within .n-btns { opacity: 1; }
.n-btns button {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(255,255,255,.6); font-size: 12px; transition: .2s;
}
.n-btns button:hover { background: #fff; transform: scale(1.12); }
.color-picks { display: flex; gap: 9px; flex-wrap: wrap; }
.color-picks button {
  width: 34px; height: 34px; border-radius: 11px; border: 2.5px solid transparent;
  transition: .2s;
}
.color-picks button:hover { transform: translateY(-3px); }
.color-picks button.sel { border-color: var(--text); transform: translateY(-3px) scale(1.06); }

/* ================= الجداول ================= */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
table.tbl thead th {
  background: rgba(var(--primary-rgb), .10);
  font-weight: 800; font-size: 12.5px; color: var(--text-2);
  padding: 13px 14px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.tbl tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-weight: 600; vertical-align: middle; }
table.tbl tbody tr { transition: all .2s ease; }
table.tbl tbody tr:hover { background: rgba(var(--primary-rgb), .07); }
table.tbl tbody tr.row-hide { animation: collapseRow .35s forwards; }
table.tbl .c-name { display: flex; align-items: center; gap: 10px; }
table.tbl .c-name .file-ava { width: 38px; height: 38px; flex: 0 0 38px; font-size: 14px; border-radius: 12px; }
table.tbl .c-name b { font-size: 14px; }
table.tbl .c-name small { display: block; color: var(--text-3); font-size: 11.5px; font-weight: 600; }
.row-actions { display: flex; gap: 6px; }
.row-actions button {
  width: 33px; height: 33px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); transition: .2s; font-size: 14px;
}
.row-actions button:hover { background: rgba(var(--primary-rgb), .14); color: var(--primary); transform: translateY(-2px); }
.row-actions button.del:hover { background: rgba(239,68,68,.15); color: var(--red); border-color: rgba(239,68,68,.4); }

.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.search-box { position: relative; flex: 1 1 320px; min-width: 220px; }
.search-box input {
  width: 100%; padding: 13px 46px 13px 15px;
  background: var(--surface); backdrop-filter: blur(14px);
  border: 1.5px solid var(--border); border-radius: 15px;
  font-size: 14px; font-weight: 600; outline: none; transition: .22s;
  box-shadow: var(--shadow);
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .14); }
.search-box .s-ico { position: absolute; inset-inline-start: 15px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-box .s-clear { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); display: none; }
.search-box.has-val .s-clear { display: block; }
.filter-sel, .filter-date {
  padding: 12px 14px; background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 15px; font-size: 13.5px; font-weight: 700; outline: none;
  backdrop-filter: blur(14px); box-shadow: var(--shadow); transition: .2s;
}
.filter-sel:focus, .filter-date:focus { border-color: var(--primary); }

.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; color: var(--text-3); font-weight: 700; }

.pager { display: flex; gap: 7px; align-items: center; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager button {
  min-width: 38px; height: 38px; padding: 0 11px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 700; font-size: 13.5px; color: var(--text-2); transition: .2s;
}
.pager button:hover:not(:disabled) { background: rgba(var(--primary-rgb), .13); color: var(--primary); transform: translateY(-2px); }
.pager button.cur { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; box-shadow: 0 8px 18px rgba(var(--primary-rgb),.32); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ================= خطوات الملف ================= */
.steps-editor { display: flex; flex-direction: column; gap: 9px; }
.step-row {
  display: flex; gap: 9px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 13px; padding: 9px 11px; animation: fadeUp .3s ease both;
}
.step-row input[type="text"] {
  flex: 1; min-width: 0; padding: 8px 11px; background: transparent;
  border: 1px solid transparent; border-radius: 9px; font-size: 13.5px; font-weight: 700; outline: none;
}
.step-row input[type="text"]:focus { border-color: var(--primary); background: var(--surface-solid); }
.step-row input[type="date"] {
  padding: 8px 9px; background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: 9px; font-size: 12px; font-weight: 600; outline: none; max-width: 152px;
}
.seg { display: flex; background: var(--surface-solid); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { padding: 5px 11px; font-size: 11.5px; font-weight: 800; border-radius: 8px; color: var(--text-3); transition: .2s; white-space: nowrap; }
.seg button.on { background: var(--primary); color: #fff; box-shadow: 0 5px 12px rgba(var(--primary-rgb),.3); }
.seg button.on.ok { background: var(--green); }
.step-row .del-step { color: var(--text-3); font-size: 17px; transition: .2s; }
.step-row .del-step:hover { color: var(--red); transform: rotate(90deg); }

/* التايم لاين */
.timeline { position: relative; padding-inline-start: 6px; }
.tl-item { position: relative; padding-inline-start: 30px; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; inset-inline-start: 7px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--surface-solid);
  border: 3px solid var(--primary); z-index: 2;
}
.tl-item.ok::before { border-color: var(--green); background: var(--green); }
.tl-item.pending::before { border-color: var(--yellow); }
.tl-item::after {
  content: ""; position: absolute; inset-inline-start: 13px; top: 22px; bottom: -4px;
  width: 2px; background: repeating-linear-gradient(var(--border-strong) 0 5px, transparent 5px 10px);
}
.tl-item:last-child::after { display: none; }
.tl-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 11px 14px; }
.tl-body h5 { font-size: 14px; font-weight: 800; }
.tl-body small { color: var(--text-3); font-size: 12px; font-weight: 600; }

/* صفحة تفاصيل العميل */
.profile-hero {
  display: flex; gap: 18px; align-items: center; flex-wrap: wrap;
  padding: 24px; border-radius: var(--radius); margin-bottom: 20px;
  background:
    linear-gradient(135deg, rgba(var(--primary-rgb), .95), rgba(var(--primary-rgb), .72)),
    var(--surface);
  color: #fff; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.profile-hero::after {
  content: "📁"; position: absolute; inset-inline-end: -14px; top: -34px;
  font-size: 170px; opacity: .12; font-family: Georgia, serif;
}
.profile-hero .file-ava { width: 76px; height: 76px; flex: 0 0 76px; font-size: 28px; border-radius: 24px; background: rgba(255,255,255,.2); box-shadow: 0 10px 24px rgba(0,0,0,.2); }
.profile-hero h3 { font-size: 23px; font-weight: 800; }
.profile-hero .p-sub { font-size: 13.5px; opacity: .9; font-weight: 600; }
.profile-hero .p-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }
.profile-hero .p-chips .chip { background: rgba(255,255,255,.2); color: #fff; }
.profile-hero .p-acts { margin-inline-start: auto; display: flex; gap: 9px; z-index: 2; flex-wrap: wrap; }
.profile-hero .p-acts .btn.ghost { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  padding: 16px 17px; border-radius: 17px; display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); transition: .25s;
}
.stat:hover { transform: translateY(-4px); }
.stat .s-ico { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 14px; display: grid; place-items: center; font-size: 21px; background: rgba(var(--primary-rgb), .14); color: var(--primary); }
.stat b { font-size: 22px; font-weight: 800; display: block; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--text-3); font-weight: 700; }

.two-col { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; align-items: start; }
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 13px; padding: 11px 14px; font-size: 13.5px;
}
.info-row span { color: var(--text-3); font-weight: 700; }
.info-row b { font-weight: 800; direction: ltr; text-align: left; }

/* ================= التذكيرات ================= */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button {
  padding: 9px 17px; border-radius: 13px; font-weight: 800; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); display: flex; align-items: center; gap: 7px; transition: .22s;
  backdrop-filter: blur(12px);
}
.tabs button:hover { transform: translateY(-2px); border-color: rgba(var(--primary-rgb), .4); }
.tabs button.on { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; box-shadow: 0 9px 20px rgba(var(--primary-rgb),.3); }
.tabs button .cnt { background: rgba(0,0,0,.14); padding: 0 8px; border-radius: 20px; font-size: 11.5px; }
.tabs button:not(.on) .cnt { background: rgba(var(--primary-rgb),.13); color: var(--primary); }

.rem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.rem-grid .rem-card { background: var(--surface); backdrop-filter: blur(16px); }
.rem-grid .rem-card.done { transform: none; }

/* ================= الإعدادات ================= */
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; align-items: start; }
.set-card { padding: 20px; }
.set-card > h4 {
  font-size: 15.5px; font-weight: 800; margin-bottom: 4px;
  display: flex; align-items: center; gap: 9px;
}
.set-card > h4 .h-ico { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: rgba(var(--primary-rgb),.13); color: var(--primary); font-size: 16px; }
.set-card > p.sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 15px; }
.set-line {
  display: flex; align-items: center; justify-content: space-between; gap: 13px;
  padding: 12px 0; border-bottom: 1px dashed var(--border);
}
.set-line:last-child { border-bottom: none; }
.set-line .sl-txt b { font-size: 13.5px; font-weight: 800; display: block; }
.set-line .sl-txt span { font-size: 12px; color: var(--text-3); font-weight: 600; }

/* شريط التنقّل بين الأقسام */
.set-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.set-nav a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 800; color: var(--text-2);
  text-decoration: none; white-space: nowrap; transition: .18s;
}
.set-nav a:hover { border-color: rgba(var(--primary-rgb),.5); color: var(--primary); transform: translateY(-1px); }
.set-nav a.sel { background: rgba(var(--primary-rgb),.14); border-color: rgba(var(--primary-rgb),.45); color: var(--primary); }
.set-nav a[hidden] { display: none; }

/* الربط الخارجي */
.ext-block {
  padding: 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  margin-bottom: 14px;
}
.ext-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 13px; font-size: 14px; font-weight: 800;
}
.ext-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-3); display: inline-block; margin-inline-end: 7px;
  vertical-align: middle;
}
.ext-dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(16,185,129,.15); }
.ext-dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(239,68,68,.15); }
.ext-state { font-size: 12.5px; font-weight: 800; color: var(--text-3); text-align: end; }
.ext-state.ok { color: var(--green); }
.ext-state.bad { color: var(--red); }
.ext-acts { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.ext-acts .hint { margin: 0; }

.section-sort { display: flex; flex-direction: column; gap: 9px; }
.sort-item {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 13px; padding: 11px 13px; cursor: grab; transition: .22s;
}
.sort-item:active { cursor: grabbing; }
.sort-item.dragging { opacity: .4; }
.sort-item.drag-over { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb),.16); }
.sort-item .s-name { flex: 1; font-size: 13.5px; font-weight: 800; }

.theme-picks { display: flex; gap: 11px; flex-wrap: wrap; }
.theme-picks button {
  flex: 1 1 130px; padding: 13px; border-radius: 14px;
  border: 2.5px solid var(--border); background: var(--surface-2);
  font-weight: 800; font-size: 13.5px; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: .22s;
}
.theme-picks button span.i { font-size: 21px; }
.theme-picks button:hover { transform: translateY(-3px); }
.theme-picks button.sel { border-color: var(--primary); background: rgba(var(--primary-rgb), .12); color: var(--primary); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches button { width: 38px; height: 38px; border-radius: 13px; border: 3px solid transparent; transition: .2s; position: relative; }
.swatches button:hover { transform: translateY(-3px) scale(1.05); }
.swatches button.sel { border-color: var(--text); }
.swatches button.sel::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

.logo-pick { display: flex; align-items: center; gap: 14px; }
.logo-pick .file-ava { width: 66px; height: 66px; flex: 0 0 66px; font-size: 26px; border-radius: 20px; }

/* ================= الحركات ================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-28px) scale(.96); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes slideOut { to { opacity: 0; transform: translateX(-30px) scale(.94); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes collapseRow { to { opacity: 0; transform: translateX(40px); background: rgba(239,68,68,.14); } }
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(245,158,11,.45); }
  70% { box-shadow: 0 0 0 12px rgba(245,158,11,0); }
  100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
}
@keyframes donePop { 0% { transform: scale(1); } 45% { transform: scale(1.14); } 100% { transform: scale(1); } }
.pop { animation: donePop .35s ease; }

.stagger > * { animation: fadeUp .45s ease both; }
.stagger > *:nth-child(1) { animation-delay: .03s; }
.stagger > *:nth-child(2) { animation-delay: .09s; }
.stagger > *:nth-child(3) { animation-delay: .15s; }
.stagger > *:nth-child(4) { animation-delay: .21s; }
.stagger > *:nth-child(5) { animation-delay: .27s; }
.stagger > *:nth-child(6) { animation-delay: .33s; }

/* ================= الاستجابة ================= */
.overlay-side { display: none; position: fixed; inset: 0; background: rgba(8,14,32,.5); backdrop-filter: blur(3px); z-index: 55; opacity: 0; transition: .3s; }
.overlay-side.show { display: block; opacity: 1; }

@media (max-width: 1080px) {
  .two-col { grid-template-columns: 1fr; }
  .dash-section.sec-notes { flex: 1 1 100%; }
  .notes-list { max-height: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); box-shadow: none; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .shell { margin-inline-start: 0; }
  .burger { display: grid; }
  .main { padding: 20px 15px 40px; }
  .topbar { padding: 0 15px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-head h3 { font-size: 20px; }
  .dash-section { flex: 1 1 100%; min-width: 0; }
  .modal { border-radius: 20px; }
  .profile-hero { padding: 18px; }
  .profile-hero .p-acts { margin-inline-start: 0; width: 100%; }
  .toolbar > * { flex: 1 1 100%; }
  .stat b { font-size: 19px; }
}

@media print {
  .sidebar, .topbar, .row-actions, .toolbar, .btn { display: none !important; }
  .shell { margin: 0; }
  body { background: #fff; }
}

/* ================= بحث سريع عن عميل (لوحة التحكم) ================= */
.search-hero { position: relative; margin-bottom: 20px; z-index: 46; }
.search-hero .search-box input {
  padding: 16px 52px 16px 96px;
  font-size: 15.5px;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
}
.search-hero .search-box .s-ico { inset-inline-start: 18px; }
.search-hero .search-box .s-clear {
  display: none;
  inset-inline-end: 16px;
  width: 30px; height: 30px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px; line-height: 1;
}
.search-hero .search-box.has-val .s-clear { display: grid; place-items: center; }
.search-hero .search-box.has-val input { padding-inline-end: 54px; }

.s-kbd {
  position: absolute; inset-inline-end: 54px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 800; font-family: inherit;
  color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border); border-bottom-width: 2.5px;
  border-radius: 8px; padding: 3px 8px; pointer-events: none;
}
.search-hero .search-box.has-val .s-kbd { display: none; }

.search-drop {
  position: absolute; top: calc(100% + 10px); inset-inline: 0;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: min(62vh, 520px);
  overflow-y: auto;
  animation: popIn .22s cubic-bezier(.34, 1.3, .64, 1);
}
.sd-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; font-size: 12.5px; font-weight: 800; color: var(--text-3);
  background: rgba(var(--primary-rgb), .08);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.sd-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .18s ease, transform .18s ease;
}
.sd-item:last-child { border-bottom: none; }
.sd-item:hover, .sd-item.active { background: rgba(var(--primary-rgb), .12); }
.sd-item.active { box-shadow: inset -4px 0 0 var(--primary); }
.sd-item .file-ava { width: 42px; height: 42px; flex: 0 0 42px; font-size: 15px; border-radius: 14px; }
.sd-meta { flex: 1; min-width: 0; }
.sd-meta b { display: block; font-size: 14.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-meta span {
  font-size: 12px; color: var(--text-3); font-weight: 700;
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px;
}
.sd-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.sd-empty { padding: 34px 18px; text-align: center; color: var(--text-3); }
.sd-empty .e-ico {
  width: 70px; height: 70px; margin: 0 auto 12px; display: grid; place-items: center;
  font-size: 34px; background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: 24px; animation: floaty 3.4s ease-in-out infinite;
}
.sd-empty h5 { color: var(--text-2); font-size: 15.5px; font-weight: 800; margin-bottom: 4px; }
.sd-empty p { font-size: 13px; margin-bottom: 14px; }
.sd-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 12.5px; font-weight: 700; color: var(--text-3);
}
.sd-foot .keys { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sd-foot kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 800;
  background: var(--surface-solid); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; color: var(--text-2);
}
mark.hl { background: rgba(245, 158, 11, .4); color: inherit; border-radius: 4px; padding: 0 2px; font-weight: 900; }

@media (max-width: 640px) {
  .s-kbd { display: none; }
  .search-hero .search-box input { padding: 14px 46px; font-size: 14.5px; }
  .search-hero .search-box.has-val input { padding-inline-end: 50px; }
  .sd-tags { display: none; }
}

/* ================= صفحة تسجيل الدخول ================= */
body[data-page="login"] {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px 18px;
  background:
    radial-gradient(1100px 520px at 85% -10%, rgba(var(--primary-rgb), .28), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(var(--primary-rgb), .18), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
}
.auth-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.auth-card {
  width: min(420px, 100%);
  padding: 34px 30px 26px;
  text-align: center;
  border-radius: 28px;
  animation: popIn .34s cubic-bezier(.34, 1.3, .64, 1);
}
.auth-card.shake { animation: shake .4s ease; }
.auth-logo {
  width: 78px; height: 78px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 38px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .22), rgba(var(--primary-rgb), .1));
  border: 1px solid rgba(var(--primary-rgb), .32);
  box-shadow: var(--shadow-lg);
}
.auth-logo img { width: 60%; height: 60%; object-fit: contain; }
.auth-card h1 { font-size: 23px; font-weight: 900; letter-spacing: -.3px; margin-bottom: 6px; }
.auth-sub { font-size: 13.5px; color: var(--text-3); font-weight: 600; margin-bottom: 22px; line-height: 1.7; }
.auth-card form { text-align: start; }
.auth-card .field { margin-bottom: 15px; }
.auth-card .field input { width: 100%; padding: 13px 15px; border-radius: 14px; font-size: 15px; }
.auth-card .field input:focus { box-shadow: 0 0 0 4px rgba(var(--primary-rgb), .16); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-inline-end: 48px !important; }
.pw-eye {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 11px; border: none;
  background: var(--surface-2); cursor: pointer; font-size: 15px;
  display: grid; place-items: center;
}
.pw-eye:hover { background: rgba(var(--primary-rgb), .14); }
.auth-alert {
  font-size: 13px; font-weight: 800; line-height: 1.6;
  padding: 11px 13px; border-radius: 13px; margin-bottom: 14px;
  background: rgba(239, 68, 68, .12); color: var(--red);
  border: 1px solid rgba(239, 68, 68, .3); text-align: center;
}
.auth-alert.ok { background: rgba(16, 185, 129, .12); color: var(--green); border-color: rgba(16, 185, 129, .3); }
.auth-btn { width: 100%; padding: 14px; font-size: 15.5px; font-weight: 800; border-radius: 15px; }
.auth-btn:disabled { opacity: .7; cursor: not-allowed; }
.auth-foot {
  margin-top: 18px; padding-top: 15px; border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-3); font-weight: 700; text-align: center;
}
.auth-crumb { font-size: 12.5px; color: var(--text-3); font-weight: 700; }

/* ================= شريط المستخدم في الأعلى ================= */
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 12px 6px 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 230px;
}
.uc-ava {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 900;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), .95), rgba(var(--primary-rgb), .65));
  color: #fff;
}
.uc-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.uc-txt b { font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-txt i { font-size: 10.5px; font-style: normal; color: var(--text-3); font-weight: 700; }

/* ================= المستخدم في الشريط الجانبي ================= */
.nav-me {
  display: flex; align-items: center; gap: 10px;
  margin: 10px 14px; padding: 10px 12px;
  background: rgba(var(--primary-rgb), .1);
  border: 1px solid rgba(var(--primary-rgb), .22);
  border-radius: 16px;
}
.nm-ava {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 900;
  background: linear-gradient(135deg, var(--primary), rgba(var(--primary-rgb), .6));
  color: #fff;
}
.nm-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.nm-txt b { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm-txt i { font-size: 11px; font-style: normal; color: var(--text-3); font-weight: 700; }

/* ================= إدارة المستخدمين ================= */
.users-list { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.user-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: border-color .18s ease, opacity .18s ease;
}
.user-row:hover { border-color: rgba(var(--primary-rgb), .45); }
.user-row.off { opacity: .55; }
.ur-ava {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 14px;
  display: grid; place-items: center; font-size: 15px; font-weight: 900;
  background: rgba(var(--primary-rgb), .16); color: var(--primary);
}
.user-row.off .ur-ava { background: rgba(239, 68, 68, .14); color: var(--red); }
.ur-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ur-meta b { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ur-meta i { font-size: 12px; font-style: normal; color: var(--text-3); font-weight: 700; }
.ur-perms { display: flex; gap: 5px; flex-wrap: wrap; }
.ur-acts { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ur-acts .btn { min-width: 34px; height: 32px; padding: 0 9px; }
.perm-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.perm-check {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12.5px; font-weight: 700;
  transition: all .16s ease;
}
.perm-check:has(input:checked) {
  background: rgba(var(--primary-rgb), .14);
  border-color: rgba(var(--primary-rgb), .5);
  color: var(--primary);
}
.perm-check input { accent-color: var(--primary); width: 15px; height: 15px; }
.empty.sm { padding: 22px 14px; }
.empty.sm p { font-size: 13px; margin: 0; }

@media (max-width: 640px) {
  .user-chip .uc-txt { display: none; }
  .user-chip { padding: 5px; }
  .auth-card { padding: 27px 20px 22px; }
  .user-row { flex-wrap: wrap; }
  .ur-acts { width: 100%; justify-content: flex-end; }
}

/* ================= بوت تلغرام (الإعدادات) ================= */
.tg-list { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.tg-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.tg-name {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 800;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tg-id { font-size: 12px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tg-empty {
  font-size: 12.5px; font-weight: 700; color: var(--text-3);
  text-align: center; padding: 12px;
  border: 1px dashed var(--border); border-radius: 12px;
}
.tg-ok { color: var(--green); font-weight: 800; }
.tg-off { color: var(--red); font-weight: 800; }
