/* =========================================================
   مساحة العمل — Design system v2
   ========================================================= */
:root {
  --bg: #f3f4fa;
  --bg-soft: #eceef6;
  --surface: #ffffff;
  --surface-2: #f9f9fd;
  --line: #e6e7f0;
  --line-strong: #d6d8e5;
  --text: #1b1c30;
  --text-2: #4f5169;
  --muted: #868aa3;
  --accent: #6c5ce7;
  --accent-2: #33c2b3;
  --accent-soft: #eeebff;
  --accent-ink: #5141d4;
  --grad: linear-gradient(135deg, #7c6cf0 0%, #5b8cf5 55%, #33c2b3 100%);
  --grad-warm: linear-gradient(135deg, #ff8a65 0%, #f2a33a 100%);
  --danger: #e5484d;
  --danger-soft: #fdeced;
  --warn: #e8930c;
  --warn-soft: #fff3df;
  --ok: #1f9d63;
  --ok-soft: #e3f6ec;
  --info: #3b82f6;
  --info-soft: #e7effe;

  --side-bg: linear-gradient(180deg, #1d1a4a 0%, #191742 55%, #15133a 100%);
  --side-text: rgba(255, 255, 255, .68);
  --side-hover: rgba(255, 255, 255, .07);
  --side-active: rgba(255, 255, 255, .13);
  --side-line: rgba(255, 255, 255, .08);

  --list-bg: #eef0f6;
  --card-shadow: 0 1px 0 rgba(27, 28, 48, .06), 0 1px 3px rgba(27, 28, 48, .06);
  --shadow-sm: 0 1px 2px rgba(27, 28, 48, .05);
  --shadow: 0 2px 4px rgba(27, 28, 48, .03), 0 8px 24px rgba(27, 28, 48, .07);
  --shadow-lg: 0 16px 48px rgba(27, 28, 48, .18);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --sidebar: 268px;
  --font: "Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #111220;
  --bg-soft: #1a1b2b;
  --surface: #1b1c2c;
  --surface-2: #202133;
  --line: #2a2c41;
  --line-strong: #36384f;
  --text: #ececf6;
  --text-2: #b6b8cf;
  --muted: #80839e;
  --accent: #8c80f7;
  --accent-soft: #29264d;
  --accent-ink: #b5adff;
  --danger-soft: #3b1f26;
  --warn-soft: #3a2e1a;
  --ok-soft: #173327;
  --info-soft: #1b2a45;
  --side-bg: linear-gradient(180deg, #121130 0%, #0e0d26 100%);
  --list-bg: #171828;
  --card-shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow: 0 2px 4px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.6;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-decoration: none; }
a.stat, a.prog-row, a.pcard, a.feed-item { color: inherit; }
svg { width: 1em; height: 1em; flex: none; }
.muted { color: var(--muted); }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none !important; }

/* ============ Buttons & fields ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 600; font-size: 14px; white-space: nowrap; color: var(--text);
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; pointer-events: none; }
.btn-primary {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -4px rgba(108, 92, 231, .55);
}
.btn-primary:hover { background: var(--grad); filter: brightness(1.06); border-color: transparent; box-shadow: 0 8px 22px -4px rgba(108, 92, 231, .65); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-soft); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-block { width: 100%; height: 48px; font-size: 15px; border-radius: 12px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-glass { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .25); color: #fff; backdrop-filter: blur(6px); }
.btn-glass:hover { background: rgba(255, 255, 255, .28); border-color: rgba(255, 255, 255, .4); }

.icon-btn {
  display: inline-grid; place-items: center; position: relative;
  width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn.glass { color: #fff; background: rgba(255, 255, 255, .16); }
.icon-btn.glass:hover { background: rgba(255, 255, 255, .28); }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, .field input, .field select, .field textarea {
  width: 100%; height: 44px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: 11px;
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; min-height: 80px; padding: 10px 13px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft);
}
select { cursor: pointer; }

/* ============ Auth ============ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(800px 500px at 80% -10%, rgba(124, 108, 240, .9), transparent 60%),
              radial-gradient(700px 500px at 0% 110%, rgba(51, 194, 179, .75), transparent 60%),
              #1d1a4a;
  display: flex; align-items: center; justify-content: center; padding: 48px;
}
.auth-side::after {
  content: ""; position: absolute; inset: 0; opacity: .12;
  background-image: radial-gradient(rgba(255, 255, 255, .8) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000, transparent 80%);
}
.auth-side-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-side h2 { font-size: 30px; line-height: 1.5; margin: 34px 0 24px; letter-spacing: -.3px; }
.auth-feats { list-style: none; padding: 0; margin: 0 0 34px; display: grid; gap: 12px; }
.auth-feats li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: rgba(255, 255, 255, .88); }
.auth-feats span { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); font-size: 17px; }
.auth-mock { display: flex; gap: 10px; }
.mock-col { flex: 1; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; backdrop-filter: blur(6px); }
.mock-col i { height: 6px; width: 40%; border-radius: 6px; }
.mock-col b { height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .85); }
.mock-col b.s { height: 22px; opacity: .6; }
.auth > form { align-self: center; justify-self: center; }
.auth-card {
  width: calc(100% - 48px); max-width: 400px; margin: 40px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  padding: 36px 32px 28px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 26px 0 4px; font-size: 26px; }
.auth-card .muted { margin: 0 0 24px; }
.auth-error { color: var(--danger); font-size: 13.5px; min-height: 20px; margin: 12px 0 0; text-align: center; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; background: radial-gradient(600px 300px at 80% 0, rgba(124, 108, 240, .25), transparent 70%), var(--bg); }
  .auth-side { display: none; }
}

/* ============ Brand ============ */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16.5px; letter-spacing: -.2px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 6px 16px -4px rgba(108, 92, 231, .6);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.brand-lg { font-size: 19px; }
.brand-lg .brand-mark { width: 40px; height: 40px; border-radius: 13px; }
.brand-light { color: #fff; }

/* ============ Layout ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar);
  background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; padding: 20px 14px 14px; z-index: 30; overflow-y: auto;
}
.sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); background-clip: content-box; }
.sidebar > .brand { padding: 2px 8px 22px; color: #fff; }
.main { flex: 1; margin-inline-start: var(--sidebar); min-width: 0; display: flex; flex-direction: column; position: relative; }
.main::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 340px; pointer-events: none; z-index: 0;
  background: radial-gradient(600px 240px at 85% -40px, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
              radial-gradient(500px 220px at 10% -60px, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px; border-radius: 11px;
  color: var(--side-text); font-weight: 500; position: relative;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; inset-inline-start: -14px; top: 9px; bottom: 9px; width: 4px;
  border-radius: 0 4px 4px 0; background: linear-gradient(#a99cff, #5ee0cf);
}
[dir="rtl"] .nav-item.active::before { border-radius: 4px 0 0 4px; }
.nav-item svg { width: 19px; height: 19px; opacity: .9; }
.nav-item .count {
  margin-inline-start: auto; font-size: 11.5px; font-weight: 600; color: rgba(255, 255, 255, .7);
  min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 20px; background: rgba(255, 255, 255, .08);
}
.nav-item .count.hot { background: #ff5d6c; color: #fff; }
.nav-section { margin-top: 24px; }
.nav-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 11px 8px; font-size: 11.5px; font-weight: 700; color: rgba(255, 255, 255, .42); letter-spacing: .4px;
}
.nav-section-head .icon-btn { color: rgba(255, 255, 255, .6); }
.nav-section-head .icon-btn:hover { background: var(--side-hover); color: #fff; }
.p-dot { width: 10px; height: 10px; border-radius: 4px; flex: none; display: inline-block; }
.nav-item .p-dot { margin-inline: 4px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .06); }
.nav-item .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-empty { padding: 6px 11px; font-size: 13px; color: rgba(255, 255, 255, .4); }
.sidebar-foot {
  margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--side-line);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-foot .who b { display: block; font-size: 14px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who small { color: rgba(255, 255, 255, .45); font-size: 12px; }
.sidebar-foot .icon-btn { color: rgba(255, 255, 255, .65); }
.sidebar-foot .icon-btn:hover { background: var(--side-hover); color: #fff; }
.sidebar .av { box-shadow: 0 0 0 2px #1d1a4a; }

.topbar {
  position: sticky; top: 0; z-index: 20; height: 68px;
  display: flex; align-items: center; gap: 14px; padding: 0 30px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.page-title { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; min-width: 0; }
.page-title .p-dot { width: 14px; height: 14px; border-radius: 5px; }
.page-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 40px; width: 270px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px; color: var(--muted);
  transition: border-color .15s, box-shadow .15s, width .25s; box-shadow: var(--shadow-sm);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); width: 330px; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); }
.search svg { width: 16px; height: 16px; }
.bell .badge {
  position: absolute; top: 3px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 10px; background: #ff5d6c; color: #fff; font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg);
}
.bell.ring svg { animation: ring .9s ease; transform-origin: 50% 10%; }
@keyframes ring { 15%, 45% { transform: rotate(14deg); } 30%, 60% { transform: rotate(-14deg); } 75% { transform: rotate(5deg); } }
.menu-btn { display: none; }
.content { padding: 6px 30px 70px; flex: 1; position: relative; z-index: 1; min-width: 0; }
.ic-plus, .bell-ic { display: inline-flex; }
.ic-plus svg { width: 16px; height: 16px; }

/* ============ Home ============ */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 28px 30px; margin: 10px 0 20px;
  color: #fff; background: radial-gradient(500px 300px at 0% 120%, rgba(51, 194, 179, .7), transparent 60%), var(--grad);
  display: flex; align-items: center; gap: 24px; box-shadow: 0 18px 40px -18px rgba(108, 92, 231, .7);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09);
}
.hero::before { width: 260px; height: 260px; top: -110px; inset-inline-end: 140px; }
.hero::after { width: 160px; height: 160px; bottom: -80px; inset-inline-end: -30px; }
.hero > * { position: relative; z-index: 1; }
.hero h2 { margin: 0; font-size: 27px; letter-spacing: -.3px; }
.hero p { margin: 6px 0 0; opacity: .9; font-size: 15px; }
.hero .date { display: inline-block; font-size: 12.5px; padding: 3px 11px; border-radius: 20px; background: rgba(255, 255, 255, .18); margin-bottom: 10px; }
.hero-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.hero .ring { margin-inline-start: auto; flex: none; text-align: center; }
.ring-wrap { position: relative; width: 112px; height: 112px; }
.ring-wrap svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring-wrap .rv { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; line-height: 1.1; }
.ring-wrap .rv b { font-size: 26px; }
.ring-wrap .rv small { font-size: 11.5px; opacity: .85; }
.ring-cap { font-size: 12.5px; opacity: .85; margin-top: 6px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; }
.stat-ic svg { width: 22px; height: 22px; }
.stat b { display: block; font-size: 25px; line-height: 1.1; }
.stat small { color: var(--muted); font-size: 13px; }
.g-accent { background: linear-gradient(135deg, #8b7cf6, #6c5ce7); box-shadow: 0 6px 14px -4px rgba(108, 92, 231, .5); }
.g-danger { background: linear-gradient(135deg, #ff7a85, #e5484d); box-shadow: 0 6px 14px -4px rgba(229, 72, 77, .5); }
.g-warn { background: linear-gradient(135deg, #ffc15e, #f2930c); box-shadow: 0 6px 14px -4px rgba(242, 147, 12, .5); }
.g-ok { background: linear-gradient(135deg, #4fd39a, #1f9d63); box-shadow: 0 6px 14px -4px rgba(31, 157, 99, .5); }
.tone-accent { background: var(--accent-soft); color: var(--accent-ink); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 8px; }
.card-head h3 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 4px 18px 16px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; }
.section-title h3 { margin: 0; font-size: 16.5px; }

.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pcard {
  position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  padding: 16px; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; display: block;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 64px; background: linear-gradient(135deg, var(--pc), color-mix(in srgb, var(--pc) 55%, #fff)); opacity: .95; }
.pcard > * { position: relative; }
.pcard .pc-badge {
  width: 46px; height: 46px; border-radius: 14px; background: var(--surface); color: var(--pc);
  display: grid; place-items: center; font-weight: 700; font-size: 18px; margin-top: 18px; box-shadow: var(--shadow);
}
.pcard h4 { margin: 10px 0 2px; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pc-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.pcard .bar { width: 100%; margin-top: 10px; }
.av-stack { display: inline-flex; }
.av-stack .av + .av { margin-inline-start: -7px; }

.prog-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.prog-row + .prog-row { border-top: 1px dashed var(--line); }
.bar { height: 7px; border-radius: 7px; background: var(--bg-soft); overflow: hidden; width: 90px; flex: none; }
.bar > i { display: block; height: 100%; border-radius: inherit; transition: width .5s; }
.load-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; cursor: pointer; }
.load-row + .load-row { border-top: 1px dashed var(--line); }
.load-row .name { flex: 1; font-weight: 500; min-width: 0; }
.load-row .lbar { display: flex; height: 7px; border-radius: 7px; overflow: hidden; background: var(--bg-soft); margin-top: 5px; }
.load-row .lbar i { display: block; height: 100%; }
.chip-n { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; padding: 9px 0; align-items: flex-start; cursor: pointer; }
.feed-item + .feed-item { border-top: 1px dashed var(--line); }
.feed-item .ft { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.55; }
.feed-item .ft b { font-weight: 600; }
.feed-item .ft .tt { color: var(--accent-ink); font-weight: 500; }
.feed-item small { display: block; color: var(--muted); font-size: 12px; }

/* ============ Avatars ============ */
.av {
  --c: var(--accent);
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 75%, #fff), var(--c)); box-shadow: 0 0 0 2px var(--surface);
}
.av.lg { width: 40px; height: 40px; font-size: 15px; }
.av.xl { width: 54px; height: 54px; font-size: 19px; }
.av.xs { width: 24px; height: 24px; font-size: 10px; }
.av.empty { background: transparent; color: var(--muted); border: 1.5px dashed var(--line-strong); box-shadow: none; }
.av.empty svg { width: 13px; height: 13px; }
.av.sys { background: var(--grad); }
.av.sys svg { width: 13px; height: 13px; }

/* ============ Labels ============ */
.lbl {
  --l: var(--accent);
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; white-space: nowrap; color: #fff; background: var(--l);
  max-width: 140px; overflow: hidden; text-overflow: ellipsis;
}
.lbls { display: flex; flex-wrap: wrap; gap: 4px; }
.lbl.soft { color: color-mix(in srgb, var(--l) 85%, #000); background: color-mix(in srgb, var(--l) 16%, transparent); }
:root[data-theme="dark"] .lbl.soft { color: color-mix(in srgb, var(--l) 60%, #fff); background: color-mix(in srgb, var(--l) 25%, transparent); }

/* ============ Task rows (list) ============ */
.group { margin-bottom: 18px; }
.group-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px; margin-bottom: 6px;
  font-weight: 700; font-size: 14px; cursor: pointer; user-select: none;
}
.group-head .chev { transition: transform .2s; color: var(--muted); display: inline-flex; }
.group.collapsed .chev { transform: rotate(90deg); }
.group.collapsed .rows { display: none; }
.group-head .n { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--bg-soft); padding: 0 8px; border-radius: 20px; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); }
.card .rows { border: 0; box-shadow: none; border-radius: 0; background: transparent; }
.card .rows .row { padding-inline: 4px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px; min-height: 52px;
  border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.selected { background: var(--accent-soft); }
.row .title { flex: 1; min-width: 0; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.row .title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .title .lbls { flex-wrap: nowrap; }
.row.is-done .title span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.row .meta { display: flex; align-items: center; gap: 10px; flex: none; }
.row-add { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: var(--muted); }
.row-add input { flex: 1; border: 0; outline: 0; background: transparent; padding: 4px 0; }
.row-add svg { width: 16px; height: 16px; }

.check {
  width: 21px; height: 21px; border-radius: 50%; flex: none;
  border: 1.8px solid var(--line-strong); background: transparent;
  display: grid; place-items: center; padding: 0; color: transparent; transition: all .15s;
}
.check svg { width: 12px; height: 12px; stroke-width: 3.2; }
.check:hover { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.check.pop { animation: pop .35s ease; }
@keyframes pop { 40% { transform: scale(1.35); } }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--bg-soft); color: var(--text-2);
}
.tag .p-dot { width: 8px; height: 8px; border-radius: 3px; }
.tag svg { width: 13px; height: 13px; }
.tag.overdue { background: var(--danger-soft); color: var(--danger); }
.tag.today { background: var(--warn-soft); color: var(--warn); }
.tag.soon { background: var(--info-soft); color: var(--info); }
.tag.donedue { background: var(--ok-soft); color: var(--ok); }
.prio { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.prio.high { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.st-pill { font-size: 11.5px; font-weight: 600; padding: 2px 10px; border-radius: 20px; white-space: nowrap; }
.st-todo { background: var(--bg-soft); color: var(--text-2); }
.st-doing { background: var(--info-soft); color: var(--info); }
.st-review { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.mini { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.mini svg { width: 14px; height: 14px; }
.mini.ok { color: var(--ok); }

/* ============ Toolbar ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 18px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; box-shadow: var(--shadow-sm); }
.seg button {
  border: 0; background: transparent; height: 32px; padding: 0 13px; border-radius: 9px;
  font-weight: 600; font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px;
}
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); }
.filter {
  height: 38px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13px; font-weight: 500; outline: none; box-shadow: var(--shadow-sm);
}
.filter:focus { border-color: var(--accent); }
.filter.on { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.avatars-filter { display: inline-flex; align-items: center; gap: 3px; padding-inline: 4px; }
.avatars-filter .av { cursor: pointer; opacity: .5; transition: opacity .15s, transform .15s; }
.avatars-filter .av:hover { opacity: .85; }
.avatars-filter .av.on { opacity: 1; transform: scale(1.12); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--c); }
.spacer { flex: 1; }
.toggle-done { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch { width: 34px; height: 20px; border-radius: 20px; background: var(--line-strong); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .2s; box-shadow: var(--shadow-sm); }
.toggle-done.on .switch { background: var(--accent); }
.toggle-done.on .switch::after { inset-inline-start: 16px; }

/* ============ Project banner ============ */
.pbanner {
  --pc: var(--accent);
  position: relative; overflow: hidden; border-radius: 22px; margin: 10px 0 4px; padding: 22px 24px;
  color: #fff; display: flex; align-items: center; gap: 18px;
  background: radial-gradient(400px 220px at 0% 120%, rgba(255, 255, 255, .25), transparent 60%),
              linear-gradient(135deg, var(--pc), color-mix(in srgb, var(--pc) 60%, #1d1a4a));
  box-shadow: 0 16px 36px -18px var(--pc);
}
.pbanner::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255, 255, 255, .1); top: -90px; inset-inline-end: 60px; }
.pbanner > * { position: relative; z-index: 1; }
.pbanner .pb-badge {
  width: 60px; height: 60px; border-radius: 18px; background: rgba(255, 255, 255, .2); backdrop-filter: blur(6px);
  display: grid; place-items: center; font-size: 24px; font-weight: 700; flex: none; border: 1px solid rgba(255, 255, 255, .3);
}
.pbanner h2 { margin: 0; font-size: 23px; }
.pbanner p { margin: 2px 0 0; opacity: .88; max-width: 620px; }
.pb-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; opacity: .95; }
.pb-progress .bar { width: 180px; background: rgba(255, 255, 255, .25); }
.pb-progress .bar i { background: #fff; }
.pb-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex: none; }
.pbanner .av { box-shadow: 0 0 0 2px color-mix(in srgb, var(--pc) 70%, #000); }

/* ============ Board (Trello-style) ============ */
.board-wrap {
  margin: 0 -30px; padding: 4px 30px 20px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
}
.board { display: flex; gap: 14px; align-items: flex-start; width: max-content; min-width: 100%; }
.col {
  width: 300px; flex: none; background: var(--list-bg); border-radius: 16px; padding: 0 8px 8px;
  max-height: calc(100vh - 250px); display: flex; flex-direction: column; scroll-snap-align: start;
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.col::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--sc, var(--line-strong)); }
.col.drop { box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--list-bg)); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 14px 8px 10px; font-weight: 700; font-size: 14px; flex: none; }
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.col-head .n { color: var(--text-2); font-weight: 600; font-size: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 24px; text-align: center; padding: 0 7px; border-radius: 20px; }
.col-head .icon-btn { margin-inline-start: auto; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 12px; overflow-y: auto; padding: 2px 4px 4px; margin: 0 -2px; flex: 1 1 auto; }
.cards:empty { min-height: 64px; border: 1.5px dashed var(--line-strong); border-radius: 12px; margin: 2px 2px 0; }
.cards:empty::after { content: "اسحب بطاقة إلى هنا"; margin: auto; font-size: 12.5px; color: var(--muted); }
.tcard {
  flex: none; position: relative; background: var(--surface); border-radius: 12px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(27, 28, 48, .06); border: 1px solid var(--line); overflow: hidden;
  transition: box-shadow .15s, border-color .15s, transform .15s;
  -webkit-touch-callout: none; user-select: none; touch-action: manipulation;
}
.tcard:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: 0 6px 18px -8px rgba(27, 28, 48, .25); transform: translateY(-1px); }
.tcard.prio-high { border-inline-start: 3px solid var(--danger); }
.tcard.drag-src { display: none; }
.tcard .cover { height: 34px; }
.tcard .cover.img { height: 140px; background: var(--bg-soft); }
.tcard .cover.img img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.tc-body { padding: 11px 13px 10px; }
.tc-body .lbls { margin-bottom: 8px; }
.tc-title { font-weight: 500; font-size: 14px; line-height: 1.6; word-wrap: break-word; color: var(--text); padding-inline-end: 18px; }
.tcard.is-done .tc-title { color: var(--muted); text-decoration: line-through; }
.tc-badges { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; min-height: 26px; }
.tc-badges .tag { height: 22px; padding: 0 7px; font-size: 11.5px; border-radius: 6px; }
.tc-badges .mini { color: var(--muted); }
.tc-badges > .av-stack, .tc-badges > .av { margin-inline-start: auto; }
.tc-proj { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.tc-proj .p-dot { width: 7px; height: 7px; border-radius: 2px; }
.tc-check {
  position: absolute; top: 9px; inset-inline-end: 9px; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center; padding: 0;
  background: var(--surface); color: var(--muted); opacity: 0; transform: scale(.8);
  transition: opacity .15s, transform .15s, background .15s, color .15s, border-color .15s;
}
.tc-check svg { width: 13px; height: 13px; stroke-width: 3; }
.tcard:hover .tc-check { opacity: 1; transform: none; }
.tc-check:hover { background: var(--ok); border-color: var(--ok); color: #fff; }
.tcard.is-done .tc-check { opacity: 1; transform: none; background: var(--ok); border-color: var(--ok); color: #fff; }
.card-ph { border-radius: 12px; background: color-mix(in srgb, var(--text) 9%, transparent); border: 2px dashed color-mix(in srgb, var(--text) 14%, transparent); flex: none; }
.drag-ghost {
  position: fixed !important; top: 0; left: 0; z-index: 200; pointer-events: none; margin: 0 !important;
  box-shadow: 0 18px 40px rgba(27, 28, 48, .28) !important; opacity: .97; transition: none !important;
}
.tcard.drag-ghost { transform-origin: 30% 20%; }
.col-add {
  width: 100%; margin-top: 6px; border: 0; background: transparent; flex: none;
  color: var(--text-2); padding: 9px 10px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.col-add:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.col-add svg { width: 15px; height: 15px; }
.col-add-wrap { flex: none; }
.col-input {
  width: 100%; margin-top: 6px; border: 0; border-radius: 12px; display: block;
  background: var(--surface); padding: 10px 12px; outline: none; box-shadow: var(--card-shadow), 0 0 0 2px var(--accent);
  resize: none; min-height: 64px;
}
.col-input-actions { display: flex; gap: 6px; margin-top: 6px; }

/* ============ Calendar ============ */
.cal-head { display: flex; align-items: center; gap: 10px; margin: 12px 0 14px; flex-wrap: wrap; }
.cal-head h3 { margin: 0; font-size: 19px; min-width: 150px; }
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm); }
.cal-wd, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd div { padding: 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-day { min-height: 118px; border-inline-start: 1px solid var(--line); border-top: 1px solid var(--line); padding: 6px; cursor: pointer; transition: background .12s; min-width: 0; }
.cal-grid .cal-day:nth-child(7n+1) { border-inline-start: 0; }
.cal-grid .cal-day:nth-child(-n+7) { border-top: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.out { background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
.cal-day.out .cal-num { opacity: .45; }
.cal-day.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { font-size: 12.5px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 4px; }
.cal-day.today .cal-num { background: var(--grad); color: #fff; }
.cal-items { display: flex; flex-direction: column; gap: 3px; }
.cal-chip {
  --c: var(--accent);
  font-size: 12px; font-weight: 500; padding: 3px 7px; border-radius: 6px; cursor: grab;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-inline-start: 3px solid var(--c);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
.cal-chip:hover { background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.cal-chip.done { opacity: .5; text-decoration: line-through; }
.cal-chip.overdue { border-inline-start-color: var(--danger); }
.cal-chip.drag-src { opacity: .3; }
.cal-more { font-size: 11.5px; color: var(--accent-ink); font-weight: 600; padding: 1px 6px; }

/* ============ Empty ============ */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .em { font-size: 44px; margin-bottom: 8px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 0 16px; }

/* ============ Team ============ */
.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.member { padding: 0; overflow: hidden; }
.member.inactive { opacity: .55; }
.member-cover { height: 58px; background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 50%, #fff)); }
.member-top { display: flex; align-items: flex-end; gap: 12px; padding: 0 18px; margin-top: -26px; }
.member-top .av { box-shadow: 0 0 0 4px var(--surface); }
.member-top .icon-btn { margin-inline-start: auto; }
.member-name { padding: 8px 18px 0; }
.member-name b { display: block; font-size: 16px; }
.member-name small { color: var(--muted); }
.member-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; padding: 14px 18px 18px; }
.member-stats div { background: var(--bg-soft); border-radius: 12px; padding: 9px 4px; cursor: pointer; transition: background .15s; }
.member-stats div:hover { background: var(--accent-soft); }
.member-stats b { display: block; font-size: 19px; }
.member-stats small { font-size: 11.5px; color: var(--muted); }
.role-badge { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-ink); margin-inline-start: 6px; vertical-align: middle; }

/* ============ Drawer ============ */
.drawer {
  position: fixed; inset-block: 0; inset-inline-end: 0; width: min(620px, 100vw);
  background: var(--surface); border-inline-start: 1px solid var(--line);
  box-shadow: var(--shadow-lg); z-index: 50;
  transform: translateX(-105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer.dragover::after {
  content: "أفلت الملفات هنا لإرفاقها"; position: absolute; inset: 10px; border-radius: 16px; z-index: 5;
  border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); font-size: 16px;
}
.dr-cover { height: 120px; flex: none; position: relative; background-size: cover; background-position: center; }
.dr-cover.img { height: 190px; }
.dr-head { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex: none; }
.dr-head .btn { height: 34px; }
.dr-head .grow { flex: 1; }
.dr-head .btn.is-done { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.dr-body { flex: 1; overflow-y: auto; padding: 18px 26px 30px; }
.dr-crumb { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.dr-title {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  font-size: 23px; font-weight: 700; line-height: 1.45; padding: 6px 8px; margin: 0 -8px 8px;
  border-radius: 10px; overflow: hidden; display: block;
}
.dr-title:hover { background: var(--bg-soft); }
.dr-title:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent-soft), inset 0 0 0 1px var(--accent); }
.dr-labels { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; }
.dr-labels .lbl { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 7px; cursor: pointer; max-width: none; }
.add-chip {
  height: 26px; padding: 0 10px; border-radius: 7px; border: 1px dashed var(--line-strong); background: transparent;
  font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 5px;
}
.add-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.add-chip svg { width: 13px; height: 13px; }
.props { display: grid; grid-template-columns: 122px 1fr; gap: 4px 10px; align-items: center; margin-bottom: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; }
.props > label { color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.props > label svg { width: 16px; height: 16px; }
.prop-ctl {
  height: 38px; border: 1px solid transparent; border-radius: 9px; background: transparent;
  padding: 0 10px; outline: none; font-weight: 500; width: 100%; max-width: 300px;
  transition: background .12s, border-color .12s;
}
.prop-ctl:hover { background: var(--bg-soft); }
.prop-ctl:focus { border-color: var(--accent); background: var(--surface); }
.prop-wrap { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-height: 40px; }
.prop-wrap .av { margin-inline-start: 6px; }
.prio-seg { display: inline-flex; gap: 6px; flex-wrap: wrap; padding: 4px 0; }
.prio-seg button {
  height: 31px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--text-2);
}
.prio-seg button.on { border-color: currentColor; }
.prio-seg button[data-v="high"].on { color: var(--danger); background: var(--danger-soft); }
.prio-seg button[data-v="normal"].on { color: var(--accent-ink); background: var(--accent-soft); }
.prio-seg button[data-v="low"].on { color: var(--text-2); background: var(--bg-soft); }
.status-seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px 0; }
.status-seg button { border: 1px solid transparent; cursor: pointer; font-size: 12.5px; padding: 4px 12px; opacity: .55; }
.status-seg button:hover { opacity: .85; }
.status-seg button.on { opacity: 1; border-color: currentColor; }
.dr-section { margin-top: 24px; }
.dr-section h4 { margin: 0 0 10px; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.dr-section h4 svg { width: 17px; height: 17px; color: var(--muted); }
.dr-section h4 .n { color: var(--muted); font-weight: 500; font-size: 13px; }
.dr-section h4 .act { margin-inline-start: auto; }
.desc {
  width: 100%; min-height: 96px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
  padding: 12px 14px; outline: none; resize: none; line-height: 1.8; overflow: hidden; display: block;
}
.desc:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.subs { display: flex; flex-direction: column; }
.sub { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; margin: 0 -8px; }
.sub:hover { background: var(--bg-soft); }
.sub .check { width: 19px; height: 19px; }
.sub input.st { flex: 1; border: 0; outline: 0; background: transparent; padding: 2px 0; min-width: 0; }
.sub.done input.st { color: var(--muted); text-decoration: line-through; }
.sub .icon-btn { opacity: 0; }
.sub:hover .icon-btn { opacity: 1; }
.sub-add { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--muted); }
.sub-add input { flex: 1; border: 0; border-bottom: 1px dashed var(--line-strong); outline: 0; background: transparent; padding: 6px 0; }
.sub-add input:focus { border-bottom-color: var(--accent); }
.sub-add svg { width: 16px; height: 16px; }
.sub-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.sub-progress .bar { flex: 1; width: auto; height: 6px; }
.sub-progress .bar i { background: var(--ok); }

.atts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.att { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); display: flex; flex-direction: column; }
.att .thumb { height: 92px; display: grid; place-items: center; background: var(--bg-soft); color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: .5px; }
.att .thumb img { width: 100%; height: 100%; object-fit: cover; }
.att .an { padding: 7px 9px; font-size: 12px; line-height: 1.4; }
.att .an b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att .an small { color: var(--muted); }
.att .att-tools { position: absolute; top: 6px; inset-inline-end: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.att:hover .att-tools { opacity: 1; }
.att .att-tools button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: rgba(20, 20, 35, .65); color: #fff; display: grid; place-items: center; }
.att .att-tools svg { width: 14px; height: 14px; }
.att.is-cover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.drop-hint {
  border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 14px; text-align: center; color: var(--muted);
  font-size: 13px; cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.drop-hint:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.uploading { font-size: 12.5px; color: var(--accent-ink); margin-top: 6px; }

.stream { display: flex; flex-direction: column; gap: 12px; }
.cmt { display: flex; gap: 10px; }
.cmt-body { flex: 1; min-width: 0; }
.cmt-meta { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cmt-meta b { color: var(--text); font-size: 13.5px; }
.cmt-meta .icon-btn { margin-inline-start: auto; opacity: 0; }
.cmt:hover .cmt-meta .icon-btn { opacity: 1; }
.cmt-text { background: var(--bg-soft); border-radius: 4px 14px 14px 14px; padding: 9px 13px; margin-top: 4px; white-space: pre-wrap; word-wrap: break-word; }
[dir="rtl"] .cmt-text { border-radius: 14px 4px 14px 14px; }
.cmt-text .mention { color: var(--accent-ink); font-weight: 600; background: var(--accent-soft); padding: 0 4px; border-radius: 5px; }
.cmt-text a { text-decoration: underline; word-break: break-all; }
.act-line { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); padding-inline-start: 4px; }
.act-line .dotl { width: 18px; display: grid; place-items: center; flex: none; }
.act-line .dotl i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.act-line b { color: var(--text-2); font-weight: 600; }
.cmt-form { position: relative; display: flex; gap: 10px; margin-top: 16px; align-items: flex-start; }
.cmt-form textarea {
  flex: 1; border: 1px solid var(--line-strong); border-radius: 14px; padding: 10px 13px; resize: none;
  min-height: 44px; outline: none; background: var(--surface); line-height: 1.6;
}
.cmt-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.mention-box {
  position: absolute; bottom: calc(100% + 6px); inset-inline-start: 36px; z-index: 5; min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px;
}
.mention-box button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 7px 9px; border-radius: 8px; text-align: start; }
.mention-box button:hover, .mention-box button.on { background: var(--accent-soft); }
.dr-foot { font-size: 12.5px; color: var(--muted); margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--line); }
.drawer-loading { padding: 40px; text-align: center; color: var(--muted); }
.recur-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.recur-badge svg { width: 13px; height: 13px; }

/* ============ Modal ============ */
.modal-root:empty { display: none; }
.modal-back {
  position: fixed; inset: 0; z-index: 80; background: rgba(16, 15, 40, .45);
  backdrop-filter: blur(4px); display: grid; place-items: start center; padding: 10vh 16px 16px; overflow-y: auto;
  animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 580px; background: var(--surface); border-radius: 22px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 4px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 14px 22px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 12px 22px 18px; flex-wrap: wrap; }
.modal-foot .hint { margin-inline-end: auto; font-size: 12px; color: var(--muted); }
kbd { font-family: inherit; font-size: 11px; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; background: var(--surface-2); }
.qa-title { width: 100%; border: 0; outline: 0; font-size: 20px; font-weight: 600; padding: 6px 0 10px; background: transparent; }
.qa-desc { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--text-2); min-height: 44px; }
.qa-props { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.qa-props select, .qa-props input {
  height: 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  padding: 0 10px; font-size: 13px; font-weight: 500; outline: none; max-width: 100%;
}
.qa-props select:focus, .qa-props input:focus { border-color: var(--accent); }
.qa-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.qa-labels .lbl { cursor: pointer; height: 26px; padding: 0 10px; font-size: 12px; border-radius: 7px; opacity: .4; transition: opacity .12s, transform .12s; max-width: none; }
.qa-labels .lbl.on { opacity: 1; transform: scale(1.04); }
.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.colors button {
  width: 30px; height: 30px; border-radius: 9px; border: 0; background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); transition: transform .12s;
}
.colors button:hover { transform: scale(1.1); }
.colors button.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.colors.sm button { width: 26px; height: 26px; border-radius: 7px; }
.shortcuts { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; align-items: center; }
.report-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; max-height: 50vh; overflow-y: auto; }
.report-box h5 { margin: 14px 0 6px; font-size: 14px; }
.report-box h5:first-child { margin-top: 0; }
.report-box ul { margin: 0; padding-inline-start: 20px; }
.report-box li { margin: 3px 0; }
.report-box li small { color: var(--muted); }
.label-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.label-row input { flex: 1; height: 36px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: var(--surface); outline: none; }
.label-row input:focus { border-color: var(--accent); }
.label-row .sw { width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--c); flex: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ============ Popover / menu ============ */
.menu, .pop {
  position: fixed; z-index: 90; min-width: 200px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px;
  animation: fade .12s;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent;
  padding: 8px 10px; border-radius: 9px; text-align: start; font-size: 13.5px;
}
.menu button:hover { background: var(--bg-soft); }
.menu button.danger { color: var(--danger); }
.menu button svg { width: 16px; height: 16px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.pop { padding: 12px; width: 290px; }
.pop h5 { margin: 0 0 10px; font-size: 13.5px; text-align: center; color: var(--text-2); }
.pop .pick { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.pop .pick .lbl { flex: 1; height: 32px; font-size: 13px; border-radius: 8px; cursor: pointer; max-width: none; padding: 0 12px; }
.pop .pick .ck { width: 20px; height: 20px; border-radius: 6px; border: 1.8px solid var(--line-strong); display: grid; place-items: center; color: transparent; flex: none; cursor: pointer; }
.pop .pick .ck.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pop .pick .ck svg { width: 12px; height: 12px; stroke-width: 3; }
.pop .pop-new { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pop .pop-new input { flex: 1; height: 34px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 0 10px; outline: none; background: var(--surface); min-width: 0; }
.pop .pop-new input:focus { border-color: var(--accent); }
.cover-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.cover-grid button { height: 32px; border-radius: 8px; border: 0; background: var(--c); }
.cover-grid button.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.cover-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.cover-imgs button { height: 54px; border-radius: 8px; border: 0; padding: 0; overflow: hidden; background: var(--bg-soft); }
.cover-imgs img { width: 100%; height: 100%; object-fit: cover; }

/* Notifications panel */
.notif-panel { position: fixed; z-index: 90; width: 380px; max-width: calc(100vw - 20px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rise .18s; }
.np-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.np-head h4 { margin: 0; font-size: 15px; }
.np-list { max-height: min(460px, 65vh); overflow-y: auto; }
.np-item { display: flex; gap: 11px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line); position: relative; transition: background .1s; }
.np-item:last-child { border-bottom: 0; }
.np-item:hover { background: var(--surface-2); }
.np-item.unread { background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.np-item.unread::after { content: ""; position: absolute; top: 18px; inset-inline-end: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.np-item .nt { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.55; padding-inline-end: 12px; }
.np-item .nt q { quotes: "«" "»"; font-weight: 600; }
.np-item .snip { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.np-item small { color: var(--muted); font-size: 11.5px; }
.np-foot { padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.np-foot .btn { margin-inline-start: auto; }

/* ============ Toasts ============ */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #1d1a4a; color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 14px; animation: rise .2s;
}
:root[data-theme="dark"] .toast { background: #ececf6; color: #1b1c30; }
.toast.err { background: var(--danger); color: #fff; }
.toast button { border: 0; background: transparent; color: #b5adff; font-weight: 700; padding: 0; }
:root[data-theme="dark"] .toast button { color: var(--accent-ink); }
:root[data-theme="dark"] .toast:not(.err) button { color: #5141d4; }

.celebrate { position: fixed; pointer-events: none; z-index: 300; font-size: 22px; animation: fly 1s ease-out forwards; }
@keyframes fly { to { transform: translateY(-90px) scale(1.5); opacity: 0; } }

/* ============ Multiple assignees ============ */
.av.more { background: var(--bg-soft); color: var(--text-2); font-size: 9.5px; box-shadow: 0 0 0 2px var(--surface); }
.a-chips { gap: 6px; padding: 4px 0; }
.prop-wrap.a-chips .av { margin: 0; }
.a-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 4px 0 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.a-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.a-chips .add-chip { height: 30px; border-radius: 20px; }
.pop .pick .pn { flex: 1; cursor: pointer; font-size: 13.5px; }
.pop .pick:has(.pn) { padding: 6px 6px; border-radius: 9px; cursor: pointer; }
.pop .pick:has(.pn):hover { background: var(--bg-soft); }
.qa-people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.qa-cap { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); margin-inline-end: 2px; }
.qa-cap svg { width: 15px; height: 15px; }
.qa-person {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 4px 0 12px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface-2); font-size: 13px; font-weight: 500; opacity: .6;
  transition: opacity .12s, border-color .12s, background .12s;
}
.qa-person:hover { opacity: .9; }
.qa-person.on { opacity: 1; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

/* ============ Presence ============ */
.av-wrap { position: relative; display: inline-flex; flex: none; }
.av-wrap .online {
  position: absolute; bottom: -1px; inset-inline-end: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 2.5px var(--surface);
}
.member-top .av-wrap .online { width: 15px; height: 15px; bottom: 2px; inset-inline-end: 2px; box-shadow: 0 0 0 3px var(--surface); }

/* ============ Font picker ============ */
.fonts { display: grid; gap: 8px; }
.font-opt {
  position: relative; display: grid; gap: 2px; text-align: start; padding: 12px 16px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .12s, background .12s;
}
.font-opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.font-opt b { font-size: 16.5px; font-weight: 600; }
.font-opt small { color: var(--muted); font-size: 12px; font-family: system-ui, sans-serif; }
.font-opt .ck { position: absolute; top: 50%; inset-inline-end: 14px; transform: translateY(-50%); width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center; background: var(--accent); color: #fff; }
.font-opt .ck svg { width: 14px; height: 14px; stroke-width: 3; }
.font-opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.font-opt.on .ck { display: grid; }

/* ============ Chat ============ */
:root { --chat-bg: #f5f5fb; --bubble-in: #ffffff; }
:root[data-theme="dark"] { --chat-bg: #141523; --bubble-in: #24253a; }
.chat-mode .content { padding-bottom: 14px; }
.chat {
  display: grid; grid-template-columns: 310px minmax(0, 1fr);
  height: calc(100vh - 92px); height: calc(100dvh - 92px); min-height: 420px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow);
}
.chat-list { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--surface-2); }
.cl-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.cl-head h3 { margin: 0; font-size: 17px; }
.cl-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 14px; }
.cl-sec { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .3px; padding: 16px 10px 6px; }
.cl-empty { font-size: 12.5px; color: var(--muted); padding: 4px 10px; }
.room {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 14px; color: var(--text);
  transition: background .12s; position: relative;
}
.room:hover { background: var(--bg-soft); }
.room.active { background: var(--accent-soft); }
.room .av, .chat-head .av { width: 42px; height: 42px; font-size: 15px; }
.room-ic {
  --c: var(--accent);
  width: 42px; height: 42px; border-radius: 13px; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #fff), var(--c));
}
.room-ic.g { background: var(--grad); box-shadow: 0 6px 14px -6px rgba(108, 92, 231, .6); }
.room-ic svg { width: 20px; height: 20px; }
.room-t { flex: 1; min-width: 0; }
.room-n { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.room-n b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-n small { font-size: 11.5px; color: var(--muted); flex: none; }
.room-s { display: flex; align-items: center; gap: 8px; margin-top: 1px; }
.room-s .snip { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room.unread .room-n b { font-weight: 700; }
.room.unread .room-s .snip { color: var(--text); font-weight: 500; }
.room.unread .room-n small { color: var(--accent-ink); font-weight: 600; }
.room-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.typing-txt { color: var(--ok); font-weight: 500; }

.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; position: relative; background: var(--chat-bg); }
.chat-main.dragover::after {
  content: "أفلت الملفات هنا لإرسالها"; position: absolute; inset: 12px; border-radius: 18px; z-index: 5;
  border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); font-size: 16px;
}
.chat-head { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.chat-head .ch-t { flex: 1; min-width: 0; line-height: 1.35; }
.chat-head .ch-t b { display: block; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .ch-t small { font-size: 12.5px; color: var(--muted); }
.on-txt { color: var(--ok); font-weight: 500; }
.chat-back { display: none; }
.chat-msgs {
  flex: 1; overflow-y: auto; padding: 14px 22px 10px; display: flex; flex-direction: column;
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px); background-size: 20px 20px;
}
.chat-more { text-align: center; padding: 4px 0 8px; }
.chat-empty { margin: auto; text-align: center; max-width: 340px; color: var(--muted); padding: 30px 10px; }
.chat-empty .em { font-size: 46px; }
.chat-empty h4 { margin: 6px 0 4px; color: var(--text); font-size: 16px; }
.chat-empty p { margin: 0; font-size: 13.5px; }
.day-sep { text-align: center; margin: 16px 0 6px; position: sticky; top: 0; z-index: 2; }
.day-sep span { display: inline-block; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); padding: 2px 12px; border-radius: 20px; box-shadow: var(--shadow-sm); }

.msg { display: flex; align-items: flex-end; gap: 8px; max-width: min(78%, 640px); margin-top: 10px; align-self: flex-start; position: relative; }
.msg.cont { margin-top: 3px; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .av-gap { width: 24px; flex: none; }
.msg-col { min-width: 0; display: flex; flex-direction: column; }
.msg.mine .msg-col { align-items: flex-end; }
.msg-name { font-size: 12px; font-weight: 600; margin: 0 6px 3px; }
.bubble {
  position: relative; background: var(--bubble-in); border: 1px solid var(--line); border-radius: 18px;
  padding: 8px 13px 5px; box-shadow: var(--card-shadow); max-width: 100%; overflow-wrap: anywhere;
}
.msg:not(.mine):not(.cont) .bubble { border-start-start-radius: 5px; }
.msg.mine .bubble { background: linear-gradient(135deg, #7c6cf0, #5b5ce6); color: #fff; border-color: transparent; box-shadow: 0 4px 12px -6px rgba(108, 92, 231, .7); }
.msg.mine:not(.cont) .bubble { border-start-end-radius: 5px; }
.msg-text { white-space: pre-wrap; line-height: 1.7; }
.msg-text a { text-decoration: underline; word-break: break-all; }
.msg.mine .msg-text a { color: #fff; }
.msg-text .mention { color: var(--accent-ink); font-weight: 600; background: var(--accent-soft); padding: 0 4px; border-radius: 5px; }
.msg.mine .msg-text .mention { color: #fff; background: rgba(255, 255, 255, .22); }
.msg-time { display: block; text-align: end; font-size: 10.5px; color: var(--muted); margin-top: 1px; line-height: 1.3; }
.msg.mine .msg-time { color: rgba(255, 255, 255, .75); }
.msg.pending { opacity: .7; }
.bubble.deleted { background: transparent; border: 1px dashed var(--line-strong); box-shadow: none; color: var(--muted); font-style: italic; font-size: 13px; padding: 6px 12px; }
.msg.mine .bubble.deleted { background: transparent; color: var(--muted); border-color: var(--line-strong); box-shadow: none; }
.msg-del { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-end: -34px; opacity: 0; transition: opacity .12s; }
.msg.mine .msg-del { inset-inline-end: auto; inset-inline-start: -34px; }
.msg:hover .msg-del { opacity: 1; }
.msg-img { display: block; margin: -3px -8px 4px; }
.msg-img img { display: block; max-width: min(300px, 100%); max-height: 320px; border-radius: 13px; object-fit: cover; background: var(--bg-soft); }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--bg-soft); color: inherit; margin-bottom: 4px; }
.msg-file svg { width: 20px; height: 20px; flex: none; }
.msg-file b { display: block; font-size: 13px; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file small { font-size: 11.5px; opacity: .75; }
.msg.mine .msg-file { background: rgba(255, 255, 255, .16); }
.msg-task {
  display: flex; align-items: center; gap: 10px; min-width: 230px; margin: 2px -5px 5px; padding: 9px 11px;
  border-radius: 13px; background: var(--surface); border: 1px solid var(--line); color: var(--text); cursor: pointer;
  transition: border-color .12s, transform .12s;
}
.msg-task:hover { border-color: var(--accent); transform: translateY(-1px); }
.msg-task.gone { color: var(--muted); cursor: default; font-size: 13px; }
.msg-task .mt-t { flex: 1; min-width: 0; line-height: 1.4; }
.msg-task .mt-t b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-task .mt-t small { font-size: 11.5px; color: var(--muted); }
.st-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.chat-compose { position: relative; flex: none; padding: 2px 14px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.chat-typing { min-height: 22px; font-size: 12px; color: var(--muted); padding: 3px 8px 1px; display: flex; align-items: center; gap: 6px; }
.tdots { display: inline-flex; gap: 3px; }
.tdots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: tdot 1.1s infinite ease-in-out; }
.tdots i:nth-child(2) { animation-delay: .15s; }
.tdots i:nth-child(3) { animation-delay: .3s; }
@keyframes tdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.cc-pending { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 6px 8px 6px 12px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); font-size: 13px; }
.cc-pending > svg { width: 16px; height: 16px; flex: none; }
.cc-pending span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-row {
  display: flex; align-items: flex-end; gap: 4px; padding: 5px; border-radius: 18px;
  background: var(--surface-2); border: 1px solid var(--line-strong); transition: border-color .15s, box-shadow .15s;
}
.cc-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
#chatInput { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; resize: none; line-height: 1.6; padding: 8px 6px; min-height: 40px; max-height: 170px; overflow-y: auto; }
.send-btn {
  width: 40px; height: 40px; border-radius: 13px; border: 0; flex: none; display: grid; place-items: center; color: #fff;
  background: var(--grad); box-shadow: 0 6px 14px -6px rgba(108, 92, 231, .8); transition: transform .1s, filter .15s;
}
.send-btn:hover { filter: brightness(1.07); }
.send-btn:active { transform: scale(.94); }
.send-btn svg { width: 18px; height: 18px; }
[dir="rtl"] .send-btn svg { transform: scaleX(-1); }
.chat-compose .mention-box { bottom: calc(100% - 6px); inset-inline-start: 90px; }
.pop.pop-wide { width: 350px; max-width: calc(100vw - 20px); }
.tp-q { width: 100%; height: 38px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 12px; outline: none; background: var(--surface); margin-bottom: 8px; }
.tp-q:focus { border-color: var(--accent); }
.tp-list { max-height: 300px; overflow-y: auto; margin: 0 -4px; }
.tp-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; padding: 8px 8px; border-radius: 9px; text-align: start; }
.tp-item:hover { background: var(--bg-soft); }
.tp-item .tp-t { flex: 1; min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-item small { color: var(--muted); font-size: 11.5px; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 860px) {
  .chat-mode .content { padding: 0; }
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 62px); height: calc(100dvh - 62px); border: 0; border-radius: 0; box-shadow: none; }
  .chat:not(.in-room) .chat-main { display: none; }
  .chat.in-room .chat-list { display: none; }
  .chat-list { border: 0; }
  .chat-back { display: inline-grid; }
  .chat-head { padding: 9px 10px; gap: 8px; }
  .chat-msgs { padding: 10px 12px 8px; }
  .msg { max-width: 88%; }
  .msg-del { opacity: .6; }
  .msg:not(.mine) .msg-del { inset-inline-end: -30px; }
  .chat-compose { padding: 2px 8px 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .chat-compose .mention-box { inset-inline-start: 10px; }
  .chat-mode .toasts { bottom: 90px; }
}

/* =========================================================
   v3 theme — modern & colorful (Monday / ClickUp style)
   ========================================================= */
:root {
  --bg: #f6f7fb;
  --bg-soft: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --line: #e4e7ef;
  --line-strong: #d0d4e4;
  --text: #2b2d42;
  --text-2: #5f6178;
  --muted: #8e91a8;
  --accent: #6161ff;
  --accent-2: #00c875;
  --accent-soft: #ececff;
  --accent-ink: #4646d8;
  --grad: linear-gradient(120deg, #6161ff 0%, #8f5cf7 45%, #ff5ac4 100%);
  --danger: #e2445c;
  --danger-soft: #fde8ec;
  --warn: #f59f1b;
  --warn-soft: #fff3e0;
  --ok: #00b86b;
  --ok-soft: #dcf8ea;
  --info: #579bfc;
  --info-soft: #e6f0ff;
  --side-bg: #ffffff;
  --side-text: #4a4c63;
  --side-hover: #f2f3f8;
  --side-active: #ececff;
  --side-line: #eceef4;
  --list-bg: #f1f3f8;
  --card-shadow: 0 1px 2px rgba(43, 45, 66, .07);
  --shadow-sm: 0 1px 2px rgba(43, 45, 66, .05);
  --shadow: 0 4px 14px -4px rgba(43, 45, 66, .12);
  --r-lg: 14px;
}
:root[data-theme="dark"] {
  --bg: #15161f;
  --bg-soft: #20212d;
  --surface: #1c1d28;
  --surface-2: #22232f;
  --line: #2d2f3e;
  --line-strong: #3a3c4e;
  --text: #ececf4;
  --text-2: #b9bbcf;
  --muted: #84879f;
  --accent: #7b7bff;
  --accent-soft: #2a2a52;
  --accent-ink: #b0b0ff;
  --danger-soft: #3d1e27;
  --warn-soft: #3a2d17;
  --ok-soft: #12352a;
  --info-soft: #1b2b47;
  --side-bg: #1a1b26;
  --side-text: #c2c4d6;
  --side-hover: #242535;
  --side-active: #2a2a52;
  --side-line: #2a2c3a;
  --list-bg: #191a24;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 4px 14px -4px rgba(0, 0, 0, .5);
}

/* ---- buttons ---- */
.btn-primary { background: var(--accent); box-shadow: 0 4px 12px -4px rgba(97, 97, 255, .55); }
.btn-primary:hover { background: #5050ee; filter: none; box-shadow: 0 6px 16px -4px rgba(97, 97, 255, .65); }
.brand-mark { background: var(--grad); box-shadow: 0 6px 14px -5px rgba(143, 92, 247, .6); }

/* ---- light sidebar with colorful icon tiles ---- */
.sidebar { background: var(--side-bg); color: var(--side-text); border-inline-end: 1px solid var(--line); }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); background-clip: content-box; }
.sidebar > .brand { color: var(--text); }
.nav-item { color: var(--side-text); padding: 6px 9px; gap: 11px; }
.nav-item:hover { background: var(--side-hover); color: var(--text); }
.nav-item.active { background: var(--side-active); color: var(--accent-ink); }
.nav-item.active::before { background: var(--accent); }
.nav-ic {
  --ic: var(--accent);
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  color: var(--ic); background: color-mix(in srgb, var(--ic) 13%, transparent); transition: background .15s, color .15s;
}
.nav-ic svg { width: 17px !important; height: 17px !important; opacity: 1 !important; }
.nav-item.active .nav-ic { background: var(--ic); color: #fff; box-shadow: 0 4px 10px -3px color-mix(in srgb, var(--ic) 70%, transparent); }
.nav-item .count { background: var(--bg-soft); color: var(--text-2); }
.nav-item.active .count { background: var(--surface); }
.nav-item .count.hot { background: var(--danger); color: #fff; }
.nav-section-head { color: var(--muted); }
.nav-section-head .icon-btn { color: var(--muted); }
.nav-section-head .icon-btn:hover { background: var(--side-hover); color: var(--text); }
#projectNav .nav-item { padding: 8px 11px; }
.nav-item .p-dot { width: 12px; height: 12px; border-radius: 4px; box-shadow: none; margin-inline: 9px; }
.nav-empty { color: var(--muted); }
.sidebar-foot { border-top-color: var(--side-line); }
.sidebar-foot .who b { color: var(--text); }
.sidebar-foot .who small { color: var(--muted); }
.sidebar-foot .icon-btn { color: var(--text-2); }
.sidebar-foot .icon-btn:hover { background: var(--side-hover); color: var(--text); }
.sidebar .av { box-shadow: 0 0 0 2px var(--side-bg); }

/* ---- topbar ---- */
.main::before { display: none; }
.topbar { background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom-color: var(--line); }
.content { padding-top: 18px; }
.search { background: var(--bg); box-shadow: none; }

/* ---- hero & stats ---- */
.hero { background: radial-gradient(500px 300px at 0% 120%, rgba(255, 203, 0, .45), transparent 60%), var(--grad); box-shadow: 0 18px 40px -20px rgba(143, 92, 247, .8); border-radius: 20px; margin-top: 0; }
.stat { border: 0; color: #fff; box-shadow: 0 10px 24px -14px var(--tone, rgba(0, 0, 0, .4)); }
.stat small { color: rgba(255, 255, 255, .88); font-weight: 500; }
.stat-ic { background: rgba(255, 255, 255, .22); box-shadow: none; }
.stat.t-accent { --tone: #6161ff; background: linear-gradient(135deg, #6161ff, #8b7dff); }
.stat.t-danger { --tone: #e2445c; background: linear-gradient(135deg, #e2445c, #ff7a8c); }
.stat.t-warn { --tone: #fdab3d; background: linear-gradient(135deg, #f59f1b, #ffc35c); }
.stat.t-ok { --tone: #00c875; background: linear-gradient(135deg, #00b86b, #33d98f); }
.card { border-radius: 14px; }
.pcard { border-radius: 14px; }

/* ---- list: Monday-style colored groups & status cells ---- */
.group { --g: var(--accent); margin-bottom: 22px; }
.group-head { color: var(--g); font-size: 15.5px; padding: 4px 2px; }
.group-head .chev { color: var(--g); }
.group-head .n { background: color-mix(in srgb, var(--g) 13%, transparent); color: var(--g); }
.group .rows { border-radius: 10px; border-inline-start: 6px solid var(--g); box-shadow: var(--card-shadow); }
.row { min-height: 48px; padding: 6px 8px 6px 14px; gap: 12px; }
[dir="rtl"] .row { padding: 6px 14px 6px 8px; }
.row:hover { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.st-cell {
  --s: var(--muted);
  flex: none; width: 128px; height: 34px; border: 0; border-radius: 8px; padding: 0 8px;
  background: var(--s); color: #fff; font-weight: 600; font-size: 12.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; transition: filter .12s, transform .12s;
}
.st-cell:hover { filter: brightness(1.07); transform: translateY(-1px); }
.card .rows .st-cell { width: 112px; height: 30px; font-size: 12px; }
.card .rows .row { padding-inline: 6px; }
.menu-sw { width: 14px; height: 14px; border-radius: 4px; flex: none; display: inline-block; }
.check { border-color: var(--line-strong); }
.check.on { background: var(--ok); border-color: var(--ok); }

/* ---- solid status pills ---- */
.st-pill { color: #fff !important; }
.st-todo { background: #8d93ab; }
.st-doing { background: #fdab3d; }
.st-review { background: #a25ddc; }
.st-done { background: #00c875; }
.status-seg button { opacity: .4; }
.status-seg button.on { opacity: 1; border-color: transparent; box-shadow: 0 3px 10px -3px rgba(0, 0, 0, .3); }

/* ---- tags ---- */
.tag { border-radius: 6px; }
.tag.overdue { background: var(--danger); color: #fff; }
.tag.today { background: #fdab3d; color: #fff; }
.tag.soon { background: var(--info-soft); color: #2f74e0; }
:root[data-theme="dark"] .tag.soon { color: #8bb8ff; }

/* ---- toolbar ---- */
.seg { border-radius: 10px; box-shadow: none; }
.seg button { border-radius: 7px; }
.seg button.on { background: var(--accent); color: #fff; box-shadow: 0 3px 8px -3px rgba(97, 97, 255, .6); }
.filter { border-radius: 9px; box-shadow: none; }

/* ---- board: ClickUp-style colored columns ---- */
.col { background: color-mix(in srgb, var(--sc) 7%, var(--list-bg)); border: 0; border-radius: 14px; }
.col::before { display: none; }
.col-head { margin: 10px 0 8px; padding: 7px 8px 7px 12px; border-radius: 10px; background: var(--sc); color: #fff; box-shadow: 0 4px 12px -6px var(--sc); }
[dir="rtl"] .col-head { padding: 7px 12px 7px 8px; }
.col-head .dot { display: none; }
.col-head .n { background: rgba(255, 255, 255, .25); color: #fff; border: 0; }
.col-head .icon-btn { color: #fff; }
.col-head .icon-btn:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.cards:empty { border-color: color-mix(in srgb, var(--sc) 35%, transparent); }
.tcard { border-color: transparent; box-shadow: 0 1px 3px rgba(43, 45, 66, .1); }
.tcard:hover { border-color: color-mix(in srgb, var(--sc, var(--accent)) 55%, transparent); }
:root[data-theme="dark"] .tcard { border-color: var(--line); }
.col-add:hover { background: color-mix(in srgb, var(--sc) 14%, transparent); }

/* ---- project banner ---- */
.pbanner { border-radius: 18px; background: radial-gradient(400px 220px at 0% 120%, rgba(255, 255, 255, .28), transparent 60%), linear-gradient(120deg, var(--pc), color-mix(in srgb, var(--pc) 55%, #ff5ac4)); }

/* ---- chat ---- */
.msg.mine .bubble { background: linear-gradient(135deg, #6161ff, #8f5cf7); }
.room-ic.g { background: var(--grad); }
.room.active { background: var(--accent-soft); }

/* ---- drawer & modals ---- */
.modal { border-radius: 16px; }
.toast { background: #2b2d42; }

@media (min-width: 861px) {
  .chat-mode .content { padding-top: 10px; }
  .chat { height: calc(100vh - 94px); height: calc(100dvh - 94px); }
}
@media (max-width: 860px) {
  .st-cell { width: 92px; font-size: 11.5px; height: 30px; }
  .content { padding-top: 10px; }
}

/* ============ Responsive ============ */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(105%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(16, 15, 40, .45); z-index: 25; display: none; }
  .sidebar.open + .scrim { display: block; }
  .main { margin-inline-start: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 6px; height: 62px; }
  .page-title { font-size: 17px; }
  .content { padding: 4px 14px 70px; }
  .board-wrap { margin: 0 -14px; padding: 4px 14px 20px; scroll-snap-type: x mandatory; }
  .col { width: 84vw; max-height: none; }
  .cards { overflow: visible; }
  .search { width: 40px; padding: 0 11px; }
  .search input { width: 0; }
  .search:focus-within { width: 170px; }
  .search:focus-within input { width: 100%; }
  .hide-sm { display: none; }
  .topbar .btn-primary { width: 40px; padding: 0; }
  .row .meta .tag.proj, .row .title .lbls { display: none; }
  .props { grid-template-columns: 96px 1fr; padding: 8px 10px; }
  .dr-body { padding: 14px 16px 30px; }
  .hero { padding: 22px; flex-direction: column; align-items: flex-start; }
  .hero .ring { margin-inline-start: 0; display: none; }
  .hero h2 { font-size: 22px; }
  .pbanner { flex-wrap: wrap; padding: 18px; }
  .pbanner .pb-badge { width: 48px; height: 48px; font-size: 20px; }
  .pb-actions { margin-inline-start: 0; width: 100%; }
  .cal-day { min-height: 72px; padding: 4px; }
  .cal-chip { font-size: 0; padding: 0; height: 6px; border-radius: 3px; border: 0; background: var(--c); }
  .cal-more { font-size: 10px; padding: 0; }
  .cal-wd div { padding: 8px 2px; font-size: 11px; }
  .tc-check { opacity: 1; transform: none; }
}
@media (max-width: 520px) {
  .stats { gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat-ic { width: 38px; height: 38px; border-radius: 12px; }
  .stat b { font-size: 20px; }
  .row .meta .mini { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .drawer, .toasts { display: none !important; }
  .main { margin: 0; }
}

/* login side panel — colorful theme */
.auth-side {
  background: radial-gradient(700px 420px at 85% -10%, rgba(255, 90, 196, .75), transparent 60%),
              radial-gradient(600px 420px at 0% 110%, rgba(0, 200, 117, .55), transparent 60%),
              linear-gradient(135deg, #6161ff, #8f5cf7);
}

/* ============ Messenger-style chat dock ============ */
#chatDock { position: fixed; bottom: 0; inset-inline-end: 22px; z-index: 60; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
#chatDock > *, .dock-wins > * { pointer-events: auto; }
.dock-wins { display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
.dock-fab {
  position: relative; width: 58px; height: 58px; margin-bottom: 22px; border-radius: 50%; border: 0;
  display: grid; place-items: center; color: #fff; background: var(--grad);
  box-shadow: 0 12px 26px -8px rgba(97, 97, 255, .75); transition: transform .15s;
}
.dock-fab:hover { transform: scale(1.07); }
.dock-fab svg { width: 27px; height: 27px; }
.dock-fab .badge {
  position: absolute; top: -3px; inset-inline-end: -3px; min-width: 23px; height: 23px; padding: 0 6px; border-radius: 12px;
  background: #e2445c; color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--bg);
}
.chat-mode #chatDock { display: none; }
.dock-win {
  width: 336px; height: 470px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0;
  box-shadow: 0 14px 44px -10px rgba(30, 30, 70, .4); animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
.dock-win.min { height: 54px; }
.dock-win.min > :not(.dock-head) { display: none; }
.dock-win.bump { animation: dockBump .5s ease; }
@keyframes dockBump { 30% { transform: translateY(-10px); } 60% { transform: translateY(0); } 80% { transform: translateY(-4px); } }
.dock-head {
  display: flex; align-items: center; gap: 9px; height: 54px; padding: 0 12px 0 6px; flex: none; cursor: pointer;
  background: var(--grad); color: #fff;
}
[dir="rtl"] .dock-head { padding: 0 12px 0 6px; }
.dock-head .av, .dock-head .room-ic { width: 36px; height: 36px; font-size: 13px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.dock-head .room-ic.g { background: rgba(255, 255, 255, .22); }
.dock-head .av-wrap .online { box-shadow: 0 0 0 2px #8f5cf7; }
.dock-head .ch-t { flex: 1; min-width: 0; line-height: 1.3; }
.dock-head .ch-t b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-head .ch-t small { font-size: 11.5px; color: rgba(255, 255, 255, .85); }
.dock-head .on-txt { color: #b9ffd9; }
.dock-head .icon-btn { color: #fff; }
.dock-head .icon-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.dock-badge { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 11px; background: #e2445c; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.dock-badge[hidden] { display: none; }
.dock-win .chat-msgs { padding: 10px 12px 6px; background-color: var(--chat-bg); overflow-x: hidden; }
.dock-win .msg { max-width: 84%; }
.dock-win .msg-del { inset-inline-end: -26px; }
.dock-win .msg.mine .msg-del { inset-inline-start: -26px; }
.dock-win .msg-img img { max-width: 210px; max-height: 220px; }
.dock-win .msg-task { min-width: 0; }
.dock-win .chat-empty { padding: 16px 8px; }
.dock-win .chat-empty .em { font-size: 34px; }
.dock-win .chat-empty p { font-size: 12.5px; }
.dock-win .chat-compose { padding: 0 8px 8px; }
.dock-win .cc-row { border-radius: 16px; padding: 3px; }
.dock-win .cc-row .icon-btn { width: 32px; height: 32px; }
.dock-win .cc-row .icon-btn svg { width: 17px; height: 17px; }
.dock-win .chat-input { padding: 7px 4px; min-height: 36px; max-height: 110px; }
.dock-win .send-btn { width: 36px; height: 36px; border-radius: 12px; }
.dock-win .chat-compose .mention-box { inset-inline-start: 40px; }
.dock-win .day-sep { margin: 10px 0 4px; }
.chat-pane.dragover { position: relative; }
.chat-pane.dragover::after {
  content: "أفلت الملفات هنا لإرسالها"; position: absolute; inset: 10px; border-radius: 16px; z-index: 5;
  border: 2px dashed var(--accent); background: color-mix(in srgb, var(--accent-soft) 88%, transparent);
  display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); font-size: 15px;
}
button.room { width: 100%; border: 0; background: transparent; text-align: start; font: inherit; color: inherit; cursor: pointer; }
.dock-pop { padding: 10px 8px; }
.dock-pop-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 6px; }
.dock-pop-head h5 { margin: 0; text-align: start; font-size: 15px; color: var(--text); }
.dock-list { max-height: min(420px, 60vh); overflow-y: auto; }
.dock-list .cl-sec { padding: 10px 10px 4px; }

/* ============ Popup notifications ============ */
#notifPops {
  position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 250; width: 370px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.npop {
  --nk: var(--accent);
  pointer-events: auto; position: relative; overflow: hidden; display: flex; gap: 12px; cursor: pointer;
  padding: 14px 14px 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 20px 44px -14px rgba(30, 30, 70, .42); animation: npopIn .4s cubic-bezier(.2, .9, .3, 1.25);
}
[dir="rtl"] .npop { padding: 14px 16px 12px 14px; }
.npop::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--nk); }
.npop:hover { border-color: color-mix(in srgb, var(--nk) 45%, var(--line)); }
.npop-assign { --nk: #6161ff; } .npop-comment { --nk: #579bfc; } .npop-mention { --nk: #ff5ac4; }
.npop-done { --nk: #00c875; } .npop-review { --nk: #a25ddc; } .npop-due { --nk: #e2445c; }
.npop.out { animation: npopOut .26s ease forwards; }
@keyframes npopIn { from { opacity: 0; transform: translateY(24px) scale(.95); } }
@keyframes npopOut { to { opacity: 0; transform: translateY(12px) scale(.97); } }
.npop-ic { position: relative; flex: none; align-self: flex-start; }
.npop-ic .av { width: 44px; height: 44px; font-size: 16px; }
.npop-ic .av.sys svg { width: 20px; height: 20px; color: #fff; }
.npop-type {
  position: absolute; bottom: -4px; inset-inline-end: -6px; width: 23px; height: 23px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--nk);
  background: var(--surface); box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
}
.npop-t { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.55; padding-inline-end: 18px; }
.npop-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 13px; color: var(--nk); margin-bottom: 2px; }
.npop-h small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.npop-b q { quotes: "«" "»"; font-weight: 600; }
.npop-snip { margin-top: 5px; padding: 5px 9px; border-radius: 9px; background: var(--bg-soft); color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npop-p { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--text-2); }
.npop-p .tag { height: 20px; font-size: 11px; padding: 0 6px; }
.npop-cta { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--accent-ink); }
.npop-x { position: absolute; top: 7px; inset-inline-end: 7px; opacity: .45; }
.npop:hover .npop-x { opacity: 1; }

/* ============ Sticky notes ============ */
.notes-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 2px 0 8px; }
.note-new {
  flex: 1; min-width: 260px; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 18px; text-align: start;
  border-radius: 14px; border: 1.5px dashed #f5c542; background: color-mix(in srgb, #ffe066 22%, var(--surface));
  color: var(--text-2); font-weight: 500; transition: background .15s, border-color .15s, transform .1s;
}
.note-new:hover { border-style: solid; background: color-mix(in srgb, #ffe066 38%, var(--surface)); }
.note-new:active { transform: translateY(1px); }
.note-new svg { width: 21px; height: 21px; color: #e0a000; flex: none; }
.note-new span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-search {
  display: flex; align-items: center; gap: 8px; width: 270px; height: 52px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.notes-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.notes-search svg { width: 17px; height: 17px; }
.notes-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.notes-hint { margin: 0 0 18px; font-size: 12.5px; color: var(--muted); }
.notes-sec { margin: 4px 0 12px; font-weight: 700; font-size: 14px; color: var(--text-2); }
.notes { columns: 270px; column-gap: 16px; margin-bottom: 18px; }
.note {
  --nc: #ffe066;
  position: relative; break-inside: avoid; margin: 10px 0 16px; padding: 16px 14px 8px;
  border-radius: 6px 6px 18px 6px; background: color-mix(in srgb, var(--nc) 58%, #fff);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .05), 0 10px 22px -12px color-mix(in srgb, var(--nc) 75%, #000);
  transition: transform .18s, box-shadow .18s;
}
[dir="rtl"] .note { border-radius: 6px 6px 6px 18px; }
.note:hover, .note:focus-within { transform: translateY(-2px); box-shadow: 0 1px 1px rgba(0, 0, 0, .05), 0 16px 30px -14px color-mix(in srgb, var(--nc) 80%, #000); }
.note::before {
  content: ""; position: absolute; top: -8px; left: 50%; width: 64px; height: 17px; transform: translateX(-50%) rotate(-2.5deg);
  background: rgba(255, 255, 255, .6); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); border-radius: 2px;
}
.note-pin { position: absolute; top: 10px; inset-inline-end: 10px; color: #d6334a; }
.note-pin svg { width: 16px; height: 16px; }
.note-title { width: 100%; border: 0; outline: 0; background: transparent; padding: 2px 0 4px; padding-inline-end: 22px; font-weight: 700; font-size: 15.5px; color: #2b2d42; }
.note-body { width: 100%; display: block; border: 0; outline: 0; background: transparent; resize: none; overflow: hidden; min-height: 64px; padding: 0; line-height: 1.75; font-size: 14px; color: #3b3d52; }
.note-title::placeholder, .note-body::placeholder { color: rgba(43, 45, 66, .42); }
.note-links { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 2px; }
.note-links a {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; width: fit-content; padding: 3px 9px; border-radius: 8px;
  background: rgba(255, 255, 255, .6); color: #2f4bd0; font-size: 12.5px; font-weight: 500; direction: ltr;
}
.note-links a:hover { background: #fff; }
.note-links a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-links svg { width: 13px; height: 13px; flex: none; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 32px; margin-top: 6px; }
.note-foot small { font-size: 11.5px; color: rgba(43, 45, 66, .55); white-space: nowrap; }
.note-tools { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .15s; }
.note:hover .note-tools, .note:focus-within .note-tools { opacity: 1; }
.note-tools .icon-btn { color: #3b3d52; width: 28px; height: 28px; }
.note-tools .icon-btn:hover { background: rgba(0, 0, 0, .08); color: #1b1c30; }
.note .nc { width: 15px; height: 15px; padding: 0; margin: 0 1px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .95); background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); }
.note .nc.on { box-shadow: 0 0 0 2px #2b2d42; }
:root[data-theme="dark"] .note { background: color-mix(in srgb, var(--nc) 32%, #22233a); }
:root[data-theme="dark"] .note-title { color: #f6f6fc; }
:root[data-theme="dark"] .note-body { color: #e3e4f0; }
:root[data-theme="dark"] .note-title::placeholder, :root[data-theme="dark"] .note-body::placeholder { color: rgba(255, 255, 255, .4); }
:root[data-theme="dark"] .note-foot small { color: rgba(255, 255, 255, .55); }
:root[data-theme="dark"] .note-tools .icon-btn { color: #e3e4f0; }
:root[data-theme="dark"] .note-tools .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
:root[data-theme="dark"] .note-links a { background: rgba(255, 255, 255, .1); color: #c9d3ff; }
:root[data-theme="dark"] .note::before { background: rgba(255, 255, 255, .25); }
@media (hover: none) { .note-tools { opacity: 1; } }

@media (max-width: 860px) {
  #chatDock { inset-inline-end: 14px; }
  .dock-wins { display: none; }
  .dock-fab { width: 52px; height: 52px; margin-bottom: 16px; }
  #notifPops { inset-inline: 12px; bottom: 82px; width: auto; }
  .notes { columns: 1; }
  .notes-search { width: 100%; }
  .note-new span { font-size: 13px; }
}

/* ============ Smart quick add ============ */
.qa-smart { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 30px; margin: -2px 0 8px; font-size: 12.5px; }
.sm-cap { font-weight: 700; color: var(--accent-ink); }
.sm-hint { color: var(--muted); }
.sm-hint b { color: var(--text-2); font-weight: 600; }
.sm-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 6px; border-radius: 20px;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; animation: fade .2s;
}
.sm-chip .av { width: 18px; height: 18px; font-size: 8.5px; box-shadow: none; }
.sm-chip .p-dot { width: 9px; height: 9px; }
.sm-chip.hot { background: var(--danger-soft); color: var(--danger); }
.sm-title { color: var(--muted); margin-inline-start: 4px; }
.qa-private {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px dashed var(--line-strong); background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.qa-private.on { border-style: solid; border-color: var(--text); background: var(--text); color: var(--surface); }
.qa-private-note { display: none; margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: var(--bg-soft); font-size: 13px; color: var(--text-2); }
.modal.is-private .qa-people { display: none; }
.modal.is-private .qa-private-note { display: block; }

/* ============ Private tasks ============ */
.mini.priv { color: var(--text-2); }
.priv-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text); background: var(--bg-soft); padding: 2px 9px; border-radius: 20px; }
.priv-badge svg, .priv-note svg { width: 13px; height: 13px; }
.priv-note { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); padding: 0 6px; }
.priv-toggle { display: inline-flex; align-items: center; gap: 9px; border: 0; background: transparent; font-size: 13px; color: var(--text-2); padding: 6px 6px; border-radius: 8px; }
.priv-toggle:hover { background: var(--bg-soft); }
.priv-toggle.on { color: var(--text); font-weight: 600; }
.priv-toggle.on .switch { background: var(--text); }
.priv-toggle.on .switch::after { inset-inline-start: 16px; }

/* ============ Trash ============ */
.trash-link { font-size: 12.5px; opacity: .75; margin-top: 4px; }
.trash-link svg { width: 16px !important; height: 16px !important; margin-inline: 7px; }
.trash-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.trash-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.trash-row:last-child { border-bottom: 0; }
.trash-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); flex: none; }
.trash-ic svg { width: 17px; height: 17px; }
.trash-t { flex: 1; min-width: 0; line-height: 1.45; }
.trash-t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: line-through; text-decoration-color: var(--line-strong); }
.trash-t small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.trash-left { font-size: 12px; color: var(--muted); white-space: nowrap; }
.trash-left.soon { color: var(--danger); font-weight: 600; }

/* ============ Video library (spreadsheet) ============ */
.v-toolbar { margin-top: 4px; }
.v-search { height: 38px; width: 250px; border-radius: 10px; }
.v-counts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.v-count {
  --s: var(--muted);
  height: 32px; padding: 0 11px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--s) 40%, transparent);
  background: color-mix(in srgb, var(--s) 12%, var(--surface)); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.v-count b { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-inline-start: 4px; padding: 0 5px; border-radius: 6px; background: var(--s); color: #fff; font-size: 11.5px; }
.v-count.on { background: var(--s); color: #fff; border-color: var(--s); }
.v-count.on b { background: rgba(255, 255, 255, .3); }
.sheet-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--card-shadow); max-height: calc(100vh - 230px); }
.sheet { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; min-width: 980px; }
.sheet th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--text-2); font-weight: 700; font-size: 12.5px;
  text-align: start; padding: 10px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
.sheet th:hover { color: var(--accent-ink); }
.sheet th.v-n, .sheet th:last-child { cursor: default; }
.sheet td { border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); padding: 0; height: 42px; vertical-align: middle; }
.sheet td:last-child { border-inline-end: 0; }
.sheet tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.sheet .v-n { width: 42px; text-align: center; color: var(--muted); font-size: 12px; background: var(--surface-2); }
.sheet .w-title { min-width: 220px; }
.sheet .w-link { min-width: 260px; }
.sheet .w-notes { min-width: 180px; }
.sheet .vc {
  width: 100%; height: 41px; border: 0; outline: 0; background: transparent; padding: 0 10px; font-size: 13.5px; color: var(--text);
  border-radius: 0; transition: box-shadow .1s, background .1s;
}
.sheet .vc:focus { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface); }
.sheet .v-title { font-weight: 600; }
.sheet select.vc { cursor: pointer; }
.sheet select.v-status { --s: var(--muted); width: calc(100% - 12px); height: 30px; margin: 0 6px; border-radius: 7px; background: var(--s); color: #fff; font-weight: 600; font-size: 12.5px; text-align: center; }
.sheet select.v-status option { background: var(--surface); color: var(--text); }
.sheet .v-link { position: relative; }
.sheet .v-link .vc { padding-inline-end: 70px; font-size: 12.5px; color: var(--text-2); }
.v-open {
  position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%); height: 26px; padding: 0 10px; border-radius: 7px;
  display: inline-flex; align-items: center; background: #1a73e8; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.v-open:hover { background: #1557b0; }
.sheet .v-act { width: 40px; text-align: center; }
.sheet .v-act .icon-btn { opacity: 0; }
.sheet tr:hover .v-act .icon-btn { opacity: 1; }
.sheet .v-add td { background: var(--surface-2); border-bottom: 0; }
.sheet .v-add td:not(.v-n) { display: flex; align-items: center; gap: 8px; padding: 6px 8px; height: auto; border-inline-end: 0; }
.v-add-in { flex: 1; min-height: 32px; border: 1px dashed var(--line-strong); border-radius: 8px; background: var(--surface); padding: 6px 10px; outline: 0; resize: none; line-height: 1.5; font-size: 13px; }
.v-add-in:focus { border-style: solid; border-color: var(--accent); }
.v-add-proj { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 8px; font-size: 13px; }
.v-empty-hint { text-align: center; color: var(--muted); font-size: 13.5px; margin: 16px 0; }

/* ============ Reactions & editing ============ */
.rx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg.mine .rx { justify-content: flex-end; }
.rx-chip {
  display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--surface); font-size: 13px; line-height: 1; box-shadow: var(--shadow-sm);
}
.rx-chip b { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.rx-chip.on { border-color: var(--accent); background: var(--accent-soft); }
.rx-chip.on b { color: var(--accent-ink); }
.rx-chip:hover { transform: translateY(-1px); }
.rx-pop { width: auto; min-width: 0; padding: 5px; border-radius: 30px; }
.rx-pick { display: flex; gap: 2px; }
.rx-pick button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; transition: transform .12s, background .12s; }
.rx-pick button:hover { transform: scale(1.25); background: var(--bg-soft); }
.msg-acts {
  position: absolute; top: -14px; inset-inline-end: -6px; display: flex; gap: 1px; padding: 2px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 3;
}
.msg.mine .msg-acts { inset-inline-end: auto; inset-inline-start: -6px; }
.msg:hover .msg-acts { opacity: 1; pointer-events: auto; }
.msg-acts .icon-btn { width: 28px; height: 28px; font-size: 15px; }
.msg-acts .icon-btn svg { width: 15px; height: 15px; }
.msg-time i { font-style: normal; opacity: .85; }
.msg-edit textarea {
  width: 100%; min-width: 220px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 10px; padding: 7px 10px; outline: 0; resize: none;
  background: rgba(255, 255, 255, .95); color: #2b2d42; line-height: 1.6; display: block;
}
.msg:not(.mine) .msg-edit textarea { border-color: var(--accent); background: var(--surface); color: var(--text); }
.me-acts { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.me-acts span { flex: 1; font-size: 11px; opacity: .8; }
.me-acts .btn { height: 28px; padding: 0 10px; font-size: 12px; }
.msg.mine .me-acts .btn:not(.btn-primary) { background: rgba(255, 255, 255, .2); color: #fff; border-color: transparent; }
.msg.mine .me-acts .btn-primary { background: #fff; color: var(--accent-ink); }
.cmt-tools { margin-inline-start: auto; display: inline-flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.cmt:hover .cmt-tools { opacity: 1; }
.cmt-meta .cmt-tools .icon-btn { opacity: 1; margin: 0; font-size: 14px; }
.cmt-edit textarea { width: 100%; border: 1px solid var(--accent); border-radius: 12px; padding: 9px 12px; resize: none; outline: 0; background: var(--surface); line-height: 1.6; margin-top: 4px; min-height: 60px; }
.cmt-edit .me-acts span { color: var(--muted); }
@media (hover: none) { .msg-acts { opacity: .9; pointer-events: auto; position: static; margin-top: 2px; align-self: center; } .cmt-tools { opacity: 1; } }

@media (max-width: 860px) {
  .v-search { width: 100%; }
  .sheet-wrap { max-height: none; margin: 0 -14px; border-radius: 0; border-inline: 0; }
}

/* ============ Video library tabs: finished vs raw footage ============ */
.v-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 10px; margin: 6px 0 2px; }
.v-tab {
  --t: #6161ff;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 10px; text-align: start;
  padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  font-size: 14.5px; font-weight: 700; color: var(--text-2); transition: border-color .15s, background .15s, box-shadow .15s;
}
.v-tab.raw { --t: #a25ddc; }
.v-tab b { grid-row: span 2; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; background: var(--bg-soft); color: var(--text-2); font-size: 14px; }
.v-tab small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.v-tab:hover { border-color: color-mix(in srgb, var(--t) 50%, var(--line)); }
.v-tab.on { border-color: var(--t); background: color-mix(in srgb, var(--t) 9%, var(--surface)); color: var(--text); box-shadow: 0 6px 16px -10px var(--t); }
.v-tab.on b { background: var(--t); color: #fff; }
@media (max-width: 860px) { .v-tabs { grid-template-columns: 1fr 1fr; } .v-tab { padding: 9px 10px; font-size: 13px; } .v-tab small { display: none; } }
