
/* =============================================================================
 * اسکرول بار نازک سراسری (مرورگر + منو + پنل ها) — هماهنگ با تم
 * ============================================================================= */
* {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 6px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

body.dark *,
body.dark {
  scrollbar-color: #475569 transparent;
}

body.dark *::-webkit-scrollbar-thumb {
  background: #475569;
}

body.dark *::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* منوی سایدبار */
.sidebar,
.sidebar .nav-list,
.modal,
.modal-body,
#alertsContainer,
.user-dropdown {
  scrollbar-width: thin;
}


/**
 * =============================================================================
 * سیستم مدیریت انبار — استایل اصلی
 * فایل: assets/css/app.css
 * =============================================================================
 * ساختار:
 *   1. متغیرها و ریست
 *   2. چیدمان کلی (هدر، سایدبار، محتوا)
 *   3. کارت ها، جداول، فرم ها، دکمه ها
 *   4. مودال، توست، هشدار ها
 *   5. پریلودر
 *   6. تم تیره
 *   7. چاپ و واکنش گرا
 *   8. کامپوننت های توسعه
 * =============================================================================
 */

    :root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --bg: #f1f5f9;
  --card: #fff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --safe-bottom:env(safe-area-inset-bottom,0px)
}

* {
  margin:0;
  padding:0;
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent
}

body {
  font-family:'Vazirmatn',sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
  min-height:100vh;
  overflow-x:hidden
}

.header {
  background:var(--card);
  border-bottom:1px solid var(--border);
  padding: 0;
  position:sticky;
  top:0;
  z-index:100;
  box-shadow:var(--shadow);
  transition: box-shadow 0.22s ease;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  transition: none;
}

.header.scrolled {
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}

/* ارتفاع هدر ثابت می‌ماند تا هنگام اسکرول پرپر نزند */
.header.scrolled .header-inner {
  padding: 0.75rem 1rem;
}

















.header-left {
  display:flex;
  align-items:center;
  gap:.75rem
}

.menu-btn {
  width:42px;
  height:42px;
  border:none;
  background:#f1f5f9;
  border-radius:10px;
  font-size:1.3rem;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  flex-shrink:0;
}
.menu-lines {
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:center;
  gap:5px;
  width:20px;
  height:16px;
}
.menu-line {
  display:block;
  height:2.5px;
  border-radius:2px;
  background:#ef4444;
  transform-origin:center;
  animation:
    menuLinePulse 2.8s ease-in-out infinite,
    menuLineRainbow 4s linear infinite;
}
.menu-line-1 { width:20px; animation-delay: 0s, 0s; }
.menu-line-2 { width:14px; animation-delay: 0.15s, 0.35s; }
.menu-line-3 { width:17px; animation-delay: 0.3s, 0.7s; }
@keyframes menuLinePulse {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  40% { transform: scaleX(0.82); opacity: 0.85; }
  55% { transform: scaleX(1.06); opacity: 1; }
  70% { transform: scaleX(0.92); opacity: 0.9; }
}
@keyframes menuLineRainbow {
  0%   { background-color: #ef4444; } /* قرمز */
  16%  { background-color: #f97316; } /* نارنجی */
  33%  { background-color: #eab308; } /* زرد */
  50%  { background-color: #22c55e; } /* سبز */
  66%  { background-color: #3b82f6; } /* آبی */
  83%  { background-color: #a855f7; } /* بنفش */
  100% { background-color: #ef4444; } /* برگشت به قرمز */
}
body.dark .menu-line {
  /* رنگ از انیمیشن رنگین‌کمان می‌آید؛ در دارک هم همان طیف */
  background: #ef4444;
}
.menu-btn:hover {
  background:#e2e8f0;
}
body.dark .menu-btn:hover {
  background:#334155;
}
@media (prefers-reduced-motion: reduce) {
  .menu-line { animation: none; background: #334155; }
  body.dark .menu-line { background: #e2e8f0; }
}

.logo {
  display:flex;
  align-items:center;
  gap:.5rem;
  font-weight:700;
  font-size:.95rem
}

.logo-icon {
  width:34px;
  height:34px;
  background:linear-gradient(135deg,#2563eb,#1d4ed8);
  border-radius:9px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#fff;
  font-size:1rem
}

.logo-text {
  transition: font-size 0.22s ease;
  display:none
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: .4rem .65rem .4rem .65rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  color: inherit;
  font: inherit;
}

.user-avatar {
  overflow: hidden;
  width:30px;
  height:30px;
  border-radius:50%;
  background:#cbd5e1;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:.8rem
}

.sidebar-overlay {
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  z-index:200;
  opacity:0;
  visibility:hidden;
  transition:all .3s
}

.sidebar-overlay.show {
  opacity:1;
  visibility:visible
}

.sidebar {
  overflow-y: auto;
  overflow-x: hidden;

  position:fixed;
  top:0;
  right:0;
  width:280px;
  max-width:85vw;
  height:100%;
  background:var(--card);
  z-index:210;
  transform:translateX(100%);
  transition:transform .3s;
  display:flex;
  flex-direction:column;
  box-shadow:-8px 0 30px rgba(0,0,0,.1)
}

.sidebar.open {
  transform:translateX(0)
}

.sidebar-header {
  padding:1.25rem 1.2rem;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between
}

.sidebar-header h3 {
  font-size:1.05rem;
  font-weight:600
}

.close-sidebar {
  width:36px;
  height:36px;
  border:none;
  background:#f1f5f9;
  border-radius:8px;
  font-size:1.2rem;
  cursor:pointer
}

.nav-list {
  padding:1rem .75rem;
  flex:1;
  overflow-y:auto
}

.nav-item {
  display:flex;
  align-items:center;
  gap:.85rem;
  padding:.9rem 1rem;
  border-radius:12px;
  color:var(--text-muted);
  cursor:pointer;
  font-weight:500;
  margin-bottom:.35rem;
  position:relative
}

.nav-item:hover,.nav-item.active {
  background:#eff6ff;
  color:var(--primary)
}

/* nav badge → shared soft mini (بالا) */

.sidebar-footer {
  padding:1rem;
  border-top:1px solid var(--border);
  font-size:.8rem;
  color:var(--text-muted);
  text-align:center
}

.main-content {
  padding:1rem;
  max-width:1400px;
  margin:0 auto;
  padding-bottom:calc(110px + var(--safe-bottom))
}

.search-box {
  margin-bottom: 1rem;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-field-icon {
  position: absolute;
  right: 1rem;
  top: 52%;
  transform: translateY(-50%);
  font-size: 1.05rem;
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.2s ease;
  z-index: 1;
}

.search-box input,
.search-box input#searchInput,
.search-field input#searchInput {
  width: 100%;
  padding: 0.85rem 2.65rem 0.85rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.search-box input::placeholder,
.search-box input#searchInput::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}

.search-box input:hover,
.search-box input#searchInput:hover {
  border-color: #cbd5e1;
}

.search-box input:focus,
.search-box input#searchInput:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18), 0 1px 3px rgba(15, 23, 42, 0.06) !important;
  background: #fff;
}

.search-field:focus-within .search-field-icon {
  color: var(--primary);
}

.search-box input[type="search"]::-webkit-search-decoration,
.search-box input[type="search"]::-webkit-search-cancel-button,
.search-box input[type="search"]::-webkit-search-results-button,
.search-box input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.card {
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  margin-bottom:1.25rem
}

.card-header {
  padding:1rem 1.15rem;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  flex-wrap:wrap
}

.card-title {
  font-size:1.05rem;
  font-weight:600;
  display:flex;
  align-items:center;
  gap:.45rem
}

.table-scroll {
  overflow-x:auto;
  -webkit-overflow-scrolling:touch
}

table {
  width:100%;
  border-collapse:collapse;
  min-width:680px
}

th,td {
  padding:.85rem 1rem;
  text-align:right;
  border-bottom:1px solid var(--border);
  font-size:.88rem
}

th {
  background:#f8fafc;
  font-weight:600;
  font-size:.78rem;
  color:var(--text-muted);
  white-space:nowrap
}

tr:last-child td {
  border-bottom:none
}

.code-badge {
  background:#eff6ff;
  color:var(--primary);
  padding:.2rem .5rem;
  border-radius:6px;
  font-size:.78rem;
  font-weight:600;
  font-family:monospace
}

.loc-text {
  font-size:.78rem;
  color:var(--text-muted)
}

.status {
  display:inline-flex;
  align-items:center;
  gap:.3rem;
  padding:.25rem .6rem;
  border-radius:50px;
  font-size:.76rem;
  font-weight:500;
  white-space:nowrap
}

.status.ok {
  background:var(--success-light);
  color:var(--success)
}

.status.low {
  background:var(--danger-light);
  color:var(--danger)
}

.actions-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}

.actions-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.action-icon {
  width: 34px;
  height: 34px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}

.action-icon .bi {
  margin: 0 !important;
  font-size: 1rem;
}

.action-icon.action-icon-readonly,
.action-icon[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.35);
}

.actions-view-only {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.inventory-table th.no-print,
.inventory-table td.actions-cell {
  min-width: 120px;
}


.section-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:.85rem;
  padding:0 .15rem
}

.section-header h2 {
  font-size:1.1rem;
  font-weight:600;
  color:var(--danger);
  display:flex;
  align-items:center;
  gap:.4rem
}

/* alerts-count → shared soft mini */

.alert-card {
  background:var(--card);
  border:1px solid #fecaca;
  border-radius:12px;
  padding:1rem;
  margin-bottom:.75rem;
  box-shadow:var(--shadow)
}

.alert-card.read {
  opacity: 1;
  border-color: var(--border);
  background: #f1f5f9;
  color: var(--text, #0f172a);
}
.alert-card.read .alert-title,
.alert-card.read strong,
.alert-card.read h4 {
  color: var(--text, #0f172a);
}
body.dark .alert-card.read {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
  opacity: 1;
}
body.dark .alert-card.read .alert-title,
body.dark .alert-card.read strong,
body.dark .alert-card.read h4 {
  color: #f1f5f9;
}
body.dark .alert-card.read .hint,
body.dark .alert-card.read .text-muted {
  color: #94a3b8;
}

/* پنل هشدار/وبلاگ: ارتفاع متناسب با نمایشگر، بقیه اسکرول */
.alerts-desktop {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 96px);
}
.alerts-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.15rem 0.35rem 0.35rem 0;
  margin-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}
#alertsContainer {
  max-height: none;
  overflow: visible;
  padding: 0;
  margin-bottom: 0;
}
.blog-container {
  margin-bottom: 0.75rem;
}
.alerts-section-head {
  margin-top: 0.15rem;
}
.alerts-empty {
  padding: 1rem 0.5rem;
}
@media (max-width: 767px) {
  .alerts-desktop {
    max-height: none;
  }
  .alerts-scroll {
    max-height: min(70vh, 32rem);
  }
}
@media (min-width: 768px) {
  .alerts-desktop {
    position: sticky;
    top: 88px;
  }
}


.alert-title {
  font-weight:600;
  font-size:.95rem;
  margin-bottom:.3rem
}

.alert-meta {
  font-size:.82rem;
  color:var(--text-muted);
  margin-bottom:.9rem
}

.alert-actions {
  display:flex;
  gap:.5rem;
  flex-wrap:wrap
}

.history-item {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:.85rem 1rem;
  border-bottom:1px solid var(--border);
  font-size:.9rem
}

.history-item:last-child {
  border-bottom:none
}

.history-item .qty {
  font-weight:600;
  white-space:nowrap
}

.history-item .qty.out {
  color:var(--danger)
}

.history-item .qty.in {
  color:var(--success)
}

.history-meta {
  font-size:.78rem;
  color:var(--text-muted)
}

.btn {
  border:none;
  border-radius:10px;
  padding:.65rem 1.1rem;
  font-family:inherit;
  font-size:.88rem;
  font-weight:500;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:.4rem;
  min-height:44px;
  text-decoration: none !important;
}
a.btn, a.btn:hover, a.btn:focus, a.btn:active, a.btn:visited {
  text-decoration: none !important;
}

.btn-sm {
  padding:.45rem .75rem;
  font-size:.8rem;
  min-height:36px
}

.btn-primary {
  background:var(--primary);
  color:#fff
}

.btn-primary:active {
  background:var(--primary-dark)
}

.btn-danger {
  background:var(--danger);
  color:#fff
}

.btn-outline {
  background:#fff;
  border:1px solid var(--border);
  color:var(--text)
}

/* خردلی ملایم — خروجی اکسل */
.btn-mustard {
  background: #c4a35a;
  border: 1px solid #b8944a;
  color: #fff;
}
.btn-mustard:hover, .btn-mustard:active {
  background: #b8944a;
  color: #fff;
}
body.dark .btn-mustard {
  background: #b89a5c;
  border-color: #a6884a;
  color: #1a1a1a;
}

.btn-success {
  background:var(--success);
  color:#fff
}

.btn-warning {
  background:var(--warning);
  color:#fff
}

.btn-full {
  width:100%
}

.bottom-bar {
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  background:var(--card);
  border-top:1px solid var(--border);
  padding:.7rem .85rem calc(.7rem + var(--safe-bottom));
  display:flex;
  gap:.45rem;
  z-index:90;
  box-shadow:0 -4px 20px rgba(0,0,0,.06)
}

.bottom-bar .btn {
  flex:1;
  font-size:.78rem;
  padding:.55rem .4rem
}

.modal-overlay {
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.55);
  backdrop-filter:blur(5px);
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index:300;
  opacity:0;
  visibility:hidden;
  pointer-events:none;
  transition:all .3s
}

.modal-overlay.show {
  opacity:1;
  visibility:visible;
  pointer-events:auto
}

.modal {
  background:#fff;
  border-radius:20px 20px 0 0;
  width:100%;
  max-width:100%;
  max-height:92vh;
  overflow:hidden;
  transform:translateY(100%);
  transition:transform .35s;
  display:flex;
  flex-direction:column
}

.modal-overlay.show .modal {
  transform:translateY(0)
}

.modal-header {
  padding:1.15rem 1.25rem;
  border-bottom:1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content:space-between
}

.modal-header h3 {
  font-size:1.1rem;
  font-weight:600
}

.modal-close {
  width:36px;
  height:36px;
  border:none;
  background:#f1f5f9;
  border-radius:8px;
  font-size:1.3rem;
  cursor:pointer
}

.modal-body {
  padding:1.25rem;
  overflow-y:auto;
  flex:1
}

.email-preview {
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:12px;
  padding:1.25rem;
  font-size:.92rem;
  line-height:1.85;
  white-space:pre-wrap
}

.email-subject {
  font-weight:700;
  margin-bottom:1rem;
  padding-bottom:.75rem;
  border-bottom:1px dashed var(--border)
}

.modal-footer {
  padding:1rem 1.25rem calc(1rem + var(--safe-bottom));
  border-top:1px solid var(--border);
  display:flex;
  gap:.6rem;
  flex-wrap:wrap
}

.modal-footer .btn {
  flex:1;
  min-width:100px
}

.form-group {
  margin-bottom:1rem
}

.form-group label {
  display:block;
  font-size:.88rem;
  font-weight:500;
  margin-bottom:.4rem
}

.form-group input,.form-group select {
  width:100%;
  padding:.75rem 1rem;
  border:1px solid var(--border);
  border-radius:10px;
  font-family:inherit;
  font-size:.95rem;
  background:#fff;
  color:var(--text)
}

.form-group input:focus,.form-group select:focus {
  outline:none;
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(37,99,235,.15)
}

.hint {
  font-size:.8rem;
  color:var(--text-muted);
  margin-top:.3rem
}

.stock-info {
  background:#f0f9ff;
  border:1px solid #bae6fd;
  border-radius:10px;
  padding:.75rem 1rem;
  font-size:.9rem;
  margin-bottom:1rem;
  display:none
}

.stock-info.show {
  display:block
}

.empty-state {
  text-align:center;
  padding:2.5rem 1rem;
  color:var(--text-muted)
}

.empty-state .icon {
  font-size:2.8rem;
  margin-bottom:.6rem
}

.toast {
  position:fixed;
  bottom:calc(110px + var(--safe-bottom));
  left:50%;
  transform:translateX(-50%) translateY(80px);
  background:#1e293b;
  color:#fff;
  padding:.85rem 1.4rem;
  border-radius:12px;
  font-size:.9rem;
  box-shadow:0 10px 30px rgba(0,0,0,.2);
  z-index:400;
  opacity:0;
  transition:all .3s;
  max-width:90%;
  text-align:center
}

.toast.show {
  transform:translateX(-50%) translateY(0);
  opacity:1
}

@media(min-width:768px) {
  .logo-text {
    transition: font-size 0.22s ease;
    display:inline
  }
  .main-content {
    padding:1.5rem;
    padding-bottom:1.5rem
  }
  .bottom-bar {
    display:none
  }
  /* مودال‌ها هم‌عرض با باکس برنامه (حداکثر ۱۴۰۰px) — نه درصدی از کل مانیتور */
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1rem;
    box-sizing: border-box;
  }
  .modal {
    border-radius: 16px;
    width: 100%;
    max-width: min(1400px, calc(100vw - 2rem));
    max-height: 85vh;
    transform: scale(.97);
    opacity: 0;
    margin: 0 auto;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.28);
  }
  .modal-overlay.show .modal {
    transform: scale(1);
    opacity: 1;
  }
  /* فرم‌های کوچک‌تر داخل همان محدوده */
  .modal.modal-sm {
    max-width: min(480px, calc(100vw - 2rem));
  }
  .modal.modal-md {
    max-width: min(640px, calc(100vw - 2rem));
  }
  .modal.modal-lg {
    max-width: min(960px, calc(100vw - 2rem));
  }
}

/* تبلت و دسکتاپ: دو ستونه — جستجو بالای لیست، ساعت بالای هشدار ها */
@media (min-width: 768px) {
  .layout-desktop {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
    align-items: start;
  }
  .alerts-desktop {
    position: sticky;
    top: 88px;
  }
  .sidebar-clock {
    display: flex !important;
    width: 100%;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
  }
  /* ساعت هدر در تبلت/دسکتاپ لازم نیست چون کنار هشدار هاست */
  .header-actions .desktop-clock {
    display: none !important;
  }
  .mobile-clock {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .layout-desktop {
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
  }
}


                #app-preloader {
        position:fixed;
  inset:0;
  z-index:9999;
  background:#f1f5f9;
        display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
        transition:opacity .4s ease,visibility .4s ease,background .2s ease;

}

#app-preloader.hide {
  opacity:0;
  visibility:hidden;
  pointer-events:none
}

.preloader-logo {
        width:64px;
  height:64px;
  border-radius:16px;
        background:linear-gradient(135deg,#2563eb,#1d4ed8);
        display:flex;
  align-items:center;
  justify-content:center;
        color:#fff;
  font-size:1.8rem;
  margin-bottom:1.25rem;
        box-shadow:0 8px 24px rgba(37,99,235,.35);
        animation:preloader-pulse 1.2s ease-in-out infinite;

}

@keyframes preloader-pulse {
        0%,100% {
transform:scale(1)
  }
   50% {
transform:scale(1.06)
  }

}

.preloader-title {
  font-size:1rem;
  font-weight:600;
  color:#1e293b;
  margin-bottom:.35rem
}

.preloader-sub {
  font-size:.85rem;
  color:#64748b;
  margin-bottom:1.5rem
}

.preloader-bar-wrap {
        width:min(260px,70vw);
  height:6px;
  background:#e2e8f0;
  border-radius:50px;
  overflow:hidden
}

.preloader-bar {
        height:100%;
  width:0%;
  border-radius:50px;
        background:linear-gradient(90deg,#2563eb,#60a5fa,#2563eb);
        background-size:200% 100%;
        animation:preloader-shine 1.2s linear infinite;
        transition:width .25s ease;

}

@keyframes preloader-shine {
        0% {
background-position:100% 0
  }
   100% {
background-position:-100% 0
  }

}

.preloader-pct {
  font-size:.78rem;
  color:#64748b;
  margin-top:.6rem;
  font-variant-numeric:tabular-nums
}

        html.dark-pending #app-preloader,    body.dark #app-preloader {
  background:#0f172a
}

html.dark-pending .preloader-title,    body.dark .preloader-title {
  color:#f1f5f9
}

html.dark-pending .preloader-sub,    body.dark .preloader-sub,    html.dark-pending .preloader-pct,    body.dark .preloader-pct {
  color:#94a3b8
}

html.dark-pending .preloader-bar-wrap,    body.dark .preloader-bar-wrap {
  background:#334155
}

html.dark-pending .preloader-logo,    body.dark .preloader-logo {
        box-shadow:0 8px 28px rgba(37,99,235,.5);

}

        body.dark  {
        --bg: #0f172a;
   --card: #1e293b;
   --border: #334155;
   --text: #f1f5f9;
   --text-muted: #94a3b8;
        --shadow: 0 4px 12px rgba(0,0,0,.3);

}

body.dark .header, body.dark .sidebar, body.dark .bottom-bar, body.dark .card, body.dark .modal  {
   background: var(--card);

}

body.dark th  {
   background: #0f172a;

}

body.dark .user-chip, body.dark .menu-btn, body.dark .close-sidebar, body.dark .modal-close  {
   background: #334155;
   color: #f1f5f9;

}

body.dark .nav-item:hover, body.dark .nav-item.active  {
   background: #1e3a5f;
   color: #93c5fd;

}

body.dark .search-box input,
body.dark .search-box input#searchInput,
body.dark .form-group input {
   background: #0f172a;
   color: #f1f5f9;
   border-color: #334155;
   box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

body.dark .search-box input:hover,
body.dark .search-box input#searchInput:hover {
   border-color: #475569;
   background: #111827;
}

body.dark .search-box input:focus,
body.dark .search-box input#searchInput:focus {
   outline: none !important;
   border-color: #3b82f6 !important;
   background: #0f172a;
   box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22), 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body.dark .search-box input::placeholder,
body.dark .search-box input#searchInput::placeholder {
   color: #94a3b8;
   opacity: 1;
}

body.dark .search-field-icon {
   color: #94a3b8;
}

body.dark .search-field:focus-within .search-field-icon {
   color: #60a5fa;
}
body.dark .form-group select {
   background-color: #0f172a;
   background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
   background-repeat: no-repeat;
   background-position: left 0.85rem center;
   background-size: 12px 8px;
   color: #f1f5f9;
   border-color: #334155;
}
body.dark .form-group textarea,
body.dark textarea.ann-textarea,
body.dark textarea {
   background: #0f172a;
   color: #f1f5f9;
   border-color: #334155;
}
body.dark .form-group textarea::placeholder,
body.dark textarea.ann-textarea::placeholder,
body.dark textarea::placeholder {
   color: #94a3b8;
   opacity: 1;
}
body.dark .form-group textarea:focus,
body.dark textarea.ann-textarea:focus,
body.dark textarea:focus {
   border-color: #3b82f6;
   outline: none;
   box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

body.dark .code-badge  {
   background: #1e3a5f;
   color: #93c5fd;

}

body.dark .summary-item  {
   background: #0f172a;
   border-color: #334155;

}

body.dark .stock-info  {
   background: #0c4a6e;
   border-color: #0369a1;
   color: #e0f2fe;

}

body.dark .btn-outline  {
   background: #1e293b;
   border-color: #475569;
   color: #f1f5f9;

}

body.dark a[href*="saeednafisi"]  {
   background: #0c4a6e !important;
   color: #7dd3fc !important;

}

body.dark .modal-body .hint  {
   background: #0c4a6e !important;
   border-color: #0369a1 !important;
   color: #e0f2fe;

}

        @media(min-width:768px) {
        .menu-btn {
display:flex !important
  }

}

.user-wrap {
  position: relative;
  margin-left: 0;
  padding-left: 0;
  margin-inline-start: 0;
  padding-inline-start: 0;
}



.user-chip:hover {
  background:#e2e8f0
}

body.dark .user-chip:hover {
  background:#475569
}

.user-dropdown {
        position:absolute;
  top:calc(100% + 8px);
  left:0;
  min-width:220px;
        background:var(--card);
  border:1px solid var(--border);
  border-radius:12px;
        box-shadow:0 10px 40px rgba(0,0,0,.15);
  z-index:150;
  display:none;
  overflow:hidden
}

.user-dropdown.show {
  display:block
}

.user-dropdown .dd-item {
        display:flex;
  align-items:center;
  gap:.75rem;
  padding:.85rem 1rem;
        cursor:pointer;
  font-size:.9rem;
  color:var(--text);
  border:none;
  background:none;
  width:100%;
  font-family:inherit;
  text-align:right
}

.user-dropdown .dd-item:hover {
  background:#f1f5f9
}

body.dark .user-dropdown .dd-item:hover {
  background:#334155
}

.user-dropdown .dd-divider {
  height:1px;
  background:var(--border);
  margin:.25rem 0
}

.user-avatar img,
.avatar-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 50%;
  width:30px;
  height:30px;
  border-radius:50%;
  object-fit:cover
}

.avatar-preview {
  width:80px;
  height:80px;
  border-radius:50%;
  object-fit:cover;
  background:#cbd5e1;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:2rem;
  margin:0 auto 1rem;
  overflow:hidden
}

.avatar-preview img {
  width:100%;
  height:100%;
  object-fit:cover
}

.desktop-only {
  display:none
}

@media(min-width:768px) {
  .desktop-only {
display:inline-flex
  }

}

.report-filters {
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  margin-bottom:1rem
}

.report-filters select,.report-filters input {
  padding:.55rem .75rem;
  border:1px solid var(--border);
  border-radius:8px;
  font-family:inherit;
  font-size:.85rem
}

.summary-box {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(120px,1fr));
  gap:.75rem;
  margin-bottom:1rem
}

.summary-item {
  background:#f8fafc;
  border:1px solid var(--border);
  border-radius:10px;
  padding:.85rem;
  text-align:center
}

.summary-item .num {
  font-size:1.3rem;
  font-weight:700
}

.summary-item .lbl {
  font-size:.78rem;
  color:var(--text-muted)
}

.view-panel {
  display:none
}

.view-panel.active {
  display:block
}

@media print {
  /* همیشه چاپ با ظاهر روشن — حتی اگر تم تیره فعال باشد */
  html,
  html.dark-pending,
  body,
  body.dark {
    background: #fff !important;
    color: #111 !important;
    color-scheme: light !important;
  }
  body.dark,
  body.dark *,
  body.print-inventory,
  body.print-inventory *,
  body.print-variance,
  body.print-variance *,
  .print-area,
  .print-area * {
    color: #111 !important;
    background: transparent !important;
    border-color: #333 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  body.dark .print-area,
  body.dark .card,
  body.dark table,
  body.dark .inventory-table,
  body.dark th,
  body.dark td,
  body.dark .summary-item,
  body.dark .stock-info {
    background: #fff !important;
    color: #111 !important;
  }
  body.dark th,
  body.print-inventory .inventory-table th {
    background: #eee !important;
    color: #111 !important;
  }
  body.dark a,
  body.dark a:visited {
    color: #111 !important;
  }

  /* حالت پیش فرض گزارش ها: فقط .print-area */
  body:not(.print-inventory):not(.print-variance) * {
    visibility: hidden;
  }
  body:not(.print-inventory):not(.print-variance) .print-area,
  body:not(.print-inventory):not(.print-variance) .print-area * {
    visibility: visible;
  }
  body:not(.print-inventory):not(.print-variance) .print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff !important;
    color: #111 !important;
  }
  /* جدول گزارش هنگام چاپ نباید اسکرول‌باکس بماند — همه ردیف‌ها چاپ شوند */
  body:not(.print-inventory):not(.print-variance) .print-area .table-scroll {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
  body:not(.print-inventory):not(.print-variance) .print-area table {
    page-break-inside: auto;
  }
  body:not(.print-inventory):not(.print-variance) .print-area tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  .no-print {
    display: none !important;
  }

  /* چاپ لیست اقلام */
  body.print-inventory {
    background: #fff !important;
    color: #000 !important;
  }
  body.print-inventory * {
    visibility: visible !important;
    color: #000 !important;
  }
  body.print-inventory .header,
  body.print-inventory .sidebar,
  body.print-inventory .sidebar-overlay,
  body.print-inventory .bottom-bar,
  body.print-inventory .modal-overlay,
  body.print-inventory .pagination,
  body.print-inventory .search-box,
  body.print-inventory .alerts-desktop,
  body.print-inventory #historyCard,
  body.print-inventory #reportsSection,
  body.print-inventory #lowstockSection,
  body.print-inventory .no-print,
  body.print-inventory #app-preloader {
    display: none !important;
    visibility: hidden !important;
  }
  body.print-inventory .main,
  body.print-inventory .content,
  body.print-inventory .layout-desktop,
  body.print-inventory .card,
  body.print-inventory .table-scroll {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    background: #fff !important;
  }
  body.print-inventory .print-only,
  body.print-inventory .inventory-print-header {
    display: block !important;
  }
  body.print-inventory .inventory-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11pt;
  }
  body.print-inventory .inventory-table th,
  body.print-inventory .inventory-table td {
    border: 1px solid #333;
    padding: 6px 8px;
    text-align: right;
  }
  body.print-inventory .inventory-table th {
    background: #eee !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}


  html.dark-pending,html.dark-pending body {
  background:#0f172a!important;
  color:#f1f5f9
}

html.dark-pending #app-preloader {
  background:#0f172a!important
}

html.dark-pending .preloader-title {
  color:#f1f5f9!important
}

html.dark-pending .preloader-sub,html.dark-pending .preloader-pct {
  color:#94a3b8!important
}

html.dark-pending .preloader-bar-wrap {
  background:#334155!important
}

.alerts-actions  {
display: flex;
flex-direction: column;
gap: 0.65rem;
margin-top: 1rem;

}

.alerts-actions .btn  {
width: 100%;
min-height: 44px;
margin: 0;

}

.icon  {
width: 1.15em;
height: 1.15em;
display: inline-block;
vertical-align: -0.2em;
fill: none;
stroke: currentColor;
stroke-width: 2;
stroke-linecap: round;
stroke-linejoin: round;
flex-shrink: 0;

}

.icon-sm  {
   width: 1em;
   height: 1em;

}

.icon-lg  {
   width: 1.5em;
   height: 1.5em;

}

.logo-icon svg  {
   width: 1.25rem;
   height: 1.25rem;
   stroke: #fff;

}

.nav-item .icon  {
   width: 1.25rem;
   height: 1.25rem;

}

.logo-img  {
width: 34px;
height: 34px;
border-radius: 9px;
object-fit: cover;

}

.logo-text-custom  {
   font-weight: 700;
   font-size: 0.95rem;

}

.form-section-title  {
font-weight: 600;
font-size: 0.95rem;
margin: 1rem 0 0.75rem;
padding-top: 0.75rem;
border-top: 1px solid var(--border);

}


/* =============================================================================
 * فونت آیکون Bootstrap Icons
 * ============================================================================= */

.bi {
  vertical-align: -0.125em;
}

.nav-item .bi,
.dd-item .bi,
.card-title .bi,
.btn .bi {
  margin-left: 0.35rem;
  font-size: 1.05em;
}

.menu-btn .bi,
.close-sidebar .bi,
.modal-close .bi {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.btn-sm .bi {
  margin-left: 0;
  font-size: 1rem;
}

.preloader-logo .bi {
  font-size: 1.75rem;
  color: #fff;
}

.logo-icon .bi {
  color: #fff;
  font-size: 1.15rem;
}

/* هماهنگی تم تیره برای آیکون ها */
body.dark .bi {
  /* رنگ از currentColor ارث می برد */
}

/* تعداد اقلام کنار عنوان */
.items-count {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9em;
  margin-right: 0.25rem;
}

.print-only {
  display: none;
}

@media print {
  .no-print {
    display: none !important;
  }

  .print-only,
  .inventory-print-header {
    display: block !important;
  }

  body {
    background: #fff !important;
  }

  .sidebar,
  .header,
  .bottom-bar,
  .modal-overlay,
  #app-preloader {
    display: none !important;
  }

  .main,
  .content {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .card {
    box-shadow: none !important;
    border: none !important;
  }

  #historyCard,
  #alertsSection,
  #reportsSection,
  #lowstockSection {
    display: none !important;
  }

  body.print-inventory #historyCard,
  body.print-inventory #alertsSection {
    display: none !important;
  }

  table {
    font-size: 12px;
  }
}


@media print {
  body.print-inventory .inventory-table th.no-print,
  body.print-inventory .inventory-table td.no-print,
  body.print-inventory .inventory-table th:last-child,
  body.print-inventory .inventory-table td:last-child {
    display: none !important;
  }

  body.print-inventory #historyCard,
  body.print-inventory .alerts-panel,
  body.print-inventory #alertsSection {
    display: none !important;
  }
}


/* صفحه بندی لیست اقلام */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 1.1rem 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(to bottom, transparent, rgba(241, 245, 249, 0.6));
}

.pagination .page-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.pagination .page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}

.pagination .page-btn:active:not(:disabled) {
  transform: translateY(0);
}

.pagination .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.pagination .page-btn.active:hover:not(:disabled) {
  background: var(--primary-dark, #1d4ed8);
  color: #fff;
}

.pagination .page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.pagination .page-info {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0 0.35rem 0 0.65rem;
  padding: 0.55rem 0.9rem;
  background: #f1f5f9;
  border-radius: 10px;
  white-space: nowrap;
}

body.dark .pagination {
  background: linear-gradient(to bottom, transparent, rgba(15, 23, 42, 0.5));
}

body.dark .pagination .page-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

body.dark .pagination .page-btn:hover:not(:disabled) {
  background: #1e3a5f;
  border-color: #3b82f6;
  color: #93c5fd;
}

body.dark .pagination .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.dark .pagination .page-info {
  background: #0f172a;
  color: #94a3b8;
}

@media (max-width: 480px) {
  .pagination {
    gap: 0.45rem;
    padding: 1rem 0.75rem 1.1rem;
  }

  .pagination .page-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 0.65rem;
    font-size: 0.9rem;
    border-radius: 10px;
  }

  .pagination .page-info {
    width: 100%;
    text-align: center;
    margin: 0.35rem 0 0;
    order: -1;
  }
}


/* جستجوی کالا در مودال ورود/خروج */
.item-search-input {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
  background: var(--card);
  color: var(--text);
}

.item-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.item-select-list {
  width: 100%;
  min-height: 160px;
  max-height: 200px;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--card);
  color: var(--text);
}

.item-select-list option {
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
}

.unit-label {
  font-weight: 500;
  color: var(--primary);
  font-size: 0.88em;
}

body.dark .item-search-input,
body.dark .item-select-list {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}


.btn.is-busy,
.btn:disabled {
  opacity: 0.7;
  cursor: wait;
}


/* پالس ملایم برای ردیف کمبود موجودی */
@keyframes stock-low-pulse {
  0%, 100% { background-color: rgba(254, 226, 226, 0.35); }
  50% { background-color: rgba(254, 202, 202, 0.85); }
}
tr.row-low-pulse td {
  animation: stock-low-pulse 2.4s ease-in-out infinite;
}
/* نوار قرمز در لبه شروع ستون (در RTL سمت راست) */
tr.row-low-pulse td:first-child {
  box-shadow: inset -1px 0 0 #dc2626;
  border-inline-start: 1px solid #dc2626;
}
body.dark tr.row-low-pulse td {
  animation-name: stock-low-pulse-dark;
}
body.dark tr.row-low-pulse td:first-child {
  box-shadow: inset -1px 0 0 #f87171;
  border-inline-start-color: #f87171;
}

/* مسیر دسته‌بندی زیر نام کالا — مخفی در موبایل و تبلت کوچک */
.item-cat-path {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .15rem;
}
@media (max-width: 991px) {
  .item-cat-path {
    display: none !important;
  }
}
@keyframes stock-low-pulse-dark {
  0%, 100% { background-color: rgba(127, 29, 29, 0.25); }
  50% { background-color: rgba(185, 28, 28, 0.4); }
}


/* سوییچ کپسولی هشدار ایمیل */
.alert-email-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.45rem 0.6rem;
  background: rgba(37, 99, 235, 0.06);
  border-radius: 999px;
}
.alert-email-toggle .toggle-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.capsule-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.capsule-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.capsule-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  border-radius: 999px;
  transition: 0.2s;
}
.capsule-slider:before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  right: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.capsule-switch input:checked + .capsule-slider {
  background: #22c55e;
}
.capsule-switch input:checked + .capsule-slider:before {
  transform: translateX(-22px);
}
body.dark .alert-email-toggle {
  background: rgba(59, 130, 246, 0.15);
}
body.dark .capsule-slider {
  background: #475569;
}

/* نحوه سفارش‌دهی بخش — رادیوهای فشرده */
.order-mode-box {
  margin-bottom: 1rem;
}
.order-mode-title {
  font-weight: 600;
  margin-bottom: .45rem;
  display: block;
  font-size: .9rem;
}
.order-mode-radios {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .2rem;
  background: var(--bg, #f1f5f9);
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
}
.order-mode-opt {
  position: relative;
  cursor: pointer;
  margin: 0;
}
.order-mode-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.order-mode-chip {
  display: inline-block;
  padding: .4rem .75rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-muted, #64748b);
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
  user-select: none;
}
.order-mode-opt input:checked + .order-mode-chip {
  background: #fff;
  color: var(--primary, #2563eb);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .1);
  font-weight: 600;
}
.order-mode-opt:hover .order-mode-chip {
  color: var(--text, #0f172a);
}
body.dark .order-mode-radios {
  background: rgba(30, 41, 59, .8);
  border-color: #334155;
}
body.dark .order-mode-opt input:checked + .order-mode-chip {
  background: #1e293b;
  color: #93c5fd;
}


/* ساعت و تاریخ شمسی */
.header-clock {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.12);
  line-height: 1.25;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* در RTL: تاریخ سمت راست، ساعت سمت چپ */
.header-clock .clock-date {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  order: 1;
}

.header-clock .clock-time {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "Vazirmatn", monospace;
  color: var(--primary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  order: 2;
}

body.dark .header-clock {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.2);
}

body.dark .header-clock .clock-time {
  color: #93c5fd;
}

.desktop-clock {
  display: none;
}

.mobile-clock {
  display: flex;
  margin: 0 0 0.85rem 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-radius: 12px;
  padding: 0.5rem 0.85rem;
}

@media (min-width: 768px) {
  .desktop-clock {
    display: flex;
    margin-left: 0.5rem;
  }
  .mobile-clock {
    display: none !important;
  }
}

/* آواتار مشاهده گر */
.user-avatar.viewer-avatar {
  background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
  color: #fff !important;
  font-size: 0.95rem !important;
}
/* اگر آواتار تصویری تنظیم شده باشد، نمایش داده می شود */
.user-avatar.viewer-avatar img.avatar-img {
  display: block !important;
}

/* پیش نمایش ایمیل در تم تیره */
.email-preview {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  font-size: 0.9rem;
  line-height: 1.7;
  max-height: 280px;
  overflow-y: auto;
}

.email-preview .email-subject {
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

body.dark .email-preview {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark .email-preview .email-subject {
  color: #f1f5f9;
  border-bottom-color: #334155;
}

.header-inner .desktop-clock {
  margin: 0;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .header-inner {
    flex-wrap: nowrap;
  }
}


/* پنل سفارش ها — هم عرض محتوای اصلی */
.orders-panel {
  width: 100%;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.orders-panel .card {
  width: 100%;
  max-width: 100%;
}


/* ========== ظاهر یکپارچه select / فیلترها ========== */
select:not([size]):not(.item-select-list),
.report-filters select,
.form-group select,
#ordersStatusFilter,
#activityActorFilter,
#reportPeriod,
#reportDept,
#reportType,
#outDept,
#itemUnit,
#smtpEnc,
#newUserRole,
#newUserDeptName,
#newUserWarehouseMode {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.85rem center;
  padding: 0.55rem 1rem 0.55rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
  min-height: 40px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
  max-width: 100%;
}

select:not([size]):not(.item-select-list):hover {
  border-color: #93c5fd;
}

select:not([size]):not(.item-select-list):focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

body.dark select:not([size]):not(.item-select-list) {
  background-color: #1e293b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.85rem center;
  background-size: 12px 8px;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark select:not([size]):not(.item-select-list):focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.report-filters select,
.report-filters input[type="date"] {
  min-width: 140px;
}

.report-filters input[type="date"] {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  background: var(--card);
  color: var(--text);
  min-height: 40px;
}

/* انبارگردانی چاپ */
@media print {
  body.print-stocktake * { visibility: hidden !important; }
  body.print-stocktake #stocktakePrint,
  body.print-stocktake #stocktakePrint * { visibility: visible !important; }
  body.print-stocktake #stocktakePrint {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    padding: 12px !important;
    background: #fff !important;
  }
  body.print-stocktake .no-print { display: none !important; }
  body.print-stocktake input.count-input { display: none !important; }
  body.print-stocktake .print-only { display: block !important; visibility: visible !important; }
  body.print-stocktake td.stocktake-count-cell {
    visibility: visible !important;
    font-weight: 700 !important;
    text-align: center !important;
  }
}
.stocktake-table input.count-input {
  width: 90px;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  text-align: center;
}


.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.onboarding-card {
  background: var(--card);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  border: 1px solid var(--border);
}
.onboarding-card h3 { margin: 0 0 .5rem; font-size: 1.15rem; }
.onboarding-card p { margin: 0; color: var(--text-muted); line-height: 1.7; font-size: .95rem; }


/* =============================================================================
 * زنگوله اعلان هدر
 * ============================================================================= */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-inline-start: auto;
  flex-wrap: nowrap;
}

.header-bell {
  position: relative;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: var(--bg, #f1f5f9);
  color: var(--text, #0f172a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.header-bell:hover {
  background: #e2e8f0;
}

body.dark .header-bell {
  background: #334155;
  color: #f1f5f9;
}

body.dark .header-bell:hover {
  background: #475569;
}


/* شمارنده‌های کوچک قرمز ملایم (نامه، زنگوله، منو) */
.header-bell-count,
.nav-item .badge,
.alerts-count {
  min-width: 15px !important;
  height: 15px !important;
  padding: 0 3px !important;
  font-size: 0.58rem !important;
  line-height: 15px !important;
  font-weight: 700 !important;
  border-radius: 999px !important;
  background: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 0 0 1.5px var(--card, #fff);
  display: none;
  align-items: center;
  justify-content: center;
}
.header-bell-count {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  z-index: 2;
}
.nav-item .badge {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}
.alerts-count {
  display: inline-flex;
  vertical-align: middle;
  margin-inline-start: 0.35rem;
}
.header-bell {
  overflow: visible !important;
}


.header-bell.has-notif {
  animation: bell-soft 2.8s ease-in-out infinite;
}

@keyframes bell-soft {
  0%, 100% { transform: rotate(0); }
  8% { transform: rotate(12deg); }
  16% { transform: rotate(-10deg); }
  24% { transform: rotate(0); }
}

/* هدر بخش — هم‌اندازه با پنل اصلی */
.dept-user-chip {
  display: flex;
  align-items: center;
  position: relative;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
}
.dept-user-chip .user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.65rem 0.4rem 0.65rem;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid transparent;
  cursor: pointer;
}
body.dark .dept-user-chip .user-chip {
  background: #334155;
}
.dept-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: inherit;
  padding: 0;
  border: none;
  background: transparent;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.dark .dept-user-name {
  background: transparent;
  border: none;
  color: inherit;
}
body.dark .dept-user-chip {
  background: transparent;
  border: none;
}

.header-logout-btn {
  flex-shrink: 0;
}

/* چیدمان هدر: لوگو یک طرف، ساعت+زنگوله+کاربر طرف دیگر */
.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 58%;
}

.header-left .logo {
  min-width: 0;
}

.header-left .logo-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* موبایل/تبلت */
@media (max-width: 1024px) {
  .header-inner {
    gap: 0.4rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .header-left {
    max-width: 48%;
  }
  .header-left .logo-text {
    font-size: 0.82rem;
  }
  .header-actions {
    gap: 0.35rem;
    margin-inline-start: auto;
  }
  .header-clock .clock-date {
    font-size: 0.72rem;
  }
  .header-clock .clock-time {
    font-size: 0.85rem;
  }
  .dept-user-name {
    max-width: min(42vw, 160px);
    font-size: 0.82rem;
  }
}

@media (max-width: 640px) {
  .header-left {
    max-width: 40%;
  }
  .header-left .logo-text {
    font-size: 0.75rem;
  }
  .header-clock .clock-date {
    display: block;
    font-size: 0.65rem;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-bell {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }
  .logout-label {
    display: none;
  }
  .dept-user-name {
    max-width: min(36vw, 120px);
  }
}

@media (max-width: 480px) {
  .dept-user-name { max-width: 72px; }
}


.dept-user-chip .user-avatar {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
  background: #cbd5e1;
}
.dept-user-chip .user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
body.dark .dept-user-chip .user-avatar {
  background: #475569;
  color: #f1f5f9;
}

/* ساعت موبایل: ساعت چپ، روز/تاریخ راست */
.mobile-clock {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.mobile-clock .clock-date {
  display: block !important;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  order: 1;
}
.mobile-clock .clock-time {
  font-size: 0.95rem;
  font-weight: 700;
  order: 2;
}
body.dark .mobile-clock .clock-date {
  color: #94a3b8;
}
@media (min-width: 768px) {
  .mobile-clock { display: none !important; }
  .desktop-clock { display: flex !important; }
}

.search-above-inventory {
  margin-bottom: 0.85rem;
}
.main-col {
  min-width: 0;
}
.sidebar-clock {
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  box-sizing: border-box;
}

@media print {
  body.print-mgmt-stock * { visibility: hidden !important; }
  body.print-mgmt-stock #mgmtStockPrintArea,
  body.print-mgmt-stock #mgmtStockPrintArea *,
  body.print-mgmt-stock #mgmtStockSummary,
  body.print-mgmt-stock #mgmtStockSummary * {
    visibility: visible !important;
  }
  body.print-mgmt-stock #mgmtStockPrintArea {
    position: absolute;
    left: 0; top: 60px; width: 100%;
  }
  body.print-mgmt-stock #mgmtStockSummary {
    position: absolute;
    left: 0; top: 0; width: 100%;
  }
  body.print-mgmt-stock #mgmtStockPrintArea,
  body.print-mgmt-stock #mgmtStockPrintArea .table-scroll {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
  body.print-mgmt-report .print-area .table-scroll {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
}


/* =============================================================================
 * فیلد تاریخ حرفه ای + سبد سفارش بخش + اعداد فارسی
 * ============================================================================= */
input[type="date"].jdate-input,
input.jdate-input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 100%;
  transition: border-color .2s, box-shadow .2s, background .2s;
  color-scheme: light;
}
input[type="date"].jdate-input:hover {
  border-color: #94a3b8;
}
input[type="date"].jdate-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
body.dark input[type="date"].jdate-input {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
  color-scheme: dark;
}
body.dark input[type="date"].jdate-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

/* برچسب شمسی کنار فیلد — بدون به هم ریختن ردیف فیلترها */
.jdate-wrap {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  vertical-align: middle;
  flex-shrink: 0;
  max-width: 100%;
}
.jdate-wrap .jdate-input {
  flex-shrink: 0;
}
.jdate-wrap .jdate-fa-label {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  font-weight: 500;
  white-space: nowrap;
  max-width: 10.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
body.dark .jdate-wrap .jdate-fa-label {
  color: #94a3b8;
}
/* در ردیف های فشرده هدر فیلتر */
.card-header .jdate-wrap .jdate-fa-label,
.orders-panel .jdate-wrap .jdate-fa-label {
  max-width: 8.5rem;
}


/* سبد سفارش بخش */
.cart-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--bg, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
}
.cart-item input[type="number"],
.cart-item .cart-qty {
  width: 88px;
  min-height: 40px;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  transition: border-color .2s, box-shadow .2s;
}
.cart-item input[type="number"]:focus,
.cart-item .cart-qty:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
body.dark .cart-item {
  background: #1e293b;
  border-color: #334155;
}
body.dark .cart-item input[type="number"],
body.dark .cart-item .cart-qty {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

/* نمایش اعداد فارسی در کل برنامه */
body.digits-fa {
  /* اعداد در فونت های فارسی اغلب خودکار فارسی می شوند؛ کلاس برای JS */
}

.list-pager {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 0.5rem;
}
.list-pager .btn {
  min-width: 2.25rem;
}


/* فیلتر دسته — زیر جستجو، تمام عرض */
.category-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0 0 0.85rem;
  padding: 0;
  box-sizing: border-box;
}
.category-filter-label {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.category-filter-select,
select#filterCategory.category-filter-select {
  flex: 1 1 auto;
  width: 100%;
  max-width: none !important;
  min-height: 2.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}
.category-filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
[data-theme="dark"] .category-filter-select,
[data-theme="dark"] select#filterCategory.category-filter-select {
  background: var(--card);
  border-color: var(--border);
  color: var(--text);
}

/* پاپ‌آپ اعلانات سراسری */
.ann-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: annFadeIn .2s ease;
}
@keyframes annFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ann-popup-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem 1.35rem 1.25rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: annSlideUp .25s ease;
}
@keyframes annSlideUp {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.ann-popup-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto .75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}
.ann-popup-title {
  margin: 0 0 .65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}
.ann-popup-body {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text, #334155);
  text-align: right;
  margin-bottom: 1rem;
  max-height: 40vh;
  overflow: auto;
}
.ann-popup-close {
  margin-top: .25rem;
}
body.dark .ann-popup-card {
  background: #1e293b;
  color: #e2e8f0;
}
body.dark .ann-popup-title {
  color: #f1f5f9;
}
body.dark .ann-popup-body {
  color: #cbd5e1;
}

/* لوگو لینک */
a.logo {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
}
a.logo:hover .logo-text,
a.logo:hover .logo-text-custom {
  text-decoration: none !important;
}
a.logo .logo-text,
a.logo .logo-text-custom {
  text-decoration: none !important;
}
#headerUserName {
  font-family: 'Ubuntu', 'Vazirmatn', sans-serif;
  font-weight: 500;
}

/* فیلد متن اعلان */
.ann-textarea,
textarea#annBody,
.form-group textarea {
  display: block;
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
  padding: .75rem;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  font-family: 'Vazirmatn', sans-serif !important;
  font-size: .95rem;
  line-height: 1.7;
  resize: none !important;
  min-height: 7rem;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
}
.ann-textarea:focus,
textarea#annBody:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.ann-textarea::placeholder,
textarea#annBody::placeholder,
.form-group textarea::placeholder {
  font-family: 'Vazirmatn', sans-serif !important;
  color: #94a3b8;
}


/* فقط هنگام چاپ دیده شود — در صفحه عادی مخفی */


/* شماره صفحه چاپ — پایین راست */
@media print {
  @page {
    margin: 12mm 10mm 16mm 10mm;
    @bottom-right {
      content: counter(page);
      font-family: Tahoma, Arial, sans-serif;
      font-size: 9pt;
      color: #333;
    }
    @bottom-center { content: none; }
    @bottom-left { content: none; }
  }
}


/* دکمه‌های آیکونی پنل سوپرادمین */
.super-owner-actions .action-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.super-owner-actions .action-icon i {
  font-size: 1rem;
  line-height: 1;
}
.super-owner-actions .action-icon-toggle {
  width: 46px;
  min-width: 46px;
  height: 34px;
}
.super-owner-actions .action-icon-toggle i {
  font-size: 1.25rem;
}


/* فیلد کمکی قفل‌شده (وقتی بخش دیگر استفاده شده) */
input.helper-locked,
select.helper-locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: #f1f5f9 !important;
}
body.dark input.helper-locked,
body.dark select.helper-locked {
  background: #1e293b !important;
}


/* اسپینر فیلدهای عددی — هماهنگ با تم تیره + حذف تغییر با اسکرول */
input[type="number"] {
  color-scheme: light;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
body.dark {
  color-scheme: dark;
}
body.dark input[type="number"],
body.dark .form-group input[type="number"],
body.dark .cart-item input[type="number"],
body.dark input[type="date"] {
  color-scheme: dark;
}
body.dark input[type="number"]::-webkit-inner-spin-button,
body.dark input[type="number"]::-webkit-outer-spin-button {
  filter: invert(0.9) contrast(0.95);
  opacity: 0.95;
}


/* ===== تولد ===== */
.header-bday {
  position: relative;
  border: none;
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
  padding: .35rem .45rem;
  border-radius: 12px;
  line-height: 1;
  animation: bdayPulse 1.6s ease-in-out infinite;
}
.header-bday:hover { background: rgba(251, 191, 36, .15); }
@keyframes bdayPulse {
  0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 transparent); }
  50% { transform: scale(1.18) rotate(-8deg); filter: drop-shadow(0 0 8px rgba(251,191,36,.7)); }
}
.bday-fab {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  left: auto;
  z-index: 90;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 1.55rem;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  box-shadow: 0 8px 24px rgba(249, 115, 22, .45);
  cursor: pointer;
  animation: bdayFabBounce 2s ease-in-out infinite;
}
.bday-fab .bday-fab-icon,
.bday-fab {
  text-align: center;
}
@keyframes bdayFabBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.08); }
  60% { transform: translateY(-4px) scale(1.03); }
}
.bday-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.bday-confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.bday-popup {
  position: relative;
  z-index: 2;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.bday-balloon {
  font-size: 3.5rem;
  display: inline-block;
  animation: bdayBalloonPop .7s cubic-bezier(.2,.9,.3,1.3) forwards;
  margin-bottom: .25rem;
}
@keyframes bdayBalloonPop {
  0% { transform: scale(0) translateY(40px); opacity: 0; }
  60% { transform: scale(1.25) translateY(-8px); opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.bday-popup-inner {
  background: var(--card, #fff);
  border-radius: 20px;
  padding: 1.5rem 1.25rem 1.25rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.25);
  animation: bdayPopupIn .45s ease .25s both;
}
@keyframes bdayPopupIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.bday-emoji { font-size: 2.5rem; margin-bottom: .35rem; }
.bday-popup-inner h3 {
  margin: 0 0 .5rem;
  font-size: 1.35rem;
  background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.bday-popup-inner p {
  color: var(--text-muted, #64748b);
  line-height: 1.7;
  margin: 0 0 1.1rem;
  font-size: .95rem;
}
body.dark .bday-popup-inner { background: #1e293b; }

/* تاریخ تولد شمسی — فقط داخل گروه‌های مشخص، بدون visibility اجباری */
#profileBirthdayGroup,
#editUserBirthdayGroup,
#superOwnerBirthdayGroup {
  margin: .75rem 0;
  padding: .75rem;
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.06);
}
#profileBirthdayGroup label,
#editUserBirthdayGroup label,
#superOwnerBirthdayGroup label {
  font-weight: 600;
  display: block;
  margin-bottom: .35rem;
}
#profileBirthdayGroup .bday-jalali-row,
#editUserBirthdayGroup .bday-jalali-row,
#superOwnerBirthdayGroup .bday-jalali-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  direction: rtl;
}
#profileBirthdayGroup .bday-j-sel,
#editUserBirthdayGroup .bday-j-sel,
#superOwnerBirthdayGroup .bday-j-sel {
  flex: 1 1 30%;
  min-width: 5.5rem;
  min-height: 42px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  font-family: inherit;
  font-size: .9rem;
  padding: 0.45rem 0.6rem;
}
body.dark #profileBirthdayGroup .bday-j-sel,
body.dark #editUserBirthdayGroup .bday-j-sel,
body.dark #superOwnerBirthdayGroup .bday-j-sel {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

.header-bday { display: none !important; }

#newUserFormChevron.open { transform: rotate(-90deg); }

.bday-dev-link {
  color: var(--primary, #2563eb);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.bday-dev-link:hover {
  color: #db2777;
}
body.dark .bday-dev-link { color: #93c5fd; }

.bday-jalali-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  direction: rtl;
}
.bday-j-sel {
  flex: 1 1 30%;
  min-width: 5.5rem;
  min-height: 42px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  font-family: inherit;
  font-size: .9rem;
  padding: 0.45rem 0.6rem;
}

/* چاپ انبارگردانی — نمایش شمارش واقعی */
@media print {
  body.print-stocktake .print-only,
  body.print-stocktake .stocktake-count-print {
    display: inline !important;
    visibility: visible !important;
  }
  body.print-stocktake .stocktake-count-print {
    font-weight: 600;
    min-width: 3rem;
  }
  body.print-stocktake input.count-input {
    display: none !important;
  }
  body.print-stocktake .stocktake-diff {
    visibility: visible !important;
  }
}

/* چاپ تحلیل اختلاف — همیشه ظاهر روشن */
@media print {
  body.print-variance * { visibility: hidden; }
  body.print-variance #varianceReportCard,
  body.print-variance #varianceReportCard * { visibility: visible; color: #111 !important; }
  body.print-variance #varianceReportCard {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 12px;
    background: #fff !important;
    color: #111 !important;
  }
  body.print-variance #varianceReportCard table,
  body.print-variance #varianceReportCard th,
  body.print-variance #varianceReportCard td {
    background: #fff !important;
    color: #111 !important;
    border-color: #333 !important;
  }
  body.print-variance #varianceReportCard th {
    background: #eee !important;
  }
  body.print-variance .no-print { display: none !important; }
  body.print-variance .print-only { display: block !important; visibility: visible !important; }
}

/* ===== نشانگر وضعیت شبکه (جایگزین لوگو/عنوان) ===== */
.net-status-host {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 32px;
  flex-shrink: 0;
}
.net-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.35rem;
  border-radius: 999px;
  background: transparent;
  user-select: none;
  direction: ltr;
}
/* چراغ وضعیت — بزرگ‌تر و واضح */
.net-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  background: #16a34a;
  box-shadow:
    0 0 0 3px rgba(22, 163, 74, 0.22),
    0 0 8px rgba(22, 163, 74, 0.55);
  animation: netLedPulse 2.2s ease-in-out infinite;
}
.net-led.online {
  background: #16a34a;
  box-shadow:
    0 0 0 3px rgba(22, 163, 74, 0.22),
    0 0 8px rgba(22, 163, 74, 0.55);
  animation: netLedPulse 2.2s ease-in-out infinite;
}
.net-led.offline {
  background: #dc2626;
  box-shadow:
    0 0 0 3px rgba(220, 38, 38, 0.25),
    0 0 8px rgba(220, 38, 38, 0.5);
  animation: none;
}
.net-led.weak {
  background: #d97706;
  box-shadow:
    0 0 0 3px rgba(217, 119, 6, 0.25),
    0 0 8px rgba(217, 119, 6, 0.5);
  animation: netLedWeakPulse 1.4s ease-in-out infinite;
}
@keyframes netLedPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18), 0 0 6px rgba(22, 163, 74, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.12), 0 0 12px rgba(22, 163, 74, 0.65); }
}
@keyframes netLedWeakPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2), 0 0 6px rgba(217, 119, 6, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(217, 119, 6, 0.15), 0 0 12px rgba(217, 119, 6, 0.6); }
}
.net-wave {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 16px;
}
.net-wave-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #16a34a;
  opacity: 0.35;
  transform: translateY(0);
  display: inline-block;
}
.net-status.is-online .net-wave-dot {
  background: #16a34a;
}
.net-status.is-offline .net-wave-dot {
  background: #dc2626;
  opacity: 0.3;
  animation: none !important;
}
.net-status.is-weak .net-wave-dot {
  background: #d97706;
  opacity: 0.55;
}
/* موج نرم هنگام فعالیت شبکه */
.net-status.is-busy .net-wave-dot {
  opacity: 1;
  animation: netWaveSoft 1.05s ease-in-out infinite;
}
.net-status.is-busy .net-wave-dot:nth-child(1) { animation-delay: 0s; }
.net-status.is-busy .net-wave-dot:nth-child(2) { animation-delay: 0.14s; }
.net-status.is-busy .net-wave-dot:nth-child(3) { animation-delay: 0.28s; }
.net-status.is-busy .net-wave-dot:nth-child(4) { animation-delay: 0.42s; }
@keyframes netWaveSoft {
  0%, 100% { transform: translateY(0) scale(0.9); opacity: 0.35; }
  50% { transform: translateY(-5px) scale(1.15); opacity: 1; }
}
body.dark .net-led.online {
  background: #22c55e;
  box-shadow:
    0 0 0 3px rgba(34, 197, 94, 0.28),
    0 0 10px rgba(34, 197, 94, 0.6);
}
body.dark .net-led.offline {
  background: #f87171;
  box-shadow:
    0 0 0 3px rgba(248, 113, 113, 0.28),
    0 0 10px rgba(248, 113, 113, 0.55);
}
body.dark .net-led.weak {
  background: #fbbf24;
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.28),
    0 0 10px rgba(251, 191, 36, 0.55);
}
body.dark .net-status.is-online .net-wave-dot {
  background: #4ade80;
}
body.dark .net-status.is-offline .net-wave-dot {
  background: #f87171;
}
body.dark .net-status.is-weak .net-wave-dot {
  background: #fbbf24;
}

/* —— انیمیشن‌های سکون (idle) —— */
.net-status.is-busy .net-wave-dot {
  animation: none !important;
}
.net-status.is-busy.is-online .net-wave-dot,
.net-status.is-busy .net-wave-dot {
  opacity: 1;
  animation: netWaveSoft 1.05s ease-in-out infinite !important;
}
.net-status.is-busy .net-wave-dot:nth-child(1) { animation-delay: 0s !important; }
.net-status.is-busy .net-wave-dot:nth-child(2) { animation-delay: 0.14s !important; }
.net-status.is-busy .net-wave-dot:nth-child(3) { animation-delay: 0.28s !important; }
.net-status.is-busy .net-wave-dot:nth-child(4) { animation-delay: 0.42s !important; }

/* محو شدن تک‌تک */
.net-status.idle-fade .net-wave-dot {
  animation: netIdleFade 2.2s ease-in-out both;
}
.net-status.idle-fade .net-wave-dot:nth-child(1) { animation-delay: 0s; }
.net-status.idle-fade .net-wave-dot:nth-child(2) { animation-delay: 0.28s; }
.net-status.idle-fade .net-wave-dot:nth-child(3) { animation-delay: 0.56s; }
.net-status.idle-fade .net-wave-dot:nth-child(4) { animation-delay: 0.84s; }
@keyframes netIdleFade {
  0% { opacity: 0.4; transform: scale(1); }
  25% { opacity: 0.05; transform: scale(0.6); }
  50% { opacity: 0.05; transform: scale(0.6); }
  75% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0.4; transform: scale(1); }
}

/* لودینگ نقطه‌ای */
.net-status.idle-loading .net-wave-dot {
  animation: netIdleLoading 1.4s ease-in-out infinite;
}
.net-status.idle-loading .net-wave-dot:nth-child(1) { animation-delay: 0s; }
.net-status.idle-loading .net-wave-dot:nth-child(2) { animation-delay: 0.15s; }
.net-status.idle-loading .net-wave-dot:nth-child(3) { animation-delay: 0.3s; }
.net-status.idle-loading .net-wave-dot:nth-child(4) { animation-delay: 0.45s; }
@keyframes netIdleLoading {
  0%, 80%, 100% { transform: translateY(0) scale(0.85); opacity: 0.3; }
  40% { transform: translateY(-6px) scale(1.2); opacity: 1; }
}

/* موج آرام سکون */
.net-status.idle-wave .net-wave-dot {
  animation: netIdleWave 1.8s ease-in-out infinite;
}
.net-status.idle-wave .net-wave-dot:nth-child(1) { animation-delay: 0s; }
.net-status.idle-wave .net-wave-dot:nth-child(2) { animation-delay: 0.18s; }
.net-status.idle-wave .net-wave-dot:nth-child(3) { animation-delay: 0.36s; }
.net-status.idle-wave .net-wave-dot:nth-child(4) { animation-delay: 0.54s; }
@keyframes netIdleWave {
  0%, 100% { transform: translateY(0); opacity: 0.35; }
  50% { transform: translateY(-5px); opacity: 1; }
}

/* جمع شدن و باز شدن */
.net-status.idle-gather .net-wave {
  position: relative;
}
.net-status.idle-gather .net-wave-dot {
  animation: netIdleGather 2.4s ease-in-out both;
}
.net-status.idle-gather .net-wave-dot:nth-child(1) { --gx: 10.5px; }
.net-status.idle-gather .net-wave-dot:nth-child(2) { --gx: 3.5px; }
.net-status.idle-gather .net-wave-dot:nth-child(3) { --gx: -3.5px; }
.net-status.idle-gather .net-wave-dot:nth-child(4) { --gx: -10.5px; }
@keyframes netIdleGather {
  0% { transform: translateX(0) scale(1); opacity: 0.45; }
  35% { transform: translateX(var(--gx, 0)) scale(0.7); opacity: 0.9; }
  50% { transform: translateX(var(--gx, 0)) scale(0.55); opacity: 0.2; }
  70% { transform: translateX(0) scale(1.25); opacity: 1; }
  100% { transform: translateX(0) scale(1); opacity: 0.4; }
}

/* نبض ترتیبی */
.net-status.idle-pulse .net-wave-dot {
  animation: netIdlePulse 2s ease-in-out both;
}
.net-status.idle-pulse .net-wave-dot:nth-child(1) { animation-delay: 0s; }
.net-status.idle-pulse .net-wave-dot:nth-child(2) { animation-delay: 0.2s; }
.net-status.idle-pulse .net-wave-dot:nth-child(3) { animation-delay: 0.4s; }
.net-status.idle-pulse .net-wave-dot:nth-child(4) { animation-delay: 0.6s; }
@keyframes netIdlePulse {
  0%, 100% { transform: scale(1); opacity: 0.35; }
  40% { transform: scale(1.45); opacity: 1; box-shadow: 0 0 6px currentColor; }
  70% { transform: scale(0.9); opacity: 0.5; }
}

/* ریپل از چپ به راست */
.net-status.idle-ripple .net-wave-dot {
  animation: netIdleRipple 2s ease-out both;
}
.net-status.idle-ripple .net-wave-dot:nth-child(1) { animation-delay: 0s; }
.net-status.idle-ripple .net-wave-dot:nth-child(2) { animation-delay: 0.2s; }
.net-status.idle-ripple .net-wave-dot:nth-child(3) { animation-delay: 0.4s; }
.net-status.idle-ripple .net-wave-dot:nth-child(4) { animation-delay: 0.6s; }
@keyframes netIdleRipple {
  0% { transform: scale(0.5); opacity: 0; }
  30% { transform: scale(1.35); opacity: 1; }
  60% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1); opacity: 0.4; }
}

/* نفس کشیدن جمعی */
.net-status.idle-breathe .net-wave-dot {
  animation: netIdleBreathe 2.8s ease-in-out both;
}
@keyframes netIdleBreathe {
  0%, 100% { transform: scale(0.85); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.95; }
}

@media print {
  .net-status-host, .net-status { display: none !important; }
}


/* ===== مطالب وبلاگ در سایدبار هشدارها ===== */
.sidebar-blog {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.15rem 0 0.5rem;
}
.sidebar-blog-head {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}
.blog-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.blog-card:hover {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}
.blog-card-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 0.25rem;
}
.blog-card-date {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.25rem;
}
.blog-card-excerpt {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-more {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: var(--primary, #2563eb);
  text-decoration: none;
  margin-top: 0.25rem;
  padding: 0.25rem 0;
}
.blog-more:hover { text-decoration: underline; }
body.dark .blog-card {
  background: var(--card, #1e293b);
  border-color: var(--border, #334155);
}
body.dark .blog-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.blog-card.has-thumb {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}
.blog-card.has-thumb .blog-card-body {
  padding: 0 0.8rem 0.75rem;
}
.blog-card-thumb {
  width: 100%;
  height: 120px;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg, #f1f5f9);
  flex: none;
}
.blog-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.blog-card-body {
  flex: 1 1 auto;
  min-width: 0;
}
.blog-card:not(.has-thumb) {
  padding: 0.7rem 0.8rem;
}


/* محو ملایم تعویض کارت‌های وبلاگ */
#blogContainer.blog-fade {
  transition: opacity 0.42s ease, transform 0.42s ease;
  opacity: 1;
  transform: translateY(0);
}
#blogContainer.blog-fade.is-fading {
  opacity: 0;
  transform: translateY(6px);
}


/* آیکون نامه — باکس ثابت، فقط آیکون گاهی می‌لرزد */
button.header-bell.header-mail,
.header-bell.header-mail {
  overflow: visible !important; /* شمارنده کمی بیرون بزند */
  transform: none !important;
}
.header-mail-wrap {
  overflow: visible !important;
}
button.header-bell.header-mail.has-notif,
.header-bell.header-mail.has-notif {
  color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.14) !important;
  animation: none !important;
  transform: none !important;
}
button.header-bell.header-mail.has-notif i,
.header-bell.header-mail.has-notif i {
  color: #dc2626 !important;
  display: inline-block;
  transform-origin: center center;
  animation: mail-shake 3.8s ease-in-out infinite !important;
}
button.header-bell.header-mail.has-notif:hover,
.header-bell.header-mail.has-notif:hover {
  background: rgba(220, 38, 38, 0.22) !important;
  color: #b91c1c !important;
  transform: none !important;
}
body.dark button.header-bell.header-mail.has-notif,
body.dark .header-bell.header-mail.has-notif {
  color: #f87171 !important;
  background: rgba(248, 113, 113, 0.18) !important;
}
body.dark button.header-bell.header-mail.has-notif i,
body.dark .header-bell.header-mail.has-notif i {
  color: #f87171 !important;
}
/* لرزش کوتاه هر چند ثانیه — بدون تغییر اندازه */
@keyframes mail-shake {
  0%, 8%, 100% { transform: rotate(0deg); }
  1.5% { transform: rotate(10deg); }
  3% { transform: rotate(-9deg); }
  4.5% { transform: rotate(7deg); }
  6% { transform: rotate(-5deg); }
  7.5% { transform: rotate(0deg); }
}
/* شمارنده کوچک — گوشه گرد کمی بیرون از باکس آیکون */
#headerMailCount.header-bell-count,
#headerMailCount.header-mail-count-mini {
  display: none;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  font-size: 0.58rem;
  line-height: 15px;
  top: -4px;
  inset-inline-end: -4px;
  background: #ef4444 !important;
  color: #fff !important;
  box-shadow: 0 0 0 1.5px var(--card, #fff);
  font-weight: 700;
  z-index: 2;
}
#headerMailCount.header-mail-count-mini[style*="flex"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.header-mail-panel {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  width: min(320px, calc(100vw - 1.5rem));
  max-width: min(320px, calc(100vw - 1.5rem));
  max-height: min(420px, 70vh);
  overflow: auto;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  z-index: 1200;
  padding: 0.4rem;
  display: none;
  box-sizing: border-box;
}
.header-mail-panel.open { display: block; }
.header-mail-wrap { position: relative; overflow: visible !important; }

/* موبایل: پنل نامه داخل عرض صفحه، نه بیرون‌زده */
@media (max-width: 640px) {
  .header-mail-wrap {
    position: static;
  }
  .header-mail-panel {
    position: fixed;
    top: auto;
    left: 0.75rem !important;
    right: 0.75rem !important;
    inset-inline: 0.75rem !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(60vh, 420px);
    margin-top: 0;
    /* زیر بالا بعد از هدر با JS یا تقریبی */
    top: 3.75rem !important;
    z-index: 1300;
  }
  .header-actions {
    overflow: visible !important;
  }
  .header {
    overflow: visible !important;
  }
}
.header-mail-item {
  display: block;
  width: 100%;
  text-align: right;
  border: none;
  background: transparent;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
}
.header-mail-item:hover { background: var(--bg, #f1f5f9); }
body.dark .header-mail-item:hover { background: #334155; }
.header-mail-item.unread {
  background: rgba(37, 99, 235, 0.06);
}
.header-mail-item-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 0.15rem;
}
.header-mail-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
}
.header-mail-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted, #64748b);
  font-size: 0.85rem;
}


/* ========== department.php فقط — چیدمان هدر سفارش‌دهنده ========== */
header .header-inner.dept-header-inner {
  display: flex !important;
  flex-direction: row !important;
  direction: ltr !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.45rem !important;
  width: 100% !important;
}
header .dept-header-inner > .header-actions {
  order: 1 !important;
  margin: 0 !important;
  margin-inline-start: 0 !important;
  margin-inline-end: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  flex-shrink: 0 !important;
  direction: rtl !important;
}
/* لوگو + وضعیت شبکه کنار هم در انتهای هدر */
header .dept-header-inner > .dept-header-end {
  order: 2 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.45rem !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  margin-left: auto !important;
  margin-inline-start: auto !important;
  justify-content: flex-start !important;
}
header .dept-header-inner > .header-left {
  order: 3 !important;
  flex: 0 1 auto !important;
  min-width: 0 !important;
  max-width: 50% !important;
  direction: rtl !important;
  margin: 0 !important;
  justify-content: flex-end !important;
}
header .dept-header-inner > .dept-header-end .net-status-host {
  display: flex !important;
  order: 1 !important;
}
header .dept-header-inner > .dept-header-end .header-logout-btn {
  order: 2 !important;
  flex-shrink: 0 !important;
}



/* دکمه شناور تم — فقط صفحه سفارش‌دهنده، غیرمزاحم */
.dept-theme-fab {
  position: fixed;
  bottom: calc(1rem + var(--safe-bottom, 0px));
  inset-inline-start: 1rem;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.15s, background 0.2s;
}
.dept-theme-fab:hover {
  opacity: 1;
  transform: scale(1.06);
}
body.dark .dept-theme-fab {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
@media (max-width: 640px) {
  .dept-theme-fab {
    bottom: calc(0.75rem + var(--safe-bottom, 0px));
    inset-inline-start: 0.75rem;
    width: 40px;
    height: 40px;
    font-size: 1.05rem;
  }
}


/* تب‌های هشدار / وبلاگ در ستون راست */
.sidebar-panel-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem 0.15rem 0.55rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 0.45rem;
}
.sidebar-panel-tab {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  background: var(--bg-muted, #f8fafc);
  color: var(--text-muted, #64748b);
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sidebar-panel-tab:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}
.sidebar-panel-tab.active {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
}
body.dark .sidebar-panel-tab {
  background: rgba(148,163,184,0.08);
  border-color: rgba(148,163,184,0.25);
}
body.dark .sidebar-panel-tab.active {
  background: var(--primary, #3b82f6);
  border-color: var(--primary, #3b82f6);
  color: #fff;
}
.sidebar-panel-tab .tab-count {
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
  font-size: 0.72rem;
  font-family: ui-monospace, 'Ubuntu', Tahoma, monospace !important;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* ارقام انگلیسی حتی در حالت digits-fa */
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
}
body.digits-fa .sidebar-panel-tab .tab-count,
body.digits-fa #alertsCount {
  /* جلوگیری از تبدیل ظاهری ارقام در CSSهای سراسری */
  font-family: ui-monospace, 'Ubuntu', Tahoma, monospace !important;
}
.sidebar-panel-tab.active .tab-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.sidebar-tab-pane[hidden] {
  display: none !important;
}
.sidebar-tab-pane.active {
  display: block;
}
.blog-container {
  margin-bottom: 0;
}


/* ساعت موبایل و سایدبار همیشه ارقام فارسی */
.mobile-clock .clock-date,
.mobile-clock .clock-time,
.sidebar-clock .clock-date,
.sidebar-clock .clock-time,
#headerClockMobile,
#headerClockSidebar {
  font-variant-numeric: normal;
}
body.digits-en .mobile-clock .clock-date,
body.digits-en .mobile-clock .clock-time,
body.digits-en .sidebar-clock .clock-date,
body.digits-en .sidebar-clock .clock-time {
  /* متن از JS با ارقام فارسی ست می‌شود */
}


/* ربان اتمام موجودی روی کارت هشدار */
.alert-card {
  position: relative;
  overflow: hidden;
}
.alert-card.alert-out-of-stock {
  border-color: rgba(220, 38, 38, 0.45);
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.55) 0%, var(--card, #fff) 48%);
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.08);
}
body.dark .alert-card.alert-out-of-stock {
  border-color: rgba(248, 113, 113, 0.4);
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.35) 0%, var(--card, #1e293b) 48%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.alert-ribbon {
  position: absolute;
  top: 11px;
  left: -34px;
  width: 112px;
  transform: rotate(-45deg);
  z-index: 2;
  pointer-events: none;
  text-align: center;
  line-height: 1;
}
.alert-ribbon span {
  display: block;
  background: linear-gradient(90deg, #b91c1c, #dc2626 50%, #b91c1c);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  letter-spacing: 0.02em;
  padding: 0.28rem 0;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.35);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}
body.dark .alert-ribbon span {
  background: linear-gradient(90deg, #991b1b, #ef4444 50%, #991b1b);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.alert-card.alert-out-of-stock .alert-title {
  padding-left: 1.75rem;
}
.alert-qty-zero {
  color: #dc2626 !important;
  font-weight: 700;
}
body.dark .alert-qty-zero {
  color: #f87171 !important;
}


/* متن ایمیل ارسال‌شده — هماهنگ با تم روشن/تیره + فونت فارسی */
pre.email-log-body,
#emailLogViewBody.email-log-body,
#emailLogViewBody {
  display: block;
  white-space: pre-wrap !important;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  max-height: 40vh;
  overflow: auto;
  padding: 0.75rem !important;
  border-radius: 10px;
  font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  font-style: normal !important;
  margin: 0 !important;
  line-height: 1.85 !important;
  letter-spacing: normal !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid var(--border, #e2e8f0) !important;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}
body.dark pre.email-log-body,
body.dark #emailLogViewBody.email-log-body,
body.dark #emailLogViewBody {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

/* مخفی‌سازی اجباری برای نقش سفارش‌دهنده */
.role-hidden-for-dept {
  display: none !important;
}


/* ---- تأیید سفارشی (جایگزین confirm) ---- */
.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .2s, visibility .2s;
}
.app-confirm-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.app-confirm-card {
  background: var(--card, #fff);
  color: var(--text, #1e293b);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  padding: 1.25rem 1.35rem 1.15rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
  border: 1px solid var(--border, #e2e8f0);
}
body.dark .app-confirm-card {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
.app-confirm-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: .55rem;
}
.app-confirm-msg {
  font-size: .92rem;
  line-height: 1.7;
  color: var(--text-muted, #64748b);
  white-space: pre-wrap;
  margin-bottom: 1.15rem;
}
body.dark .app-confirm-msg { color: #94a3b8; }
.app-confirm-actions {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.app-confirm-actions .btn {
  min-width: 96px;
}

/* برچسب دکمه افزودن در نوار پایین موبایل */
.bottom-bar-add-label {
  margin-right: .15rem;
}
@media (max-width: 360px) {
  .bottom-bar-add-label { display: none; }
}

/* نمایش/مخفی رمز */
.pass-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pass-field-wrap input {
  width: 100%;
  padding-left: 2.6rem;
}
.pass-field-toggle {
  position: absolute;
  left: .4rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-muted, #64748b);
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  padding: 0;
}
.pass-field-toggle:hover {
  color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.08);
}
body.dark .pass-field-toggle:hover {
  background: rgba(148, 163, 184, 0.12);
}


/* تقویم شمسی بازشو — فونت یکدست با برنامه */
.jdp-popup,
.jdp-popup button,
.jdp-popup span,
.jdp-trigger,
.jdp-trigger .jdp-text {
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}
.jdate-wrap {
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}
.jdp-trigger {
  font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}
