/* ===== SHARED DASHBOARD STYLES ===== */
/* Modern, consistent styling for all platform dashboards */

/* ===== MODERN KPI TILES ===== */
.kpis {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 1rem;
}

.tile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.tile:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.tile .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 184, 0, 0.1);
  border-radius: 12px;
  flex-shrink: 0;
}

.tile .icon svg {
  width: 20px;
  height: 20px;
}

.tile .meta {
  flex: 1;
  min-width: 0;
}

.tile .muted {
  font-size: 0.875rem;
  color: var(--color-secondary, #6b7280);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.tile .lead {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-contrast, #111827);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* ===== MODERN KPI GRID WITH ICONS ===== */
.kpi-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1rem;
}

.kpi {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.kpi:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.kpi .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 184, 0, 0.1);
  border-radius: 10px;
  flex-shrink: 0;
}

.kpi .icon svg {
  width: 18px;
  height: 18px;
}

.kpi .content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.kpi h4 {
  margin: 0 0 0.25rem 0;
  color: var(--color-secondary, #6b7280);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi .v {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-contrast, #111827);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* Skeleton loading state */
.tile .skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  height: 1.2em;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== MODERN PROVIDER CARDS ===== */
.providers {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

.prov-card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.prov-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
  z-index: 10;
}

.prov-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.prov-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.prov-brand img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.prov-brand strong {
  color: var(--color-contrast, #111827);
  font-weight: 600;
}

.bar {
  width: 100%;
  height: 8px;
  background: var(--color-border, #e5e7eb);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary, #ffb800), #ffd700);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 2;
}

/* Stack provider stats vertically to avoid overlap in provider cards */
.prov-card .stat-grid {
  grid-template-columns: 1fr;
  gap: 0.5rem;
}
.prov-card .stat {
  text-align: left;
  align-items: flex-start;
}

.stat {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat .muted {
  font-size: 0.75rem;
  color: var(--color-secondary, #6b7280);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat .lead {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-contrast, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* ===== MODERN PILLS AND BADGES ===== */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: var(--color-surface, #f8f9fa);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-contrast, #111827);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.pill:hover {
  border-color: var(--color-primary, #ffb800);
  background: rgba(255, 184, 0, 0.05);
}

.pill.active {
  background: var(--color-primary, #ffb800);
  border-color: var(--color-primary, #ffb800);
  color: #fff;
}

.pill.pos {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #059669;
}

.pill.neg {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

/* ===== MODERN CONTROLS ===== */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Compact variant for tighter UI similar to Task Manager */
.controls.controls-compact {
  gap: 0.5rem;
  padding: 0.75rem;
}
.controls.controls-plain {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
}

/* Muted variant: grey band behind controls, no per-field white boxes */
.controls.controls-muted {
  background: var(--color-surface, #f8f8f8);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.1));
}
.controls.controls-muted .control-field {
  background: transparent;
  border: 0;
  padding: 0;
}
.controls.controls-muted .control-input {
  border: 1px solid var(--color-border, #e5e7eb);
  background: var(--color-background, #ffffff);
}
.controls.controls-compact .control-field {
  gap: 0.15rem;
}
.controls.controls-compact .control-field .muted {
  font-size: 0.85rem;
  font-weight: 600;
}
.controls.controls-compact .control-input {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  height: 36px;
  line-height: 1.2;
  box-sizing: border-box;
  font-family: inherit;
  font-weight: 600;
}
.controls.controls-compact select.control-input,
.controls.controls-compact .pill-select {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  height: 36px;
  line-height: 1.2;
  box-sizing: border-box;
  font-weight: 600;
}
.controls.controls-compact input[type="date"].control-input {
  height: 36px;
  min-width: 160px;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  line-height: 1.2;
  box-sizing: border-box;
  font-family: inherit;
  font-weight: 600;
  appearance: none;
  -webkit-appearance: none;
}
.controls.controls-compact .pill {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}
.controls.controls-compact .btn-refresh {
  padding: 0.4rem 0.75rem;
  gap: 0.4rem;
}

.control-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.control-field .muted {
  font-size: 0.875rem;
  color: var(--color-secondary, #6b7280);
  font-weight: 500;
}

.control-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  background: var(--color-surface, #fff);
  color: var(--color-contrast, #111827);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.control-input:focus {
  outline: none;
  border-color: var(--color-primary, #ffb800);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.1);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-primary, #ffb800);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-refresh:hover {
  background: #e6a600;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 184, 0, 0.3);
  color: #fff;
  text-decoration: none;
}

.btn-refresh:active {
  transform: translateY(0);
}

/* ===== MODERN CHARTS ===== */
.chart-container {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
  width: 100% !important;
  height: 200px !important;
}

/* ===== MODERN TABLES ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(229, 231, 235, 0.8);
  background: var(--color-surface, #fff);
  position: relative;
  margin-bottom: 1rem;
}

.table-wrap::-webkit-scrollbar {
  height: 12px;
}

.table-wrap::-webkit-scrollbar-track {
  background: rgba(243, 244, 246, 0.5);
  border-radius: 6px;
  margin: 0 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #ffb800, #ff9500);
  border-radius: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(255, 184, 0, 0.3);
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, #ff9500, #ff6b00);
  box-shadow: 0 4px 8px rgba(255, 184, 0, 0.4);
  transform: scaleY(1.2);
}

.modern-table {
  width: 100%;
  min-width: 600px; /* Ensure minimum table width */
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-surface, #fff);
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  font-size: 0.7rem; /* Reduced from 0.8rem */
}

/* Make account columns wider than others */
.modern-table th:first-child,
.modern-table td:first-child {
  width: 25%; /* Account ID column - 25% of table width */
  min-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modern-table th:nth-child(2),
.modern-table td:nth-child(2) {
  width: 35%; /* Account Name column - 35% of table width */
  min-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Other columns get remaining space */
.modern-table th:not(:first-child):not(:nth-child(2)),
.modern-table td:not(:first-child):not(:nth-child(2)) {
  width: auto; /* Flexible width for other columns */
  min-width: 80px;
}

/* Tooltip for truncated account names */
.modern-table td:first-child:hover,
.modern-table td:nth-child(2):hover {
  position: relative;
}

.modern-table td:first-child:hover::after,
.modern-table td:nth-child(2):hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #1f2937;
  color: white;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-width: 300px;
  word-wrap: break-word;
}

.modern-table thead th {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #ffffff !important;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: none;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.modern-table thead th:hover {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.modern-table thead th.sortable {
  position: relative;
  padding-right: 2rem;
}

.modern-table thead th.sortable::after {
  content: '↕';
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.modern-table thead th.sortable:hover::after {
  opacity: 1;
  color: #ffb800;
}

.modern-table thead th.sort-asc::after {
  content: '↑';
  color: #ffb800;
  opacity: 1;
}

.modern-table thead th.sort-desc::after {
  content: '↓';
  color: #ffb800;
  opacity: 1;
}

/* Sorting animation */
.modern-table.sorting-complete tbody tr {
  animation: sortComplete 0.3s ease-out;
}

@keyframes sortComplete {
  0% {
    opacity: 0.7;
    transform: translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.modern-table tbody td {
  padding: 0.4rem 0.75rem;
  border-bottom: none;
  color: #1e293b;
  transition: all 0.2s ease;
  vertical-align: middle;
  line-height: 1.3;
  font-weight: 500;
  background: #ffffff;
}

.modern-table tbody tr:hover td {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.08) 0%, rgba(255, 149, 0, 0.05) 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 184, 0, 0.15);
}

/* No borders needed - using spacing instead */

.modern-table tbody tr {
  transition: all 0.2s ease;
}

.modern-table tbody tr:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Compact table variant - Even more compact */
.table-compact {
  font-size: 0.65rem; /* Reduced from 0.75rem */
}

.table-compact thead th {
  padding: 0.3rem 0.4rem; /* Reduced from 0.375rem 0.5rem */
  font-size: 0.6rem; /* Reduced from 0.7rem */
}

.table-compact tbody td {
  padding: 0.3rem 0.4rem; /* Reduced from 0.375rem 0.5rem */
  line-height: 1.2; /* Reduced from 1.3 */
}

/* Ultra-compact table variant - Most concise */
.table-ultra-compact {
  font-size: 0.6rem; /* Reduced from 0.7rem */
}

.table-ultra-compact thead th {
  padding: 0.2rem 0.3rem; /* Reduced from 0.25rem 0.5rem */
  font-size: 0.55rem; /* Reduced from 0.65rem */
}

.table-ultra-compact tbody td {
  padding: 0.2rem 0.3rem; /* Reduced from 0.25rem 0.5rem */
  line-height: 1.1; /* Reduced from 1.2 */
}

/* Table with alternating rows - Modern clean design */
.table-striped tbody tr {
  position: relative;
  border-radius: 8px;
  margin: 2px 0;
}

.table-striped tbody tr:nth-child(even) td {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.table-striped tbody tr:nth-child(odd) td {
  background: #ffffff;
}

/* Modern row separation with subtle shadows */
.table-striped tbody tr:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(226, 232, 240, 0.5) 20%, rgba(226, 232, 240, 0.8) 50%, rgba(226, 232, 240, 0.5) 80%, transparent 100%);
  border-radius: 1px;
}

.table-striped tbody tr:hover td {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.08) 0%, rgba(255, 149, 0, 0.05) 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 184, 0, 0.15);
}

/* Enhanced scrollable table styling */
.table-wrap {
  position: relative;
}

.table-wrap::before,
.table-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  pointer-events: none;
  z-index: 5;
  transition: all 0.3s ease;
}

.table-wrap::before {
  left: 0;
  background: linear-gradient(to right, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(255, 255, 255, 0.8) 50%, 
    transparent 100%);
  border-radius: 12px 0 0 12px;
}

.table-wrap::after {
  right: 0;
  background: linear-gradient(to left, 
    rgba(255, 255, 255, 0.95) 0%, 
    rgba(255, 255, 255, 0.8) 50%, 
    transparent 100%);
  border-radius: 0 12px 12px 0;
}

/* Show scroll indicators with better visibility */
.table-wrap:not(:hover)::before,
.table-wrap:not(:hover)::after {
  opacity: 0.6;
}

.table-wrap:hover::before,
.table-wrap:hover::after {
  opacity: 1;
  width: 40px;
}

/* Add scroll hint arrows - Very subtle fade */
.table-wrap::before {
  content: '◀';
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffb800;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  background: linear-gradient(to right, 
    rgba(255, 255, 255, 0.4) 0%, 
    rgba(255, 255, 255, 0.1) 30%, 
    transparent 60%);
  border-radius: 12px 0 0 12px;
  width: 12px;
  z-index: 5;
}

.table-wrap::after {
  content: '▶';
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffb800;
  font-size: 12px;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  background: linear-gradient(to left, 
    rgba(255, 255, 255, 0.4) 0%, 
    rgba(255, 255, 255, 0.1) 30%, 
    transparent 60%);
  border-radius: 0 12px 12px 0;
  width: 12px;
  z-index: 5;
}

/* Responsive table behavior */
@media (max-width: 768px) {
  .table-wrap {
    margin: 0 -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .modern-table {
    min-width: 500px;
  }
}

/* Table column utilities */
.table-col-fixed {
  position: sticky;
  left: 0;
  background: var(--color-surface, #fff);
  z-index: 2;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

.table-col-fixed-right {
  position: sticky;
  right: 0;
  background: var(--color-surface, #fff);
  z-index: 2;
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.1);
}

/* Table loading state */
.table-loading {
  position: relative;
}

.table-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* Table empty state */
.table-empty {
  text-align: center;
  padding: 2rem;
  color: var(--color-secondary, #6b7280);
  font-style: italic;
}

/* Missing data styling */
.modern-table td:empty,
.modern-table td[data-empty="true"],
.modern-table .cell-empty {
  color: #94a3b8;
  font-style: italic;
  position: relative;
}

.modern-table td:empty::before,
.modern-table td[data-empty="true"]::before,
.modern-table .cell-empty::before {
  content: '—';
  color: #cbd5e1;
  font-weight: 300;
}

/* Better empty cell indicators */
.modern-table .cell-no-data {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
}

.modern-table .cell-no-data::before {
  content: 'No data';
  font-size: 0.75rem;
  color: #cbd5e1;
  display: block;
  margin-top: 0.25rem;
}

/* Loading state for cells */
.modern-table .cell-loading {
  color: #94a3b8;
  position: relative;
}

.modern-table .cell-loading::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #e2e8f0;
  border-top: 2px solid #ffb800;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Data formatting utilities */
.modern-table .cell-number {
  text-align: right;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-weight: 600;
}

.modern-table .cell-currency {
  text-align: right;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-weight: 600;
  color: #059669;
}

.modern-table .cell-percentage {
  text-align: right;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-weight: 600;
  color: #dc2626;
}

.modern-table .cell-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.modern-table .cell-status.status-active {
  background: #dcfce7;
  color: #166534;
}

.modern-table .cell-status.status-paused {
  background: #fef3c7;
  color: #92400e;
}

.modern-table .cell-status.status-removed {
  background: #fee2e2;
  color: #991b1b;
}

/* Table row states */
.modern-table tr.row-disabled td {
  opacity: 0.6;
  background: #f8fafc;
}

.modern-table tr.row-highlight td {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.1) 0%, rgba(255, 149, 0, 0.05) 100%);
  border-left: 3px solid #ffb800;
}

/* ===== MODERN TABLE CONTROLS ===== */
.table-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.table-search {
  flex: 1;
  max-width: 300px;
}

.table-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  background: #ffffff;
}

.table-search input:focus {
  outline: none;
  border-color: #ffb800;
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.1);
}

.table-filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.table-filter {
  padding: 0.4rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.75rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-filter:hover {
  border-color: #ffb800;
  background: #fffbeb;
}

.table-filter.active {
  background: #ffb800;
  color: #ffffff;
  border-color: #ffb800;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.table-action-btn {
  padding: 0.4rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.75rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.table-action-btn:hover {
  border-color: #ffb800;
  background: #fffbeb;
  color: #ffb800;
}

.table-action-btn.active {
  background: #ffb800;
  color: #ffffff;
  border-color: #ffb800;
}

/* Table pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
}

.table-pagination-info {
  font-size: 0.75rem;
  color: #6b7280;
}

.table-pagination-controls {
  display: flex;
  gap: 0.25rem;
}

.table-pagination-btn {
  padding: 0.25rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.7rem;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-pagination-btn:hover:not(:disabled) {
  border-color: #ffb800;
  background: #fffbeb;
  color: #ffb800;
}

.table-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.table-pagination-btn.active {
  background: #ffb800;
  color: #ffffff;
  border-color: #ffb800;
}

/* ===== MODERN CARDS ===== */
.card {
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  overflow: visible;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card header {
  margin-bottom: 1rem;
}

.card h3 {
  margin: 0 0 0.5rem 0;
  color: var(--color-contrast, #111827);
  font-size: 1.125rem;
  font-weight: 600;
}

.card .subtle {
  color: var(--color-secondary, #6b7280);
  font-size: 0.875rem;
  margin: 0;
}

/* ===== MODERN TOPBAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.topbar .left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar .right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar h2 {
  margin: 0;
  color: var(--color-contrast, #111827);
  font-size: 1.5rem;
  font-weight: 700;
}

.topbar .subtle {
  color: var(--color-secondary, #6b7280);
  font-size: 0.875rem;
  margin: 0;
}

/* ===== RESPONSIVE KPI GRID ===== */
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  
  .kpi {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .kpi .icon {
    width: 32px;
    height: 32px;
  }
  
  .kpi .icon svg {
    width: 16px;
    height: 16px;
  }
  
  .kpi h4 {
    font-size: 0.7rem;
  }
  
  .kpi .v {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== MODERN TABS ===== */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--color-border, #e5e7eb);
  margin-bottom: 1rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--color-secondary, #6b7280);
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.tab-btn:hover {
  background: rgba(255, 184, 0, 0.08);
  color: var(--color-contrast, #111827);
}

.tab-btn[aria-selected="true"] {
  background: var(--color-surface, #fff);
  color: var(--color-contrast, #111827);
  box-shadow: 0 -1px 0 var(--color-surface, #fff) inset, 0 2px 0 var(--color-primary, #ffb800);
  border: 1px solid var(--color-border, #e5e7eb);
  border-bottom-color: var(--color-surface, #fff);
}

.tab-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== MODERN FORMS ===== */
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row label {
  font-weight: 600;
  color: var(--color-contrast, #111827);
  margin: 0;
}

.form-row select,
.form-row input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 8px;
  background: var(--color-surface, #fff);
  color: var(--color-contrast, #111827);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.form-row select:focus,
.form-row input:focus {
  outline: none;
  border-color: var(--color-primary, #ffb800);
  box-shadow: 0 0 0 3px rgba(255, 184, 0, 0.1);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .providers {
    grid-template-columns: 1fr;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .tile {
    padding: 1rem;
  }
  
  .tile .icon {
    width: 40px;
    height: 40px;
  }
  
  .tile .lead {
    font-size: 1.25rem;
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .tab-btn {
    flex: 1;
    min-width: calc(50% - 0.25rem);
  }
}

@media (max-width: 480px) {
  .kpis {
    grid-template-columns: 1fr;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .tile {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ===== UTILITY CLASSES ===== */
.hidden {
  display: none !important;
}

.subtle {
  color: var(--color-secondary, #6b7280);
  font-size: 0.875rem;
}

.muted {
  color: var(--color-secondary, #6b7280);
}

.lead {
  font-weight: 700;
  color: var(--color-contrast, #111827);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ===== LOADING STATES ===== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus indicators */
*:focus-visible {
  outline: 2px solid var(--color-primary, #ffb800);
  outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --color-surface: #1f2937;
    --color-border: #374151;
    --color-contrast: #f9fafb;
    --color-secondary: #9ca3af;
  }
  
  .tile,
  .prov-card,
  .card,
  .kpi,
  .topbar {
    background: var(--color-surface);
    border-color: var(--color-border);
  }
  
  .modern-table {
    background: var(--color-surface);
    border-color: var(--color-border);
  }
  
  .modern-table thead th {
    background: #374151;
    color: #ffffff !important;
  }
  
  .modern-table tbody td {
    color: var(--color-contrast);
    border-bottom-color: #374151;
  }
}