:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #fafbff;
  --border: #e6e8f2;
  --text: #1f2333;
  --text-muted: #6b7086;
  --primary: #4f46e5;
  --primary-light: #eef1ff;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(20, 22, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 22, 40, 0.08);
}

:root[data-theme="dark"] {
  --bg: #12141f;
  --surface: #1a1d2b;
  --surface-2: #222639;
  --border: #2c3049;
  --text: #eef0fa;
  --text-muted: #9aa0bf;
  --primary: #7c73f7;
  --primary-light: #262a4c;
  --danger: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
}
:root[data-theme="dark"] input[type=text], :root[data-theme="dark"] input[type=password],
:root[data-theme="dark"] input[type=date], :root[data-theme="dark"] input[type=datetime-local],
:root[data-theme="dark"] input[type=time], :root[data-theme="dark"] input[type=email],
:root[data-theme="dark"] input[type=tel], :root[data-theme="dark"] input[type=number],
:root[data-theme="dark"] select, :root[data-theme="dark"] textarea { color-scheme: dark; }
:root[data-theme="dark"] input:focus, :root[data-theme="dark"] select:focus, :root[data-theme="dark"] textarea:focus { background: var(--surface); }
/* تقویم (FullCalendar) در حالت تیره */
:root[data-theme="dark"] .fc {
  --fc-border-color: var(--border);
  --fc-page-bg-color: var(--surface);
  --fc-neutral-bg-color: var(--surface-2);
  --fc-list-event-hover-bg-color: var(--surface-2);
  --fc-today-bg-color: rgba(124, 115, 247, .14);
}
:root[data-theme="dark"] .fc-col-header-cell, :root[data-theme="dark"] .fc-daygrid-day-number,
:root[data-theme="dark"] .fc-toolbar-title, :root[data-theme="dark"] .fc-list-day-text,
:root[data-theme="dark"] .fc-list-day-side-text { color: var(--text); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
  font-weight: 800;
  font-size: 18px;
}
.brand-emoji { font-size: 24px; }

.nav-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14.5px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .icon { font-size: 17px; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; flex-shrink: 0;
}
.user-meta { line-height: 1.3; overflow: hidden; }
.user-meta .name { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .role { font-size: 11.5px; color: var(--text-muted); }

.logout-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px; font-size: 12.5px; color: var(--text-muted); text-align: center;
}
.logout-btn:hover { background: #fff1f1; color: var(--danger); border-color: #fca5a5; }

/* ---------- Main ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 22px 28px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title { font-size: 22px; font-weight: 800; margin: 0; }
.page-subtitle { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.view-toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: calc(var(--radius-sm) - 3px);
  padding: 7px 11px;
  font-size: 15px;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.view-toggle-btn.active { background: var(--primary); color: #fff; }
.view-toggle-btn:not(.active):hover { background: var(--primary-light); color: var(--primary); }

.notif-bell {
  position: relative;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.back-btn {
  flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: var(--text);
  transition: background .15s, color .15s;
}
.back-btn:hover { background: var(--primary-light); color: var(--primary); }
.notif-badge {
  position: absolute; top: -3px; left: -3px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; border-radius: var(--radius-sm);
  padding: 10px 16px; font-size: 13.5px; font-weight: 700;
  background: var(--primary); color: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform .1s, box-shadow .15s, opacity .15s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.ghost { background: transparent; color: var(--text-muted); box-shadow: none; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-weight: 800; font-size: 14.5px; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); }
.stat-card .stat-icon { font-size: 20px; }

.domain-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}

.progress-track { background: #eef0f7; border-radius: 999px; height: 9px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; }

.empty-state { text-align: center; padding: 30px 10px; color: var(--text-muted); }
.empty-state .emoji { font-size: 34px; display: block; margin-bottom: 8px; }

/* ---------- Category circles (دسته‌بندی‌های اصلی) ---------- */
.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  justify-content: flex-start;
  padding: 4px 2px 8px;
}
.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 96px;
  text-align: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  position: relative;
}
.category-circle {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  box-shadow: var(--shadow-sm);
  border: 3px solid var(--surface);
  outline: 3px solid var(--circle-color, var(--primary));
  outline-offset: -3px;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
}
.category-item:hover .category-circle { transform: translateY(-4px) scale(1.04); box-shadow: var(--shadow-md); }
.category-item:active .category-circle { transform: translateY(-1px) scale(0.99); }
.category-label { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.category-sub { font-size: 10.5px; color: var(--text-muted); }
.category-badge {
  position: absolute;
  top: -2px;
  left: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  min-width: 19px;
  height: 19px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
}
.category-item.add-new .category-circle {
  background: var(--surface-2);
  outline-color: var(--border);
  outline-style: dashed;
  color: var(--text-muted);
}

/* ---------- خوشه‌ی حباب‌ها (داشبورد اصلی) ---------- */
.bubble-field-wrap {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 150px);
  overflow-x: auto;
  overflow-y: hidden;
}
.bubble-field {
  position: relative;
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 460px;
}
.bubble {
  position: absolute;
  overflow: hidden;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  /* ظاهر «کره‌ی شیشه‌ای»: نور بازتابیِ روشن بالا-چپ + هاله‌ی رنگی محو پایین-راست روی یک زمینه‌ی نیمه‌شفاف */
  background:
    radial-gradient(120% 120% at 27% 20%, rgba(255,255,255,.85), rgba(255,255,255,0) 45%),
    radial-gradient(140% 140% at 74% 82%, rgba(var(--bubble-rgb, 109,92,232), .5), rgba(var(--bubble-rgb, 109,92,232), .06) 62%, transparent 76%),
    rgba(var(--bubble-rgb, 109,92,232), .1);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid rgba(255,255,255,.45);
  box-shadow:
    inset 0 1px 2px rgba(255,255,255,.7),
    inset 0 -16px 22px -12px rgba(var(--bubble-rgb, 109,92,232), .55),
    0 12px 26px -12px rgba(20,20,45,.32);
  opacity: 0;
  transform: scale(0.6);
  animation: bubble-in 0.5s cubic-bezier(.22,1.4,.36,1) forwards;
  transition: box-shadow .18s ease, filter .18s ease, transform .18s ease;
  will-change: transform;
}
/* لکه‌ی درخشش شیشه‌ای — بیضی محو روشن نزدیک بالای کره، مثل بازتاب نور روی یک گوی شیشه‌ای */
.bubble::before {
  content: '';
  position: absolute;
  top: 9%;
  left: 16%;
  width: 40%;
  height: 24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,255,255,0) 72%);
  filter: blur(1px);
  transform: rotate(-16deg);
  pointer-events: none;
}
.bubble:hover { box-shadow: inset 0 1px 2px rgba(255,255,255,.8), inset 0 -16px 22px -12px rgba(var(--bubble-rgb, 109,92,232), .65), 0 16px 32px -12px rgba(20,20,45,.4); filter: brightness(1.03); transform: scale(1.015); z-index: 5; }
.bubble:active { filter: brightness(0.98); transform: scale(0.99); }
.bubble-icon { font-size: var(--bubble-icon-size, 26px); line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); }
.bubble-label { font-weight: 800; color: var(--text); line-height: 1.25; font-size: var(--bubble-label-size, 12.5px); padding: 0 6%; text-shadow: 0 1px 3px rgba(0,0,0,.12); }
.bubble-count {
  font-size: var(--bubble-count-size, 10.5px);
  font-weight: 700;
  color: var(--text-muted);
}
.bubble-count b { color: var(--bubble-color, var(--primary)); }
.bubble.add-new {
  background: rgba(255,255,255,.06);
  border: 2px dashed var(--border);
  color: var(--text-muted);
  box-shadow: none;
}
.bubble.add-new::before { display: none; }
.bubble.add-new:hover { border-color: var(--primary); color: var(--primary); }
@keyframes bubble-in {
  from { opacity: 0; transform: scale(0.55); }
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; opacity: 1; transform: none; }
}
.bubble-empty-state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.bubble-ring {
  position: absolute; pointer-events: none; overflow: visible;
  opacity: 0; animation: bubble-in 0.5s cubic-bezier(.22,1.4,.36,1) forwards;
}
@media (prefers-reduced-motion: reduce) { .bubble-ring { animation: none; opacity: 1; } }

/* صفحه‌ی جزئیات یک گروه */
.group-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.group-hero .category-circle { width: 64px; height: 64px; font-size: 28px; flex-shrink: 0; }
.group-hero > div { min-width: 0; flex: 1; }
.group-hero h1 { margin: 0; font-size: 20px; font-weight: 800; overflow-wrap: break-word; }
.group-hero .domain-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

input[type=text], input[type=password], input[type=date], input[type=datetime-local],
input[type=time], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; }

.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.color-swatch.selected { border-color: var(--text); }

/* ---------- ردیف انتخاب آیکون و رنگ (حوزه‌ها/گروه‌ها) ---------- */
.icon-input-row { display: flex; gap: 8px; }
.icon-input-row input { flex: 1; text-align: center; font-size: 18px; }
.color-input-row { display: flex; gap: 8px; align-items: center; }
.color-input-row input[type=text] { flex: 1; }
.color-input-row input[type=color] {
  width: 40px; height: 40px; padding: 2px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; flex-shrink: 0;
}
.color-hint { font-size: 11px; margin-top: 5px; min-height: 14px; }
.color-hint.bad { color: var(--danger); }
.color-hint.mid { color: var(--warning); }
.color-hint.good { color: var(--success); }

/* ---------- انتخاب‌گر تاریخ شمسی (جایگزین input[type=date/datetime-local] در کل سامانه) ---------- */
.jalali-date-display { cursor: pointer; background: var(--surface-2); }
.jalali-date-display.input-error { border-color: var(--danger); }
.jalali-picker-popup {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 12px; width: 260px; font-size: 13px;
}
.jalali-picker-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; gap: 6px; }
.jalali-picker-title { flex: 1; text-align: center; }
.jalali-picker-ym { display: flex; flex: 1; gap: 4px; min-width: 0; }
.jalali-picker-month-select {
  flex: 1.4; min-width: 0; padding: 4px 2px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
}
.jalali-picker-year-input {
  flex: 1; min-width: 0; padding: 4px 4px; font-size: 12px; font-weight: 700; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text);
}
.jalali-picker-nav {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 28px; height: 28px; cursor: pointer; font-size: 15px; color: var(--text); line-height: 1;
}
.jalali-picker-nav:hover { background: var(--primary-light); color: var(--primary); }
.jalali-picker-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; color: var(--text-muted); font-size: 11px; margin-bottom: 4px; }
.jalali-picker-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jalali-picker-day {
  border: none; background: transparent; border-radius: var(--radius-sm); padding: 6px 0;
  cursor: pointer; font-size: 12.5px; color: var(--text);
}
.jalali-picker-day:hover { background: var(--primary-light); color: var(--primary); }
.jalali-picker-day.muted { visibility: hidden; cursor: default; }
.jalali-picker-day.today { font-weight: 800; color: var(--primary); }
.jalali-picker-day.selected { background: var(--primary); color: #fff; }
.jalali-picker-time-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; }
.jalali-picker-time-row select { width: auto; flex: 1; padding: 6px 8px; }
.jalali-picker-actions { display: flex; gap: 8px; margin-top: 10px; }
.jalali-picker-actions .btn { flex: 1; }

/* ---------- انتخاب‌گر ایموجی ---------- */
.emoji-picker-backdrop {
  position: fixed; inset: 0; background: rgba(20, 22, 40, .45);
  display: none; align-items: center; justify-content: center; z-index: 110; padding: 16px;
}
.emoji-picker-backdrop.open { display: flex; }
.emoji-picker { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; width: 100%; max-width: 380px; box-shadow: var(--shadow-md); }
.emoji-picker-header { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 14px; margin-bottom: 12px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; max-height: 320px; overflow-y: auto; }
.emoji-choice {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm);
  font-size: 19px; padding: 7px 0; transition: background .12s, transform .12s;
}
.emoji-choice:hover { background: var(--primary-light); transform: scale(1.08); }

/* ---------- Tables / lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface);
  flex-wrap: wrap;
}
.list-item .domain-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.list-item .title { font-weight: 700; font-size: 13.5px; }
.list-item .meta { font-size: 12px; color: var(--text-muted); }
.list-item .spacer { flex: 1; }
/* بسته‌ی عنوان/توضیحات (div بدون کلاس، بین دایره‌ی رنگی و بقیه‌ی موارد) — باید بتواند تا هر
   اندازه‌ای که لازم است جمع شود و متن داخلش بشکند، وگرنه با وجود آواتارها/برچسب‌ها/دکمه‌های
   زیاد، این بخش به چند پیکسل فشرده می‌شود و متن‌اش تکه‌تکه و غیرقابل‌خواندن می‌شود. */
.list-item > div:not(.spacer) { flex: 1 1 0%; min-width: 0; }

@media (max-width: 600px) {
  /* روی موبایل، برچسب‌ها و دکمه‌های ویرایش/حذف را با اجبار به خط بعد می‌بریم تا هیچ‌وقت از
     لبه‌ی صفحه بیرون نزنند (روی دسکتاپ به همان صورت قبلی، ته‌چین‌شده در همان خط، باقی می‌مانند). */
  .list-item .spacer { flex: 1 1 100%; }
}

.badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.todo { background: #eef0f7; color: #4b5065; }
.badge.in_progress { background: #fff3d6; color: #92650a; }
.badge.done { background: #e3f9ef; color: #0a8a56; }
.badge.blocked { background: #fde2e2; color: #b91c1c; }
.badge.high { background: #fde2e2; color: #b91c1c; }
.badge.medium { background: #fff3d6; color: #92650a; }
.badge.low { background: #e6f4ff; color: #0369a1; }

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  padding: 20px;
}
.auth-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: var(--radius-lg);
  padding: 32px 28px; box-shadow: var(--shadow-md);
}
.auth-logo { text-align: center; font-size: 36px; margin-bottom: 6px; }
.auth-title { text-align: center; font-weight: 800; font-size: 19px; margin-bottom: 2px; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-bottom: 22px; }
.auth-error { background: #fde2e2; color: #b91c1c; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 12.5px; margin-bottom: 14px; }
.auth-hint { margin-top: 16px; font-size: 11.5px; color: var(--text-muted); text-align: center; line-height: 1.8; }

/* ---------- Calendar ---------- */
#calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; overflow-x: hidden; }
.fc { direction: rtl; }
.fc-event { border: none !important; cursor: pointer; }
/* نوار ابزار پیش‌فرض FullCalendar (دکمه‌های قبلی/بعدی/امروز، عنوان، سوییچ نما) روی موبایل به‌جای
   سرریز افقی و بیرون‌زدگی از کارت، باید به چند خط بشکند و دکمه‌هایش کوچک‌تر شوند. */
.fc-header-toolbar { flex-wrap: wrap; row-gap: 10px; }
.fc-toolbar-chunk { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.fc .fc-button { white-space: nowrap; }
@media (max-width: 600px) {
  .fc-toolbar-title { font-size: 16px !important; }
  .fc .fc-button { padding: 5px 9px !important; font-size: 12.5px !important; }
  .fc-header-toolbar { justify-content: center !important; }
}
/* فعالیت‌های چندروزه (مثل مسافرت) که از صفحه‌ی کارها می‌آیند — با خط‌چین از رویدادهای واقعی متمایز می‌شوند */
.fc-task-range .fc-event-main { border: 2px dashed rgba(255,255,255,.85); border-radius: 6px; }
.fc-task-range.fc-task-range-done .fc-event-main { opacity: .55; text-decoration: line-through; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.calendar-legend { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle-group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.toggle-group button { border: none; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.toggle-group button.active { background: var(--primary); color: #fff; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 22, 40, .45);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); padding: 22px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-md);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 800; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); }
/* دکمه‌های تایید/انصراف به‌صورت «چسبان» به پایینِ خودِ مودال چسبانده می‌شوند (نه پایینِ فرم/صفحه) —
   با position: sticky نسبت به همان .modal که overflow-y: auto دارد. این‌طوری در فرم‌های بلند (مثل
   ویرایش کار/فعالیت) روی موبایل، بدون نیاز به اسکرول تا انتهای فرم، دکمه‌ها همیشه در دیدرس می‌مانند. */
.modal-actions {
  display: flex; gap: 8px; margin-top: 18px; justify-content: flex-end;
  position: sticky; bottom: 0; margin-left: -22px; margin-right: -22px;
  padding: 14px 22px 4px; background: var(--surface); border-top: 1px solid var(--border); z-index: 2;
}
@media (max-width: 480px) {
  .modal { padding: 16px; max-height: 94vh; }
  .modal-actions { margin-left: -16px; margin-right: -16px; padding: 12px 16px 4px; }
  .modal-actions .btn { flex: 1; justify-content: center; }
  .card-title button.btn { width: 100%; justify-content: center; }
  .group-hero { gap: 12px; }
  .group-hero .category-circle { width: 52px; height: 52px; font-size: 22px; }
  .group-hero h1 { font-size: 17px; }
}

/* ---------- Notifications dropdown ---------- */
/* موقعیتِ دقیقِ پنل با جاوااسکریپت (بر اساسِ محلِ واقعیِ زنگ روی صفحه) محاسبه و به‌صورتِ inline
   style تنظیم می‌شود — چون بسته به صفحه و عرضِ صفحه، زنگ گاهی نزدیکِ لبه‌ی چپ و گاهی وسطِ صفحه
   می‌افتد و یک مقدارِ ثابتِ CSS برای «چپ» یا «راست» در همه‌ی حالت‌ها جواب نمی‌دهد. مقادیرِ زیر فقط
   یک پیش‌فرضِ اولیه‌اند، پیش از اجرای جاوااسکریپت. */
.notif-panel {
  position: fixed; top: 60px; left: 12px; right: auto; width: 340px; max-width: calc(100vw - 24px); max-height: 420px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); display: none; z-index: 90;
}
.notif-panel.open { display: block; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; display: flex; align-items: flex-start; gap: 8px; }
.notif-item:last-child { border-bottom: none; }
.notif-item-link { flex: 1; min-width: 0; color: inherit; text-decoration: none; display: block; cursor: pointer; }
.notif-item .title { font-weight: 700; margin-bottom: 3px; }
.notif-item .time { color: var(--text-muted); font-size: 11px; margin-top: 4px; }
.notif-item.unread { background: var(--primary-light); }
.notif-item-delete {
  flex-shrink: 0; background: none; border: none; color: var(--text-muted); font-size: 14px;
  padding: 2px 4px; border-radius: var(--radius-sm); line-height: 1;
}
.notif-item-delete:hover { color: var(--danger); background: #fff1f1; }

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.wrap { flex-wrap: wrap; }

/* ---------- Mobile ---------- */
.mobile-topbar { display: none; }
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: center;
    padding: 10px 14px; border-left: none; border-bottom: 1px solid var(--border); overflow-x: auto;
  }
  .brand { padding: 4px 8px; }
  .nav-list { flex-direction: row; }
  .nav-item span.label { display: none; }
  .sidebar-footer { flex-direction: row; margin-right: auto; }
  .user-meta { display: none; }
  .main { padding: 16px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: 1fr; }
}

/* وقتی از یک اعلان روی یک کار/رویداد کلیک می‌شود، برای چند ثانیه برجسته می‌شود تا پیدا کردنش راحت باشد */
@keyframes highlightFlash {
  0%, 100% { background: transparent; }
  25%, 75% { background: var(--primary-light); }
}
.highlight-flash {
  animation: highlightFlash 2.4s ease-in-out;
}
