/* ===== Pull-to-Refresh ===== */
.ptr-indicator {
  position: fixed;
  top: -60px;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  gap: 8px;
  z-index: 110;
  pointer-events: none;
  transition: top 0.3s ease;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
.ptr-indicator .ptr-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: ptr-spin 0.8s linear infinite;
}
.ptr-indicator.ptr-refreshing .ptr-spinner {
  animation: ptr-spin 0.6s linear infinite;
}
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ===== المكونات المشتركة ===== */

/* ─── البطاقات ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--space-md);
}
.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}
.card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.card-body { padding: var(--space-lg); }
.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  background: var(--bg-hover);
}

/* ─── الأزرار ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 8px 18px;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-secondary { background: var(--text-secondary); color: #fff; }
.btn-secondary:hover:not(:disabled) { background: #5a6268; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #157347; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #bb2d3b; }
.btn-warning { background: var(--color-warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d49000; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) { background: var(--color-primary-light); }
.btn-outline-danger {
  background: transparent;
  border: 1.5px solid var(--color-danger);
  color: var(--color-danger);
}
.btn-outline-danger:hover:not(:disabled) { background: #fce8ea; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); }
.btn-sm { padding: 5px 12px; font-size: var(--font-size-xs); }
.btn-lg { padding: 12px 28px; font-size: var(--font-size-lg); }
.btn-block { width: 100%; }
.btn-icon { padding: 6px; border-radius: var(--border-radius-sm); }

/* ─── النماذج ──────────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-md); }
.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}
.form-label .required { color: var(--color-danger); margin-right: 2px; }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-family: var(--font-family);
  transition: border-color var(--transition);
  direction: rtl;
  text-align: right;
  text-align-last: right;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,107,60,0.12);
}
.form-input.error,
.form-select.error { border-color: var(--color-danger); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 4px;
}
.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ─── الجداول ──────────────────────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
  width: 100%;
}
.table-responsive > table {
  min-width: 640px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}
.data-table th {
  background: var(--bg-hover);
  padding: 10px 14px;
  text-align: right;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr:last-child td { border-bottom: none; }

/* تحويل الجدول إلى بطاقات على الموبايل */
@media (max-width: 480px) {
  .data-table thead { display: none; }
  .data-table tr {
    display: block;
    background: var(--bg-card);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
  }
  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px var(--space-sm);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    flex-shrink: 0;
    margin-left: var(--space-sm);
  }
}

/* ─── الشارات ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: var(--font-size-xs);
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: #856404; }
.badge-danger  { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-bg);    color: #055160; }
.badge-secondary { background: #e9ecef; color: var(--text-secondary); }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-purple  { background: #f3e8ff; color: #7e22ce; }

/* ─── الإشعارات المنبثقة (Toast) ──────────────────────────── */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-md));
  left: var(--space-md);
  right: var(--space-md);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--font-size-sm);
  font-weight: 600;
  pointer-events: all;
  animation: slideIn 0.3s ease;
  border-right: 4px solid var(--color-primary);
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}
.toast.success { border-color: var(--color-success); }
.toast.error   { border-color: var(--color-danger); }
.toast.warning { border-color: var(--color-warning); }
.toast.info    { border-color: var(--color-info); }
@keyframes slideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ─── هيكل التحميل (Skeleton) ─────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--border-radius-sm);
}
.skeleton-card {
  height: 80px;
  border-radius: var(--border-radius-md);
  margin-bottom: var(--space-sm);
}
.skeleton-text { height: 16px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── spinner صغير داخل الأزرار ───────────────────────────── */
.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 4px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── الحالة الفارغة ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: var(--space-md); }
.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}
.empty-state-desc { font-size: var(--font-size-sm); }

/* ─── تخصيص الأعمدة (Column Toggle) ──────────────────────── */
.col-toggle-wrapper {
  position: relative;
  display: inline-block;
}
.col-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.col-toggle-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.col-toggle-btn.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.col-toggle-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: auto;
  right: 0;
  min-width: 220px;
  max-width: calc(100vw - 16px);
  max-height: 360px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.col-toggle-dropdown.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}
.col-toggle-dropdown-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.col-toggle-dropdown-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
}
.col-toggle-reset {
  font-size: var(--font-size-xs);
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background var(--transition);
}
.col-toggle-reset:hover {
  background: var(--color-primary-light);
}
.col-toggle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.col-toggle-item:hover {
  background: var(--bg-hover);
}
.col-toggle-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
}
.col-toggle-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}
.col-toggle-item.locked input[type="checkbox"] {
  cursor: not-allowed;
}
.col-toggle-item label {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  cursor: pointer;
  flex: 1;
}
.col-toggle-item.locked label {
  cursor: not-allowed;
}
.col-toggle-item .lock-icon {
  font-size: 11px;
  color: var(--text-muted);
}
.col-toggle-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  margin-right: 2px;
}

/* إخفاء الأعمدة */
.col-hidden {
  display: none !important;
}

/* ─── المودال ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 8000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
@media (min-width: 481px) {
  .modal-overlay { align-items: center; }
}
.modal {
  background: var(--bg-card);
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}
@media (min-width: 481px) {
  .modal { border-radius: var(--border-radius-lg); }
}
.modal-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-title { font-size: var(--font-size-lg); font-weight: 700; }
.modal-body { padding: var(--space-lg); }
.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--bg-card);
}
@media (max-width: 480px) {
  .modal-footer {
    padding: var(--space-md) var(--space-md);
    gap: 8px;
  }
  .modal-footer .btn {
    font-size: 13px;
    padding: 8px 12px;
    white-space: nowrap;
  }
}
/* أزرار داخل المودال - إعادة ضبط كاملة */
.modal button {
  box-sizing: border-box;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── الترقيم ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-md) 0;
  flex-wrap: wrap;
}
.pagination-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.pagination-btn:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
.pagination-btn.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-info { font-size: var(--font-size-sm); color: var(--text-secondary); }

/* ─── أدوات مساعدة ─────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.fw-bold { font-weight: 700; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.gap-sm { gap: var(--space-sm); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.page-enter { animation: pageEnter 0.25s ease; }
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── شريط البحث ───────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.search-input-wrap {
  flex: 1;
  min-width: 200px;
  max-width: 500px;
  position: relative;
}
@media (max-width: 480px) {
  .search-input-wrap {
    min-width: 140px;
  }
  .search-bar .ss-wrapper {
    flex: 1 1 100%;
    min-width: 0;
  }
  .search-bar .form-select {
    flex: 1 1 100%;
    min-width: 0;
  }
}
.search-input-wrap .search-icon {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap .form-input { padding-right: 38px; direction: rtl; text-align: right; text-align-last: right; }
.search-bar .ss-wrapper { flex: 0 1 180px; min-width: 140px; }
.search-bar .form-select { flex: 0 1 180px; min-width: 140px; }

/* ─── الفلاتر ──────────────────────────────────────────────── */
.filters-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.filters-row .form-select { min-width: 140px; flex: 1; max-width: 200px; }
.filters-row .ss-wrapper { min-width: 140px; flex: 1; max-width: 200px; }

@media (max-width: 480px) {
  .filters-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .filters-row .form-select {
    min-width: 0;
    max-width: none;
    width: 100%;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }
  .filters-row > div {
    min-width: 0;
    width: 100%;
  }
  .filters-row > div .form-select {
    width: 100%;
  }
  .filters-row .ss-wrapper {
    min-width: 0;
    max-width: none;
  }
}

/* ─── عنصر القائمة ─────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-hover); }
.list-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-md);
  flex-shrink: 0;
  overflow: hidden;
}
.list-item-avatar img { width: 100%; height: 100%; object-fit: cover; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title {
  font-weight: 700;
  font-size: var(--font-size-md);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: 2px;
}
.list-item-date {
  display: inline;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  white-space: nowrap;
}
.list-item-date::before {
  content: ' · ';
}
.list-item-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── تحسين عنصر القائمة على شاشات الموبايل ─────────────────── */
@media (max-width: 480px) {
  .list-item {
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm);
  }
  .list-item-avatar {
    display: none;
  }
  .list-item-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .list-item-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.4;
    font-size: var(--font-size-sm);
  }
  .list-item-subtitle {
    font-size: var(--font-size-xs);
    line-height: 1.4;
  }
  .list-item-meta {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-width: 0;
  }
  .list-item-meta .badge {
    font-size: 10px;
    padding: 2px 6px;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* التاريخ في السطر الفرعي */
  .list-item-date {
    font-size: 10px;
  }
  /* في تبويب طلبات المساعدة في citizen-detail، نجعل الميتا أكثر compact */
  #tab-requests .list-item-meta .badge {
    max-width: 65px;
    font-size: 9px;
    padding: 1px 5px;
  }
}

/* ─── زر الإضافة العائم (FAB) ──────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-md));
  left: var(--space-md);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-lg);
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  transition: transform var(--transition), background var(--transition);
}
.fab:hover { transform: scale(1.08); background: var(--color-primary-dark); }
@media (min-width: 769px) { .fab { display: none; } }

/* ─── شريط الإجراءات ───────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}
.action-bar-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
  color: var(--text-primary);
}
.action-bar-actions { display: flex; gap: var(--space-sm); flex-wrap: wrap; }
@media (max-width: 480px) {
  .action-bar-title {
    font-size: var(--font-size-md);
  }
}

/* ─── تفاصيل ───────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}
.detail-item {}
.detail-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.detail-value {
  font-size: var(--font-size-md);
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── التبويبات ────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  gap: 0;
}
.tab-btn {
  padding: 10px var(--space-lg);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition);
}
.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
@media (max-width: 480px) {
  .tab-btn {
    padding: 8px var(--space-sm);
    font-size: var(--font-size-xs);
  }
}
.tab-btn:hover:not(.active) { color: var(--text-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── حاوية كلمة المرور مع زر الإظهار ──────────────────────── */
.password-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.password-wrapper .form-input {
  flex: 1;
}
.password-toggle {
  padding: 6px 10px;
  font-size: var(--font-size-md);
  line-height: 1;
  flex-shrink: 0;
}

/* ─── القائمة المنسدلة القابلة للبحث (Searchable Select) ──────── */
.ss-wrapper { position: relative; width: 100%; user-select: none; }
.ss-display {
  background: var(--bg-input, var(--bg-card));
  border: 1px solid var(--border-color);
  padding: 0 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 42px;
  color: var(--text-color);
  font-size: 14px;
  transition: all 0.2s ease;
}
.ss-display:hover { border-color: var(--color-primary); }
.ss-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  z-index: 9999;
  display: none;
  flex-direction: column;
  max-height: 250px;
}
.ss-menu.ss-open { display: flex; }
.ss-search { padding: 8px; border-bottom: 1px solid var(--border-color); }
.ss-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  outline: none;
  background: var(--bg-body);
  color: var(--text-color);
  font-family: inherit;
}
.ss-search input:focus { border-color: var(--color-primary); }
.ss-list { overflow-y: auto; padding: 4px 0; margin: 0; list-style: none; }
.ss-option {
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-color);
  font-size: 14px;
  transition: background 0.15s;
}
.ss-option:hover, .ss-option.ss-selected {
  background: var(--bg-hover);
  color: var(--color-primary);
}

/* ===== تحسينات الوضع الداكن للمكونات ===== */
[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
}

[data-theme="dark"] .badge-success {
  background: rgba(42, 157, 143, 0.2);
  color: #2a9d8f;
}
[data-theme="dark"] .badge-warning {
  background: rgba(224, 159, 62, 0.2);
  color: #e09f3e;
}
[data-theme="dark"] .badge-danger {
  background: rgba(230, 57, 70, 0.2);
  color: #e63946;
}
[data-theme="dark"] .badge-info {
  background: rgba(69, 123, 157, 0.2);
  color: #6a9bc5;
}
[data-theme="dark"] .badge-secondary {
  background: #3a3a3a;
  color: #a0a0a0;
}
[data-theme="dark"] .badge-primary {
  background: rgba(61, 90, 128, 0.3);
  color: #6a9bc5;
}
[data-theme="dark"] .badge-purple {
  background: rgba(126, 34, 206, 0.2);
  color: #a855f7;
}

[data-theme="dark"] .btn-outline-danger:hover:not(:disabled) {
  background: rgba(230, 57, 70, 0.2);
}

/* ===== Notification Toast ===== */
.notif-toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
  width: calc(100% - 32px);
  pointer-events: none;
}
.notif-toast {
  pointer-events: auto;
  background: var(--bg-card, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  animation: notif-toast-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
  border: 1px solid var(--border-color, rgba(0,0,0,0.08));
  position: relative;
  overflow: hidden;
}
.notif-toast.notif-toast-out {
  animation: notif-toast-out 0.3s ease forwards;
}
.notif-toast-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--color-primary-bg, rgba(61, 90, 128, 0.1));
  color: var(--color-primary, #3d5a80);
}
.notif-toast-icon.success {
  background: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
}
.notif-toast-icon.warning {
  background: rgba(237, 108, 2, 0.1);
  color: #ed6c02;
}
.notif-toast-icon.error {
  background: rgba(211, 47, 47, 0.1);
  color: #d32f2f;
}
.notif-toast-icon.info {
  background: rgba(61, 90, 128, 0.1);
  color: #3d5a80;
}
.notif-toast-content {
  flex: 1;
  min-width: 0;
}
.notif-toast-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-color, #1a1a2e);
  margin-bottom: 2px;
  line-height: 1.3;
}
.notif-toast-body {
  font-size: 12px;
  color: var(--text-muted, #666);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}
.notif-toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted, #999);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  transition: background 0.2s;
}
.notif-toast-close:hover {
  background: rgba(0, 0, 0, 0.06);
}
.notif-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--color-primary, #3d5a80);
  animation: notif-toast-progress 5s linear forwards;
}
.notif-toast-progress.success {
  background: #2e7d32;
}
.notif-toast-progress.warning {
  background: #ed6c02;
}
.notif-toast-progress.error {
  background: #d32f2f;
}
.notif-toast-progress.info {
  background: #3d5a80;
}

@keyframes notif-toast-in {
  0% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes notif-toast-out {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
}
@keyframes notif-toast-progress {
  0% { width: 100%; }
  100% { width: 0%; }
}

[data-theme="dark"] .notif-toast {
  background: #2a2a3e;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .notif-toast-title {
  color: #e0e0e0;
}
[data-theme="dark"] .notif-toast-close:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ===== Status Filter Pills (Financial Aid) ===== */
.status-pills-scroll {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}
.status-pills-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}
.status-pill {
  flex-shrink: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.status-pill:active {
  transform: scale(0.95) !important;
}

/* ===== Auto-Reply System Messages ===== */
.system-message {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 8px auto;
  text-align: center;
  font-size: 13px;
  color: #0369a1;
  max-width: 90%;
  position: relative;
  animation: systemMsgIn 0.3s ease-out;
}
.system-message .system-badge {
  font-size: 10px;
  margin-bottom: 4px;
  opacity: 0.7;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.system-message .system-text {
  line-height: 1.65;
}
@keyframes systemMsgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
