/* ==========================================================================
   Dashboard Tables
   Scoped component styles for payment, saved-searches, settings and tickets
   dashboards. All rules live under .im-dashboard-table so they only apply
   when that wrapper class is present in the markup.

   Notes:
   - Inline SVGs are used for icons; no Font Awesome selectors are included.
   - Add `class="im-dashboard-table"` to the page wrapper element.
   - For a narrow layout (settings-style), add
     `class="dashboard-container dashboard-container--narrow"`.
   ========================================================================== */

.im-dashboard-table {
  /* Primary brand palette */
  --dt-primary: #f9c23c;
  --dt-primary-light: rgba(249, 194, 60, 0.15);
  --dt-primary-dark: #e5b030;

  /* Secondary / accent */
  --dt-secondary: #9ca3af;
  --dt-accent-blue: #a3b8c6;

  /* Surfaces */
  --dt-background: #fdfcf8;
  --dt-surface: #ffffff;
  --dt-surface-warm: #f5f3ef;
  --dt-border: #e8e5e0;

  /* Text */
  --dt-text-primary: #4a4a48;
  --dt-text-secondary: #7a7a78;
  --dt-text-muted: #a3a3a1;

  /* Semantic */
  --dt-success: #8fb996;
  --dt-warning: #e6c9a8;
  --dt-danger: #d4a5a5;
  --dt-danger-light: #f9e5e5;
  --dt-info: #a3b8c6;

  /* Payment status */
  --dt-status-pending: #e6c9a8;
  --dt-status-pending-bg: #fdf4e3;
  --dt-status-paid: #8fb996;
  --dt-status-paid-bg: #e8f5e9;

  /* Ticket status */
  --dt-status-open: #e6c9a8;
  --dt-status-open-bg: #fdf4e3;
  --dt-status-in-progress: #a3b8c6;
  --dt-status-in-progress-bg: #e8f0f4;
  --dt-status-resolved: #8fb996;
  --dt-status-resolved-bg: #e8f5e9;
  --dt-status-closed: #9ca3af;
  --dt-status-closed-bg: #f0f0f0;

  /* Ticket priority */
  --dt-priority-high: #d4a5a5;
  --dt-priority-high-bg: #f9ebeb;
  --dt-priority-medium: #e6c9a8;
  --dt-priority-medium-bg: #fdf4e3;
  --dt-priority-low: #8fb996;
  --dt-priority-low-bg: #e8f5e9;

  /* Spacing */
  --dt-space-xs: 0.25rem;
  --dt-space-sm: 0.5rem;
  --dt-space-md: 1rem;
  --dt-space-lg: 1.5rem;
  --dt-space-xl: 2rem;
  --dt-space-2xl: 3rem;

  /* Radius */
  --dt-radius-sm: 8px;
  --dt-radius-md: 12px;
  --dt-radius-lg: 16px;
  --dt-radius-xl: 24px;
  --dt-radius-full: 9999px;

  /* Shadows */
  --dt-shadow-sm: 0 1px 3px rgba(74, 74, 72, 0.04);
  --dt-shadow-md: 0 4px 12px rgba(74, 74, 72, 0.06);
  --dt-shadow-lg: 0 8px 24px rgba(74, 74, 72, 0.08);

  /* Transitions */
  --dt-transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --dt-transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);

  color: var(--dt-text-primary);
  line-height: 1.6;
}

.im-dashboard-table,
.im-dashboard-table *,
.im-dashboard-table *::before,
.im-dashboard-table *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.im-dashboard-table .dashboard-container {
  margin: 0 auto;
}


.im-dashboard-table .page-header {
  margin-bottom: var(--dt-space-xl);
  padding-bottom: var(--dt-space-lg);
  border-bottom: 1px solid var(--dt-border);
}

.im-dashboard-table .page-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--dt-text-primary);
  margin-bottom: var(--dt-space-sm);
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
}

.im-dashboard-table .page-title-icon {
  width: 48px;
  height: 48px;
  background: var(--dt-primary-light);
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dt-primary);
}

.im-dashboard-table .page-title-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.im-dashboard-table .page-subtitle {
  font-size: 0.9375rem;
  color: var(--dt-text-secondary);
  margin-left: calc(48px + var(--dt-space-md));
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.im-dashboard-table .main-card,
.im-dashboard-table .settings-card {
  background: var(--dt-surface);
  border-radius: var(--dt-radius-xl);
  box-shadow: var(--dt-shadow-lg);
  border: 1px solid var(--dt-border);
  overflow: hidden;
}

.im-dashboard-table .card-header {
  padding: var(--dt-space-lg) var(--dt-space-xl);
  background: linear-gradient(135deg, var(--dt-surface) 0%, var(--dt-surface-warm) 100%);
  border-bottom: 1px solid var(--dt-border);
}

.im-dashboard-table .card-header-custom {
  padding: var(--dt-space-lg) var(--dt-space-xl);
  background: linear-gradient(135deg, var(--dt-surface) 0%, var(--dt-surface-warm) 100%);
  border-bottom: 1px solid var(--dt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--dt-space-md);
}

.im-dashboard-table .card-title {
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dt-text-primary);
}

.im-dashboard-table .card-icon {
  width: 40px;
  height: 40px;
  background: var(--dt-primary-light);
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dt-primary-dark);
}

.im-dashboard-table .card-icon svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.im-dashboard-table .card-description {
  margin-top: var(--dt-space-sm);
  margin-left: calc(40px + var(--dt-space-md));
  font-size: 0.875rem;
  color: var(--dt-text-secondary);
}

.im-dashboard-table .card-body {
  padding: var(--dt-space-xl);
}

.im-dashboard-table .section-title {
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dt-text-primary);
}

.im-dashboard-table .section-icon {
  width: 40px;
  height: 40px;
  background: var(--dt-primary-light);
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dt-primary-dark);
}

.im-dashboard-table .section-icon svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Stats cards (tickets)
   -------------------------------------------------------------------------- */

.im-dashboard-table .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--dt-space-lg);
  margin-bottom: var(--dt-space-xl);
}

.im-dashboard-table .stat-card {
  background: var(--dt-surface);
  border-radius: var(--dt-radius-lg);
  padding: var(--dt-space-lg);
  box-shadow: var(--dt-shadow-md);
  border: 1px solid var(--dt-border);
  transition: all var(--dt-transition-fast);
  cursor: pointer;
}

.im-dashboard-table .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--dt-shadow-lg);
}

.im-dashboard-table .stat-card.active {
  border-color: var(--dt-primary);
  background: var(--dt-primary-light);
}

.im-dashboard-table .stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--dt-space-sm);
}

.im-dashboard-table .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.im-dashboard-table .stat-icon svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-dashboard-table .stat-icon.open {
  background: var(--dt-status-open-bg);
  color: var(--dt-primary-dark);
}

.im-dashboard-table .stat-icon.progress {
  background: var(--dt-status-in-progress-bg);
  color: var(--dt-status-in-progress);
}

.im-dashboard-table .stat-icon.resolved {
  background: var(--dt-status-resolved-bg);
  color: var(--dt-success);
}

.im-dashboard-table .stat-icon.closed {
  background: var(--dt-status-closed-bg);
  color: var(--dt-status-closed);
}

.im-dashboard-table .stat-label,
.im-dashboard-table .stat-label-small {
  font-size: 0.875rem;
  color: var(--dt-text-secondary);
  font-weight: 500;
}

.im-dashboard-table .stat-label-small {
  font-size: 0.75rem;
  color: var(--dt-text-muted);
}

.im-dashboard-table .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dt-text-primary);
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */

.im-dashboard-table .toolbar {
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
  flex-wrap: wrap;
}

.im-dashboard-table .toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--dt-space-sm);
  padding: var(--dt-space-sm) var(--dt-space-md);
  border-radius: var(--dt-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--dt-transition-fast);
  cursor: pointer;
  border: 1px solid var(--dt-border);
  background: var(--dt-surface);
  color: var(--dt-text-secondary);
}

.im-dashboard-table .toolbar-btn:hover {
  background: var(--dt-surface-warm);
  border-color: var(--dt-secondary);
  color: var(--dt-text-primary);
  transform: translateY(-1px);
}

.im-dashboard-table .toolbar-btn.active {
  background: var(--dt-primary);
  color: white;
  border-color: var(--dt-primary);
}

.im-dashboard-table .toolbar-btn svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-dashboard-table .pagination-info {
  font-size: 0.875rem;
  color: var(--dt-text-muted);
  padding: 0 var(--dt-space-md);
}

.im-dashboard-table .search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.im-dashboard-table .search-box input {
  padding: var(--dt-space-sm) var(--dt-space-md) var(--dt-space-sm) 2.5rem;
  border: 1px solid var(--dt-border);
  border-radius: var(--dt-radius-md);
  font-size: 0.875rem;
  width: 240px;
  background: var(--dt-surface);
  color: var(--dt-text-primary);
  transition: all var(--dt-transition-fast);
}

.im-dashboard-table .search-box input:focus {
  outline: none;
  border-color: var(--dt-primary);
  box-shadow: 0 0 0 3px var(--dt-primary-light);
}

.im-dashboard-table .search-box svg {
  position: absolute;
  left: var(--dt-space-md);
  color: var(--dt-text-muted);
  width: 0.875rem;
  height: 0.875rem;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.im-dashboard-table .table-container {
  overflow-x: auto;
  padding: 0 var(--dt-space-xl) var(--dt-space-xl);
}

.im-dashboard-table .data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: var(--dt-space-lg);
}

.im-dashboard-table .data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.im-dashboard-table .data-table th {
  background: var(--dt-surface-warm);
  padding: var(--dt-space-md) var(--dt-space-lg);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dt-text-muted);
  border-bottom: 1px solid var(--dt-border);
  white-space: nowrap;
}

.im-dashboard-table .data-table th.text-right {
  text-align: right;
}

.im-dashboard-table .data-table th:first-child {
  border-top-left-radius: var(--dt-radius-md);
}

.im-dashboard-table .data-table th:last-child {
  border-top-right-radius: var(--dt-radius-md);
}

.im-dashboard-table .data-table td {
  padding: var(--dt-space-lg);
  border-bottom: 1px dashed var(--dt-border);
  font-size: 0.9375rem;
  color: var(--dt-text-secondary);
  vertical-align: middle;
}

.im-dashboard-table .data-table tbody tr {
  transition: all var(--dt-transition-fast);
}

.im-dashboard-table .data-table tbody tr:hover {
  background: var(--dt-surface-warm);
  transform: scale(1.002);
}

.im-dashboard-table .data-table tbody tr:last-child td {
  border-bottom: none;
}

.im-dashboard-table .data-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: var(--dt-radius-md);
}

.im-dashboard-table .data-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: var(--dt-radius-md);
}

/* Notifications table (settings) */

.im-dashboard-table .notifications-table-wrapper {
  border: 1px solid var(--dt-border);
  border-radius: var(--dt-radius-lg);
  overflow: hidden;
  margin-bottom: var(--dt-space-xl);
}

.im-dashboard-table .notifications-table {
  width: 100%;
  border-collapse: collapse;
}

.im-dashboard-table .notifications-table th {
  background: var(--dt-surface-warm);
  padding: var(--dt-space-md) var(--dt-space-lg);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dt-text-muted);
  border-bottom: 1px solid var(--dt-border);
}

.im-dashboard-table .notifications-table th:first-child {
  width: 60%;
}

.im-dashboard-table .notifications-table th:not(:first-child) {
  text-align: center;
  width: 20%;
}

.im-dashboard-table .notifications-table td {
  padding: var(--dt-space-lg);
  border-bottom: 1px dashed var(--dt-border);
  font-size: 0.9375rem;
  color: var(--dt-text-secondary);
}

.im-dashboard-table .notifications-table tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Cell content
   -------------------------------------------------------------------------- */

.im-dashboard-table .invoice-link,
.im-dashboard-table .ticket-link {
  display: inline-flex;
  align-items: center;
  gap: var(--dt-space-sm);
  color: var(--dt-accent-blue);
  font-weight: 600;
  text-decoration: none;
  transition: all var(--dt-transition-fast);
}

.im-dashboard-table .invoice-link:hover,
.im-dashboard-table .ticket-link:hover {
  color: var(--dt-primary-dark);
  transform: translateX(2px);
}

.im-dashboard-table .invoice-link svg,
.im-dashboard-table .ticket-link svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}

.im-dashboard-table .ticket-link {
  font-family: monospace;
  font-size: 0.875rem;
}

.im-dashboard-table .date-cell {
  font-weight: 500;
  color: var(--dt-text-primary);
  white-space: nowrap;
}

.im-dashboard-table .amount-cell {
  font-weight: 600;
  color: var(--dt-text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.im-dashboard-table .amount-cell.premium {
  color: var(--dt-primary-dark);
}

/* Product / service cell (payment) */

.im-dashboard-table .product-cell {
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
}

.im-dashboard-table .product-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--dt-surface);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: var(--dt-surface-warm);
}

.im-dashboard-table .product-info {
  display: flex;
  flex-direction: column;
}

.im-dashboard-table .product-name {
  font-weight: 500;
  color: var(--dt-text-primary);
  font-size: 0.9375rem;
}

.im-dashboard-table .product-meta {
  font-size: 0.75rem;
  color: var(--dt-text-muted);
}

/* Location / category / specs (saved searches) */

.im-dashboard-table .location-cell {
  font-weight: 500;
  color: var(--dt-text-primary);
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
}

.im-dashboard-table .location-cell svg {
  color: var(--dt-primary);
  flex-shrink: 0;
  width: 0.875rem;
  height: 0.875rem;
}

.im-dashboard-table .category-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--dt-space-sm);
  padding: var(--dt-space-sm) var(--dt-space-md);
  background: var(--dt-primary-light);
  color: var(--dt-primary-dark);
  border-radius: var(--dt-radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
}

.im-dashboard-table .category-badge svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-dashboard-table .type-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--dt-space-sm);
  padding: var(--dt-space-sm) var(--dt-space-md);
  background: var(--dt-surface-warm);
  color: var(--dt-text-secondary);
  border-radius: var(--dt-radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--dt-border);
}

.im-dashboard-table .type-badge svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-dashboard-table .category-label {
  font-size: 0.875rem;
  color: var(--dt-text-secondary);
}

.im-dashboard-table .specs-cell {
  font-size: 0.875rem;
  color: var(--dt-text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Ticket info cell */

.im-dashboard-table .ticket-cell {
  display: flex;
  align-items: flex-start;
  gap: var(--dt-space-md);
}

.im-dashboard-table .ticket-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.im-dashboard-table .ticket-icon svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.im-dashboard-table .ticket-icon.technical {
  background: #f3e8ff;
  color: #9333ea;
}

.im-dashboard-table .ticket-icon.billing {
  background: #fef3c7;
  color: #d97706;
}

.im-dashboard-table .ticket-icon.general {
  background: #dbeafe;
  color: #2563eb;
}

.im-dashboard-table .ticket-icon.feature {
  background: #d1fae5;
  color: #059669;
}

.im-dashboard-table .ticket-info {
  display: flex;
  flex-direction: column;
  gap: var(--dt-space-xs);
}

.im-dashboard-table .ticket-subject {
  font-weight: 600;
  color: var(--dt-text-primary);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.im-dashboard-table .ticket-preview {
  font-size: 0.8125rem;
  color: var(--dt-text-muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.im-dashboard-table .messages-count {
  display: inline-flex;
  align-items: center;
  gap: var(--dt-space-xs);
  font-size: 0.8125rem;
  color: var(--dt-text-muted);
  margin-top: var(--dt-space-xs);
}

.im-dashboard-table .messages-count svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}

/* Agent cell */

.im-dashboard-table .agent-cell {
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
}

.im-dashboard-table .agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--dt-surface);
  box-shadow: var(--dt-shadow-sm);
  background: var(--dt-surface-warm);
}

.im-dashboard-table .agent-info {
  display: flex;
  flex-direction: column;
}

.im-dashboard-table .agent-name {
  font-weight: 500;
  color: var(--dt-text-primary);
  font-size: 0.875rem;
}

.im-dashboard-table .agent-role {
  font-size: 0.75rem;
  color: var(--dt-text-muted);
}

.im-dashboard-table .unassigned {
  color: var(--dt-text-muted);
  font-style: italic;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Status & priority badges
   -------------------------------------------------------------------------- */

.im-dashboard-table .status-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--dt-space-md);
}

.im-dashboard-table .badge-group {
  display: flex;
  flex-direction: column;
  gap: var(--dt-space-sm);
}

.im-dashboard-table .status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--dt-space-sm);
  padding: var(--dt-space-sm) var(--dt-space-md);
  border-radius: var(--dt-radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.im-dashboard-table .status-badge svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}

.im-dashboard-table .status-badge.pending,
.im-dashboard-table .status-badge.open {
  background: var(--dt-status-pending-bg);
  color: var(--dt-primary-dark);
}

.im-dashboard-table .status-badge.paid,
.im-dashboard-table .status-badge.resolved {
  background: var(--dt-status-paid-bg);
  color: var(--dt-success);
}

.im-dashboard-table .status-badge.in-progress {
  background: var(--dt-status-in-progress-bg);
  color: #5b7c8c;
}

.im-dashboard-table .status-badge.closed {
  background: var(--dt-status-closed-bg);
  color: var(--dt-text-secondary);
}

.im-dashboard-table .priority-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--dt-space-xs);
  padding: var(--dt-space-xs) var(--dt-space-sm);
  border-radius: var(--dt-radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

.im-dashboard-table .priority-badge svg {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}

.im-dashboard-table .priority-badge.high {
  background: var(--dt-priority-high-bg);
  color: #b85450;
}

.im-dashboard-table .priority-badge.medium {
  background: var(--dt-priority-medium-bg);
  color: var(--dt-primary-dark);
}

.im-dashboard-table .priority-badge.low {
  background: var(--dt-priority-low-bg);
  color: #5a8f6a;
}

/* --------------------------------------------------------------------------
   Action buttons & dropdowns
   -------------------------------------------------------------------------- */

.im-dashboard-table .action-wrapper {
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
}

.im-dashboard-table .action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--dt-space-sm);
  padding: var(--dt-space-sm) var(--dt-space-md);
  border-radius: var(--dt-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--dt-transition-fast);
  cursor: pointer;
  border: 1px solid var(--dt-border);
  background: var(--dt-surface);
  color: var(--dt-text-secondary);
  text-decoration: none;
}

.im-dashboard-table .action-btn:hover {
  background: var(--dt-surface-warm);
  border-color: var(--dt-secondary);
  color: var(--dt-text-primary);
  transform: translateY(-1px);
}

.im-dashboard-table .action-btn.view {
  background: var(--dt-primary);
  color: white;
  border-color: var(--dt-primary);
}

.im-dashboard-table .action-btn.view:hover {
  background: var(--dt-primary-dark);
  border-color: var(--dt-primary-dark);
}

.im-dashboard-table .action-btn.delete {
  color: var(--dt-danger);
  border-color: var(--dt-danger);
}

.im-dashboard-table .action-btn.delete:hover {
  background: var(--dt-danger-light);
  border-color: var(--dt-danger);
}

.im-dashboard-table .action-btn svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-dashboard-table .action-dropdown {
  position: relative;
}

.im-dashboard-table .dropdown-trigger {
  width: 36px;
  height: 36px;
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--dt-text-muted);
  cursor: pointer;
  transition: all var(--dt-transition-fast);
}

.im-dashboard-table .dropdown-trigger:hover {
  background: var(--dt-surface-warm);
  color: var(--dt-text-primary);
}

.im-dashboard-table .dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--dt-surface);
  border-radius: var(--dt-radius-md);
  box-shadow: var(--dt-shadow-lg);
  border: 1px solid var(--dt-border);
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--dt-transition-fast);
  z-index: 100;
  padding: var(--dt-space-sm);
}

.im-dashboard-table .action-dropdown.active .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.im-dashboard-table .dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
  padding: var(--dt-space-md);
  border-radius: var(--dt-radius-sm);
  font-size: 0.875rem;
  color: var(--dt-text-secondary);
  text-decoration: none;
  transition: all var(--dt-transition-fast);
  cursor: pointer;
}

.im-dashboard-table .dropdown-item:hover {
  background: var(--dt-surface-warm);
  color: var(--dt-text-primary);
}

.im-dashboard-table .dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--dt-text-muted);
}

.im-dashboard-table .dropdown-item.delete {
  color: var(--dt-danger);
}

.im-dashboard-table .dropdown-item.delete:hover {
  background: var(--dt-danger-light);
}

.im-dashboard-table .dropdown-item.delete svg {
  color: var(--dt-danger);
}

.im-dashboard-table .dropdown-divider {
  height: 1px;
  background: var(--dt-border);
  margin: var(--dt-space-sm) 0;
}

/* --------------------------------------------------------------------------
   Delete confirmation modal (saved searches)
   -------------------------------------------------------------------------- */

.im-dashboard-table .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(74, 74, 72, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--dt-transition-base);
  z-index: 1000;
}

.im-dashboard-table .modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.im-dashboard-table .modal-content {
  background: var(--dt-surface);
  border-radius: var(--dt-radius-xl);
  box-shadow: var(--dt-shadow-lg);
  border: 1px solid var(--dt-border);
  max-width: 400px;
  width: 90%;
  padding: var(--dt-space-xl);
  transform: scale(0.9) translateY(20px);
  transition: all var(--dt-transition-base);
}

.im-dashboard-table .modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.im-dashboard-table .modal-header {
  display: flex;
  align-items: center;
  gap: var(--dt-space-md);
  margin-bottom: var(--dt-space-lg);
}

.im-dashboard-table .modal-icon {
  width: 48px;
  height: 48px;
  background: var(--dt-danger-light);
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dt-danger);
}

.im-dashboard-table .modal-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.im-dashboard-table .modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dt-text-primary);
}

.im-dashboard-table .modal-text {
  font-size: 0.9375rem;
  color: var(--dt-text-secondary);
  margin-bottom: var(--dt-space-xl);
  line-height: 1.6;
}

.im-dashboard-table .modal-actions {
  display: flex;
  gap: var(--dt-space-md);
  justify-content: flex-end;
}

.im-dashboard-table .modal-btn {
  padding: var(--dt-space-sm) var(--dt-space-lg);
  border-radius: var(--dt-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dt-transition-fast);
  border: 1px solid var(--dt-border);
}

.im-dashboard-table .modal-btn.cancel {
  background: var(--dt-surface);
  color: var(--dt-text-secondary);
}

.im-dashboard-table .modal-btn.cancel:hover {
  background: var(--dt-surface-warm);
}

.im-dashboard-table .modal-btn.confirm {
  background: var(--dt-danger);
  color: white;
  border-color: var(--dt-danger);
}

.im-dashboard-table .modal-btn.confirm:hover {
  background: #c48b8b;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.im-dashboard-table .empty-state {
  text-align: center;
  padding: var(--dt-space-2xl);
  color: var(--dt-text-muted);
}

.im-dashboard-table .empty-state-icon {
  width: 64px;
  height: 64px;
  background: var(--dt-surface-warm);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--dt-space-lg);
  color: var(--dt-text-muted);
}

.im-dashboard-table .empty-state-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Generic buttons
   -------------------------------------------------------------------------- */

.im-dashboard-table .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--dt-space-sm);
  padding: var(--dt-space-sm) var(--dt-space-lg);
  border-radius: var(--dt-radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dt-transition-fast);
  border: none;
  font-family: inherit;
}

.im-dashboard-table .btn-primary {
  background: var(--dt-primary);
  color: white;
}

.im-dashboard-table .btn-primary:hover {
  background: var(--dt-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--dt-shadow-md);
}

.im-dashboard-table .btn-secondary {
  background: var(--dt-surface-warm);
  color: var(--dt-text-secondary);
  border: 1px solid var(--dt-border);
}

.im-dashboard-table .btn-secondary:hover {
  background: var(--dt-border);
  color: var(--dt-text-primary);
}

.im-dashboard-table .btn svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Settings / notification preferences
   -------------------------------------------------------------------------- */

.im-dashboard-table .notifications-table-wrapper .channel-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--dt-space-xs);
}

.im-dashboard-table .channel-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--dt-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.im-dashboard-table .channel-icon svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.im-dashboard-table .channel-icon.email {
  background: #dbeafe;
  color: #2563eb;
}

.im-dashboard-table .channel-icon.browser {
  background: #f3e8ff;
  color: #9333ea;
}

.im-dashboard-table .notification-type {
  display: flex;
  align-items: center;
  gap: var(--dt-space-sm);
}

.im-dashboard-table .notification-type-text {
  font-weight: 500;
  color: var(--dt-text-primary);
}

.im-dashboard-table .info-icon {
  color: var(--dt-text-muted);
  cursor: help;
  transition: color var(--dt-transition-fast);
}

.im-dashboard-table .info-icon:hover {
  color: var(--dt-primary);
}

.im-dashboard-table .info-icon svg {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-dashboard-table .checkbox-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.im-dashboard-table .custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--dt-border);
  border-radius: var(--dt-radius-sm);
  cursor: pointer;
  transition: all var(--dt-transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dt-surface);
}

.im-dashboard-table .custom-checkbox:hover {
  border-color: var(--dt-primary);
}

.im-dashboard-table .custom-checkbox.checked {
  background: var(--dt-primary);
  border-color: var(--dt-primary);
  color: white;
}

.im-dashboard-table .custom-checkbox input {
  display: none;
}

.im-dashboard-table .custom-checkbox svg {
  width: 12px;
  height: 12px;
  color: white;
  opacity: 0;
  transition: opacity var(--dt-transition-fast);
  pointer-events: none;
}

.im-dashboard-table .custom-checkbox.checked svg {
  opacity: 1;
}

.im-dashboard-table .form-section {
  margin-bottom: var(--dt-space-xl);
}

.im-dashboard-table .form-section:last-child {
  margin-bottom: 0;
}

.im-dashboard-table .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--dt-space-lg);
  margin-bottom: var(--dt-space-lg);
}

.im-dashboard-table .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--dt-space-sm);
}

.im-dashboard-table .form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dt-text-primary);
  display: flex;
  align-items: center;
  gap: var(--dt-space-xs);
}

.im-dashboard-table .form-select {
  padding: var(--dt-space-md);
  border: 1px solid var(--dt-border);
  border-radius: var(--dt-radius-md);
  font-size: 0.9375rem;
  color: var(--dt-text-primary);
  background: var(--dt-surface);
  transition: all var(--dt-transition-fast);
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237A7A78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.im-dashboard-table .form-select:focus {
  outline: none;
  border-color: var(--dt-primary);
  box-shadow: 0 0 0 3px var(--dt-primary-light);
}

.im-dashboard-table .form-hint {
  font-size: 0.8125rem;
  color: var(--dt-text-muted);
  margin-top: var(--dt-space-xs);
}

.im-dashboard-table .form-actions {
  display: flex;
  gap: var(--dt-space-md);
  margin-top: var(--dt-space-xl);
  padding-top: var(--dt-space-xl);
  border-top: 1px solid var(--dt-border);
}

.im-dashboard-table .helper-text {
  font-size: 0.8125rem;
  color: var(--dt-text-muted);
  margin-top: var(--dt-space-lg);
  padding-top: var(--dt-space-lg);
  border-top: 1px solid var(--dt-border);
  display: flex;
  align-items: flex-start;
  gap: var(--dt-space-sm);
}

.im-dashboard-table .helper-text svg {
  margin-top: 2px;
  color: var(--dt-primary);
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.im-hidden-form {
  display: none;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

.im-dashboard-table .animate-fade-in {
  animation: dt-fade-in 0.5s ease-out;
}

@keyframes dt-fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .im-dashboard-table {
    padding: var(--dt-space-md);
  }

  .im-dashboard-table .page-title {
    font-size: 1.25rem;
  }

  .im-dashboard-table .page-subtitle {
    margin-left: 0;
    margin-top: var(--dt-space-sm);
  }

  .im-dashboard-table .card-header-custom {
    flex-direction: column;
    align-items: flex-start;
  }

  .im-dashboard-table .toolbar {
    width: 100%;
    justify-content: space-between;
  }

  .im-dashboard-table .search-box input {
    width: 100%;
  }

  .im-dashboard-table .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .im-dashboard-table .data-table,
  .im-dashboard-table .notifications-table {
    font-size: 0.875rem;
  }

  .im-dashboard-table .data-table th,
  .im-dashboard-table .data-table td,
  .im-dashboard-table .notifications-table th,
  .im-dashboard-table .notifications-table td {
    padding: var(--dt-space-md);
  }

  .im-dashboard-table .notifications-table th:first-child {
    width: 50%;
  }

  .im-dashboard-table .product-cell {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--dt-space-sm);
  }

  .im-dashboard-table .ticket-cell {
    flex-direction: column;
    gap: var(--dt-space-sm);
  }

  .im-dashboard-table .ticket-preview {
    max-width: 200px;
  }

  .im-dashboard-table .status-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }

  .im-dashboard-table .agent-cell {
    flex-direction: column;
    align-items: flex-start;
  }

  .im-dashboard-table .specs-cell {
    max-width: 120px;
  }

  .im-dashboard-table .action-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .im-dashboard-table .action-btn {
    justify-content: center;
  }

  .im-dashboard-table .card-body {
    padding: var(--dt-space-lg);
  }

  .im-dashboard-table .form-actions {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .im-dashboard-table .form-row {
    grid-template-columns: 1fr;
  }
}
