/* Client - Main CSS - RTL/Farsi */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; direction: rtl; scroll-behavior: smooth; overflow-x: hidden; }

body {
  font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
  font-size: 14px;
  color: #1f2937;
  background: #f9fafb;
  line-height: 1.7;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: #6366f1; text-decoration: none; transition: color 0.25s ease; }
a:hover { color: #4f46e5; }
img { max-width: 100%; height: auto; }

/* ===== LAYOUT ===== */
.layout-wrapper { display: flex; min-height: 100vh; overflow-x: hidden; }

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-right: 260px;
  transition: margin-right 0.25s ease;
  min-width: 0;
}
.main-content.sidebar-collapsed { margin-right: 70px; }

.page-content { flex: 1; padding: 32px; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-header h1 {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #111827;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}
.page-header h1 i { color: #6366f1; font-size: 25px; }
.page-header p { color: #6b7280; font-size: 13px; margin: 5px 0 0; }

/* ===== WEBSITE PAGES ===== */
.website-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(170px, 1fr) minmax(140px, 1fr) auto;
  gap: 12px;
  align-items: end;
}
.website-filter-grid label {
  display: block;
  color: #4b5563;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
}
.website-filter-actions, .website-row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}
.website-row-actions .btn-sm {
  width: auto;
  min-width: 0;
  height: auto;
  padding: 6px 11px;
}
.website-list-table th,
.website-list-table td {
  height: 62px;
  vertical-align: middle;
}
.website-list-table th:not(:first-child),
.website-list-table td:not(:first-child) {
  text-align: center;
}
.website-list-table th:first-child,
.website-list-table td:first-child {
  min-width: 260px;
  text-align: right;
}
.website-site-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  line-height: 1.45;
  white-space: nowrap;
}
.website-site-title {
  color: #4f46e5;
  font-weight: 700;
}
.website-site-domain {
  color: #64748b;
  font-size: 12px;
  unicode-bidi: isolate;
}
.website-list-table .website-row-actions {
  justify-content: center;
}
.website-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.website-status-active { color: #047857; background: #d1fae5; }
.website-status-inactive { color: #4b5563; background: #f3f4f6; }
.website-status-suspended { color: #b45309; background: #fef3c7; }
.website-status-archived { color: #991b1b; background: #fee2e2; }
.website-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; right: 0;
  width: 260px;
  height: 100vh;
  height: 100dvh;
  background: #1e293b;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width 0.25s ease, right 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed { width: 70px; }
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-item-text,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-group-label,
.sidebar.collapsed .sidebar-group-chevron,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-footer-user-info { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .sidebar-group-toggle { justify-content: center; padding: 12px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.logo-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px; color: #fff;
}
.sidebar-logo-text { color: #fff; font-size: 16px; font-weight: 700; white-space: nowrap; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 9999px; }

.sidebar-group { margin: 3px 8px; }
.sidebar-group-toggle {
  width: 100%; border: 0; background: transparent; color: rgba(255,255,255,0.75);
  border-radius: 10px; padding: 11px 8px; display: flex; align-items: center;
  gap: 11px; font: inherit; font-weight: 600; text-align: right; cursor: pointer;
  transition: background 250ms ease, color 250ms ease;
}
.sidebar-group-toggle:hover, .sidebar-group-toggle:focus-visible { background: rgba(255,255,255,0.07); color: #fff; outline: none; }
.sidebar-group-toggle .sidebar-group-icon { width: 22px; flex-shrink: 0; text-align: center; font-size: 19px; }
.sidebar-group-toggle .sidebar-group-chevron { margin-right: auto; font-size: 18px; transition: transform 250ms ease; }
.sidebar-group-toggle .nav-badge { background: #ef4444; color: #fff; font-size: 10px; padding: 1px 6px; min-width: 19px; border-radius: 9999px; text-align: center; }
.sidebar-group.is-open > .sidebar-group-toggle { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-group.is-open > .sidebar-group-toggle .sidebar-group-chevron { transform: rotate(180deg); }
.sidebar-group-items {
  display: none;
}
.sidebar-group-items .nav-item { padding: 9px 28px 9px 10px; margin-right: 0; margin-left: 0; font-size: 13px; }
.sidebar-group.is-open > .sidebar-group-items { display: block; }

.sidebar-section-title {
  padding: 8px 16px 4px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.75);
  border-radius: 10px;
  margin: 2px 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-decoration: none;
  font-size: 14px;
}
.nav-item i { font-size: 18px; flex-shrink: 0; width: 22px; text-align: center; }
.nav-item .nav-badge {
  margin-right: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  min-width: 20px;
  text-align: center;
}
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active {
  background: #6366f1;
  color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-footer-user { display: flex; align-items: center; gap: 10px; }
.sidebar-footer-user img { width: 36px; height: 36px; border-radius: 9999px; object-fit: cover; }
.sidebar-footer-user-info { flex: 1; overflow: hidden; }
.sidebar-footer-user-info .user-name {
  color: #fff; font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-footer-user-info .user-role { color: rgba(255,255,255,0.5); font-size: 12px; }

/* ===== TOPBAR ===== */
.topbar {
  background: #fff;
  border-bottom: 1px solid #f3f4f6;
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.topbar-right, .topbar-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 18px; font-weight: 700; color: #111827; }

.topbar-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}
.topbar-btn i { font-size: 18px; }
.topbar-btn:hover { background: #eef2ff; color: #6366f1; }
.topbar-btn .badge-count {
  position: absolute;
  top: 4px; left: 4px;
  background: #ef4444; color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 5px;
  border-radius: 9999px;
  min-width: 18px; text-align: center;
}

/* ===== CARDS ===== */
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #f3f4f6;
  padding: 24px;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}
.card-title { font-size: 16px; font-weight: 600; color: #111827; }

/* Stat Cards */
.stat-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #f3f4f6;
  padding: 24px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px rgba(0,0,0,0.08); }
.stat-card-inner { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.icon-primary { background: #e0e7ff; color: #6366f1; }
.icon-success { background: #d1fae5; color: #10b981; }
.icon-warning { background: #fef3c7; color: #f59e0b; }
.icon-danger  { background: #fee2e2; color: #ef4444; }
.icon-info    { background: #dbeafe; color: #3b82f6; }
.icon-purple  { background: #ede9fe; color: #7c3aed; }
.stat-value { font-size: 28px; font-weight: 700; color: #111827; line-height: 1; }
.stat-label { font-size: 12px; color: #6b7280; margin-top: 4px; }
.stat-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.trend-up { color: #10b981; }
.trend-down { color: #ef4444; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-weight: 500; font-size: 14px;
  border: none; border-radius: 10px;
  cursor: pointer; padding: 10px 20px;
  transition: all 0.2s ease;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn i { font-size: 15px; }

.btn-primary { background: #6366f1; color: #fff; box-shadow: 0 4px 14px rgba(99,102,241,0.3); }
.btn-primary:hover { background: #4f46e5; color: #fff; }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: transparent; border: 1.5px solid #e5e7eb; color: #374151; }
.btn-outline:hover { background: #f9fafb; border-color: #d1d5db; }
.btn-outline-primary { background: transparent; border: 1.5px solid #6366f1; color: #6366f1; }
.btn-outline-primary:hover { background: #eef2ff; }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.table td .btn-sm { width: 45px; height: 40px; min-width: 45px; padding: 0; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ===== FORM CONTROLS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 14px; font-weight: 500;
  color: #374151; margin-bottom: 6px;
}
.form-group label .required { color: #ef4444; margin-right: 3px; }

.form-control {
  width: 100%;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 14px; color: #1f2937;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  direction: rtl;
}
.form-control:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-control::placeholder { color: #9ca3af; }
.form-control:disabled { background: #f9fafb; cursor: not-allowed; }

textarea.form-control { resize: vertical; min-height: 100px; }

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 16px;
  padding-left: 36px;
}

.form-hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.form-error { font-size: 12px; color: #ef4444; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.input-group { position: relative; }
.input-group .form-control { padding-right: 40px; }
.input-icon {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: #9ca3af; font-size: 16px;
  pointer-events: none;
}
.input-group button.input-icon {
  pointer-events: auto;
  cursor: pointer;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 9999px;
  font-size: 12px; font-weight: 600;
  background: #f3f4f6; color: #374151;
  white-space: nowrap;
}
.badge-open       { background: #d1fae5; color: #065f46; }
.badge-inprogress { background: #dbeafe; color: #1e40af; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-resolved   { background: #ede9fe; color: #5b21b6; }
.badge-closed     { background: #f3f4f6; color: #4b5563; }
.badge-reopened   { background: #fee2e2; color: #991b1b; }
.badge-customerreplied { background: #fef3c7; color: #92400e; }
.badge-low        { background: #f3f4f6; color: #4b5563; }
.badge-medium     { background: #dbeafe; color: #1e40af; }
.badge-high       { background: #fef3c7; color: #92400e; }
.badge-critical   { background: #fee2e2; color: #991b1b; }

/* ===== TABLE ===== */
.table-container {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #f3f4f6;
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #f3f4f6;
  flex-wrap: wrap; gap: 10px;
}

table.table { width: 100%; border-collapse: collapse; direction: rtl; }
table.table thead tr { background: #f9fafb; }
table.table th {
  padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: #6b7280; text-align: right;
  border-bottom: 1px solid #f3f4f6; white-space: nowrap;
}
table.table td {
  padding: 14px 16px; font-size: 14px;
  color: #374151; border-bottom: 1px solid #f9fafb;
  vertical-align: middle; white-space: nowrap;
}
table.table tbody tr { transition: background 0.15s ease; }
table.table tbody tr:hover { background: #f9fafb; }
table.table tbody tr:last-child td { border-bottom: none; }

.ticket-number { font-family: monospace; font-size: 12px; color: #6b7280; }
.ticket-subject {
  font-weight: 500; color: #111827;
  max-width: 300px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  display: block;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 16px;
}
.page-item .page-link {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 14px;
  color: #6b7280; border: 1px solid #e5e7eb;
  transition: all 0.15s ease; cursor: pointer; text-decoration: none;
}
.page-item .page-link:hover { border-color: #6366f1; color: #6366f1; background: #eef2ff; }
.page-item.active .page-link { background: #6366f1; color: #fff; border-color: #6366f1; }
.page-item.disabled .page-link { opacity: 0.4; cursor: not-allowed; }

/* ===== ALERTS ===== */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; margin-bottom: 16px;
}
.alert i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid rgba(16,185,129,0.3); }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid rgba(239,68,68,0.3); }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid rgba(245,158,11,0.3); }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid rgba(59,130,246,0.3); }

/* ===== TOAST ===== */
.toast-container {
  position: fixed; bottom: 32px; left: 32px;
  z-index: 1200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: 0 20px 25px rgba(0,0,0,0.1);
  min-width: 280px; max-width: 380px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.4);
  animation: toastIn 0.3s ease;
}
.toast i { font-size: 20px; flex-shrink: 0; }
.toast-message { flex: 1; font-size: 14px; color: #1f2937; }
.toast-close { color: #9ca3af; cursor: pointer; background: none; border: none; font-size: 16px; padding: 0; }
.toast-close:hover { color: #374151; }
.toast-success { border-right: 4px solid #10b981; }
.toast-success i { color: #10b981; }
.toast-error { border-right: 4px solid #ef4444; }
.toast-error i { color: #ef4444; }
.toast-warning { border-right: 4px solid #f59e0b; }
.toast-warning i { color: #f59e0b; }
.toast-info { border-right: 4px solid #6366f1; }
.toast-info i { color: #6366f1; }
.toast.toast-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn { from { opacity:0; transform:translateX(-20px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(-20px); } }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 1100;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: #fff; border-radius: 20px;
  box-shadow: 0 20px 25px rgba(0,0,0,0.15);
  width: 100%; max-width: 520px; max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.25s ease;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px; border-bottom: 1px solid #f3f4f6;
}
.modal-title { font-size: 18px; font-weight: 600; color: #111827; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: none; background: #f3f4f6;
  cursor: pointer; transition: all 0.15s; color: #6b7280;
}
.modal-close:hover { background: #e5e7eb; color: #1f2937; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid #f3f4f6;
  display: flex; align-items: center; gap: 10px;
  flex-direction: row-reverse;
}

@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes modalIn { from { opacity:0; transform:scale(.95) translateY(-10px); } to { opacity:1; transform:scale(1) translateY(0); } }

/* ===== NOTIFICATION DROPDOWN ===== */
.notification-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 360px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 20px 25px rgba(0,0,0,0.1);
  border: 1px solid #f3f4f6;
  overflow: hidden; z-index: 1050;
  animation: fadeIn 0.2s ease;
  display: none;
}
.notification-dropdown.show { display: block; }
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid #f3f4f6;
  font-weight: 600; color: #111827;
}
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid #f9fafb;
  transition: background 0.15s; cursor: pointer;
}
.notif-item:hover { background: #f9fafb; }
.notif-item.unread { background: #eef2ff; }
.notif-icon {
  width: 36px; height: 36px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 16px;
}
.notif-icon.created { background: #d1fae5; color: #10b981; }
.notif-icon.replied { background: #dbeafe; color: #3b82f6; }
.notif-icon.status  { background: #fef3c7; color: #f59e0b; }
.notif-icon.assigned{ background: #e0e7ff; color: #6366f1; }
.notif-content { flex: 1; }
.notif-title { font-weight: 500; color: #111827; font-size: 14px; }
.notif-msg   { color: #6b7280; font-size: 12px; margin-top: 2px; }
.notif-time  { color: #9ca3af; font-size: 11px; margin-top: 2px; }
.notif-footer {
  padding: 10px 16px; text-align: center;
  border-top: 1px solid #f3f4f6;
  font-size: 13px; color: #6366f1; cursor: pointer;
}
.notif-footer:hover { background: #eef2ff; }

/* ===== USER DROPDOWN ===== */
.user-avatar { position: relative; display: inline-block; cursor: pointer; }
.user-avatar img { width: 38px; height: 38px; border-radius: 9999px; object-fit: cover; }
.avatar-fallback {
  width: 38px; height: 38px; border-radius: 9999px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 14px;
}

.user-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 220px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 20px 25px rgba(0,0,0,0.1);
  border: 1px solid #f3f4f6;
  padding: 4px 0; z-index: 1050;
  animation: fadeIn 0.2s ease;
  display: none;
}
.user-dropdown.show { display: block; }
.dropdown-header {
  padding: 16px; border-bottom: 1px solid #f3f4f6;
  font-weight: 500; color: #1f2937; font-size: 14px;
}
.dropdown-header small { color: #9ca3af; display: block; font-size: 12px; font-weight: 400; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: #4b5563; font-size: 14px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer; border: none; background: transparent;
  width: 100%; text-align: right;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  text-decoration: none;
}
.dropdown-item i { font-size: 16px; }
.dropdown-item:hover { background: #f9fafb; color: #111827; }
.dropdown-item.text-danger { color: #ef4444; }
.dropdown-item.text-danger:hover { background: #fee2e2; }

/* ===== CONVERSATION ===== */
.conversation { display: flex; flex-direction: column; gap: 16px; }

.conversation-item { display: flex; gap: 12px; }
.conversation-item.agent-reply { flex-direction: row-reverse; }
.conversation-item.agent-reply .message-bubble {
  background: #eef2ff; border-color: #e0e7ff;
  border-radius: 14px 4px 14px 14px;
}
.conversation-item.internal-note .message-bubble {
  background: #fef3c7; border-color: rgba(245,158,11,0.3);
  border-style: dashed;
}

.avatar { width: 40px; height: 40px; border-radius: 9999px; object-fit: cover; flex-shrink: 0; }
.avatar-placeholder {
  width: 40px; height: 40px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: #e0e7ff; color: #6366f1;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}

.message-content { flex: 1; }
.message-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.sender-name { font-weight: 600; color: #1f2937; }
.message-time { font-size: 12px; color: #9ca3af; }
.message-bubble {
  background: #fff; border: 1px solid #e5e7eb;
  border-radius: 4px 14px 14px 14px;
  padding: 14px 16px;
  line-height: 1.8; color: #374151; word-break: break-word;
}
.internal-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(245,158,11,0.12); color: #d97706;
  padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 600;
}

/* ===== TICKET DETAIL LAYOUT ===== */
.ticket-detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.ticket-info-card {
  background: #fff; border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #f3f4f6;
  overflow: hidden;
}
.info-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #f9fafb; font-size: 14px;
}
.info-item:last-child { border-bottom: none; }
.info-label { color: #6b7280; }
.info-value { color: #1f2937; font-weight: 500; }

/* ===== FILE UPLOAD ===== */
.file-upload-area {
  border: 2px dashed #e5e7eb; border-radius: 14px;
  padding: 40px 32px; text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.file-upload-area:hover, .file-upload-area.dragover {
  border-color: #6366f1; background: #eef2ff;
}
.upload-icon { font-size: 40px; color: #d1d5db; margin-bottom: 12px; display: block; }
.file-upload-area:hover .upload-icon { color: #6366f1; }
.upload-text { color: #6b7280; font-size: 14px; }
.upload-hint { color: #9ca3af; font-size: 12px; margin-top: 4px; }

.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: #f9fafb;
  border-radius: 10px; border: 1px solid #e5e7eb;
}
.file-info { display: flex; align-items: center; gap: 10px; }
.file-name { font-size: 14px; color: #1f2937; }
.file-size { font-size: 12px; color: #9ca3af; }
.file-remove { color: #ef4444; cursor: pointer; transition: color 0.15s; background: none; border: none; font-size: 16px; }
.file-remove:hover { color: #dc2626; }

/* ===== RATING ===== */
.rating { display: flex; align-items: center; gap: 4px; direction: ltr; }
.star { font-size: 24px; color: #e5e7eb; cursor: pointer; transition: color 0.15s; }
.star.active, .star:hover { color: #f59e0b; }

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 32px; text-align: center;
}
.empty-icon { font-size: 64px; color: #e5e7eb; margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 600; color: #9ca3af; margin-bottom: 8px; }
.empty-description { color: #9ca3af; margin-bottom: 20px; }

/* ===== SEARCH BAR ===== */
.search-bar { position: relative; }
.search-bar input { padding-right: 40px; padding-left: 16px; border-radius: 9999px; }
.search-bar .search-icon {
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%); color: #9ca3af;
  pointer-events: none;
}

/* ===== AUTH PAGES ===== */
.auth-wrapper {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #4f46e5 100%);
  padding: 32px;
  position: relative; overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px; border-radius: 9999px;
  background: radial-gradient(circle, rgba(99,102,241,0.15) 0%, transparent 70%);
  top: -100px; right: -100px;
}
.auth-wrapper::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px; border-radius: 9999px;
  background: radial-gradient(circle, rgba(14,165,233,0.12) 0%, transparent 70%);
  bottom: -80px; left: 20%;
}

.auth-card {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 20px;
  padding: 40px;
  width: 100%; max-width: 440px;
  position: relative; z-index: 1;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  animation: authCardIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes authCardIn {
  from { opacity:0; transform:translateY(30px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-circle {
  width: 64px; height: 64px; border-radius: 20px;
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 28px; color: #fff;
  box-shadow: 0 4px 14px rgba(99,102,241,0.35);
}
.auth-logo h1 { font-size: 22px; font-weight: 700; color: #111827; margin-bottom: 4px; }
.auth-logo p { color: #6b7280; font-size: 14px; }

.auth-divider {
  text-align: center; margin: 20px 0;
  color: #9ca3af; font-size: 13px; position: relative;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 42%; height: 1px; background: #e5e7eb;
}
.auth-divider::before { right: 0; }
.auth-divider::after  { left: 0; }

/* ===== SPINNER ===== */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid #f3f4f6; border-top-color: #6366f1;
  border-radius: 9999px;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== MOBILE OVERLAY ===== */
.mobile-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.5); z-index: 999;
}

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ===== CHART ===== */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { max-width: 100%; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 992px) {
  .main-content { margin-right: 0 !important; }
  .sidebar {
    right: -260px;
    transform: none;
  }
  .sidebar.mobile-open {
    right: 0;
  }
  .mobile-overlay.active { display: block; }
  .d-none-lg { display: none !important; }
  .ticket-detail-layout { grid-template-columns: 1fr; }
  .page-content { overflow-x: hidden; }
  .website-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .d-none-md { display: none !important; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .auth-card { padding: 28px 20px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header > .btn, .page-header > div:last-child { align-self: stretch; }
  .website-split-grid { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .website-filter-grid { grid-template-columns: 1fr; }
  .website-filter-actions .btn-primary { flex: 1; }
}

/* ===== KPI & TIME TRACKING ===== */
.kpi-active-timer {
  padding: 18px 22px; margin-bottom: 18px; border-right: 4px solid #ef4444;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  background: linear-gradient(90deg, #fff 0%, #fff7f7 100%);
}
.kpi-timer-actions { display: flex; align-items: center; gap: 14px; }
#activeTimerElapsed { font-size: 22px; font-weight: 700; color: #b91c1c; min-width: 105px; }
.kpi-filter-grid { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; }
.kpi-filter-grid label, .kpi-date-filter label, .kpi-project-filter label, .kpi-inline-form label { display: block; font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.kpi-filter-actions, .kpi-date-filter, .kpi-project-filter { display: flex; align-items: end; gap: 8px; }
.kpi-date-filter > div { min-width: 220px; }
.kpi-project-filter > div { flex: 1; max-width: 520px; }
.kpi-table td { vertical-align: middle; }
.kpi-block-muted { display: block; color: #6b7280; margin-top: 4px; }
.kpi-description { display: block; color: #6b7280; font-size: 12px; margin-top: 4px; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.kpi-status-draft { background: #dbeafe; color: #1d4ed8; }
.kpi-status-submitted { background: #fef3c7; color: #92400e; }
.kpi-status-approved { background: #d1fae5; color: #065f46; }
.kpi-status-rejected { background: #fee2e2; color: #991b1b; }
.kpi-limit-note { padding: 12px 18px; color: #92400e; background: #fffbeb; font-size: 12px; }
.kpi-pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.kpi-checkbox { display: inline-flex !important; align-items: center; gap: 8px; color: #374151; cursor: pointer; }
.kpi-checkbox input { width: 18px; height: 18px; accent-color: #6366f1; }
.kpi-form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.kpi-inline-form { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.kpi-task-form { grid-template-columns: 2fr 1.5fr 1fr auto auto; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.kpi-project-list { display: flex; flex-direction: column; gap: 18px; }
.kpi-project-card { padding: 20px; }
.kpi-project-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.kpi-project-header h3 { margin: 0 0 4px; }
.kpi-progress { height: 7px; background: #eef2ff; border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.kpi-progress span { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #0ea5e9); border-radius: inherit; }
.kpi-dashboard-grid { align-items: start; }
.kpi-department-bars { display: flex; flex-direction: column; gap: 14px; }
.kpi-department-row { display: grid; grid-template-columns: 130px 1fr 150px; gap: 14px; align-items: center; }
.kpi-department-row > div { height: 10px; background: #eef2ff; border-radius: 999px; overflow: hidden; }
.kpi-department-row i { display: block; height: 100%; background: #6366f1; border-radius: inherit; }

@media (max-width: 1200px) {
  .kpi-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .kpi-active-timer, .kpi-project-header { align-items: stretch; flex-direction: column; }
  .kpi-filter-grid, .kpi-inline-form, .kpi-task-form { grid-template-columns: 1fr; }
  .kpi-date-filter, .kpi-project-filter { align-items: stretch; flex-direction: column; }
  .kpi-date-filter > div, .kpi-project-filter > div { min-width: 0; max-width: none; width: 100%; }
  .kpi-department-row { grid-template-columns: 100px 1fr; }
  .kpi-department-row strong { grid-column: 2; }
}

/* ===== WEBSITE DETAILS UX ===== */
.website-detail-heading-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.website-detail-header-actions,
.website-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.website-detail-header-actions form { margin: 0; }

.website-detail-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  overflow-x: auto;
}
.website-detail-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #64748b;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease, box-shadow .2s ease;
}
.website-detail-tab i { font-size: 17px; }
.website-detail-tab:hover { background: #f8fafc; color: #334155; }
.website-detail-tab.active {
  color: #4f46e5;
  background: #eef2ff;
  box-shadow: inset 0 0 0 1px #e0e7ff;
}
.website-tab-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.website-detail-tab.active .website-tab-count { background: #fff; color: #4f46e5; }

.website-detail-panel { animation: websitePanelFade .18s ease; }
.website-detail-panel[hidden] { display: none !important; }
@keyframes websitePanelFade { from { opacity: .35; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.website-summary-card,
.website-performance-card,
.website-data-card { margin-bottom: 18px; }

.website-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef2f7;
}
.website-section-header.compact { margin-bottom: 14px; }
.website-section-header h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
}
.website-section-header h2 i { color: #6366f1; font-size: 18px; }
.website-section-header p { margin: 3px 0 0; color: #94a3b8; font-size: 11px; }

.website-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.website-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
}
.website-info-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #eef2ff;
  color: #6366f1;
  font-size: 17px;
}
.website-info-item > div { min-width: 0; }
.website-info-item small { display: block; color: #94a3b8; font-size: 10px; margin-bottom: 2px; }
.website-info-item strong,
.website-info-item a {
  display: block;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.website-info-item a { color: #4f46e5; }

.website-kpi-group + .website-kpi-group { margin-top: 16px; }
.website-kpi-group-title {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
}
.website-kpi-grid { display: grid; gap: 8px; }
.website-kpi-grid-cost { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.website-kpi-grid-time { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.website-kpi-item {
  min-width: 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 10px;
}
.website-kpi-item > span { display: block; color: #64748b; font-size: 10px; margin-bottom: 4px; }
.website-kpi-item > strong { display: block; color: #1e293b; font-size: 15px; font-weight: 700; }
.website-kpi-item > small { display: block; margin-top: 3px; font-size: 10px; }
.website-kpi-item.website-kpi-emphasis { background: #eef2ff; border-color: #e0e7ff; }
.website-kpi-item.website-kpi-emphasis > strong { color: #4338ca; }

.website-detail-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.website-data-card { padding: 18px; min-width: 0; }
.website-table-wrap { overflow-x: auto; margin: 0 -4px -4px; }
.website-data-card .table { margin: 0; }
.website-data-card .table th { color: #64748b; font-size: 11px; white-space: nowrap; }
.website-data-card .table td { font-size: 12px; vertical-align: middle; }
.website-empty-row { padding: 24px 10px; text-align: center; color: #94a3b8; font-size: 12px; }

/* one consistent icon-only action size in website grid */
.website-list-table .website-row-actions .btn-sm {
  width: 34px;
  height: 34px;
  padding: 0;
  flex: 0 0 34px;
}
.website-list-table .website-row-actions .btn-sm i { font-size: 16px; }

@media (max-width: 1200px) {
  .website-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .website-kpi-grid-time { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .website-detail-two-column { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .website-detail-header-actions .btn,
  .website-detail-header-actions form,
  .website-detail-header-actions form .btn { flex: 1 1 auto; }
  .website-detail-tabs { justify-content: flex-start; }
  .website-section-header { flex-direction: column; align-items: stretch; }
  .website-section-actions .btn { flex: 1 1 auto; }
  .website-kpi-grid-cost { grid-template-columns: 1fr; }
}
@media (max-width: 576px) {
  .website-summary-grid,
  .website-kpi-grid-time { grid-template-columns: 1fr; }
  .website-detail-tab { padding: 8px 11px; }
  .website-detail-tab span:not(.website-tab-count) { font-size: 12px; }
}

/* ===== ADMIN UX ALIGNMENT & MANAGEABLE WORK TYPES ===== */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  background: #fff;
  color: #4b5563;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background .2s ease;
}
.admin-back-btn:hover { border-color: #c7d2fe; color: #4f46e5; background: #eef2ff; }
.admin-back-btn[hidden] { display: none !important; }

.kpi-form-field { min-width: 0; }
.kpi-form-field > label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  min-height: 18px;
}
.kpi-field-hint {
  display: block;
  min-height: 18px;
  margin-top: 5px;
  color: #9ca3af;
  font-size: 11px;
  line-height: 1.55;
}
.kpi-form-action {
  display: flex;
  align-items: flex-start;
  padding-top: 24px;
}

.kpi-rate-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}
.kpi-rate-notes { grid-column: span 2; }
.kpi-rate-form .js-thousands-separator { direction: ltr; text-align: left; }

.kpi-project-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}
.kpi-project-intelligence-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: start;
}
.kpi-task-form-aligned {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr auto auto;
  gap: 12px;
  align-items: start;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.kpi-task-checkbox {
  align-self: start;
  margin-top: 31px;
  min-height: 42px;
  padding: 0 4px;
}

.work-type-create-card,
.work-type-list-card { padding: 20px; margin-bottom: 18px; }
.work-type-create-card h3,
.work-type-list-card h3 { margin: 0 0 6px; }
.work-type-create-form {
  display: grid;
  grid-template-columns: 1.4fr .9fr 1fr .65fr auto auto;
  gap: 12px;
  align-items: start;
  margin-top: 16px;
}
.work-type-checkbox {
  align-self: start;
  margin-top: 30px;
  min-height: 42px;
  white-space: nowrap;
}
.work-type-create-form > .btn { margin-top: 24px; }
.work-type-list-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.work-type-list-heading p { margin: 4px 0 0; }
.work-type-list-heading .badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 12px;
  white-space: nowrap;
}
.work-type-items { display: flex; flex-direction: column; gap: 10px; }
.work-type-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}
.work-type-item.is-inactive { background: #f9fafb; opacity: .78; }
.work-type-edit-form {
  display: grid;
  grid-template-columns: 1.3fr .8fr 1fr .55fr auto auto auto;
  gap: 10px;
  align-items: start;
}
.work-type-edit-form > .btn { margin-top: 24px; }
.work-type-remove-form { padding-top: 24px; }

@media (max-width: 1200px) {
  .kpi-rate-form,
  .kpi-project-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-rate-notes { grid-column: auto; }
  .kpi-project-intelligence-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-task-form-aligned { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-task-checkbox { margin-top: 0; }
  .work-type-create-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-type-checkbox, .work-type-create-form > .btn { margin-top: 0; }
  .work-type-edit-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-type-edit-form > .btn { margin-top: 0; }
}

@media (max-width: 768px) {
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; }
  .admin-back-btn span { display: none; }
  .admin-back-btn { width: 38px; padding: 0; justify-content: center; }
  .kpi-rate-form,
  .kpi-project-create-form,
  .kpi-project-intelligence-form,
  .kpi-task-form-aligned,
  .work-type-create-form,
  .work-type-edit-form { grid-template-columns: 1fr; }
  .kpi-form-action { padding-top: 0; }
  .work-type-item { grid-template-columns: 1fr; }
  .work-type-remove-form { padding-top: 0; }
  .work-type-list-heading { flex-direction: column; }
}

/* ===== ADMIN WORK TYPES / UNITS GRID ===== */
.table-responsive { width: 100%; overflow-x: auto; }
.admin-data-grid { min-width: 820px; }
.admin-data-grid th { white-space: nowrap; }
.admin-data-grid td { vertical-align: middle; }
.admin-data-grid code { font-size: 12px; color: #475569; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px; padding: 3px 7px; }
.is-inactive-row { background: #f8fafc; color: #6b7280; }
.grid-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.grid-actions form { margin: 0; }
.work-type-create-grid { grid-template-columns: 1.35fr .9fr 1fr .65fr auto auto; }
.work-unit-create-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr .65fr auto;
  gap: 14px;
  align-items: start;
  margin-top: 16px;
}
.work-admin-modal {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .22);
  width: min(680px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s ease;
}
.work-admin-modal .modal-header h3 { margin: 0; font-size: 18px; }
.work-admin-modal form { padding: 22px 24px 24px; }
.work-admin-modal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.work-admin-checks { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 16px; }
.modal-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ورودی‌های مالی فارسی */
.js-persian-money, .price-input { direction: rtl; text-align: right; font-variant-numeric: normal; }

@media (max-width: 1200px) {
  .work-type-create-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .work-unit-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .work-type-create-grid, .work-unit-create-form, .work-admin-modal-grid { grid-template-columns: 1fr; }
  .grid-actions { min-width: 170px; }
}

.sidebar-step-label { display: flex; align-items: center; gap: 7px; margin: 14px 10px 6px; padding-top: 10px; border-top: 1px solid rgba(148, 163, 184, 0.15); font-size: 11px; font-weight: 700; color: #94a3b8; white-space: nowrap; }

.sidebar-step-label:first-child { margin-top: 5px; padding-top: 4px; border-top: 0; }

.sidebar-step-label > span { width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; background: rgba(20, 184, 166, 0.14); color: #14b8a6; font-size: 10px; font-weight: 800; }

/* ===== CUSTOMER LOGIN PAGE ===== */
body.login-page {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 88% 8%, rgba(99, 102, 241, 0.18), transparent 30%), radial-gradient(circle at 12% 80%, rgba(14, 165, 233, 0.14), transparent 28%), linear-gradient(145deg, #f8fafc 0%, #eef2ff 52%, #f0f9ff 100%);
  color: #1f2937;
}

.login-shell {
  width: 100%;
  max-width: 1240px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 36px 28px 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.login-main {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  align-items: stretch;
  gap: 22px;
}

.login-intro-card,
.login-card,
.login-footer {
  border: 1px solid rgba(255, 255, 255, 0.84);
  box-shadow: 0 24px 64px rgba(51, 65, 85, 0.12);
}

.login-intro-card {
  min-height: 560px;
  padding: 52px;
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  background: linear-gradient(150deg, rgba(30, 41, 59, 0.98), rgba(49, 46, 129, 0.95)), #0f172a;
  color: #ffffff;
}
.login-intro-card::before, .login-intro-card::after {
  content: "";
  position: absolute;
  border-radius: 9999px;
  pointer-events: none;
}
.login-intro-card::before {
  width: 360px;
  height: 360px;
  top: -180px;
  left: -110px;
  border: 72px solid rgba(255, 255, 255, 0.045);
}
.login-intro-card::after {
  width: 240px;
  height: 240px;
  right: -105px;
  bottom: -120px;
  background: rgba(14, 165, 233, 0.13);
  filter: blur(2px);
}
.login-intro-card > * {
  position: relative;
  z-index: 1;
}
.login-intro-card h1 {
  max-width: 540px;
  margin: 18px 0 14px;
  color: #ffffff;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.45;
  letter-spacing: -0.7px;
}

.login-brand-mark {
  width: 58px;
  height: 58px;
  margin-bottom: 32px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 27px;
  backdrop-filter: blur(8px);
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border: 1px solid rgba(165, 180, 252, 0.35);
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.18);
  color: #e0e7ff;
  font-size: 12px;
  font-weight: 600;
}

.login-intro-text {
  max-width: 570px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 15px;
  line-height: 2;
}

.login-feature-list {
  width: 100%;
  margin: 26px 0 30px;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}
.login-feature-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
}
.login-feature-list i {
  color: #67e8f9;
  font-size: 17px;
  flex-shrink: 0;
}

.login-about-link {
  padding: 0 0 5px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
  background: transparent;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: gap 250ms ease, border-color 250ms ease;
}
.login-about-link:hover, .login-about-link:focus-visible {
  gap: 14px;
  border-color: #ffffff;
  outline: none;
}

.auth-card.login-card {
  max-width: none;
  min-height: 560px;
  padding: 42px;
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  position: relative;
  animation: loginCardIn 0.45s ease both;
}

.login-card-header {
  margin-bottom: 24px;
}
.login-card-header .logo-circle {
  width: 56px;
  height: 56px;
  margin-bottom: 13px;
  border-radius: 17px;
  font-size: 23px;
}
.login-card-header h2 {
  margin-bottom: 5px;
  color: #111827;
  font-size: 22px;
  font-weight: 700;
}
.login-card-header p {
  font-size: 13px;
}

.login-form .form-group {
  margin-bottom: 17px;
}
.login-form .form-control {
  min-height: 48px;
  background: #fbfdff;
}
.login-form .input-group .form-control {
  padding-right: 43px;
}

.login-password-toggle {
  width: 38px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.login-password-toggle:focus-visible {
  color: #6366f1;
  outline: 2px solid rgba(99, 102, 241, 0.3);
  border-radius: 7px;
}

.login-form-options {
  margin: -1px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.login-form-options a {
  font-weight: 500;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4b5563;
  cursor: pointer;
}
.login-remember input {
  width: 17px;
  height: 17px;
  accent-color: #6366f1;
}

.login-captcha-row {
  display: grid;
  grid-template-columns: minmax(155px, 1fr) minmax(100px, 0.72fr);
  gap: 10px;
}
.login-captcha-row > .form-control {
  padding-inline: 10px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
}

.login-captcha-question {
  min-height: 48px;
  padding: 8px 14px;
  border: 1px dashed #c7d2fe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
}
.login-captcha-question i {
  font-size: 19px;
}

.login-submit {
  min-height: 50px;
  margin-top: 5px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  box-shadow: 0 10px 24px rgba(99, 102, 241, 0.25) !important;
}

.login-alert-content {
  display: flex;
  flex-direction: column;
}

.login-footer {
  min-height: 100px;
  padding: 14px 18px 14px 22px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(85px, 0.35fr);
  align-items: center;
  gap: 26px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(14px);
}

.login-footer-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}
.login-footer-brand div {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.login-footer-brand strong {
  color: #1f2937;
  font-size: 13px;
}
.login-footer-brand div > span {
  color: #6b7280;
  font-size: 11px;
}

.login-footer-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #eef2ff;
  color: #6366f1;
  font-size: 20px;
}

.login-footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.login-footer-links a {
  padding: 8px 11px;
  border-radius: 9px;
  color: #4b5563;
  font-size: 12px;
  font-weight: 500;
}
.login-footer-links a:hover, .login-footer-links a:focus-visible {
  background: #eef2ff;
  color: #4f46e5;
  outline: none;
}

.login-enamad {
  justify-self: end;
}
.login-enamad a {
  width: 68px;
  height: 68px;
  padding: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: #ffffff;
  transition: transform 250ms ease, box-shadow 250ms ease;
}
.login-enamad a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
}
.login-enamad img {
  display: block;
  max-width: 58px;
  max-height: 58px;
  object-fit: contain;
}

.system-info-dialog {
  width: min(680px, 100% - 32px);
  max-height: min(780px, 100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.3);
  overflow: hidden;
}
.system-info-dialog::backdrop {
  background: rgba(15, 23, 42, 0.66);
  backdrop-filter: blur(5px);
}
.system-info-dialog[open] {
  animation: dialogIn 0.22s ease-out;
}
.system-info-dialog .login-eyebrow {
  color: #4f46e5;
  background: #eef2ff;
  border-color: #e0e7ff;
}

.system-info-header {
  padding: 24px 26px 18px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.system-info-header h2 {
  margin-top: 10px;
  color: #111827;
  font-size: 20px;
  line-height: 1.6;
}

.system-info-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #f3f4f6;
  color: #4b5563;
  font-size: 21px;
  cursor: pointer;
}
.system-info-close:hover, .system-info-close:focus-visible {
  background: #fee2e2;
  color: #ef4444;
  outline: none;
}

.system-info-body {
  max-height: calc(100dvh - 180px);
  padding: 22px 26px 28px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}
.system-info-body::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.system-info-body::-webkit-scrollbar-track {
  background: transparent;
}
.system-info-body::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 9999px;
}
.system-info-body::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
.system-info-body > p {
  color: #4b5563;
  line-height: 2;
}
.system-info-body section {
  margin-top: 22px;
}
.system-info-body section h3 {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #111827;
  font-size: 15px;
}
.system-info-body section h3 i {
  color: #6366f1;
  font-size: 18px;
}
.system-info-body section p {
  color: #4b5563;
  line-height: 2;
}

.system-info-notice {
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid #bae6fd;
  border-radius: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f0f9ff;
  color: #075985;
}
.system-info-notice i {
  margin-top: 3px;
  flex-shrink: 0;
  font-size: 19px;
}
.system-info-notice p {
  line-height: 1.9;
}

.login-spinner {
  animation: spin 0.7s linear infinite;
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes dialogIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (max-width: 960px) {
  .login-shell {
    justify-content: flex-start;
  }
  .login-main {
    grid-template-columns: 1fr;
  }
  .login-intro-card,
  .auth-card.login-card {
    min-height: auto;
  }
  .login-intro-card {
    padding: 40px;
  }
  .login-brand-mark {
    margin-bottom: 24px;
  }
  .login-footer {
    grid-template-columns: 1fr auto;
  }
  .login-footer-links {
    grid-row: 2;
    grid-column: 1/-1;
    padding-top: 10px;
    border-top: 1px solid #f3f4f6;
  }
}
@media (max-width: 576px) {
  .login-shell {
    padding: 14px 12px;
    gap: 12px;
  }
  .login-main {
    gap: 12px;
  }
  .login-intro-card,
  .auth-card.login-card {
    border-radius: 20px;
  }
  .login-intro-card {
    padding: 28px 22px;
  }
  .login-brand-mark {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    border-radius: 15px;
    font-size: 23px;
  }
  .login-intro-card h1 {
    margin-top: 14px;
    font-size: 27px;
  }
  .login-intro-text {
    font-size: 14px;
  }
  .login-feature-list {
    grid-template-columns: 1fr;
    margin: 20px 0 24px;
  }
  .auth-card.login-card {
    padding: 30px 20px;
  }
  .login-form-options {
    align-items: flex-start;
  }
  .login-captcha-row {
    grid-template-columns: minmax(0, 1.35fr) minmax(86px, 0.65fr);
  }
  .login-captcha-question {
    padding-inline: 9px;
    font-size: 16px;
  }
  .login-footer {
    padding: 16px;
    border-radius: 18px;
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 14px;
  }
  .login-footer-brand strong {
    font-size: 12px;
  }
  .login-footer-links {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 2px;
  }
  .login-footer-links a {
    padding: 7px;
  }
  .login-enamad a {
    width: 60px;
    height: 60px;
  }
  .login-enamad img {
    max-width: 52px;
    max-height: 52px;
  }
  .system-info-header {
    padding: 20px 18px 16px;
  }
  .system-info-header h2 {
    font-size: 17px;
  }
  .system-info-body {
    padding: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .auth-card.login-card,
  .system-info-dialog[open],
  .login-spinner {
    animation: none;
  }
}

/* Staff service navigation: nested links keep a clear RTL hierarchy. */
.staff-sidebar-group .sidebar-group-items { margin-inline: 16px 6px; border-inline-start: 1px solid rgba(148,163,184,.25); }
.staff-sidebar-group .sidebar-group-items .nav-item { padding: 10px 14px; margin: 4px 8px 4px 0; gap: 10px; font-size: 13px; min-height: 42px; }
.staff-sidebar-group .sidebar-group-items .nav-item i { color: #94a3b8; font-size: 18px; }
.staff-sidebar-group .sidebar-group-items .nav-item.active i, .staff-sidebar-group .sidebar-group-items .nav-item:hover i { color: #fff; }
.sidebar.collapsed .staff-sidebar-group .sidebar-group-items { margin: 0; border: 0; }
.sidebar.collapsed .staff-sidebar-group .sidebar-group-items .nav-item { margin: 4px 0; padding: 10px; }
