/* =========================================================
   التصنيفات والتقويم والتعديل الجماعي والمتابعون
   الألوان من css/theme.css (--c-*) وتتبدّل تلقائياً مع الوضع الليلي.
   ========================================================= */

/* ---------- وسم التصنيف ---------- */
.ctag { --c: var(--c-gray); display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 0 9px; line-height: 22px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 82%, var(--ink)); background: color-mix(in srgb, var(--c) 13%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.ctag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.ctag span { overflow: hidden; text-overflow: ellipsis; }
.ctag.is-pending { border-style: dashed; }

/* ---------- حقل التصنيف في النموذج ---------- */
.cat-other[hidden] { display: none; }

/* ---------- اختيار اللون ---------- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.swatch input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- منتقي اللون الحر ---------- */
.cpick { display: grid; gap: 10px; }
.cp-custom summary { cursor: pointer; font-weight: 600; color: var(--accent); width: fit-content; }
.cp-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 10px; }
.cp-native { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; }
.cp-f { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.cp-f input { min-height: 40px; width: 74px; text-align: center; font-variant-numeric: tabular-nums; }
.cp-f.cp-hex input { width: 108px; text-transform: lowercase; }
.cp-err { color: var(--red); }
.cp-preview { display: flex; flex-wrap: wrap; gap: 10px; }
.cp-preview:empty { display: none; }
.cp-sample { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line); min-width: 150px; flex: 1 1 150px; }
.cp-sample.cp-light { background: #ffffff; color: #0f2342; }
.cp-sample.cp-dark { background: #151f29; color: #e6ebef; }
.cp-sample small { font-size: 12px; opacity: .8; }
.cp-sample .cp-warn { color: inherit; opacity: 1; font-weight: 600; }
.cp-chip { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 0 9px; line-height: 22px; border-radius: 99px; font-size: 12.5px; font-weight: 600; border: 1px solid; }
.cp-chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }

/* ---------- إدارة التصنيفات ---------- */
.cat-rows { display: grid; gap: 8px; margin: 12px 0; }
.cat-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); }
.cat-row.off { opacity: .65; }
.cat-row .grow { flex: 1 1 40px; min-width: 0; }
.cat-edit { display: grid; gap: 12px; width: 100%; padding-top: 6px; }
.sug-row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-2); }
.sug-row .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sug-row select { min-height: 36px; }

/* ---------- جدول التصنيفات في اللوحة والتقرير ---------- */
.cat-count-n { font-variant-numeric: tabular-nums; }

/* ---------- المتابعون ---------- */
.followers { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- التحديد والتعديل الجماعي ---------- */
.bulkbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--r);
  background: var(--accent-t); border: 1px solid var(--accent); color: var(--accent); }
.bulkbar strong { flex: 1 1 140px; }
.tcard-wrap { position: relative; }
.sel-box { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; z-index: 1; display: flex; padding: 4px; cursor: pointer; }
.sel-box input { width: 20px; height: 20px; }
.tcard-wrap.sel .tcard { border-color: var(--accent); background: var(--accent-t); }
.tcard-wrap .tc-top { padding-inline-end: 34px; }

/* ---------- التقويم ---------- */
.cal-nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.cal-nav h2 { margin: 0; font-size: 18px; flex: 1 1 140px; text-align: center; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.cal-h { padding: 8px 4px; text-align: center; font-weight: 700; font-size: 13px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--ink-2); }
.cal-d { min-height: 104px; padding: 4px; border-inline-start: 1px solid var(--line-2); border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-d:nth-of-type(7n + 8) { border-inline-start: 0; }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .cal-n { opacity: .5; }
.cal-d.off { background: color-mix(in srgb, var(--ink-3) 6%, var(--surface)); }
.cal-n { font-size: 13px; font-weight: 700; color: var(--ink-2); padding: 0 4px; }
.cal-d.today .cal-n { display: inline-block; align-self: flex-start; background: var(--primary); color: var(--white); border-radius: 99px; padding: 0 8px; }
.cal-i { --c: var(--ink-3); display: block; width: 100%; text-align: start; border: 0; border-inline-start: 3px solid var(--c); border-radius: 3px; padding: 2px 6px; font-size: 12.5px; line-height: 1.5; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, var(--c) 13%, var(--surface)); color: var(--ink); }
.cal-i:hover { background: color-mix(in srgb, var(--c) 24%, var(--surface)); }
.cal-i.late { box-shadow: inset 0 0 0 1px var(--red); }
.cal-i.done { opacity: .6; text-decoration: line-through; }
.cal-i.mtg { --c: var(--accent); font-weight: 600; }
.cal-more { font-size: 12px; color: var(--ink-3); padding: 0 4px; background: none; border: 0; cursor: pointer; text-align: start; }
.cal-hint { margin-top: 10px; }
.cal-day-list { display: grid; gap: 6px; }
@media (max-width: 720px) {
  .cal-d { min-height: 64px; padding: 2px; }
  .cal-i { pointer-events: none; font-size: 0; padding: 0; height: 6px; border-radius: 3px; border-inline-start-width: 0; background: var(--c); }
  .cal-i.mtg { height: 8px; }
  .cal-h { font-size: 11.5px; padding: 6px 0; }
  .cal-more { font-size: 11px; }
}

/* ألوان التصنيفات: في آخر الملف ليغلب لونها اللون الافتراضي لكل عنصر */
.c-blue { --c: var(--c-blue); } .c-teal { --c: var(--c-teal); } .c-green { --c: var(--c-green); } .c-amber { --c: var(--c-amber); }
.c-red { --c: var(--c-red); } .c-purple { --c: var(--c-purple); } .c-pink { --c: var(--c-pink); } .c-gray { --c: var(--c-gray); }
/* ألوان حرة (HEX): متغيّران محسوبان لكل ثيم من js/colors.js ليبقى النص مقروءاً */
.c-custom { --c: var(--cc-l, var(--c-gray)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .c-custom { --c: var(--cc-d, var(--c-gray)); } }
:root[data-theme="dark"] .c-custom { --c: var(--cc-d, var(--c-gray)); }

/* عناصر قابلة للضغط في النظرة العامة والتصنيفات */
button.ctag { border: 0; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ctag.is-link { cursor: pointer; }
.ctag.is-link:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px var(--c); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-align: start; }
.linkish:hover { color: var(--accent); text-decoration: underline; }
button.kpi { background: none; border: 0; border-inline-start: 1px solid var(--line); font: inherit; color: inherit; text-align: start; cursor: pointer; }
button.kpi:first-child { border-inline-start: 0; }
button.kpi:hover { background: var(--accent-t); }
.cell[data-act] { cursor: pointer; }

/* ---------- المنصات والإدارات ---------- */
.plat-block[hidden], .plat-other[hidden], .dept-pick[hidden] { display: none; }
.plat-block { display: grid; gap: 12px; }
.plat-cat { margin: 16px 0 0; font-size: 14px; color: var(--ink-2); }
.ptag { border-radius: var(--r-sm); }
.dept-row .grow { min-width: 0; }
.dept-row .block { display: block; }
.dept-pick { margin-top: 8px; }
