/* Automation module — phase 0 shell */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Vazirmatn', sans-serif;
  background: var(--ui-bg);
  color: var(--ui-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.automation-loading {
  flex: 1 0 auto;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--ui-border);
  border-top-color: var(--ui-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.automation-app {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.automation-page-header {
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 30;
}

.automation-topbar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
  overflow: visible;
}
.automation-topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--ui-text);
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  line-height: 1.2;
  white-space: nowrap;
}
.page-title-icon {
  width: 2em;
  height: 2em;
  flex: 0 0 2em;
  display: block;
  color: currentColor;
}
.automation-user-label {
  font-size: 0.85rem;
  color: var(--ui-text-muted);
  margin-right: 0;
  white-space: nowrap;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.automation-topbar-right,
.automation-topbar-tools,
.automation-topbar-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.automation-topbar-tools {
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-start;
}
.automation-topbar-icons {
  margin-inline-start: auto;
  justify-content: flex-start;
  position: relative;
  z-index: 40;
}
.automation-topbar-icons .portal-chat-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.automation-topbar-icons .portal-chat-contacts {
  z-index: 6000;
}
.automation-topbar-icons .header-icon-btn {
  position: relative;
}
.automation-topbar-icons .app-update-icon-btn {
  color: #ecfdf5;
  background: #0f766e;
  border: none;
}
.automation-topbar-icons .app-update-icon-btn:hover:not(:disabled) {
  background: #115e59;
  color: #fff;
  transform: rotate(-20deg);
}
.automation-topbar-icons .app-update-icon-btn[hidden] {
  display: none !important;
}
.automation-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.automation-search-wrap input {
  min-width: 180px;
  padding: 6px 10px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 6px;
  background: var(--ui-surface);
  color: var(--ui-text);
}
.automation-search-wrap select {
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--ui-border-strong);
  background: var(--ui-surface);
  color: var(--ui-text);
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-sm { padding: 6px 10px; font-size: 0.88rem; }

.header-icon-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  padding: 0 !important;
  display: inline-grid;
  place-items: center;
  justify-items: center;
  align-items: center;
  border-radius: 9px;
  line-height: 0;
  gap: 0 !important;
  overflow: hidden;
  box-sizing: border-box;
}
.header-icon-btn > i,
.header-icon-btn > .portal-app-icon {
  grid-area: 1 / 1;
  margin: 0 !important;
  font-size: 24px;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  display: block;
  box-sizing: border-box;
}
.header-icon-btn > i::before {
  display: block;
  width: 100%;
  line-height: inherit;
  text-align: center;
}
.header-icon-btn > .portal-app-icon {
  width: 28px;
  height: 28px;
}
.header-icon-btn > .portal-app-icon--lg {
  width: 32px;
  height: 32px;
}
a.header-icon-btn { box-sizing: border-box; }
.btn-primary { background: var(--ui-accent); color: #fff; }
.btn-primary:hover { background: var(--ui-accent-hover); }
.btn-secondary { background: #64748b; color: #fff; }

.automation-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  background: var(--ui-surface-muted);
  border-bottom: 1px solid var(--ui-border);
}
.stat-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 100px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.stat-card:hover,
.stat-card:focus-visible {
  border-color: var(--ui-accent);
  box-shadow: 0 0 0 3px var(--ui-accent-soft);
  background: var(--ui-surface-muted);
  outline: none;
}
.stat-card.has-count {
  border-color: var(--ui-accent);
}
.stat-card strong { display: block; font-size: 1.2rem; color: var(--ui-accent); }
.stat-card.has-count strong { color: var(--ui-accent-hover); }
.stat-card span { font-size: 0.78rem; color: var(--ui-text-muted); }

.dashboard-loading { padding: 16px; text-align: center; }
.dashboard-empty { padding: 24px 16px; text-align: center; color: #64748b; }
.dashboard-section {
  margin-bottom: 28px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  overflow: hidden;
}
.dashboard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.dashboard-section-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #0f172a;
}
.dashboard-section-table { margin: 0; }
.dashboard-section-table tbody tr { cursor: pointer; }
.dashboard-section-table tbody tr:hover { background: var(--ui-row-hover); }
.badge-dashboard-highlight {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: #fef3c7;
  color: #92400e;
  vertical-align: middle;
}
.dashboard-section[data-section="approvals"] .badge-dashboard-highlight {
  background: #fee2e2;
  color: #b91c1c;
}
.dashboard-section[data-section="action"] .badge-dashboard-highlight {
  background: #ffedd5;
  color: #c2410c;
}

.automation-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.panel-rail-toggle {
  flex-shrink: 0;
  width: 18px;
  align-self: stretch;
  border: none;
  padding: 0;
  margin: 0;
  background: #e2e8f0;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.panel-rail-toggle:hover {
  background: #cbd5e1;
  color: #1e293b;
}
.nav-rail-toggle {
  background: #334155;
  color: #cbd5e1;
}
.nav-rail-toggle:hover {
  background: #475569;
  color: #fff;
}

.automation-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ui-sidebar-bg);
  color: var(--ui-sidebar-text);
  padding: 10px 8px 14px;
  transition: width 0.18s ease;
}

.sidebar-section {
  --section-accent: #2563eb;
  border-right: 3px solid var(--section-accent);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.28);
  margin: 0 0 8px;
  overflow: hidden;
}
.sidebar-section--dash { --section-accent: #3b82f6; }
.sidebar-section--letters { --section-accent: #2563eb; }
.sidebar-section--events { --section-accent: #7c3aed; }
.sidebar-section--personnel {
  --section-accent: #059669;
  background: #1a2e28;
  box-shadow: inset 0 0 0 1px rgba(5, 150, 105, 0.35);
}
.sidebar-section--admin { --section-accent: #64748b; }
.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--section-accent);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 8px 10px;
  cursor: pointer;
  text-align: right;
}
.sidebar-section-header.static { cursor: default; }
.sidebar-section-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.sidebar-section-arrow {
  font-size: 0.75rem;
  opacity: 0.95;
  transition: transform 0.18s ease;
}
.sidebar-section-arrow.open { transform: rotate(180deg); }
.sidebar-section-content { padding: 4px 0 6px; }
.sidebar-section-content.collapsed { display: none; }
.sidebar-subheader {
  padding: 7px 12px 5px;
  font-size: 0.72rem;
  color: #9ca3af;
  font-weight: 700;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  text-align: right;
  position: relative;
}
.sidebar-item:hover { background: rgba(255,255,255,0.08); }
.sidebar-item.active { background: var(--section-accent); color: #fff; }
.sidebar-item i { width: 20px; text-align: center; }
.sidebar-badge {
  margin-right: auto;
  margin-left: 6px;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.4;
}
.sidebar-item.active .sidebar-badge {
  background: #fff;
  color: var(--section-accent);
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px;
  margin-bottom: 0;
  border-bottom: none;
}
.sidebar-profile-text { min-width: 0; flex: 1; }
.sidebar-profile-name {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}
.sidebar-profile-title {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 2px;
}
.sidebar-nav-search {
  position: relative;
  padding: 0 12px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-nav-search[hidden] {
  display: none !important;
}
.sidebar-nav-search-wrap {
  position: relative;
}
.sidebar-nav-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.75rem;
  pointer-events: none;
}
.sidebar-nav-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 30px 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.35);
  color: #e2e8f0;
  font-size: 0.8rem;
}
.sidebar-nav-search-input::placeholder {
  color: #94a3b8;
}
.sidebar-nav-search-input:focus {
  outline: none;
  border-color: rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.55);
}
.sidebar-nav-search-results {
  list-style: none;
  margin: 6px 0 0;
  padding: 4px;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  z-index: 20;
  position: absolute;
  left: 12px;
  right: 12px;
}
.sidebar-nav-search-results[hidden] {
  display: none !important;
}
.sidebar-nav-search-results li {
  margin: 0;
}
.sidebar-nav-search-hit {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e2e8f0;
  font: inherit;
  font-size: 0.8rem;
  text-align: right;
  cursor: pointer;
}
.sidebar-nav-search-hit:hover,
.sidebar-nav-search-hit:focus {
  background: rgba(148, 163, 184, 0.15);
  outline: none;
}
.sidebar-nav-search-hit i {
  color: #94a3b8;
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}
.sidebar-nav-search-hit span {
  min-width: 0;
  line-height: 1.35;
}
.sidebar-nav-search-empty {
  padding: 8px 10px;
  font-size: 0.78rem;
  color: #94a3b8;
}
.user-avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #334155;
  color: #e2e8f0;
  font-weight: 700;
}
.user-avatar-sm { width: 24px; height: 24px; font-size: 0.7rem; }
.user-avatar-md { width: 48px; height: 48px; font-size: 1rem; }
.user-avatar-lg { width: 48px; height: 48px; font-size: 1.1rem; }
.user-avatar-fallback { border: 1px solid rgba(255, 255, 255, 0.15); }
img.user-avatar { object-fit: cover; display: block; }
.user-with-avatar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.recipients-with-avatars {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  max-width: 280px;
}
.recipients-with-avatars .user-with-avatar {
  max-width: 100%;
}
.recipients-with-avatars .user-with-avatar > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.user-avatar-wrap {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.user-avatar-wrap > img.user-avatar:only-child {
  display: block;
}

.automation-layout.nav-rail-collapsed .automation-sidebar {
  width: 64px;
  padding: 8px 4px 12px;
}
.automation-layout.nav-rail-collapsed .automation-sidebar-nav {
  padding: 0;
}
.automation-layout.nav-rail-collapsed .sidebar-profile {
  justify-content: center;
  padding: 8px 4px 12px;
  gap: 0;
}
.automation-layout.nav-rail-collapsed .sidebar-profile-text,
.automation-layout.nav-rail-collapsed .sidebar-nav-search,
.automation-layout.nav-rail-collapsed .sidebar-item > span:not(.sidebar-badge),
.automation-layout.nav-rail-collapsed .sidebar-section-title span,
.automation-layout.nav-rail-collapsed .sidebar-section-arrow,
.automation-layout.nav-rail-collapsed .sidebar-subheader {
  display: none;
}
.automation-layout.nav-rail-collapsed .sidebar-section-header {
  justify-content: center;
  padding: 8px 4px;
}
.automation-layout.nav-rail-collapsed .sidebar-section-title {
  gap: 0;
}
.automation-layout.nav-rail-collapsed .sidebar-item {
  justify-content: center;
  padding: 9px 4px;
}
.automation-layout.nav-rail-collapsed .sidebar-item i {
  margin: 0;
}
.automation-layout.nav-rail-collapsed .sidebar-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  margin: 0;
  min-width: 16px;
  padding: 0 4px;
  font-size: 0.65rem;
}
.automation-layout.nav-rail-collapsed .sidebar-profile .user-avatar-lg {
  width: 36px;
  height: 36px;
  font-size: 0.9rem;
}
.approval-step-name .user-with-avatar {
  vertical-align: middle;
}
.ud-panel-wrap,
.ud-registry-wrap { padding: 4px 0; }
.ud-table { margin-top: 12px; }
.ud-registry-picker { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ud-registry-avatar { min-width: 0; }
.ud-registry-select { width: 100%; max-width: 420px; flex: 1; }
.ud-registry-user-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ud-profile-row label { display: flex; align-items: center; gap: 8px; font-weight: 500; }

.automation-main {
  flex: 1;
  padding: 16px 20px;
  overflow: auto;
  min-width: 0;
}

.automation-org-chart-panel-cell,
.org-chart-panel-cell {
  padding: 16px !important;
  vertical-align: top;
}
.org-chart-layout {
  display: flex;
  flex-wrap: nowrap;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
}
.org-chart-view {
  flex: 1;
  min-width: 0;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  overflow: hidden;
}
.org-chart-view h4,
.org-chart-admin h4 {
  margin: 0 0 12px;
  font-size: 1rem;
}
.org-chart-admin {
  flex: 1;
  min-width: 260px;
  max-width: 360px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  position: relative;
}
.org-chart-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.org-chart-admin-head h4 {
  margin: 0;
}
.org-chart-admin .org-admin-toggle {
  width: 28px;
  height: 28px;
  align-self: center;
  border-radius: 6px;
  background: #f1f5f9;
}
.org-chart-admin-rail-label {
  display: none;
}
.org-chart-admin.is-collapsed {
  flex: 0 0 44px;
  min-width: 44px;
  max-width: 44px;
  padding: 8px 4px;
  overflow: hidden;
}
.org-chart-admin.is-collapsed .org-chart-admin-head h4,
.org-chart-admin.is-collapsed .org-chart-admin-body {
  display: none;
}
.org-chart-admin.is-collapsed .org-chart-admin-head {
  margin: 0;
  justify-content: center;
}
.org-chart-admin.is-collapsed .org-chart-admin-rail-label {
  display: block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  text-align: center;
  margin: 10px auto 0;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.org-chart-tree { font-size: 0.9rem; line-height: 1.8; }
.org-chart-node { padding: 2px 0; color: #1e293b; }
.org-chart-position { font-weight: 600; margin-top: 4px; }
.org-chart-holder { font-weight: 400; color: #334155; font-size: 0.86rem; }
.org-chart-holder i { color: #94a3b8; margin-left: 6px; font-size: 0.78rem; }
.org-holder-meta { color: #64748b; font-size: 0.82rem; margin-right: 6px; }
.org-chart-extra { margin-top: 20px; padding-top: 16px; border-top: 1px dashed #cbd5e1; }
.org-chart-extra h5 { margin: 0 0 8px; font-size: 0.92rem; color: #475569; }
.org-unassigned-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.86rem; }
.org-unassigned-list li { padding: 4px 0; color: #64748b; }
.org-unassigned-list i { margin-left: 6px; color: #94a3b8; }
.org-chart-orphaned h5 { color: #b45309; }
.org-chart-orphaned i { color: #d97706 !important; }
.org-chart-node i { color: #64748b; margin-left: 6px; }
.org-ceo-badge { color: #2563eb; }
.org-flag-badge {
  display: inline-block;
  margin-inline-start: 0.2rem;
  padding: 0 0.28em;
  font-size: 0.72em;
  font-weight: 700;
  border-radius: 0.25rem;
  vertical-align: middle;
  line-height: 1.4;
}
.org-lh-badge { background: #dbeafe; color: #1d4ed8; }
.org-ne-badge { background: #f3f4f6; color: #6b7280; }
.org-so-badge { background: #dcfce7; color: #15803d; }
.letter-path-unit {
  fill: #6b7280;
  font-size: 9px;
}
.org-chart-empty { font-size: 0.88rem; color: #64748b; }

.org-chart-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.org-chart-view-header h4 { margin: 0; }
.org-chart-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.org-chart-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.org-chart-vacant-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #475569;
  cursor: pointer;
  user-select: none;
}
.org-chart-vacant-toggle input { cursor: pointer; }
.org-chart-view-toggle-label {
  font-size: 0.82rem;
  color: #64748b;
}

.org-position-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0c4a6e;
  font-weight: 600;
  font-size: 0.86rem;
  border: 1px solid #bae6fd;
}
.org-position-badge-vacant {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  opacity: 0.75;
}
.org-vacant-label,
.org-hierarchy-vacant {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
}
.org-chart-vacant { padding: 2px 0 6px; }

.org-chart-holder-self,
.org-hierarchy-holder-self {
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 6px;
  padding: 4px 8px !important;
  color: #854d0e;
  font-weight: 600;
}
.org-self-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: #eab308;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  vertical-align: middle;
}

.org-chart-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.org-chart-scroll-x {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: 6px;
  scrollbar-gutter: stable;
}
.org-chart-scroll-x::-webkit-scrollbar {
  height: 10px;
}
.org-chart-scroll-x::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}
.org-chart-scroll-x::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}
.org-chart-scroll-hint {
  margin: 0 0 8px;
  font-size: 0.78rem;
  color: #64748b;
  text-align: center;
}
.org-chart-scroll-hint i {
  margin-left: 4px;
  color: #94a3b8;
}

.org-forests-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: min-content;
}
.org-forest-block {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.org-forest-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  padding-bottom: 8px;
  border-bottom: 1px dashed #cbd5e1;
}
.org-forest-multi-hint { margin: 0 0 10px; }
.org-forest-orphan-hint { color: #d97706; font-size: 0.85rem; }
.org-forest-body { min-width: min-content; }
.org-forest-pyramid .org-pyramid-root {
  margin: 0 auto;
  padding-right: 0;
}
.org-pos-admin-panel {
  margin-bottom: 12px;
  min-width: 0;
}
.org-pos-search-wrap {
  position: relative;
  margin-bottom: 8px;
}
.org-pos-search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.78rem;
  pointer-events: none;
}
.org-pos-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 32px 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  background: #f8fafc;
}
.org-pos-search-input:focus {
  outline: none;
  border-color: #94a3b8;
  background: #fff;
}
.org-pos-compact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(52vh, 480px);
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.org-pos-compact-item {
  border-bottom: 1px solid #f1f5f9;
}
.org-pos-compact-item:last-child {
  border-bottom: none;
}
.org-pos-compact-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: right;
  font: inherit;
  color: #1e293b;
}
.org-pos-compact-head:hover {
  background: #f8fafc;
}
.org-pos-compact-item.is-open > .org-pos-compact-head {
  background: #f1f5f9;
  font-weight: 700;
}
.org-pos-compact-title {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-pos-compact-chevron {
  flex-shrink: 0;
  color: #94a3b8;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.org-pos-compact-item.is-open .org-pos-compact-chevron {
  transform: rotate(180deg);
}
.org-pos-edit-panel {
  padding: 4px 10px 12px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.org-pos-edit-panel[hidden] {
  display: none !important;
}
.org-pos-search-empty {
  margin: 8px 2px 0;
}
.org-pos-fields {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.org-pos-fields .form-group.float-field {
  margin-bottom: 0.75rem;
}
.org-pos-fields select,
.org-pos-fields input[type="text"] {
  width: 100%;
  min-width: 0;
  font-size: 0.85rem;
}
.org-pos-title-primary label {
  font-weight: 700;
  color: #0f172a;
}
.org-pos-title-primary .org-pos-title-input {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  border-color: #94a3b8;
  background: #fff;
}
.org-pos-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  align-items: center;
}
.org-pos-edit-actions .btn.danger {
  color: #dc2626;
  margin-inline-start: auto;
}
/* زمینه تیره‌تر برای «سمت بالاتر» تا با عنوان سمت اشتباه نشود */
.org-pos-parent-field.form-group.float-field > select,
.org-pos-parent-field.form-group.float-field > input,
#addOrgPositionForm .org-pos-parent-field.form-group.float-field > select {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
}
.org-pos-parent-field.form-group.float-field > label,
#addOrgPositionForm .org-pos-parent-field.form-group.float-field > label {
  background: #e2e8f0 !important;
}
.org-pos-parent-field.form-group.float-field.is-floated > label,
.org-pos-parent-field.form-group.float-field:focus-within > label,
#addOrgPositionForm .org-pos-parent-field.form-group.float-field.is-floated > label,
#addOrgPositionForm .org-pos-parent-field.form-group.float-field:focus-within > label {
  background: #e2e8f0 !important;
}
.org-pos-admin-hint { margin-top: 8px; }

.org-pyramid-wrap {
  width: 100%;
  min-width: 0;
  padding: 0 0 8px;
}
.org-pyramid-wrap .org-chart-extra {
  direction: rtl;
  text-align: right;
}
.org-pyramid-tree {
  display: inline-block;
  width: max-content;
  min-width: 100%;
  text-align: center;
  padding: 8px 16px 4px;
  box-sizing: border-box;
}
.org-pyramid-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.org-pyramid-root {
  display: flex;
  justify-content: center;
}
.org-pyramid-children {
  display: flex;
  justify-content: center;
  padding-top: 24px;
  position: relative;
}
.org-pyramid-children::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 24px;
  background: #94a3b8;
}
.org-pyramid-item {
  position: relative;
  padding: 24px 10px 0;
  text-align: center;
}
.org-pyramid-item::before,
.org-pyramid-item::after {
  content: '';
  position: absolute;
  top: 0;
  width: 50%;
  height: 24px;
  border-top: 2px solid #94a3b8;
}
.org-pyramid-item::before {
  right: 50%;
  border-right: 2px solid #94a3b8;
  border-radius: 0 4px 0 0;
}
.org-pyramid-item::after {
  left: 50%;
  border-left: 2px solid #94a3b8;
  border-radius: 4px 0 0 0;
}
.org-pyramid-root > .org-pyramid-item::before,
.org-pyramid-root > .org-pyramid-item::after {
  display: none;
}
.org-pyramid-children > .org-pyramid-item:only-child::before,
.org-pyramid-children > .org-pyramid-item:only-child::after {
  display: none;
}
.org-pyramid-children > .org-pyramid-item:first-child:not(:only-child)::before {
  border: none;
}
.org-pyramid-children > .org-pyramid-item:last-child:not(:only-child)::after {
  border: none;
}
.org-pyramid-card {
  direction: rtl;
  display: inline-block;
  min-width: 132px;
  max-width: 210px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  position: relative;
  z-index: 1;
}
.org-pyramid-card-vacant {
  background: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.72;
}

/* شاخه‌های سربرگ — رنگ متمایز + نام واحد جدا و بالاتر از کارت سمت */
.org-pyramid-node-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.org-lh-unit-wrap {
  margin-bottom: 2px;
}
.org-lh-unit-label {
  display: inline-block;
  max-width: 220px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--org-lh-bg, #fffbeb);
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--org-lh-label, #92400e);
  border-radius: 999px;
  background: var(--org-lh-label, #92400e);
  box-shadow: 0 1px 3px var(--org-lh-shadow, rgba(146, 64, 14, 0.12));
  word-break: break-word;
  text-align: center;
}
/* نام واحد سمت غیرسربرگ‌دار: پس‌زمینه روشن، متن تیره — متمایز از برچسب سربرگ */
.org-lh-unit-label.org-unit-label-plain {
  color: #1e293b;
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: none;
  font-weight: 600;
}
.org-pyramid-item-lh-root,
.org-pyramid-item-unit {
  padding-top: 28px;
}
.org-pyramid-card.org-pyramid-card-lh-root {
  max-width: 240px;
  border-width: 2px;
  box-shadow: 0 2px 6px var(--org-lh-shadow, rgba(146, 64, 14, 0.12));
}
.org-pyramid-card[class*='org-lh-c'] {
  border-color: var(--org-lh-border, #cbd5e1);
  background: var(--org-lh-bg, #fff);
}
.org-pyramid-card.org-pyramid-card-vacant[class*='org-lh-c'] {
  background: var(--org-lh-bg-vacant, #f8fafc);
  opacity: 0.85;
}
.org-chart-node.org-lh-tinted[class*='org-lh-c'],
.org-lh-tinted[class*='org-lh-c'] {
  border-right: 3px solid var(--org-lh-border, transparent);
  padding-right: 6px;
  margin-right: -3px;
}
.org-chart-node.org-lh-root {
  background: var(--org-lh-bg, transparent);
  border-radius: 6px;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 8px;
}
.org-pyramid-item[class*='org-lh-c']::before,
.org-pyramid-item[class*='org-lh-c']::after {
  border-top-color: var(--org-lh-line, #94a3b8);
}
.org-pyramid-item[class*='org-lh-c']::before {
  border-right-color: var(--org-lh-line, #94a3b8);
}
.org-pyramid-item[class*='org-lh-c']::after {
  border-left-color: var(--org-lh-line, #94a3b8);
}
.org-pyramid-item[class*='org-lh-c'] > .org-pyramid-children::before {
  background: var(--org-lh-line, #94a3b8);
}

/* ۰ طلایی · ۱ فیروزه‌ای · ۲ سرخ‌گلی · ۳ آبی آسمانی · ۴ زیتونی · ۵ سرمه‌ای · ۶ مسی · ۷ سبزآبی */
.org-lh-c0 {
  --org-lh-border: #d4a017;
  --org-lh-bg: #fffbeb;
  --org-lh-bg-vacant: #fef9c3;
  --org-lh-label: #92400e;
  --org-lh-line: #ca8a04;
  --org-lh-shadow: rgba(202, 138, 4, 0.18);
}
.org-lh-c1 {
  --org-lh-border: #0d9488;
  --org-lh-bg: #f0fdfa;
  --org-lh-bg-vacant: #ccfbf1;
  --org-lh-label: #115e59;
  --org-lh-line: #14b8a6;
  --org-lh-shadow: rgba(13, 148, 136, 0.16);
}
.org-lh-c2 {
  --org-lh-border: #e11d48;
  --org-lh-bg: #fff1f2;
  --org-lh-bg-vacant: #ffe4e6;
  --org-lh-label: #9f1239;
  --org-lh-line: #f43f5e;
  --org-lh-shadow: rgba(225, 29, 72, 0.14);
}
.org-lh-c3 {
  --org-lh-border: #0284c7;
  --org-lh-bg: #f0f9ff;
  --org-lh-bg-vacant: #e0f2fe;
  --org-lh-label: #075985;
  --org-lh-line: #0ea5e9;
  --org-lh-shadow: rgba(2, 132, 199, 0.14);
}
.org-lh-c4 {
  --org-lh-border: #65a30d;
  --org-lh-bg: #f7fee7;
  --org-lh-bg-vacant: #ecfccb;
  --org-lh-label: #3f6212;
  --org-lh-line: #84cc16;
  --org-lh-shadow: rgba(101, 163, 13, 0.14);
}
.org-lh-c5 {
  --org-lh-border: #4338ca;
  --org-lh-bg: #eef2ff;
  --org-lh-bg-vacant: #e0e7ff;
  --org-lh-label: #312e81;
  --org-lh-line: #6366f1;
  --org-lh-shadow: rgba(67, 56, 202, 0.14);
}
.org-lh-c6 {
  --org-lh-border: #c2410c;
  --org-lh-bg: #fff7ed;
  --org-lh-bg-vacant: #ffedd5;
  --org-lh-label: #9a3412;
  --org-lh-line: #ea580c;
  --org-lh-shadow: rgba(194, 65, 12, 0.14);
}
.org-lh-c7 {
  --org-lh-border: #0891b2;
  --org-lh-bg: #ecfeff;
  --org-lh-bg-vacant: #cffafe;
  --org-lh-label: #155e75;
  --org-lh-line: #06b6d4;
  --org-lh-shadow: rgba(8, 145, 178, 0.14);
}
.org-hierarchy-position {
  margin-bottom: 8px;
}
.org-hierarchy-holder {
  font-size: 0.84rem;
  color: #334155;
  padding: 4px 0;
  border-top: 1px dashed #e2e8f0;
  margin-top: 4px;
}
.org-hierarchy-rep {
  font-size: 0.8rem;
  color: #475569;
}
.org-pyramid-card-rep {
  background: #f8fafc;
  border-style: dashed;
}
.org-pyramid-card-expert-branch {
  border-color: #94a3b8;
}
.org-pyramid-item-rep > .org-pyramid-card {
  min-width: 140px;
}
.org-chart-rep-wrap {
  opacity: 0.95;
}
.org-position-badge-rep {
  font-weight: 500;
  color: #64748b;
}
.org-hierarchy-holder i {
  color: #94a3b8;
  margin-left: 4px;
  font-size: 0.75rem;
}

.approval-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  font-size: 0.88rem;
}
.approval-preview ol { margin: 6px 20px 0 0; padding: 0; }
.approval-chain {
  margin: 14px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.letter-path-diagram {
  margin: 14px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.letter-path-diagram-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.letter-path-diagram-title {
  display: block;
  margin: 0;
  color: #0f172a;
}
.letter-path-zoom-controls {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.letter-path-zoom-controls[hidden] {
  display: none !important;
}
.letter-path-zoom-controls .btn {
  min-width: 2rem;
  padding: 0.15rem 0.45rem;
  line-height: 1.2;
}
.letter-path-diagram-viewport {
  overflow: hidden;
  max-height: min(360px, 55vh);
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  touch-action: none;
  cursor: default;
  position: relative;
}
.letter-path-diagram-viewport.is-overflow {
  cursor: grab;
}
.letter-path-diagram-viewport.is-dragging {
  cursor: grabbing;
}
.letter-path-diagram-stage {
  transform-origin: 0 0;
  will-change: transform;
  width: max-content;
  min-width: 100%;
}
.letter-path-diagram-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.letter-path-svg {
  display: block;
  max-width: none;
  font-family: inherit;
}
.letter-path-edge path {
  stroke: #94a3b8;
  stroke-width: 2;
}
.letter-path-edge-solid path {
  stroke: #475569;
}
.letter-path-edge-dashed path {
  stroke: #94a3b8;
}
.letter-path-edge-reply path {
  stroke: #2563eb;
}
.letter-path-edge-refer path {
  stroke: #0f766e;
}
.letter-path-arrow-angle {
  fill: none;
  stroke: #475569;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.letter-path-arrow-angle-reply {
  stroke: #2563eb;
}
.letter-path-arrow-angle-refer {
  stroke: #0f766e;
}
.letter-path-edge-label {
  fill: #334155;
  font-size: 11px;
  font-weight: 600;
  stroke: #f8fafc;
  stroke-width: 4px;
  paint-order: stroke fill;
  stroke-linejoin: round;
}
.letter-path-node rect {
  fill: #fff;
  stroke: #cbd5e1;
  stroke-width: 1.5;
}
.letter-path-node-done rect {
  fill: #f0fdf4;
  stroke: #86efac;
}
.letter-path-node-current rect {
  fill: #eff6ff;
  stroke: #2563eb;
  stroke-width: 2.25;
}
.letter-path-node-future rect {
  fill: #f8fafc;
  stroke: #cbd5e1;
  stroke-dasharray: 4 3;
}
.letter-path-node-vacant rect {
  fill: #fff7ed;
  stroke: #fb923c;
  stroke-dasharray: 5 4;
}
.letter-path-node-vacant .letter-path-name {
  fill: #c2410c;
  font-style: italic;
}
.letter-path-kind {
  fill: #64748b;
  font-size: 9px;
}
.letter-path-name {
  fill: #0f172a;
  font-size: 11px;
  font-weight: 600;
}
.letter-path-pos {
  fill: #64748b;
  font-size: 9px;
}
@media print {
  .letter-path-diagram {
    break-inside: avoid;
  }
  .letter-path-diagram-scroll {
    overflow: visible;
  }
}
.approval-chain-list {
  margin: 8px 20px 0 0;
  padding: 0;
  list-style: decimal;
}
.approval-step {
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e2e8f0;
}
.approval-step-current {
  border-color: #2563eb;
  background: #eff6ff;
}
.approval-step-approved {
  border-color: #86efac;
  background: #f0fdf4;
}
.approval-step-rejected {
  border-color: #fca5a5;
  background: #fef2f2;
}
.approval-step-name {
  display: block;
  font-weight: 600;
}
.approval-step-status {
  display: block;
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 2px;
}
.approval-action-hint {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.approval-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 12px;
}
.approval-filter-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.automation-table .col-check {
  width: 2.25rem;
  text-align: center;
  vertical-align: middle;
}
.automation-table .col-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}
#automationMainActions .approval-filter-bar {
  width: 100%;
  margin-bottom: 0;
}
#automationMainActions .cartable-bulk-bar {
  gap: 8px;
}
.badge-approval-step {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-approval-outcome {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-approval-pending {
  background: #fef3c7;
  color: #92400e;
}
.badge-approval-approved {
  background: #dcfce7;
  color: #166534;
}
.badge-approval-submitted {
  background: #e0e7ff;
  color: #3730a3;
}
.badge-approval-completed {
  background: #cffafe;
  color: #0e7490;
}
.badge-official-num {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  font-size: 0.75rem;
  color: #475569;
}
.badge-approval-rejected {
  background: #fee2e2;
  color: #991b1b;
}
.badge-template-visibility {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-template-public {
  background: #dbeafe;
  color: #1e40af;
}
.badge-template-personal {
  background: #f3e8ff;
  color: #6b21a8;
}
.template-actions {
  white-space: nowrap;
}
.template-actions .btn {
  margin-left: 4px;
}
.ready-text-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}
.ready-text-picker select {
  width: 100%;
}
.recipient-purpose-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.recipient-purpose-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
}
.recipient-purpose-person {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recipient-purpose-field.form-group.float-field {
  flex: 1 1 200px;
  min-width: 200px;
  max-width: 320px;
  margin-bottom: 0.35rem;
}
.recipient-purpose-field.form-group.float-field > select {
  width: 100%;
}
.letter-purposes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.letter-purposes-table th,
.letter-purposes-table td {
  border: 1px solid #e2e8f0;
  padding: 6px 8px;
  vertical-align: middle;
}
.letter-purposes-table input[type="text"] {
  width: 100%;
  min-width: 120px;
}
.letter-purpose-levels,
.lp-purpose-levels-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.draft-word-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.draft-word-options select {
  min-width: 160px;
}
.draft-main-document {
  margin-bottom: 16px;
}
.draft-doc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.draft-doc-name {
  flex: 1;
  font-size: 0.92rem;
  color: #334155;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.draft-doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
}
.draft-doc-preview {
  margin-top: 12px;
}
.draft-doc-preview-frame {
  height: 520px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}
.draft-doc-preview-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.draft-doc-preview-fallback {
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
}
.draft-doc-preview-loading {
  padding: 24px;
  text-align: center;
}
.btn.btn-icon {
  background: transparent;
  border: none;
  color: #475569;
  cursor: pointer;
  padding: 6px 8px;
  font-size: 16px;
  border-radius: 6px;
}
.btn.btn-print-pdf {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  vertical-align: middle;
  line-height: 1;
}
.btn.btn-print-pdf:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
}
.print-pdf-icon {
  position: relative;
  display: inline-block;
  width: 1.35em;
  height: 1.2em;
  line-height: 1;
}
.print-pdf-icon__print {
  font-size: 1.05em;
  position: absolute;
  right: 0.22em;
  top: 0.05em;
  color: #334155;
}
.print-pdf-icon__pdf {
  font-size: 0.72em;
  position: absolute;
  left: -0.05em;
  bottom: -0.05em;
  color: #b91c1c;
  background: #f8fafc;
  border-radius: 2px;
  padding: 0 1px;
  box-shadow: 0 0 0 1px #f8fafc;
}
.btn.btn-icon:hover:not(:disabled) {
  background: #e2e8f0;
  color: #1e293b;
}
.btn.btn-icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn.btn-icon.danger {
  color: #dc2626;
}
.btn.btn-icon.danger:hover:not(:disabled) {
  background: #fee2e2;
  color: #b91c1c;
}
.btn.btn-form-action {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  vertical-align: middle;
  line-height: 1;
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn.btn-form-action:hover:not(:disabled) {
  background: #e2e8f0;
  color: #0f172a;
}
.btn.btn-form-action--primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.btn.btn-form-action--primary:hover:not(:disabled) {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #fff;
}
.btn.btn-form-action--danger {
  border-color: #fecaca;
  background: #fff;
  color: #dc2626;
}
.btn.btn-form-action--danger:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
  color: #b91c1c;
}
.btn.btn-form-action--link {
  border: none;
  background: transparent;
  color: #2563eb;
  min-width: 1.75rem;
  min-height: 1.75rem;
  padding: 4px 6px;
}
.btn.btn-form-action--link:hover:not(:disabled) {
  background: #eff6ff;
  color: #1d4ed8;
}
.recipient-picker-toolbar .btn.btn-form-action--link {
  margin-top: 0;
}
.draft-attachments-section {
  margin-top: 4px;
}
.draft-attachments-list {
  list-style: none;
  margin: 8px 0 10px;
  padding: 0;
}
.draft-attach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 6px;
  background: #fff;
}
.draft-attach-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}
.draft-attach-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.draft-attach-input {
  margin-top: 6px;
}
.draft-doc-ready {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  color: #065f46;
}
.form-hint-warn {
  color: #b45309;
  margin-top: 6px;
}
.letter-row-pending-approval td {
  background: var(--ui-row-pending);
  color: var(--ui-text);
}
.letter-row-pending-approval:hover td {
  background: var(--ui-row-pending-hover);
}
.letter-row-approval-done td {
  background: var(--ui-row-done);
  color: var(--ui-row-done-text);
}
.letter-row-approval-done:hover td {
  background: var(--ui-row-done-hover);
}
.att-pr-row-pending td {
  background: var(--ui-row-pending);
  color: var(--ui-text);
}
.att-pr-row-pending:hover td {
  background: var(--ui-row-pending-hover);
}
.att-pr-row-done td {
  background: var(--ui-row-done);
  color: var(--ui-row-done-text);
}
.att-pr-row-done:hover td {
  background: var(--ui-row-done-hover);
}
.org-pos-list { list-style: none; padding: 0; margin: 0 0 12px; }
.org-pos-list li { padding: 4px 0; border-bottom: 1px solid #eee; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.org-pos-del-btn { flex-shrink: 0; cursor: pointer; }
.org-pos-del-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.automation-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.automation-main-header h2 {
  margin: 0;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  line-height: 1.2;
}
.page-section-heading {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  line-height: 1.2;
}
.page-section-icon-box {
  width: 1.7em;
  height: 1.7em;
  min-width: 1.7em;
  flex: 0 0 1.7em;
  display: inline-grid;
  place-items: center;
  justify-items: center;
  align-items: center;
  box-sizing: border-box;
  border: 1px solid currentColor;
  border-radius: 0.42em;
  overflow: hidden;
  line-height: 0;
  color: inherit;
}
.page-section-icon {
  width: 1em;
  height: 1em;
  font-size: 1em;
  line-height: 1em;
  display: block;
  text-align: center;
  margin: 0;
  color: currentColor;
}
.page-section-icon::before {
  display: block;
  width: 100%;
  line-height: inherit;
  text-align: center;
}
.page-section-title-text {
  min-width: 0;
}
.dashboard-section-head .page-section-heading {
  margin: 0;
  font-size: inherit;
}

.automation-table-wrap {
  background: var(--ui-surface);
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  overflow: auto;
}
.automation-panel-host {
  padding: 16px;
  min-height: 120px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
/* نوار sticky تنظیمات درخواست باید نسبت به اسکرول .automation-main بچسبد */
.automation-table-wrap:has(#automationPanelHost:not([hidden]) .ir-settings) {
  overflow: visible;
}
.automation-panel-host:has(.ir-settings) {
  overflow: visible;
}
.automation-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.automation-table th, .automation-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-border);
  text-align: right;
  color: var(--ui-text);
}
.automation-table th { background: var(--ui-table-head); font-weight: 600; color: var(--ui-text); }
.letter-row { cursor: pointer; }
.letter-row:hover { background: var(--ui-row-hover); }
.letter-row:not(.letter-row-pending-approval):not(.letter-row-approval-done):hover td {
  background: var(--ui-row-hover);
  color: var(--ui-text);
}
/* نخوانده: زمینه سفید؛ خوانده: زمینه تیره */
.letter-row.letter-unread:not(.letter-row-pending-approval):not(.letter-row-approval-done) td {
  background: var(--ui-surface);
  font-weight: 600;
}
.letter-row.letter-read:not(.letter-row-pending-approval):not(.letter-row-approval-done) td,
.letter-row:not(.letter-unread):not(.letter-row-pending-approval):not(.letter-row-approval-done) td {
  background: var(--ui-row-read);
  font-weight: 400;
}
.letter-row.letter-unread:not(.letter-row-pending-approval):not(.letter-row-approval-done):hover td,
.letter-row.letter-read:not(.letter-row-pending-approval):not(.letter-row-approval-done):hover td,
.letter-row:not(.letter-unread):not(.letter-row-pending-approval):not(.letter-row-approval-done):hover td {
  background: var(--ui-row-hover);
  color: var(--ui-text);
}
.badge-action {
  font-size: 0.72rem;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

/* رنگ پس‌زمینه ردیف بر اساس نوع نامه در صندوق دریافتی */
.letter-row.letter-row-type-internal td {
  background: #ecfdf5 !important;
}
.letter-row.letter-row-type-incoming td {
  background: #eff6ff !important;
}
.letter-row.letter-row-type-received td {
  background: #f8fafc !important;
}
.letter-row.letter-row-type-internal.letter-unread td,
.letter-row.letter-row-type-incoming.letter-unread td,
.letter-row.letter-row-type-received.letter-unread td {
  font-weight: 600;
}
.letter-row.letter-row-type-internal:hover td,
.letter-row.letter-row-type-incoming:hover td,
.letter-row.letter-row-type-received:hover td {
  filter: brightness(0.97);
}
.letter-row.letter-row-action-needed td:first-child {
  box-shadow: inset 3px 0 0 #d97706;
}
.cartable-type-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  background: #e2e8f0;
  color: #334155;
}
.cartable-type-badge.cartable-type-internal {
  background: #d1fae5;
  color: #065f46;
}
.cartable-type-badge.cartable-type-incoming {
  background: #dbeafe;
  color: #1e40af;
}
.cartable-action-label {
  font-size: 0.8rem;
  white-space: nowrap;
}
.cartable-action-label.cartable-action-yes { color: #b45309; font-weight: 600; }
.cartable-action-label.cartable-action-done { color: #047857; }
.cartable-action-label.cartable-action-no { color: #94a3b8; }
.cartable-star-cell { color: #cbd5e1; }
.cartable-star-cell.is-on { color: #eab308; }
.automation-table .col-star { text-align: center; width: 2.5rem; }
.cartable-type-filter-bar { margin-bottom: 6px; }
.badge-urgency {
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.badge-urgency-urgent {
  background: #ffedd5;
  color: #c2410c;
}
.badge-urgency-immediate {
  background: #fee2e2;
  color: #b91c1c;
}
.recipient-action-panel {
  margin: 8px 0 12px;
}
.recipient-action-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.recipient-action-list li {
  padding: 4px 0;
}
.recipient-action-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-wrap: wrap;
}
.recipient-action-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-wrap: wrap;
}
.readonly-person-field {
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.urgency-select {
  max-width: 200px;
}
.letter-meta-header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.92rem;
}
.letter-metadata-edit {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fffbeb;
}
.letter-metadata-edit .form-group {
  margin-bottom: 10px;
}
.letter-flag { font-size: 0.78rem; margin-right: 4px; }
.letter-flag-reply { color: #2563eb; }
.letter-flag-forward { color: #7c3aed; }
.letter-flag-thread { color: #64748b; }
.badge-thread-count {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 7px;
  border-radius: 999px;
  margin-right: 4px;
}
.letter-thread-timeline {
  margin-bottom: 16px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.letter-thread-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}
.letter-thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}
.letter-thread-item {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.letter-thread-item.is-active {
  border-color: #93c5fd;
  box-shadow: inset 0 0 0 1px #93c5fd;
  background: #f8fbff;
}
.letter-thread-item[data-thread-letter] {
  cursor: pointer;
}
.letter-thread-item[data-thread-letter]:hover {
  border-color: #bfdbfe;
  background: #f1f5f9;
}
.letter-thread-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.8rem;
}
.letter-thread-kind {
  background: #e2e8f0;
  color: #334155;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.letter-thread-item.is-active .letter-thread-kind {
  background: #dbeafe;
  color: #1d4ed8;
}
.letter-thread-meta { color: #64748b; direction: ltr; }
.letter-thread-time { color: #94a3b8; margin-right: auto; }
.letter-thread-who { margin-bottom: 4px; }
.letter-thread-subject { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.letter-thread-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.65;
  color: #475569;
  background: transparent;
  border: none;
  padding: 0;
}

.letter-dup-form .letter-dup-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 12px 0 16px;
  max-height: 50vh;
  overflow: auto;
}
.letter-dup-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}
.letter-dup-row:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.letter-dup-row input.letter-dup-cb {
  margin-top: 4px;
  flex-shrink: 0;
}
.letter-dup-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.letter-dup-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}
.letter-dup-pct {
  font-size: 0.85rem;
  color: #b45309;
  font-weight: 600;
}
.letter-dup-reason {
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.55;
}
.req-dup-reasons {
  margin: 12px 0 16px;
  padding-inline-start: 1.2rem;
  max-height: 45vh;
  overflow: auto;
}
.req-dup-item {
  margin-bottom: 8px;
  line-height: 1.55;
  color: #334155;
}

.automation-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.automation-modal {
  background: #fff;
  border-radius: 10px;
  width: min(560px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}
.automation-modal-wide {
  width: min(980px, 96vw);
  max-width: none;
}
.automation-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: #fff;
}
.automation-modal-header h3 { margin: 0; font-size: 1rem; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.automation-modal-sticky-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  z-index: 2;
}
.automation-modal-sticky-actions[hidden],
.automation-modal-sticky-actions:empty {
  display: none !important;
}
.automation-modal-body {
  padding: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.form-group { margin-bottom: 12px; min-width: 0; max-width: 100%; }
.form-group label { display: block; margin-bottom: 4px; font-size: 0.88rem; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
}
.form-group .recipient-picker .recipient-search-input {
  width: auto;
  flex: 1 1 8rem;
  min-width: 6rem;
  max-width: 100%;
  padding: 6px 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.form-group input[type='checkbox'],
.form-group input[type='radio'] {
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  flex-shrink: 0;
}
.form-group.form-group--check {
  margin-bottom: 0;
}
.form-group.form-group--check > .checkbox-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  padding: 0;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  width: auto !important;
  max-width: none;
}
.form-group.form-group--check > .checkbox-inline span {
  line-height: 1.25;
  white-space: nowrap;
}
.event-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
  margin: 4px 0 14px;
}
.event-recurrence-block {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.event-recurrence-block #eventRecurrenceFields {
  margin-top: 8px;
}
.event-series-scope .form-actions {
  margin-top: 12px;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
  .form-group.form-group--check > .checkbox-inline span {
    white-space: normal;
  }
}
.field-hint {
  display: block;
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 4px;
}
.automation-select-multi { min-height: 160px; }

.recipient-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.recipient-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}
.recipient-picker-toolbar .btn-link {
  padding: 0;
  font-size: 0.85rem;
}
.recipient-picker .lookup-container,
.recipient-picker .recipient-field-box {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  /* visible تا dropdown مخاطب بیرون از کادر دیده شود؛ کوتاه‌سازی متن فقط روی چیپ‌ها */
  overflow: visible;
}
.recipient-picker .recipient-field-box:focus-within {
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.25);
}
.recipient-picker .lookup-section-label {
  padding: 6px 10px 2px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: none;
}
.recipient-picker .recipient-lookup-group {
  font-weight: 600;
}
.contact-groups-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-groups-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.contact-groups-item--system {
  background: #eef2ff;
  border-color: #c7d2fe;
}
.contact-groups-item--personal {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.contact-groups-item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.contact-groups-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.contact-groups-page h4 {
  margin: 0 0 8px;
}
.contact-groups-members-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.contact-groups-member-row {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.contact-groups-member-filter input {
  width: 100%;
}
.recipient-picker .lookup-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  z-index: 120;
  max-height: 240px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}
.recipient-picker .lookup-item {
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.recipient-picker .lookup-item:hover {
  background: #f1f5f9;
}
.recipient-picker .lookup-item.muted {
  color: #64748b;
  cursor: default;
}
.recipient-search-input {
  flex: 1 1 8rem;
  min-width: 6rem;
  width: auto;
  padding: 6px 4px;
  border: none;
  border-radius: 0;
  background: transparent;
  font: inherit;
  outline: none;
  box-shadow: none;
}
.recipient-picker[data-multiple='0'].has-selection .recipient-search-input {
  flex: 0 1 7rem;
  min-width: 4.5rem;
}
.recipient-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 auto;
  overflow: hidden;
}
.recipient-picker[data-multiple='0'] .recipient-chips {
  flex: 1 1 0;
  width: 0;
  max-width: 100%;
}
.recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 0.88rem;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.recipient-picker[data-multiple='0'] .recipient-chip {
  display: flex;
  width: 100%;
  max-width: 100%;
}
.recipient-chip .user-with-avatar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.recipient-chip .user-with-avatar > span:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}
.recipient-chip .user-avatar-wrap,
.recipient-chip .user-avatar,
.recipient-chip img.user-avatar {
  flex-shrink: 0;
}
.recipient-chip-remove {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}
.recipient-chip-remove:hover {
  color: #b91c1c;
}
.recipient-hidden-select {
  display: none !important;
}

.external-party-logo-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.external-party-logo-empty {
  color: #94a3b8;
}
.external-party-logo-preview {
  width: 96px;
  height: 96px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #94a3b8;
  font-size: 0.85rem;
}
.external-party-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.9rem;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.form-actions .btn > i,
.automation-modal-sticky-actions .btn > i,
.pr-detail-actions .btn > i,
.pr-sticky-actions .btn > i {
  margin-inline-end: 0.35em;
}
.form-hint {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.5;
}
.btn-link {
  background: transparent;
  color: #2563eb;
  padding: 4px 0;
  margin-top: 4px;
}
.letter-detail pre {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  font-family: inherit;
}
.letter-flow ul {
  margin: 8px 0 0;
  padding-right: 20px;
  font-size: 0.85rem;
  color: #475569;
}
.letter-detail-actions {
  flex-wrap: wrap;
}
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.event-audience-groups {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.event-audience-group-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin: 0;
  cursor: pointer;
}

.automation-empty {
  padding: 24px;
  text-align: center;
  color: #64748b;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 6px;
  color: #fff;
  background: #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: auto;
}
.toast.error { background: #dc2626; }
.toast.success { background: #16a34a; }

.letter-attachments {
  margin: 12px 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}
.letter-attachments ul { margin: 8px 0 0; padding-right: 20px; }
.letter-body pre {
  white-space: pre-wrap;
  background: #f1f5f9;
  padding: 12px;
  border-radius: 6px;
  font-family: inherit;
  margin: 0;
}
.letter-body.letter-body-html {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  line-height: 1.75;
}
.letter-body.letter-body-html p,
.letter-body.letter-body-html > div,
.letter-body.letter-body-html .letter-new-body > p,
.letter-body.letter-body-html .letter-new-body > div,
.letter-body.letter-body-html .letter-quote-content > p,
.letter-body.letter-body-html .letter-quote-content > div {
  margin: 0 0 0.75em;
}
.letter-body.letter-body-html p:last-child,
.letter-body.letter-body-html > div:last-child { margin-bottom: 0; }
.letter-body.letter-body-html .letter-new-body {
  margin: 0 0 0.35em;
}
.letter-body.letter-body-html .letter-reply-gap {
  margin: 0.35em 0 0.85em;
  line-height: 0.6;
  min-height: 0.6em;
}
.letter-body.letter-body-html .letter-quote-meta {
  margin: 0 0 0.85em;
  display: block;
}
.letter-body.letter-body-html ul,
.letter-body.letter-body-html ol {
  margin: 0.5em 0 0.75em;
  padding-right: 1.4em;
}
.letter-body.letter-body-html .letter-img-wrap,
.letter-body-editor .letter-img-wrap {
  margin: 0.75em 0;
}
.letter-body.letter-body-html .letter-img-wrap img,
.letter-body-editor .letter-img-wrap img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
}
.letter-body.letter-body-html .letter-img-right,
.letter-body-editor .letter-img-right { text-align: right !important; }
.letter-body.letter-body-html .letter-img-center,
.letter-body-editor .letter-img-center { text-align: center !important; }
.letter-body.letter-body-html .letter-img-left,
.letter-body-editor .letter-img-left { text-align: left !important; }
.letter-body-editor .letter-img-wrap.letter-img-selected {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.letter-body-editor table.letter-table.letter-table-selected {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}
.letter-body.letter-body-html .letter-table,
.letter-body-editor .letter-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75em 0;
  table-layout: fixed;
}
.letter-body.letter-body-html .letter-table th,
.letter-body.letter-body-html .letter-table td,
.letter-body-editor .letter-table th,
.letter-body-editor .letter-table td {
  padding: 6px 8px;
  vertical-align: top;
  word-break: break-word;
}
.letter-body.letter-body-html .letter-table-all th,
.letter-body.letter-body-html .letter-table-all td,
.letter-body-editor .letter-table-all th,
.letter-body-editor .letter-table-all td {
  border: 1px solid #334155;
}
.letter-body.letter-body-html .letter-table-inner,
.letter-body-editor .letter-table-inner {
  border: none;
}
.letter-body.letter-body-html .letter-table-inner th,
.letter-body.letter-body-html .letter-table-inner td,
.letter-body-editor .letter-table-inner th,
.letter-body-editor .letter-table-inner td {
  border: none;
  border-left: 1px solid #334155;
  border-bottom: 1px solid #334155;
}
.letter-body.letter-body-html .letter-table-inner tr > :last-child,
.letter-body-editor .letter-table-inner tr > :last-child {
  border-left: none;
}
.letter-body.letter-body-html .letter-table-inner tr:last-child > *,
.letter-body-editor .letter-table-inner tr:last-child > * {
  border-bottom: none;
}
.letter-body.letter-body-html .letter-table-header th,
.letter-body.letter-body-html .letter-table-header td,
.letter-body-editor .letter-table-header th,
.letter-body-editor .letter-table-header td {
  border: none;
}
.letter-body.letter-body-html .letter-table-header tr:first-child > *,
.letter-body-editor .letter-table-header tr:first-child > * {
  border-bottom: 1px solid #334155;
}
.letter-body.letter-body-html .letter-table-none th,
.letter-body.letter-body-html .letter-table-none td,
.letter-body-editor .letter-table-none th,
.letter-body-editor .letter-table-none td {
  border: none;
}
.letter-body blockquote.letter-quote,
.letter-quote-block blockquote.letter-quote {
  display: block;
  margin: 12px 0 0;
  padding: 12px 14px;
  background: #eef2f6;
  border-right: 3px solid #94a3b8;
  border-radius: 6px;
  color: #334155;
  font-size: 0.95em;
}
.letter-body blockquote.letter-quote blockquote.letter-quote,
.letter-quote-block blockquote.letter-quote blockquote.letter-quote {
  margin-top: 10px;
  background: #e8eef4;
}
.letter-quote-meta {
  margin: 0 0 8px;
  font-weight: 600;
  color: #475569;
  display: block;
}
.letter-quote-content { margin: 0; display: block; }
.letter-quote-content > p,
.letter-quote-content > div {
  margin: 0 0 0.65em;
}
.letter-quote-content > :last-child { margin-bottom: 0; }
.letter-new-body { margin-bottom: 4px; display: block; }
.letter-reply-gap { margin: 0.35em 0 0.75em; }
.letter-quote-block {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-right: 3px solid #64748b;
  border-radius: 8px;
  padding: 12px 14px;
  max-height: 220px;
  overflow: auto;
  color: #334155;
  line-height: 1.7;
  font-size: 0.95rem;
}
.letter-quote-block p,
.letter-quote-block > div,
.letter-quote-block .letter-new-body > p,
.letter-quote-block .letter-new-body > div {
  margin: 0 0 0.65em;
}
.letter-quote-block pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  background: transparent;
  padding: 0;
}
.letter-body-editor-host {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.letter-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.letter-editor-toolbar-sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: #cbd5e1;
}
.letter-editor-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
}
.letter-editor-toolbar button {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}
.letter-editor-toolbar button.letter-editor-icon-btn {
  min-width: 26px;
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}
.letter-editor-tool-group > .letter-editor-icon-btn {
  border-color: transparent;
  background: transparent;
}
.letter-editor-toolbar .letter-editor-icon-btn svg {
  width: 15px;
  height: 15px;
  display: block;
}
.letter-editor-toolbar button:hover {
  background: #e2e8f0;
}
.letter-editor-tool-group > .letter-editor-icon-btn:hover {
  background: #e2e8f0;
}
.letter-editor-toolbar button.is-align-active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.letter-editor-tool-group > .letter-editor-icon-btn.is-align-active {
  border-color: #93c5fd;
}
.letter-editor-pop-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.letter-editor-pop {
  width: min(380px, 100%);
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  padding: 16px 18px;
}
.letter-editor-pop h4 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: #0f172a;
}
.letter-editor-pop-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.letter-editor-pop-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #334155;
  flex: 1;
  min-width: 120px;
}
.letter-editor-pop-row input {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 8px;
  font-family: inherit;
}
.letter-editor-pop-hint {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #64748b;
}
.letter-table-style-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.letter-table-style-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.letter-table-style-btn svg {
  width: 26px;
  height: 26px;
}
.letter-table-style-btn:hover {
  background: #f1f5f9;
}
.letter-table-style-btn.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}
.letter-editor-pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.letter-ocr-pop {
  width: min(520px, 100%);
}
.letter-ocr-file-label,
.letter-ocr-text-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  font-size: 0.85rem;
  color: #334155;
}
.letter-ocr-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.7;
  direction: rtl;
}
.letter-ocr-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.letter-ocr-actions .btn i {
  font-size: 0.9em;
  line-height: 1;
}
.letter-ocr-actions .letter-ocr-run-icon {
  display: inline-flex;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}
.letter-ocr-actions .letter-ocr-run-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.letter-editor-toolbar button.letter-editor-icon-btn:disabled,
.letter-editor-toolbar button.letter-editor-icon-btn.is-disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}
.letter-number-convert-pop {
  width: min(360px, 100%);
}
.letter-number-convert-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 14px;
}
.letter-number-convert-btn {
  width: 100%;
  text-align: right;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  line-height: 1.4;
}
.letter-number-convert-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.letter-body-editor {
  min-height: 140px;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  line-height: 1.7;
  outline: none;
}
.letter-body-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.letter-body-editor ul,
.letter-body-editor ol {
  margin: 0.4em 0;
  padding-right: 1.4em;
}
.letter-body-editor p { margin: 0 0 0.6em; }
.letter-body-editor[contenteditable="false"] {
  background: #f8fafc;
  color: #475569;
}
.letter-flow ul { margin: 8px 0; padding-right: 0; font-size: 0.9rem; list-style: none; }
.letter-flow-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}
.letter-flow-item:last-child { border-bottom: none; }
.letter-flow-user {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 120px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: #334155;
}
.letter-flow-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  flex: 1;
}
.letter-flow-action { font-weight: 600; color: #1e293b; }
.letter-flow-time { color: #64748b; font-size: 0.82rem; }
.letter-flow-note { color: #475569; font-size: 0.85rem; }
.org-person-with-avatar { font-size: inherit; }
.org-chart-holder .user-with-avatar,
.org-hierarchy-holder .user-with-avatar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.org-unassigned-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0;
}
.letter-detail-actions { flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.automation-settings-form { max-width: 480px; }
.automation-settings-form .form-group { margin: 10px 0; }
.checkbox-inline { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.doc-editor-overlay { z-index: 20000; }
.doc-editor-modal {
  width: min(96vw, 1200px);
  max-width: none;
  height: 90vh;
  display: flex;
  flex-direction: column;
}
.doc-editor-frame {
  flex: 1;
  min-height: 70vh;
  height: calc(90vh - 64px);
  width: 100%;
  position: relative;
}
.doc-editor-frame iframe { width: 100%; height: 100%; border: 0; }

.automation-notif-btn { position: relative; }

.staff-status-wrap { position: relative; }
.staff-status-btn.staff-status-btn-active {
  background: #dbeafe;
  border: 1px solid #2563eb;
  color: #1d4ed8;
}
.staff-status-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  z-index: 1200;
  min-width: min(420px, 92vw);
  max-width: 480px;
  max-height: min(420px, 70vh);
  overflow: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  padding: 8px 0;
}
.staff-status-panel-head {
  padding: 8px 14px 10px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}
.staff-status-loading,
.staff-status-empty {
  padding: 16px 14px;
  text-align: center;
  color: #64748b;
  font-size: 0.88rem;
}
.staff-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.staff-status-row:last-child { border-bottom: none; }
.staff-status-person {
  flex: 1;
  min-width: 0;
}
.staff-status-person .user-with-avatar { font-size: 0.9rem; }
.staff-status-position {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}
.staff-status-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #cbd5e1;
}
.staff-status-dot.online { background: #22c55e; box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25); }
.staff-status-dot.offline { background: #94a3b8; }
.staff-status-times {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: #475569;
  text-align: left;
  direction: rtl;
  white-space: nowrap;
}

.notif-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  border-radius: 8px;
  padding: 0 4px;
}
.event-filter-wrap { display: inline-flex; margin-left: 8px; }
.event-filter-wrap select { padding: 4px 8px; border-radius: 4px; }
.notif-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.notif-list li { padding: 10px 12px; border-bottom: 1px solid #e2e8f0; cursor: pointer; display: flex; align-items: flex-start; gap: 10px; }
.notif-list li.notif-unread { background: #eff6ff; }
.notif-list li.notif-read { opacity: 0.62; background: #fff; }
.notif-list li.notif-empty { cursor: default; opacity: 1; color: #64748b; }
.notif-list li[data-id]:hover { background: var(--ui-row-hover); }
.notif-list li.notif-unread:hover { background: #dbeafe; }
.notif-list li p { margin: 4px 0; font-size: 0.9rem; color: #475569; }
.notif-body { flex: 1; min-width: 0; }
.event-row { cursor: pointer; }
.event-row:hover { background: var(--ui-row-hover); }

.events-calendar-wrap {
  width: 100%;
  min-width: 0;
}
.cal-view-all-hint {
  margin: 0 0 12px;
  text-align: center;
}
.events-calendar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
}
.events-calendar-title {
  margin: 0;
  font-size: 1.05rem;
  min-width: 140px;
  text-align: center;
}
.events-calendar-month-heading {
  margin: 0 0 12px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}
.cal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
  min-height: 22px;
}
.cal-day-add {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  color: #2563eb;
  cursor: pointer;
  padding: 0;
  font-size: 0.72rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-day-add:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}
.events-calendar-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.events-calendar {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  table-layout: fixed;
}
.events-calendar th {
  background: #1e293b;
  color: #f8fafc;
  padding: 10px 6px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}
.events-calendar td {
  vertical-align: top;
  border: 1px solid #e2e8f0;
  min-height: 88px;
  height: 96px;
  padding: 6px;
  background: #fff;
}
.cal-day-empty {
  background: #f8fafc;
}
.cal-day-has-events {
  background: #fffbeb;
}
.events-calendar td.cal-day-today,
.att-calendar-wrap td.cal-day-today {
  background: #fce7f3;
  box-shadow: inset 0 0 0 2px #f9a8d4;
}
.events-calendar td.cal-day-today .cal-day-num,
.att-calendar-wrap td.cal-day-today .cal-day-num {
  color: #9d174d;
  font-weight: 700;
}
.cal-day-num {
  font-weight: 600;
  font-size: 0.88rem;
  color: #334155;
}
.cal-day-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-event-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  text-align: right;
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  font-family: inherit;
  font-size: 0.72rem;
  line-height: 1.35;
  cursor: pointer;
  background: #dbeafe;
  color: #1e3a8a;
}
.cal-event-chip-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-event-video {
  margin-left: 4px;
  opacity: 0.9;
  font-size: 0.75em;
}

.cal-event-broadcast {
  background: #e0f2fe;
  color: #0c4a6e;
}

.cal-event-broadcast:hover {
  background: #bae6fd;
}

.cal-event-comments {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.68rem;
  color: #475569;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  padding: 1px 5px;
}
.cal-event-comments i {
  font-size: 0.62rem;
}
.cal-event-chip:hover {
  background: #bfdbfe;
}
.cal-event-high {
  background: #fee2e2;
  color: #991b1b;
}
.cal-event-high:hover {
  background: #fecaca;
}
.cal-event-low {
  background: #f1f5f9;
  color: #475569;
}
.cal-event-time {
  opacity: 0.85;
  margin-right: 4px;
}
.event-comments {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.event-participants-roster {
  margin: 12px 0 16px;
}
.event-participants-roster > strong {
  display: block;
  margin-bottom: 8px;
  color: #1e293b;
}
.event-participants-roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-participant-roster-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.event-participant-roster-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.event-participant-name {
  font-size: 0.92rem;
  color: #1e293b;
  font-weight: 600;
}
.event-participant-position {
  font-size: 0.8rem;
  color: #64748b;
}
.event-comments-section {
  margin: 0;
  padding: 0;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-comments-panel {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 12px 14px;
}
.event-comments-section h3 {
  margin: 0 0 10px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #166534;
}
.event-comment-compose-wrap {
  margin: 0;
}
.event-comment-compose-wrap > .btn-primary {
  min-width: 120px;
}
.event-comment-compose {
  margin-top: 10px;
  padding: 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
}
.event-comment-compose-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0c4a6e;
}
.event-comment-compose textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
}
.event-comments-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-comment-feed-item {
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}
.event-comments-panel .event-comment-empty {
  padding: 6px 2px;
  list-style: none;
}
.event-comment-feed-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.event-comment-feed-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.event-comment-feed-meta strong {
  font-size: 0.9rem;
  color: #1e293b;
}
.event-attendees-section {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}
.event-attendees-section h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.event-attendees-hint {
  margin: 0 0 12px;
}
.event-attendees-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-attendee-row {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.event-attendee-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.event-attendee-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.event-attendee-info strong {
  font-size: 0.95rem;
  color: #1e293b;
}
.event-attendee-position {
  font-size: 0.82rem;
  color: #64748b;
}
.event-attendee-actions {
  flex-shrink: 0;
}
.event-attendee-comments {
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-attendee-comment {
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.event-attendee-no-comment {
  margin: 0;
  font-size: 0.85rem;
}
.event-attendee-comment-form {
  padding: 0 14px 14px;
}
.event-attendee-comment-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
}
.event-attendee-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.event-attendee-empty {
  margin: 0;
}
.event-comments h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.event-comment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 600;
}
.event-comments-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-comment-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
}
.event-comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.event-comment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.event-comment-meta strong {
  font-size: 0.9rem;
  color: #1e293b;
}
.event-comment-time {
  font-size: 0.78rem;
  color: #64748b;
}
.event-comment-text {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #334155;
}
.event-comment-empty {
  padding: 8px 0;
  color: #64748b;
}
.event-comment-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
}
  display: block;
  font-size: 0.68rem;
  opacity: 0.85;
  direction: ltr;
  text-align: left;
}
.cal-empty-month {
  text-align: center;
  color: #64748b;
  padding: 24px !important;
}

.event-detail-export {
  background: #fff;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.event-detail-print-header {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  padding: 12px 14px;
}
.event-detail-print-header h1 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}
.event-detail-print-header p {
  margin: 0;
  font-size: 0.8rem;
  color: #64748b;
}
.event-detail-print-header--with-subject {
  display: flex;
  align-items: center;
  gap: 12px;
}
.event-detail-print-header--with-subject .event-detail-print-header-text {
  flex: 1;
  min-width: 0;
}
.event-detail-print-header--with-subject .event-detail-print-header-text p {
  margin-bottom: 0;
}
.event-detail-subject-photo {
  flex-shrink: 0;
}
.event-detail-subject-photo .user-avatar-md {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.event-detail-body {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.74rem;
  line-height: 1.5;
  color: #475569;
}
.event-detail-body p {
  margin: 0.35rem 0;
  font-size: inherit;
}
.event-detail-body strong {
  font-weight: 600;
  color: #64748b;
}
.event-detail-body .event-participants-roster {
  margin: 6px 0 8px;
  font-size: inherit;
}
.event-detail-desc {
  margin: 0.45rem 0;
}
.event-detail-desc pre {
  white-space: pre-wrap;
  background: #fff;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: #64748b;
  font-family: inherit;
  margin: 4px 0 0;
}

/* حضور و غیاب */
.att-calendar-wrap .att-cal-day { cursor: pointer; vertical-align: top; min-height: 88px; }
.att-calendar-wrap .att-day-off { background: #f8fafc; }
.att-calendar-wrap .att-day-leave {
  background: #fff7ed;
  box-shadow: inset 0 0 0 2px #fdba74;
}
.att-calendar-wrap .att-day-mission {
  background: #eef2ff;
  box-shadow: inset 0 0 0 2px #a5b4fc;
}
.att-calendar-wrap .att-day-remote {
  background: #ecfdf5;
  box-shadow: inset 0 0 0 2px #6ee7b7;
}
.att-day-body { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.att-chip { display: inline-block; font-size: 0.68rem; padding: 2px 6px; border-radius: 4px; line-height: 1.3; }
.att-chip-work { background: #dbeafe; color: #1e40af; }
.att-chip-off, .att-chip-holiday { background: #f1f5f9; color: #64748b; }
.att-chip-leave { background: #fef3c7; color: #92400e; font-weight: 600; }
.att-chip-mission { background: #e0e7ff; color: #3730a3; font-weight: 600; }
.att-chip-remote { background: #d1fae5; color: #065f46; font-weight: 600; }
.att-chip-note { background: #fce7f3; color: #9d174d; font-weight: 600; }
.att-chip-note-missing,
.att-chip-duty-missing {
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 700;
  border: 1px solid #fecaca;
}
.att-chip-note-missing i,
.att-chip-duty-missing i {
  color: #dc2626;
}
.att-week-danger-icon {
  color: #dc2626;
  font-size: 1.7rem;
  line-height: 1;
  display: inline-block;
}
.att-cal-week-cell.no-duty-report {
  background: #fff7ed;
}
.att-cal-week-cell.no-duty-report:hover {
  background: #ffedd5;
}
.att-chip-duty { background: #e0f2fe; color: #075985; font-weight: 600; }

/* گزارش ماهانه شرح وظایف بالای تقویم */
.att-jd-month-report {
  margin: 0 0 14px;
  padding: 14px 16px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 70%);
}
.att-jd-month-report-title {
  margin: 0 0 12px;
  font-family: Lalezar, Nazanin, Tahoma, sans-serif;
  font-size: 1.45rem;
  font-weight: 400;
  color: #0f172a;
  letter-spacing: 0.01em;
}
.att-jd-month-report-empty {
  margin: 0;
  font-family: Nazanin, "B Nazanin", Tahoma, sans-serif;
  color: #9a3412;
  display: flex;
  align-items: center;
  gap: 8px;
}
.att-jd-month-weeks {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.att-jd-month-week {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px 8px;
  background: #fff;
}
.att-jd-month-week-title {
  margin: 0 0 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  font-family: Zar, "B Zar", Nazanin, Tahoma, serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #0c4a6e;
}
.att-jd-month-week-ord {
  font-family: Zar, "B Zar", Nazanin, Tahoma, serif;
  font-weight: 700;
}
.att-jd-month-week-range {
  font-family: Nazanin, "B Nazanin", Tahoma, sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
  color: #475569;
}
.att-jd-month-duties {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.att-jd-month-duty-title {
  margin: 0 0 4px;
  font-family: Zar, "B Zar", Nazanin, Tahoma, serif;
  font-weight: 700;
  font-size: 0.98rem;
  color: #1e293b;
}
.att-jd-month-note {
  margin: 0 0 4px;
  font-family: Nazanin, "B Nazanin", Tahoma, sans-serif;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #334155;
  white-space: pre-wrap;
}
.att-jd-month-note-empty {
  color: #94a3b8;
  font-style: italic;
}
.att-calendar-with-week th.att-cal-week-col,
.att-calendar-with-week td.att-cal-week-cell {
  width: 7.5rem;
  min-width: 7rem;
  background: #f0f9ff;
  border-right: 2px solid #7dd3fc;
  vertical-align: middle;
  text-align: center;
  cursor: pointer;
}
.att-calendar-with-week thead th.att-cal-week-col {
  color: #0c4a6e;
  font-size: 0.78rem;
  white-space: nowrap;
}
.att-cal-week-cell:hover { background: #e0f2fe; }
.att-cal-week-cell.has-duty-report { background: #dbeafe; }
.att-cal-week-cell.has-duty-eval { box-shadow: inset 0 0 0 2px #38bdf8; }
.att-week-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  font-size: 0.72rem;
  color: #0c4a6e;
}
.att-week-eval-icon {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  color: #0369a1;
  font-size: 0.85rem;
}
.att-week-eval-icon .fa-check { color: #15803d; }
.att-week-eval-icon .fa-xmark { color: #b91c1c; }
.att-day-duty-covered {
  box-shadow: inset 0 -3px 0 #38bdf8;
}
.att-jd-duty-list { display: flex; flex-direction: column; gap: 12px; margin: 10px 0; }
.att-jd-duty-row {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.att-jd-duty-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.att-jd-report-list { margin: 0; padding-right: 1.1rem; }
.att-jd-report-list li { margin-bottom: 8px; }
.att-jd-eval-disabled {
  padding: 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
}
.att-jd-evals-all { margin-bottom: 10px; }
.att-jd-evals-all ul { margin: 4px 0 0; padding-right: 1.1rem; }
.att-personal-note-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.att-personal-note-editor-host { margin-top: 6px; }
.att-note-editor-toolbar { margin-bottom: 0; }
.att-note-editor { min-height: 120px; }
.att-sum-leave { color: #92400e; }
.att-sum-mission { color: #3730a3; }
.att-sum-remote { color: #065f46; }
.att-mini-slots { font-size: 0.68rem; color: #334155; direction: ltr; text-align: right; }
.att-lock { color: #16a34a; font-size: 0.75rem; }
.att-month-summary { margin: 12px 0; padding: 12px; background: #f8fafc; border-radius: 8px; border: 1px solid #e2e8f0; }
.att-month-summary h4 { margin: 0; font-size: 0.95rem; }
.att-month-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.att-summary-range { margin: 0 0 8px; }
.att-calendar-scroll {
  max-height: min(68vh, 560px);
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
.att-calendar.att-calendar-scrollable {
  margin: 0;
  border: none;
}
.att-calendar.att-calendar-scrollable thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  box-shadow: 0 1px 0 #e2e8f0;
}
.att-calendar .att-day-other-month {
  background: #f1f5f9;
}
.att-calendar .att-day-other-month .cal-day-num {
  color: #64748b;
  font-size: 0.85em;
}
.att-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; font-size: 0.85rem; }
.att-note-report-wrap { display: flex; flex-direction: column; gap: 12px; }
.att-note-report-header {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}
.att-note-report-brand {
  font-size: 0.78rem;
  color: #64748b;
  margin-bottom: 4px;
}
.att-note-report-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #0f172a;
  border-bottom: 2px solid #0f766e;
  padding-bottom: 8px;
}
.att-note-report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: 0.88rem;
  color: #334155;
}
.att-note-report-meta em {
  font-style: normal;
  color: #64748b;
  margin-left: 4px;
}
.att-note-report-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.att-note-report-list {
  max-height: 60vh;
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}
.att-note-report-item {
  margin: 0 0 12px;
  padding: 12px 12px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}
.att-note-report-item:last-child { margin-bottom: 0; }
.att-note-report-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #cbd5e1;
}
.att-note-report-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #0f766e;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}
.att-note-report-item h5 { margin: 0; color: #134e4a; }
.att-note-report-body {
  line-height: 1.8;
  color: #334155;
  word-break: break-word;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}
.att-note-report-body pre {
  white-space: pre-wrap;
  margin: 0;
  font-family: inherit;
  background: transparent;
  padding: 0;
}
.att-settings-panel, .att-timesheet-wrap { padding: 4px 0; }
.att-personnel-settings-form {
  max-width: 100%;
}
.att-personnel-settings-form .form-group {
  max-width: 18rem;
}
.att-personnel-settings-form .form-group label {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
.att-personnel-settings-form .form-group input[type="number"] {
  width: 18rem;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
}
.att-personnel-settings-form .att-personnel-settings-check {
  margin-top: 4px;
  max-width: none;
}
.att-personnel-settings-form .att-personnel-settings-check .checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  width: auto;
  cursor: pointer;
}
.att-personnel-settings-form .att-personnel-settings-check input[type="checkbox"] {
  width: auto;
  max-width: none;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #2563eb;
}
.att-personnel-settings-form .att-punch-actions {
  margin-top: 12px;
}
.att-inline-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.att-inline-form input { flex: 1; min-width: 120px; padding: 8px; border: 1px solid #cbd5e1; border-radius: 6px; }
.att-emp-picker { max-width: 640px; margin-bottom: 12px; }
.att-emp-picker-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.att-emp-picker-row select { flex: 1; min-width: 180px; }
.att-staff-report-form { display: flex; flex-direction: column; gap: 0.75rem; }
.att-staff-report-scope { display: flex; flex-wrap: wrap; gap: 1rem; }
.att-staff-report-scope .att-radio { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 500; }
.att-ym-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.att-ym-row select { min-width: 7rem; }
.att-staff-report-preview {
  margin-top: 0.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  background: #f8fafc;
}
.att-staff-report-actions { margin-bottom: 0.75rem; }
.att-staff-report-preview-frame {
  max-height: 55vh;
  overflow: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.75rem;
}
.att-staff-report-preview-person { margin-bottom: 1.25rem; }
.att-staff-report-preview-person h4 {
  margin: 0 0 0.5rem;
  color: #134e4a;
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 0.35rem;
}
.att-report-calendar { margin-bottom: 1rem; }
.att-report-month-title { margin: 0 0 0.5rem; font-size: 0.95rem; text-align: center; }
.att-calendar-slim-report .att-report-nonwork { background: #f8fafc; }
.att-calendar-slim-report .att-mini-slots.muted { color: #94a3b8; }

@media print {
  .att-staff-report-actions { display: none !important; }
}
.att-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.att-slot-row { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.att-ts-row { cursor: pointer; }
.att-ts-row:hover { background: #f8fafc; }
.att-ts-row.att-day-leave { background: #fff7ed; }
.att-ts-row.att-day-mission { background: #eef2ff; }
.att-ts-row.att-day-remote { background: #ecfdf5; }
.badge-ok { background: #dcfce7; color: #166534; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; }
.att-punch-panel {
  margin-bottom: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
}
.att-punch-info { margin-bottom: 12px; }
.att-punch-slots { display: block; font-size: 0.9rem; color: #334155; margin-top: 4px; }
.att-punch-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.att-pr-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.att-pr-type-btn { padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* فرم پرسنلی: چیدمان فشرده، پیوست، هزینه مأموریت */
.pr-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
  margin-bottom: 10px;
}
.pr-form-row__types {
  display: contents;
}
.pr-form-row .pr-field-compact,
.pr-form-row .form-group {
  flex: 1 1 8rem;
  min-width: 7rem;
  margin-bottom: 0;
}
.pr-field-compact label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
}
.pr-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  cursor: pointer;
  font-weight: 500;
}
.pr-att-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #e2e8f0;
}
.pr-att-item .pr-att-title {
  flex: 1 1 10rem;
  min-width: 8rem;
}
.pr-att-item .draft-attach-name {
  flex: 1 1 8rem;
  font-size: 0.85rem;
}
.pr-expense-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 8px 0 12px;
}
.pr-expense-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 12px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.pr-expense-row__top,
.pr-expense-row__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-start;
}
.pr-expense-row__top .pr-exp-title-field {
  flex: 1 1 12rem;
  min-width: 10rem;
  margin-bottom: 0 !important;
}
.pr-expense-row__bottom .pr-exp-amount-field {
  flex: 1 1 9rem;
  min-width: 8rem;
  margin-bottom: 0 !important;
}
.pr-expense-row__bottom .pr-exp-file-field {
  flex: 1.3 1 11rem;
  min-width: 9rem;
  margin-bottom: 0 !important;
  position: relative;
}
.pr-expense-row .pr-exp-del {
  flex: 0 0 auto;
  margin-top: 0.35rem;
  align-self: center;
}
.pr-exp-file-field > input[type='file'] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.85rem 0.9rem 0.55rem;
  min-height: 2.65rem;
  border: 1.5px solid var(--float-border, #bfdbfe);
  border-radius: 12px;
  background: var(--float-bg, #fff);
  font-family: inherit;
  font-size: 0.8rem;
  color: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.pr-exp-file-field > input[type='file']:focus {
  outline: none;
  border-color: var(--float-accent, #1d4ed8);
  box-shadow: 0 0 0 3px var(--float-accent-ring, rgba(29, 78, 216, 0.15));
}
.pr-exp-file-field > label {
  position: absolute !important;
  top: 0 !important;
  right: 0.9rem;
  left: auto;
  transform: translateY(-50%) !important;
  margin: 0 !important;
  padding: 0 0.4rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  line-height: 1;
  color: var(--float-label-idle, #475569) !important;
  background: #fff !important;
  pointer-events: none;
  z-index: 3 !important;
}
.pr-exp-file-field:focus-within > label {
  color: var(--float-accent, #1d4ed8) !important;
}
.pr-exp-file-name {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.3;
}
.pr-expense-total {
  margin: 8px 0 0;
  font-size: 0.95rem;
}
.pr-detail-block {
  margin: 10px 0;
}
.pr-detail-list {
  margin: 4px 0 0;
  padding-right: 20px;
}
@media (max-width: 640px) {
  .pr-expense-row__top .pr-exp-del {
    margin-top: 0;
  }
}
.att-prev-slots { background: #f8fafc; padding: 8px 12px; border-radius: 6px; direction: ltr; text-align: right; }
.att-ts-pending { color: #94a3b8; font-size: 0.85rem; }
.att-day-view p { margin: 8px 0; }
.punch-btn-active {
  background: #2563eb !important;
  color: #fff !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.35);
}
.punch-btn-idle {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  border-color: #cbd5e1 !important;
  cursor: not-allowed;
  opacity: 0.85;
}
.punch-btn-active:not(:disabled):hover {
  background: #1d4ed8 !important;
}
.automation-punch-clock {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  min-width: 5.5rem;
  text-align: center;
  padding: 4px 8px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
}
.automation-punch-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  padding: 4px 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
}
.automation-punch-hint {
  font-size: 0.78rem;
  color: #475569;
  max-width: 240px;
  line-height: 1.3;
}
.att-timesheet-hint { margin-bottom: 12px; }

/* Emergency group SMS */
.ems-panel h3 { margin-bottom: 0.35rem; }
.ems-table-wrap { overflow-x: auto; margin-top: 1rem; }
.ems-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ems-table th,
.ems-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 0.55rem 0.45rem;
  text-align: right;
  vertical-align: top;
}
.ems-table th { color: #64748b; font-weight: 600; font-size: 0.8rem; }
.ems-preview { max-width: 16rem; }
.ems-counts small { color: #64748b; display: block; }
.ems-actions { white-space: nowrap; }
.ems-del { color: #b91c1c !important; }
.ems-status {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}
.ems-status-scheduled { background: #dbeafe; color: #1d4ed8; }
.ems-status-sending { background: #fef3c7; color: #b45309; }
.ems-status-sent { background: #d1fae5; color: #047857; }
.ems-status-partial { background: #ffedd5; color: #c2410c; }
.ems-status-cancelled { background: #f1f5f9; color: #64748b; }
.ems-picker-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.ems-picker-head label { margin: 0; flex: 1; }
.ems-picker-block { margin-bottom: 1rem; }
.ems-no-mobile { color: #b45309; }
.ems-body-pre {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
}
.ems-form .form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; justify-content: flex-end; }
.ems-detail h4 { margin: 1rem 0 0.5rem; }

/* Regulations (کتابخانه) */
.reg-panel-wrap { display: flex; flex-direction: column; gap: 0.75rem; }
.reg-controls { margin-bottom: 0.25rem; }
.reg-att-list { list-style: none; margin: 0.35rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.reg-att-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.5rem;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 6px;
}
.reg-att-item a { color: inherit; text-decoration: none; }
.reg-att-item a:hover { text-decoration: underline; }
.reg-att-size { color: #64748b; font-size: 0.85em; }
.reg-att-cell { min-width: 10rem; }
.reg-inline-att {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-inline-end: 0.5rem;
  margin-bottom: 0.25rem;
  white-space: nowrap;
}
.reg-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.reg-desc { margin-top: 0.35rem; white-space: pre-wrap; }
.reg-comment-cell { white-space: nowrap; text-align: center; }
.reg-comment-count-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}
.reg-commenters-cell { min-width: 6rem; }
.reg-commenter-stack {
  display: inline-flex;
  align-items: center;
  flex-direction: row-reverse;
  padding-inline-end: 0.25rem;
}
.reg-commenter-avatar {
  display: inline-flex;
  margin-inline-end: -0.4rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
}
.reg-commenter-avatar .user-avatar,
.reg-commenter-avatar .user-avatar-wrap {
  width: 28px;
  height: 28px;
}
.reg-commenter-avatar .user-avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}
.reg-commenter-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  margin-inline-end: -0.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 0 0 2px #fff;
  z-index: 1;
}
.reg-comments-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}
.reg-comments-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.reg-comment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.8rem;
}
.reg-comment-compose-wrap { margin-bottom: 0.85rem; }
.reg-comment-compose {
  margin-top: 0.6rem;
  padding: 0.75rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
}
.reg-comment-compose textarea {
  width: 100%;
  margin: 0.35rem 0 0.6rem;
  resize: vertical;
}
.reg-comment-form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.reg-comments-feed {
  list-style: none;
  margin: 0;
  padding: 0;
}
.reg-comment-item {
  padding: 0.65rem 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 0.55rem;
}
.reg-comment-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.reg-comment-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.reg-comment-time {
  font-size: 0.8rem;
  color: #64748b;
}
.reg-comment-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}
.reg-comment-empty {
  padding: 0.5rem 0;
  color: #64748b;
}

/* Desktop only: fixed top shell + independent scroll regions */
@media (min-width: 1024px) {
  .automation-app {
    height: 100vh;
    overflow: hidden;
  }
  .automation-page-header {
    position: sticky;
    top: 0;
    z-index: 120;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  }
  .automation-layout {
    overflow: hidden;
  }
  .automation-sidebar {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }
  .automation-sidebar-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 8px 14px;
  }
  .sidebar-profile {
    flex-shrink: 0;
    margin-bottom: 0;
    background: var(--ui-sidebar-bg);
  }
  .automation-layout.nav-rail-collapsed .automation-sidebar {
    padding: 0;
  }
  .automation-layout.nav-rail-collapsed .automation-sidebar-nav {
    padding: 8px 4px 12px;
  }
}

@media (max-width: 768px) {
  .automation-layout { flex-direction: column; }
  .nav-rail-toggle { display: none; }
  .automation-layout.nav-rail-collapsed .automation-sidebar {
    width: 100%;
    padding: 8px;
  }
  .automation-layout.nav-rail-collapsed .sidebar-profile-text,
  .automation-layout.nav-rail-collapsed .sidebar-nav-search:not([hidden]),
  .automation-layout.nav-rail-collapsed .sidebar-item span,
  .automation-layout.nav-rail-collapsed .sidebar-section-title span,
  .automation-layout.nav-rail-collapsed .sidebar-section-arrow,
  .automation-layout.nav-rail-collapsed .sidebar-subheader {
    display: unset;
  }
  .automation-layout.nav-rail-collapsed .sidebar-nav-search:not([hidden]) {
    display: block;
  }
  .automation-layout.nav-rail-collapsed .sidebar-profile-text { display: block; }
  .automation-layout.nav-rail-collapsed .sidebar-item span,
  .automation-layout.nav-rail-collapsed .sidebar-section-title span { display: inline; }
  .automation-layout.nav-rail-collapsed .sidebar-section-arrow { display: inline-block; }
  .automation-layout.nav-rail-collapsed .sidebar-subheader { display: block; }
  .automation-layout.nav-rail-collapsed .sidebar-item,
  .automation-layout.nav-rail-collapsed .sidebar-section-header,
  .automation-layout.nav-rail-collapsed .sidebar-profile {
    justify-content: unset;
  }
  .automation-sidebar {
    width: 100%;
  }
  .automation-sidebar-nav {
    padding: 0 8px 8px;
  }
  .sidebar-profile {
    padding: 8px 8px 10px;
  }
  .sidebar-section { margin-bottom: 10px; }
  .sidebar-section-header { width: 100%; }
  .sidebar-section-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px;
  }
  .sidebar-section-content.collapsed { display: none; }
  .sidebar-subheader {
    grid-column: 1 / -1;
    padding: 6px 2px 0;
  }
  .sidebar-item {
    width: 100%;
    border-radius: 6px;
    font-size: 0.86rem;
    padding: 8px 10px;
  }
  .org-chart-layout { flex-wrap: wrap; }
  .org-chart-admin,
  .org-chart-admin.is-collapsed {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
  }
  .org-chart-admin.is-collapsed {
    min-height: 44px;
    padding: 8px 10px;
  }
  .org-chart-admin.is-collapsed .org-chart-admin-head {
    justify-content: space-between;
  }
  .org-chart-admin.is-collapsed .org-chart-admin-rail-label {
    writing-mode: horizontal-tb;
    transform: none;
    margin: 0;
  }
}

/* مدارک شخصی — تاریخ‌های پرسنلی و عملیات آیکونی */
.ud-dates-card {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  background: var(--surface-2, #f8fafc);
}
.ud-dates-title { margin: 0 0 0.5rem; font-size: 1rem; }
.ud-dates-hint { margin: 0 0 0.75rem; }
.ud-dates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.ud-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.ud-toolbar .form-hint { margin: 0; flex: 1; min-width: 200px; }
.ud-actions { white-space: nowrap; }
.ud-actions .btn.btn-icon { padding: 4px 7px; font-size: 15px; text-decoration: none; }
.ud-actions .btn.btn-icon.danger { color: #b91c1c; }
.ud-actions .btn.btn-icon.danger:hover { color: #991b1b; }
.badge.badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
}

/* جشن تولد / سالگرد همکاری */
.occasion-celebration {
  position: fixed;
  inset: 0;
  z-index: 12000;
  overflow: hidden;
  background: radial-gradient(ellipse at center, rgba(255,248,240,0.55), rgba(15,23,42,0.35));
  cursor: pointer;
}
.occasion-celebration-msg {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #1e293b;
  text-shadow: 0 1px 0 #fff;
  pointer-events: none;
  padding: 1rem 1.5rem;
  background: rgba(255,255,255,0.85);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.occasion-celebration-msg small {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
}
.occasion-float {
  position: absolute;
  bottom: -2rem;
  animation-name: occasionRise;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  pointer-events: none;
  user-select: none;
}
@keyframes occasionRise {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translateY(-110vh) rotate(25deg); opacity: 0.15; }
}

/* Staff succession / job handover */
.ss-panel h3 { margin-bottom: 0.35rem; }
.ss-mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.1rem;
}
.ss-mode-btn.is-active { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25); }
.ss-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 720px) {
  .ss-form-row { grid-template-columns: 1fr; }
}
.ss-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 0.5rem;
}
.ss-preview-host { margin-top: 0.85rem; }
.ss-preview-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
}
.ss-preview-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}
.ss-counts-list {
  list-style: none;
  margin: 0.6rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1rem;
}
.ss-counts-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  padding: 0.25rem 0;
  border-bottom: 1px dashed #e2e8f0;
}
.ss-warning {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 6px 8px;
}
.ss-history-title {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
}
.ss-status {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #334155;
}
.ss-status-scheduled { background: #dbeafe; color: #1d4ed8; }
.ss-status-executed { background: #d1fae5; color: #047857; }
.ss-status-cancelled { background: #f1f5f9; color: #64748b; }
.ss-status-failed { background: #fee2e2; color: #b91c1c; }
.ss-err {
  display: block;
  color: #b91c1c;
  font-size: 0.72rem;
  margin-top: 0.2rem;
}

/* شرح وظایف و ارزیابی */
.jd-panel { display: flex; flex-direction: column; gap: 1rem; }
.jd-panel h3 { margin: 0; font-size: 1.15rem; }
.jd-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #e2e8f0;
}
.jd-page-head-main { display: flex; align-items: flex-start; gap: 0.75rem; min-width: 0; }
.jd-page-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #eff6ff, #e0e7ff);
  color: #3730a3;
  flex-shrink: 0;
  font-size: 1.05rem;
}
.jd-page-titles { min-width: 0; }
.jd-page-hint { margin: 0.25rem 0 0; }
.jd-page-head-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.jd-toolbar,
.jd-action-row,
.jd-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
}
.jd-toolbar--wrap { align-items: flex-end; }
.jd-toolbar-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 8rem; }
.jd-toolbar-field--grow { flex: 1 1 220px; min-width: 180px; }
.jd-toolbar-field--btn { min-width: auto; }
.jd-toolbar-field label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #475569;
  margin: 0;
}
.jd-action-row { align-items: center; }
.jd-action-row--footer {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
  justify-content: flex-start;
}
.jd-staff-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 12px;
  background: #f1f5f9;
  width: fit-content;
}
.jd-tab {
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 9px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.jd-tab:hover { background: #e2e8f0; }
.jd-tab.is-active {
  background: #fff;
  color: #1e293b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  font-weight: 600;
}
.jd-section {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.jd-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f7;
}
.jd-section-head h4 {
  margin: 0;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #0f172a;
}
.jd-section-head h4 .fas { color: #4f46e5; }
.jd-section-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.jd-section-body { padding: 0.85rem 0.9rem 1rem; }
.jd-duty-list { display: flex; flex-direction: column; gap: 0.65rem; }
.jd-duty-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.jd-duty-inactive { opacity: 0.55; }
.jd-duty-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.jd-duty-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.jd-duty-meta,
.jd-duty-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.jd-duty-foot { justify-content: space-between; }
.jd-duty-desc { margin: 0; color: #475569; font-size: 0.9rem; }
.jd-duty-dates { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; }
.jd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  white-space: nowrap;
}
.jd-badge-public { background: #e0e7ff; color: #3730a3; }
.jd-badge-personal { background: #fce7f3; color: #9d174d; }
.jd-badge-weight { background: #ecfdf5; color: #047857; }
.jd-badge-warn { background: #fef2f2; color: #b91c1c; }
.jd-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.85rem;
}
.jd-chip-ok { background: #ecfdf5; color: #065f46; }
.jd-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.jd-activity-list li {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.jd-act-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: baseline;
}
.jd-act-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  font-size: 0.82rem;
}
.jd-file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  text-decoration: none;
}
.jd-weight-banner {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.8rem;
  border-radius: 10px;
  font-size: 0.9rem;
  flex: 1 1 220px;
}
.jd-weight-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.jd-weight-bad { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.jd-template-box { display: flex; flex-direction: column; gap: 0.5rem; }
.jd-tpl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fafbfc;
}
.jd-tpl-info { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.jd-duty-table { width: 100%; font-size: 0.88rem; }
.jd-duty-table input[type="text"],
.jd-duty-table input.jd-d-title,
.jd-duty-table .jd-d-title {
  width: 100%;
  min-width: 8rem;
  box-sizing: border-box;
}
.jd-duty-table td { vertical-align: middle; }
.jd-duty-table .jdp-field {
  min-width: 7.5rem;
  max-width: 9.5rem;
}
.jd-duty-table .jdp-input {
  width: 100%;
  box-sizing: border-box;
}
.jd-col-row {
  width: 3rem;
  text-align: center;
  white-space: nowrap;
  color: #475569;
  font-variant-numeric: tabular-nums;
}
.jd-col-active { text-align: center; width: 2.5rem; }
.jd-check { display: inline-flex; align-items: center; justify-content: center; margin: 0; }
.jd-row-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-weight: 700;
  font-size: 0.78rem;
}
.jd-empty,
.jd-empty-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #64748b;
  padding: 1.1rem 0.75rem;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.jd-empty-inline {
  justify-content: flex-start;
  padding: 0.55rem 0.7rem;
  border-style: solid;
}
.jd-modal-form .form-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.jd-modal-duty {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  background: #eef2ff;
  color: #312e81;
  font-weight: 600;
}
.jd-ev-title { margin-inline-end: 0.35rem; }
.muted { color: #64748b; }

/* —— ??????? ?????????: ???????? ?????? —— */
.auto-settings {
  max-width: 1100px;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
.auto-settings-head h3 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}
.auto-settings-head p {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.7;
}
.auto-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px) {
  .auto-settings-grid {
    grid-template-columns: 1fr 1fr;
  }
  .auto-settings-card--span2 {
    grid-column: 1 / -1;
  }
}
.auto-settings-card {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 14px;
  padding: 16px 18px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  border-inline-start: 4px solid #94a3b8;
}
.auto-settings-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}
.auto-settings-card-hint {
  margin: 0 0 12px;
  color: #64748b;
  font-size: 0.85rem;
  line-height: 1.65;
}
.auto-settings-subhead {
  margin: 16px 0 6px;
  font-weight: 700;
  font-size: 0.98rem;
  color: #14532d;
}
.auto-settings-card--limits { border-inline-start-color: #334155; background: linear-gradient(180deg, #f8fafc 0%, #fff 48px); }
.auto-settings-card--letter-numbers { border-inline-start-color: #2563eb; background: linear-gradient(180deg, #eff6ff 0%, #fff 56px); }
.auto-settings-card--letter-numbers .auto-settings-card-title { color: #1e3a8a; }
.auto-settings-card--doc-editor { border-inline-start-color: #7c3aed; background: linear-gradient(180deg, #f5f3ff 0%, #fff 48px); }
.auto-settings-card--paper { border-inline-start-color: #78716c; background: linear-gradient(180deg, #fafaf9 0%, #fff 48px); }
.auto-settings-card--letterhead { border-inline-start-color: #65a30d; background: linear-gradient(180deg, #f7fee7 0%, #fff 48px); }
.auto-settings-card--purposes { border-inline-start-color: #0d9488; background: linear-gradient(180deg, #f0fdfa 0%, #fff 48px); }
.auto-settings-card--events { border-inline-start-color: #db2777; background: linear-gradient(180deg, #fdf2f8 0%, #fff 48px); }
.auto-settings-card--sms-provider { border-inline-start-color: #0891b2; background: linear-gradient(180deg, #ecfeff 0%, #fff 48px); }
.auto-settings-card--email { border-inline-start-color: #4f46e5; background: linear-gradient(180deg, #eef2ff 0%, #fff 48px); }
.auto-settings-card--payment-pos { border-inline-start-color: #d97706; background: linear-gradient(180deg, #fffbeb 0%, #fff 48px); }
.auto-settings-card--sms-policy { border-inline-start-color: #0e7490; background: linear-gradient(180deg, #cffafe 0%, #fff 48px); }
.auto-settings-card--sms-prefs { border-inline-start-color: #059669; background: linear-gradient(180deg, #ecfdf5 0%, #fff 48px); }
.auto-settings-req-numbers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  max-height: 420px;
  overflow: auto;
  padding: 4px 2px;
}
.auto-settings-number-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(100px, 0.7fr);
  gap: 10px;
  align-items: end;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}
@media (max-width: 640px) {
  .auto-settings-number-row {
    grid-template-columns: 1fr;
  }
}
