/* =========================================================
   متغیرهای طراحی
   ========================================================= */
:root {
  --brand: #3a4a9f;
  --brand-dark: #2c3878;
  --brand-deep: #1f2858;
  --brand-tint: #eef0fb;
  --brand-tint-2: #e2e6f5;

  --bg-soft: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --line: #e6e8f2;
  --ink: #1e2340;
  --ink-2: #4a5070;
  --ink-3: #7c8299;

  --c-info: #1b8db5;
  --c-success: #1f8f5a;
  --c-warning: #d29d12;
  --c-danger: #b9402f;
  --c-muted: #6b7189;

  /* سایه‌ها با رنگ برند (نه مشکی خالص)، نور از بالا */
  --shadow-sm: 0 1px 2px rgba(31, 40, 88, .06), 0 1px 3px rgba(31, 40, 88, .05);
  --shadow-md: 0 2px 4px rgba(31, 40, 88, .05), 0 8px 24px -6px rgba(31, 40, 88, .12);
  --shadow-lg: 0 4px 8px rgba(31, 40, 88, .06), 0 18px 40px -12px rgba(31, 40, 88, .25);

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --ease: cubic-bezier(.2, .8, .2, 1);

  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-skip: 1100;

  /* اتصال فونت و رنگ‌ها به متغیرهای Bootstrap */
  --bs-body-font-family: 'Samim FD', Tahoma, sans-serif;
  --bs-body-bg: var(--bg-soft);
  --bs-body-color: var(--ink);
  --bs-secondary-color: var(--ink-3);
  --bs-border-color: var(--line);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 58, 74, 159;
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: 58, 74, 159;
  --bs-link-hover-color: var(--brand-dark);
  --bs-link-hover-color-rgb: 44, 56, 120;
  --bs-focus-ring-color: rgba(58, 74, 159, .28);
}

/* =========================================================
   فونت — نسخه FD ارقام انگلیسی را به شکل فارسی نمایش می‌دهد
   ========================================================= */
@font-face {
  font-family: 'Samim FD';
  src: url('../fonts/Samim-FD.woff') format('woff'),
       url('../fonts/Samim-FD.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  font-family: var(--bs-body-font-family);
  background-color: var(--bg-soft);
  background-image:
    radial-gradient(1200px 500px at 100% -10%, rgba(58, 74, 159, .07), transparent 60%),
    radial-gradient(900px 400px at -10% 0%, rgba(27, 141, 181, .05), transparent 55%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.75;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* بافت نویز بسیار ملایم روی کل صفحه */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

/* فرم‌ها و دکمه‌ها فونت را از body به ارث ببرند */
input, select, textarea, button, .form-control, .form-select, .btn, .badge, .tooltip, .popover {
  font-family: inherit;
}

/* ارقام هم‌عرض در جدول‌ها و آمار */
.table, .stat-card h3, .badge, .cal-day-num, .jdp-day, .file-chip-meta, .kanban-card-footer {
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4, h5, h6 { color: var(--ink); letter-spacing: -.01em; line-height: 1.4; text-wrap: balance; }
h4.fw-bold { font-size: 1.45rem; }
h6.fw-bold { font-size: 1rem; color: var(--ink); }
p { text-wrap: pretty; }

a { transition: color .2s var(--ease); }

::selection { background: rgba(58, 74, 159, .18); }

/* پرش به محتوا برای کاربران صفحه‌کلید */
.skip-link {
  position: absolute;
  top: -100px;
  right: 16px;
  z-index: var(--z-skip);
  background: var(--brand-deep);
  color: #fff;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; color: #fff; }

/* حلقه فوکوس واضح */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.btn:focus-visible, .form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 .22rem var(--bs-focus-ring-color);
  border-color: rgba(58, 74, 159, .55);
  outline: none;
}

/* =========================================================
   نوار بالا
   ========================================================= */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background:
    radial-gradient(600px 120px at 85% 0%, rgba(255, 255, 255, .10), transparent 70%),
    linear-gradient(90deg, var(--brand-deep), var(--brand-dark) 45%, var(--brand));
  box-shadow: 0 6px 24px -10px rgba(31, 40, 88, .55);
  padding-block: .55rem;
}
.app-navbar-inner { max-width: 1440px; margin-inline: auto; }

.app-navbar .navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.app-navbar .nav-link {
  position: relative;
  color: rgba(255, 255, 255, .78);
  font-size: .9rem;
  padding: .45rem .75rem !important;
  border-radius: var(--radius-sm);
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.app-navbar .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.app-navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
@media (min-width: 1200px) {
  .app-navbar .nav-link.active::after {
    content: '';
    position: absolute;
    inset-inline: .75rem;
    bottom: -0.55rem;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: #fff;
  }
}

.navbar-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  color: rgba(255, 255, 255, .85);
  font-size: .85rem;
}
.navbar-date { color: rgba(255, 255, 255, .7); }
.user-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
}
.user-avatar-lg {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 1.05rem;
  background: linear-gradient(150deg, var(--brand-dark), var(--brand));
  box-shadow: 0 8px 16px -10px rgba(58, 74, 159, .9);
}
.role-tag {
  display: inline-block;
  font-size: .7rem;
  padding: .05rem .45rem;
  border-radius: 4px;
  font-weight: 700;
  line-height: 1.6;
}
.role-admin { background: #f3d27a; color: #4a3500; }
.role-user  { background: var(--brand-tint); color: var(--brand-dark); }

/* منوی حساب کاربری */
.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  border-radius: 12px;
  padding: .25rem .3rem .25rem .65rem;
  font-size: .86rem;
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.user-menu-toggle:hover,
.user-menu-toggle.active,
.user-menu-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .3); }
.user-menu-toggle:active { transform: translateY(1px); }
.user-menu-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.user-menu-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-caret { opacity: .75; transition: transform .2s var(--ease); }
.user-menu-toggle[aria-expanded="true"] .user-menu-caret { transform: rotate(180deg); }

.user-menu-panel {
  --bs-dropdown-min-width: 260px;
  --bs-dropdown-border-color: var(--line);
  --bs-dropdown-border-radius: 16px;
  --bs-dropdown-link-color: var(--ink);
  --bs-dropdown-link-hover-bg: var(--brand-tint);
  --bs-dropdown-link-hover-color: var(--brand-dark);
  --bs-dropdown-link-active-bg: var(--brand-tint);
  --bs-dropdown-link-active-color: var(--brand-dark);
  --bs-dropdown-divider-bg: var(--line);
  --bs-dropdown-item-padding-x: .75rem;
  --bs-dropdown-item-padding-y: .55rem;
  padding: .5rem;
  margin-top: .6rem !important;
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
}
.user-menu-panel.show { animation: pop-in .18s var(--ease); }
.user-menu-panel .dropdown-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  border-radius: 10px;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.user-menu-panel .dropdown-item svg { flex-shrink: 0; color: var(--ink-3); transition: color .15s var(--ease); }
.user-menu-panel .dropdown-item:hover svg,
.user-menu-panel .dropdown-item.active svg { color: var(--brand); }
.user-menu-panel .dropdown-item.active { font-weight: 600; }
.user-menu-panel .dropdown-item.text-danger:hover { background: #fbecea; color: var(--c-danger) !important; }
.user-menu-panel .dropdown-item.text-danger svg { color: currentColor; }
.user-menu-panel .dropdown-item:disabled { opacity: 1; color: var(--ink-3); }

.user-menu-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .5rem .6rem .35rem;
}
.user-menu-id { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; min-width: 0; }
.user-menu-id strong { font-size: .95rem; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }

.notify-state {
  margin-inline-start: auto;
  font-size: .72rem;
  font-weight: 600;
  padding: .05rem .45rem;
  border-radius: 4px;
}
.notify-state:empty { display: none; }
#notifyToggleBtn.is-on .notify-state { background: #e0f2e8; color: var(--c-success); }
#notifyToggleBtn.is-blocked .notify-state { background: #eceef4; color: var(--ink-3); }

@media (max-width: 1199.98px) {
  .navbar-meta { padding: .75rem .25rem .25rem; border-top: 1px solid rgba(255, 255, 255, .12); margin-top: .5rem; justify-content: space-between; }
  /* در منوی جمع‌شده، دکمه حساب سمت راست است؛ پنل هم از راست باز شود */
  .user-menu-panel,
  .user-menu-panel[data-bs-popper] {
    position: absolute;
    right: 0;
    left: auto;
    max-width: calc(100vw - 2rem);
  }
}

/* =========================================================
   بدنه و فوتر
   ========================================================= */
.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding-top: 2rem;
  padding-bottom: 2.75rem;
  padding-inline: clamp(1rem, 3vw, 2rem);
  flex: 1 0 auto;
}

.app-footer {
  text-align: center;
  color: var(--ink-3);
  font-size: .8rem;
  padding: 1.25rem 1rem 1.75rem;
  border-top: 1px solid var(--line);
}

/* =========================================================
   کارت‌ها
   ========================================================= */
.card {
  border: 1px solid rgba(230, 232, 242, .8);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card.bg-light { background: var(--surface-2) !important; border-style: dashed; box-shadow: none; }
.card h6.fw-bold { display: flex; align-items: center; gap: .4rem; }

/* =========================================================
   کارت‌های آمار
   ========================================================= */
.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.35rem 1.3rem;
  color: #fff;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.stat-card::after {
  /* هایلایت نرم در گوشه — شکستن یکنواختی گرادیان */
  content: '';
  position: absolute;
  inset-inline-start: -30%;
  top: -60%;
  width: 90%;
  height: 160%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .22), transparent);
  z-index: -1;
  pointer-events: none;
}
.stat-card h3 {
  margin: 0;
  font-size: 2.15rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.stat-card p { margin: 0; opacity: .88; font-size: .88rem; }

a.stat-card-link {
  text-decoration: none;
  display: block;
  border-radius: var(--radius-lg);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
a.stat-card-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
a.stat-card-link:active { transform: translateY(0) scale(.985); box-shadow: var(--shadow-sm); }

.stat-total    { background: linear-gradient(150deg, #2f3d8a, #4c5cc0); box-shadow: 0 10px 24px -14px rgba(47, 61, 138, .9); }
.stat-pending  { background: linear-gradient(150deg, #5d6378, #8a90a5); box-shadow: 0 10px 24px -14px rgba(93, 99, 120, .9); }
.stat-progress { background: linear-gradient(150deg, #157a9e, #2ea7cf); box-shadow: 0 10px 24px -14px rgba(21, 122, 158, .9); }
.stat-done     { background: linear-gradient(150deg, #1a7a4c, #2fae73); box-shadow: 0 10px 24px -14px rgba(26, 122, 76, .9); }
.stat-overdue  { background: linear-gradient(150deg, #a3392b, #cf5e4f); box-shadow: 0 10px 24px -14px rgba(163, 57, 43, .9); }
.stat-users    { background: linear-gradient(150deg, var(--brand-deep), #3b4891); box-shadow: 0 10px 24px -14px rgba(31, 40, 88, .9); }
.stat-referred { background: linear-gradient(150deg, #c99412, #e6b947); color: #3d2c00; box-shadow: 0 10px 24px -14px rgba(201, 148, 18, .9); }
.stat-referred h3 { color: #2e2100; }

/* =========================================================
   برچسب‌ها
   ========================================================= */
.badge {
  padding: .32em .65em;
  border-radius: 6px;
  font-weight: 600;
  font-size: .76rem;
  color: #fff;
  line-height: 1.5;
  letter-spacing: 0;
}
.badge-secondary { background: var(--c-muted); }
.badge-info      { background: var(--c-info); }
.badge-warning   { background: #f1c84b; color: #3d2c00; }
.badge-success   { background: var(--c-success); }
.badge-danger    { background: var(--c-danger); }

.badge-light-priority  { background: #eceef4; color: #4a5070; }
.badge-medium-priority { background: #fbe7bd; color: #7a4b00; }
.badge-high-priority   { background: #f7dcd8; color: #842a1e; }

/* =========================================================
   جدول‌ها
   ========================================================= */
.table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: var(--brand-tint);
  margin-bottom: 0;
}
.table thead th {
  white-space: nowrap;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding-block: .7rem;
}
.table thead th:first-child { border-start-start-radius: var(--radius-sm); border-end-start-radius: var(--radius-sm); }
.table thead th:last-child  { border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); }
.table tbody td { border-color: #eff0f6; padding-block: .75rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody td a:not(.btn) { color: var(--ink); font-weight: 600; text-decoration: none; }
.table tbody td a:not(.btn):hover { color: var(--brand); }
.table-sm th { color: var(--ink-3); font-weight: 600; }

.task-row.overdue > * { background-color: #fdf1ef !important; }
.task-row.overdue > :first-child { box-shadow: inset -3px 0 0 var(--c-danger); }

.info-th { width: 180px; }
.text-prewrap { white-space: pre-wrap; }

/* =========================================================
   دکمه‌ها
   ========================================================= */
.btn {
  border-radius: 10px;
  font-weight: 500;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn-sm { border-radius: var(--radius-sm); }

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-deep);
  --bs-btn-active-border-color: var(--brand-deep);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 14px -8px rgba(58, 74, 159, .8);
}
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 10px 20px -10px rgba(58, 74, 159, .9); }

.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: rgba(58, 74, 159, .35);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}
.btn-outline-secondary {
  --bs-btn-color: var(--ink-2);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--brand-tint);
  --bs-btn-hover-color: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-tint-2);
  --bs-btn-active-bg: var(--brand);
  --bs-btn-active-color: #fff;
  --bs-btn-active-border-color: var(--brand);
  background: var(--surface);
}
.btn-group > .btn { border-radius: 0; }

/* =========================================================
   فرم‌ها
   ========================================================= */
.form-label { font-size: .86rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.form-control, .form-select {
  border-radius: 10px;
  border-color: var(--line);
  background-color: var(--surface);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.form-control:hover, .form-select:hover { border-color: #cfd3e4; }
.form-control::placeholder { color: #a6abbe; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-text { color: var(--ink-3); }
.was-validated .form-control:invalid, .form-control.is-invalid { border-color: var(--c-danger); }

/* =========================================================
   تب‌ها، هشدارها، لیست‌ها
   ========================================================= */
.nav-tabs { border-bottom: 1px solid var(--line); gap: .25rem; }
.nav-tabs .nav-link {
  border: 0;
  color: var(--ink-3);
  font-weight: 500;
  border-radius: 0;
  padding-inline: 1rem;
  position: relative;
}
.nav-tabs .nav-link:hover { color: var(--brand); }
.nav-tabs .nav-link.active { color: var(--brand); background: transparent; }
.nav-tabs .nav-link.active::after {
  content: '';
  position: absolute;
  inset-inline: .5rem;
  bottom: -1px;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
}

.alert {
  border: 0;
  border-radius: var(--radius-md);
  border-inline-start: 4px solid currentColor;
  box-shadow: var(--shadow-sm);
}

.list-group-item { border-color: #eff0f6; padding-block: .8rem; background: transparent; }
.list-group-item a { text-decoration: none; font-weight: 600; }

/* =========================================================
   صفحه ورود
   ========================================================= */
.login-wrapper {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem 2.5rem;
  background:
    radial-gradient(700px 400px at 85% 10%, rgba(255, 255, 255, .12), transparent 60%),
    radial-gradient(600px 500px at 0% 100%, rgba(27, 141, 181, .25), transparent 60%),
    linear-gradient(150deg, var(--brand-deep), var(--brand-dark) 50%, var(--brand));
}
.login-card {
  width: 100%;
  max-width: 410px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 30px 60px -20px rgba(15, 20, 50, .55) !important;
}
.login-card .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(150deg, var(--brand-dark), var(--brand));
  box-shadow: 0 10px 20px -10px rgba(58, 74, 159, .9);
}

/* =========================================================
   تقویم شمسی (Jalali Datepicker)
   ========================================================= */
.jdp-wrap { position: relative; }
.jdp-popup {
  display: none;
  position: absolute;
  z-index: var(--z-dropdown);
  top: calc(100% + 6px);
  right: 0;
  width: 284px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 12px;
  border: 1px solid var(--line);
}
.jdp-popup.jdp-open { display: block; animation: pop-in .18s var(--ease); }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.jdp-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jdp-title { font-weight: 700; font-size: .95rem; }
.jdp-nav {
  border: none; background: var(--brand-tint); color: var(--brand-dark);
  border-radius: 8px; font-size: .75rem; padding: 4px 8px; cursor: pointer;
  transition: background-color .2s var(--ease);
}
.jdp-nav:hover { background: var(--brand-tint-2); }
.jdp-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: .75rem; color: var(--ink-3); margin-bottom: 4px; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp-day {
  border: none; background: transparent; border-radius: 8px;
  padding: 6px 0; font-size: .82rem; cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.jdp-day:hover { background: var(--brand-tint); }
.jdp-day.jdp-selected { background: var(--brand); color: #fff; }
.jdp-day.jdp-empty { cursor: default; }
.jdp-footer { display: flex; justify-content: space-between; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.jdp-footer button {
  border: none; background: none; color: var(--brand); font-size: .78rem; cursor: pointer;
}
.jdp-footer button:hover { text-decoration: underline; }

/* =========================================================
   چیپ نمایش فایل پیوست
   ========================================================= */
.file-chip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  text-decoration: none; color: var(--ink); background: var(--surface-2); max-width: 260px;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.file-chip:hover { box-shadow: var(--shadow-md); border-color: var(--brand-tint-2); color: var(--ink); transform: translateY(-1px); }
.file-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.file-chip-icon { font-size: 1.4rem; width: 36px; text-align: center; }
.file-chip-info { display: flex; flex-direction: column; overflow: hidden; }
.file-chip-name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.file-chip-meta { font-size: .7rem; color: var(--ink-3); }
.file-chip.file-chip-sm { padding: 4px 8px; max-width: 220px; }
.file-chip.file-chip-sm img,
.file-chip.file-chip-sm .file-chip-icon { width: 28px; height: 28px; font-size: 1.1rem; }

.unread-badge { font-size: .68rem; animation: unread-pulse 1.8s infinite; }
@keyframes unread-pulse {
  0%   { opacity: 1; }
  50%  { opacity: .55; }
  100% { opacity: 1; }
}

.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-success); vertical-align: middle; margin-inline-start: 4px;
  animation: live-pulse 2s infinite;
}
.live-dot.live-dot-error { background: var(--c-danger); animation: none; }
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(31, 143, 90, .5); }
  70%  { box-shadow: 0 0 0 6px rgba(31, 143, 90, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 143, 90, 0); }
}

/* =========================================================
   تخته وظایف
   ========================================================= */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) {
  .kanban-board { grid-template-columns: 1fr; }
}
.kanban-column {
  background: #eceef6;
  border-radius: var(--radius-lg);
  padding: 10px;
  min-height: 200px;
  box-shadow: inset 0 1px 2px rgba(31, 40, 88, .05);
}
.kanban-column-header {
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px 12px;
}
.kanban-column-body {
  min-height: 120px;
  border-radius: var(--radius-md);
  transition: background-color .2s var(--ease);
  padding-bottom: 4px;
}
.kanban-column-body.drag-over {
  background: rgba(58, 74, 159, .08);
  outline: 2px dashed rgba(58, 74, 159, .35);
}
.kanban-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  border-inline-start: 4px solid #b4b9c9;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.priority-high   { border-inline-start-color: var(--c-danger); }
.kanban-card.priority-medium { border-inline-start-color: var(--c-warning); }
.kanban-card.priority-low    { border-inline-start-color: var(--c-muted); }
.kanban-card.dragging { opacity: .4; }
.kanban-card-title { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.kanban-card-title a { color: inherit; text-decoration: none; }
.kanban-card-title a:hover { color: var(--brand); }
.kanban-card-meta { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.kanban-card-footer { display: flex; justify-content: space-between; font-size: .72rem; color: var(--ink-3); }
.kanban-empty {
  text-align: center; color: #9aa0b5; font-size: .8rem; padding: 22px 0;
  border: 1.5px dashed #d6d9e6; border-radius: var(--radius-md);
}

/* =========================================================
   نمای تقویمی
   ========================================================= */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.cal-weekday {
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  color: var(--ink-3);
  padding: 4px 0;
}
.cal-cell {
  background: var(--surface-2);
  border-radius: 10px;
  min-height: 92px;
  padding: 5px 6px;
  border: 1px solid #eceef6;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.cal-cell:not(.cal-empty):hover { border-color: var(--brand-tint-2); background: var(--surface); }
.cal-cell.cal-empty { background: transparent; border: none; }
.cal-cell.cal-today { border: 2px solid var(--brand); background: var(--brand-tint); }
.cal-day-num { font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.cal-today .cal-day-num { color: var(--brand); }
.cal-pill {
  display: block;
  font-size: .68rem;
  padding: 2px 6px;
  border-radius: 5px;
  margin-bottom: 3px;
  background: #eceef6;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: filter .15s var(--ease);
}
.cal-pill:hover { background: var(--brand-tint-2); color: var(--ink); }
.cal-pill.priority-high { background: #f7dcd8; color: #842a1e; }
.cal-pill.priority-medium { background: #fbe7bd; color: #7a4b00; }
.cal-pill.cal-overdue { background: var(--c-danger); color: #fff; }
.cal-more { font-size: .65rem; color: var(--ink-3); }

.cal-pill.cal-pill-created { background: #e2e6f8; color: var(--brand-dark); border-inline-start: 3px solid var(--brand); }
.cal-pill.cal-pill-due { background: #fcecdc; color: #7f4300; border-inline-start: 3px solid #d9801f; }
.cal-pill.cal-pill-due.cal-overdue { background: var(--c-danger); color: #fff; border-inline-start-color: #6f2318; }
.cal-pill:hover { filter: brightness(.97); }

.cal-legend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  vertical-align: middle; margin-inline-end: 2px;
}

/* =========================================================
   ورود تدریجی محتوا
   ========================================================= */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.main-container > .row,
.main-container > .card,
.main-container > .kanban-board {
  animation: rise-in .45s var(--ease) backwards;
}
.main-container > :nth-child(2) { animation-delay: .04s; }
.main-container > :nth-child(3) { animation-delay: .08s; }
.main-container > :nth-child(4) { animation-delay: .12s; }
.main-container > :nth-child(5) { animation-delay: .16s; }

/* =========================================================
   پروفایل و تغییر رمز
   ========================================================= */
.user-avatar-xl {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  font-size: 1.5rem;
  background: linear-gradient(150deg, var(--brand-dark), var(--brand));
  box-shadow: 0 12px 22px -12px rgba(58, 74, 159, .9);
}
.min-w-0 { min-width: 0; }

.profile-facts > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .6rem 0;
  border-top: 1px solid #eff0f6;
  font-variant-numeric: tabular-nums;
}
.profile-facts dt { font-weight: 500; color: var(--ink-3); font-size: .86rem; }
.profile-facts dd { margin: 0; font-weight: 600; }

.link-quiet { color: var(--ink-2); text-decoration: none; font-size: .9rem; }
.link-quiet:hover { color: var(--brand); }

.password-field { position: relative; }
.password-field .form-control { padding-left: 2.75rem; }
.password-field .form-control.is-invalid { background-position: left 2.6rem center; }
.password-toggle {
  position: absolute;
  left: .35rem;
  top: calc((1.5em + .75rem + 2px) / 2);
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.password-toggle:hover { background: var(--brand-tint); color: var(--brand); }
.password-toggle[aria-pressed="true"] { color: var(--brand); }
