/* ============== OPS Dashboard Styles ============== */
/* Professional analytics dashboard with modern design */

/* ============== Unified Form Controls ============== */
/* All interactive controls share the same height for consistency */
:root {
  --control-height: 32px;
  --control-font-size: 12px;
  --control-padding-x: 10px;
  --control-border-radius: 6px;
}

/* ============== Base Layout ============== */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-primary);
  overflow-x: hidden;
}

#mainInterface {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 100vh;
}

/* ============== Top Header Bar (like designer.html) ============== */
.dashboard-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(30, 41, 59, 0.2);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
}

.dashboard-header .header-title {
  display: flex;
  align-items: center;
}

.dashboard-header .header-title h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.dashboard-header .header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dashboard-header .header-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
  font-size: 13px;
}

.dashboard-header .header-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.dashboard-header .header-btn.refresh {
  background: rgba(8, 145, 178, 0.3);
  border-color: rgba(8, 145, 178, 0.5);
}

.dashboard-header .header-btn.refresh:hover {
  background: rgba(8, 145, 178, 0.45);
}

.dashboard-header .header-separator {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
}

/* ============== User Menu Dropdown ============== */
.user-menu-container {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-menu-btn::before {
  content: '👤';
  font-size: 12px;
}

.user-menu-arrow {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.2s;
}

.user-menu-btn.active .user-menu-arrow {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 1000;
  display: none;
  overflow: hidden;
}

.user-menu-dropdown.show {
  display: block;
  animation: userMenuFadeIn 0.15s ease;
}

@keyframes userMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-menu-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--gray-50);
}

.user-menu-icon {
  font-size: 18px;
}

.user-menu-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.user-menu-dropdown button:hover {
  background: var(--gray-100);
}

.user-menu-divider {
  height: 1px;
  background: var(--border-color);
}

/* ============== Header Tabs Navigation ============== */
.header-tabs {
  display: flex;
  gap: 4px;
  margin-left: 32px;
}

.tab-item {
  padding: 8px 16px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.tab-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.tab-item.active {
  color: white;
  background: rgba(255, 255, 255, 0.2);
}

/* ============== Login Overlay ============== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.login-logo {
  font-size: 64px;
  text-align: center;
  margin-bottom: 16px;
}

/* ============== Sidebar (hidden - using horizontal tabs now) ============== */
.sidebar {
  display: none;
}

/* ============== Main Content ============== */
.main-content {
  flex: 1;
  margin-top: 49px; /* Below the header */
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 49px);
  min-width: 0;
  width: 100%;
}

/* ============== Section Local Filters ============== */
.section-filters {
  background: var(--bg-surface);
  padding: 12px 24px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.section-filters .filter-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.section-filters .last-update {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ============== Overview Section Styles ============== */
.overview-filter-banner {
  background: var(--bg-surface);
  padding: 12px 24px;
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border-color);
}

.filter-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-banner-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-banner-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-banner-inputs .filter-group.compact {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.filter-banner-inputs .filter-group.compact label {
  color: var(--text-muted);
  font-size: var(--control-font-size);
  font-weight: 500;
  margin-bottom: 0;
}

.filter-banner-inputs .filter-group.compact input[type='datetime-local'],
.filter-banner-inputs .filter-group.compact input[type='date'] {
  height: var(--control-height);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  color: var(--text-primary);
}

.filter-banner-inputs .filter-group.compact input[type='datetime-local']:hover,
.filter-banner-inputs .filter-group.compact input[type='datetime-local']:focus,
.filter-banner-inputs .filter-group.compact input[type='date']:hover,
.filter-banner-inputs .filter-group.compact input[type='date']:focus {
  background: var(--bg-surface);
  border-color: var(--accent);
  outline: none;
}

/* Date text display for human-readable dates */
.date-text-display {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  min-height: 14px;
}

/* Apply button for filters */
.filter-apply-btn {
  height: var(--control-height);
  background: var(--accent);
  border: none;
  border-radius: var(--control-border-radius);
  padding: 0 14px;
  font-size: var(--control-font-size);
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-apply-btn:hover {
  background: var(--accent-dark);
}

.filter-apply-btn.small {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
}

.filter-banner-inputs .filter-reset-btn.small {
  height: var(--control-height);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-banner-inputs .filter-reset-btn.small:hover {
  background: var(--gray-100);
  border-color: var(--accent);
  color: var(--accent);
}

.filter-banner-content .last-update {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.overview-content {
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.designers-content {
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.overview-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.overview-panel-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--gray-50) 100%);
}

.overview-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.overview-panel-body {
  padding: 24px;
}

.overview-panel-body .charts-row {
  margin-bottom: 0;
}

.summary-section {
  margin-bottom: 24px;
}

.summary-section:last-child {
  margin-bottom: 0;
}

.summary-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color);
}

/* Distribution Charts Grid */
.distribution-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.distribution-chart-section {
  display: flex;
  flex-direction: column;
}

.distribution-chart-section:first-child {
  padding-right: 24px;
  border-right: 1px dashed var(--border-color);
}

.brand-chart-controls {
  margin-bottom: 12px;
}

.brand-chart-controls .inline-select {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  font-size: var(--control-font-size);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
}

.brand-chart-controls .inline-select:hover,
.brand-chart-controls .inline-select:focus {
  border-color: var(--accent);
  outline: none;
}

.chart-container-medium {
  height: 250px;
  position: relative;
}

.chart-container-medium canvas {
  max-height: 250px;
}

@media (max-width: 900px) {
  .distribution-charts-grid {
    grid-template-columns: 1fr;
  }

  .distribution-chart-section:first-child {
    padding-right: 0;
    border-right: none;
    padding-bottom: 24px;
    border-bottom: 1px dashed var(--border-color);
  }
}

.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 900px) {
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.timeline-chart-container {
  height: 320px;
  position: relative;
}

/* ============== Global Filters Bar (removed - kept for reference) ============== */
.global-filters-bar {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-secondary) 100%);
  padding: 12px 24px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.filters-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(8, 145, 178, 0.05));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
}

.filters-indicator .indicator-icon {
  font-size: 14px;
}

.filters-indicator .indicator-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filters-indicator .indicator-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.global-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  align-items: flex-end;
}

.filter-separator {
  width: 1px;
  height: 32px;
  background: var(--border-color);
  margin: 0 4px;
}

.filter-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.filter-group label {
  font-size: var(--control-font-size);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-group select {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  min-width: 130px;
  cursor: pointer;
  transition: var(--transition);
}

.filter-group select:hover,
.filter-group input[type='datetime-local']:hover {
  border-color: var(--accent);
}

.filter-group select:focus,
.filter-group input[type='datetime-local']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.filter-group input[type='datetime-local'],
.filter-group input[type='date'] {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-primary);
}

.filter-reset-btn {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.filter-reset-btn:hover {
  background: var(--gray-100);
  border-color: var(--accent);
  color: var(--accent);
}

.global-filters-bar .last-update {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.refresh-btn,
.export-btn {
  height: var(--control-height);
  padding: 0 14px;
  border: none;
  border-radius: var(--control-border-radius);
  font-weight: 600;
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.refresh-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 4px rgba(8, 145, 178, 0.3);
}

.refresh-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.4);
}

.refresh-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(8, 145, 178, 0.3);
}

.export-btn {
  background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.export-btn:hover {
  background: linear-gradient(135deg, var(--gray-200), var(--gray-100));
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

/* ============== Dashboard Content ============== */
.dashboard-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-primary);
}

.dashboard-section {
  display: none;
  width: 100%;
}

.dashboard-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.title-filters {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============== KPI Cards ============== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: transparent;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.kpi-card.total::before {
  background: var(--accent);
}
.kpi-card.active::before {
  background: #3b82f6;
}
.kpi-card.processing::before {
  background: #f59e0b;
}
.kpi-card.approved::before {
  background: var(--success);
}
.kpi-card.rejected::before {
  background: var(--danger);
}
.kpi-card.failed::before {
  background: #6b7280;
}

.kpi-icon {
  font-size: 32px;
  opacity: 0.9;
}

.kpi-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.kpi-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
  display: inline-block;
}

.kpi-trend {
  font-size: 12px;
  margin-left: auto;
}

.kpi-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gray-100);
}

.kpi-progress::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: currentColor;
  transition: width 0.5s ease;
}

/* ============== Metrics Row ============== */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.metric-card.success-rate::before {
  background: linear-gradient(90deg, var(--success) 0%, var(--success-light) 100%);
}
.metric-card.completion-rate::before {
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
}
.metric-card.avg-steps::before {
  background: linear-gradient(90deg, #8b5cf6 0%, #a78bfa 100%);
}
.metric-card.total-cost::before {
  background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.metric-icon {
  font-size: 18px;
}

.metric-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 8px;
}

.metric-bar {
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.metric-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.metric-card.success-rate .metric-bar-fill {
  background: var(--success);
}
.metric-card.completion-rate .metric-bar-fill {
  background: var(--accent);
}

.metric-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.metric-detail span {
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============== Chart Badge ============== */
.chart-badge {
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

/* ============== Quick Access Panel ============== */
.quick-access-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  margin-top: 8px;
}

.quick-access-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quick-access-grid {
  display: flex;
  gap: 12px;
}

.quick-access-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--gray-50);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-access-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.qa-icon {
  font-size: 18px;
}

/* ============== Activity Mini ============== */
.activity-mini {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-mini-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.activity-mini-icon {
  font-size: 16px;
}

.activity-mini-text {
  flex: 1;
  color: var(--text-primary);
}

.activity-mini-text strong {
  color: var(--accent);
}

.activity-mini-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============== Charts ============== */
.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

.chart-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all 0.3s ease;
}

.chart-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.chart-card.large {
  grid-column: span 1;
}

.chart-card.wide {
  grid-column: span 2;
}

.chart-card.full {
  grid-column: 1 / -1;
}

.chart-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--gray-50) 100%);
  gap: 12px;
}

.chart-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-header select {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
  max-width: 180px;
}

.chart-header select:hover {
  border-color: var(--accent);
}

.chart-header select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.chart-controls {
  display: flex;
  gap: 4px;
}

.chart-btn {
  background: var(--gray-100);
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.chart-btn:hover {
  background: var(--gray-200);
}

.chart-btn.active {
  background: var(--accent);
  color: white;
}

.chart-body {
  padding: 16px;
  height: 220px;
  position: relative;
}

.chart-body canvas {
  max-height: 100%;
}

.chart-body.scroll {
  overflow-y: auto;
  height: 200px;
}

.chart-body.tall {
  height: 280px;
}

.chart-body.large {
  height: 320px;
}

/* ============== Ranking List ============== */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.ranking-item:hover {
  background: var(--gray-100);
}

.ranking-position {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: var(--text-secondary);
}

.ranking-item:nth-child(1) .ranking-position {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
}

.ranking-item:nth-child(2) .ranking-position {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  color: white;
}

.ranking-item:nth-child(3) .ranking-position {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: white;
}

.ranking-name {
  flex: 1;
  font-weight: 500;
  color: var(--text-primary);
}

.ranking-value {
  font-weight: 600;
  color: var(--accent);
}

/* ============== Section Header ============== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: none;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.2);
}

.section-header h2 {
  color: white;
}

.section-header h2 i {
  color: rgba(255, 255, 255, 0.9);
}

.section-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.section-controls select {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 13px;
  cursor: pointer;
}

.section-controls select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ============== Filter Pills ============== */
.filter-pills {
  display: flex;
  gap: 6px;
}

.pill {
  padding: 6px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ============== Data Table ============== */
.data-table-container {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  width: 100%;
  margin-top: 16px;
}

.table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.table-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Chart filters in header */
.chart-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Compact filter groups (inline horizontal layout) */
.filter-group.compact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.filter-group.compact label {
  font-size: var(--control-font-size);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Inline filter groups (horizontal layout with label beside input) */
.filter-group.inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.filter-group.inline label {
  font-size: var(--control-font-size);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-group.inline input[type='datetime-local'],
.filter-group.inline input[type='date'],
.filter-group.inline select {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
}

.filter-group.inline input[type='datetime-local']:hover,
.filter-group.inline input[type='date']:hover,
.filter-group.inline select:hover {
  border-color: var(--accent);
}

.filter-group.inline input[type='datetime-local']:focus,
.filter-group.inline input[type='date']:focus,
.filter-group.inline select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1);
}

.filter-group.compact input[type='datetime-local'],
.filter-group.compact input[type='date'],
.filter-group.compact select,
.filter-group.compact input[type='text'],
.filter-group.compact input[type='password'],
.filter-group.compact input[type='number'] {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
}

.filter-group.compact input[type='datetime-local']:hover,
.filter-group.compact input[type='date']:hover,
.filter-group.compact select:hover {
  border-color: var(--accent);
}

.filter-group.compact input[type='datetime-local']:focus,
.filter-group.compact input[type='date']:focus,
.filter-group.compact select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1);
}

/* Table filters row - all controls in one line */
.table-filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.table-search-inline {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  font-size: var(--control-font-size);
  width: 150px;
  transition: var(--transition);
}

.table-search-inline:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1);
}

.page-size-select {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
}

.filter-reset-btn.small {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  font-size: var(--control-font-size);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.filter-reset-btn.small:hover {
  background: var(--gray-100);
  border-color: var(--accent);
  color: var(--accent);
}

/* Styled select dropdown */
.styled-select {
  position: relative;
}

.styled-select select {
  height: var(--control-height);
  padding: 0 28px 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.styled-select::after {
  content: '▼';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.styled-select select:hover {
  border-color: var(--accent);
}

.styled-select select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.table-search {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  font-size: var(--control-font-size);
  width: 200px;
  transition: var(--transition);
}

.table-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.data-table th:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.data-table th.sorted {
  color: var(--accent);
}

.sort-icon {
  margin-left: 4px;
  opacity: 0.5;
}

.data-table td {
  font-size: 13px;
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.active {
  background: #dbeafe;
  color: #1d4ed8;
}
.status-badge.processing {
  background: #fef3c7;
  color: #b45309;
}
.status-badge.approved {
  background: #d1fae5;
  color: #047857;
}
.status-badge.rejected {
  background: #fee2e2;
  color: #b91c1c;
}
.status-badge.failed {
  background: #f3f4f6;
  color: #4b5563;
}

.action-btn {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.action-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

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

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.table-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.table-footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.table-info {
  font-size: 13px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  gap: 4px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

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

/* ============== Client Cards ============== */
.client-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  transition: var(--transition);
}

.client-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.client-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.client-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.client-card-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.client-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.client-stat {
  text-align: center;
  padding: 8px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

.client-stat-value {
  font-size: 18px;
  font-weight: 600;
  display: block;
}

.client-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ============== Activity Feed ============== */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

.activity-icon {
  font-size: 20px;
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============== Cost KPIs ============== */
.cost-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.cost-kpi-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.cost-kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.cost-kpi-card.automatic::before {
  background: #8b5cf6;
}
.cost-kpi-card.external::before {
  background: #ec4899;
}
.cost-kpi-card.internal::before {
  background: #14b8a6;
}
.cost-kpi-card.total::before {
  background: var(--accent);
}

.cost-icon {
  font-size: 36px;
}

.cost-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cost-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.cost-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.cost-count {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============== Price Config ============== */
.price-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.price-item {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-md);
}

.price-label {
  font-weight: 500;
  color: var(--text-primary);
}

.price-value {
  font-weight: 600;
  color: var(--accent);
}

/* ============== Loading Overlay ============== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============== Responsive ============== */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .charts-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart-card.full {
    grid-column: span 2;
  }
}

@media (max-width: 1200px) {
  .global-filters {
    flex-wrap: wrap;
  }

  .cost-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 72px;
  }

  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .user-name {
    display: none;
  }

  .main-content {
    margin-left: 72px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  .chart-card.large,
  .chart-card.wide,
  .chart-card.full {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 16px;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: center;
  }

  .global-filters {
    width: 100%;
    justify-content: center;
  }
}

/* ============== Dark Mode Support ============== */
body.dark-mode {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-surface: #1e293b;
  --bg-surface-elevated: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: #334155;
  --border-color-strong: #475569;
}

body.dark-mode .login-overlay {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

body.dark-mode .login-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .sidebar-toggle:hover,
body.dark-mode .nav-item:hover,
body.dark-mode .logout-btn:hover {
  background: #334155;
}

body.dark-mode .ranking-item,
body.dark-mode .activity-item,
body.dark-mode .price-item,
body.dark-mode .client-stat {
  background: #334155;
}

body.dark-mode .data-table th {
  background: #0f172a;
}

body.dark-mode .data-table tbody tr:hover {
  background: #334155;
}

body.dark-mode .loading-overlay {
  background: rgba(15, 23, 42, 0.95);
}

body.dark-mode .chart-btn {
  background: #334155;
  color: var(--text-secondary);
}

body.dark-mode .chart-btn:hover {
  background: #475569;
}

body.dark-mode .pill {
  background: #334155;
  border-color: #475569;
  color: var(--text-secondary);
}

body.dark-mode .pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

body.dark-mode .pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ============== Stats Section (Main Interface Style) ============== */
.stats-section {
  margin-bottom: 32px;
}

.stats-section:last-child {
  margin-bottom: 0;
}

.stats-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stats-section-title .title-filters {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 700px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stats-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
}

.stats-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--accent);
}

.stats-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.stats-card:hover::after {
  transform: scaleX(1);
}

.stats-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stats-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stats-card-subvalue {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.stats-card.warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #f59e0b;
}

.stats-card.warning .stats-card-value {
  color: #92400e;
}

.stats-card.danger {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #ef4444;
}

.stats-card.danger .stats-card-value {
  color: #991b1b;
}

.stats-card.success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981;
}

.stats-card.success .stats-card-value {
  color: #065f46;
}

.stats-card.highlight {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: none;
}

.stats-card.highlight .stats-card-value {
  color: white;
}

.stats-card.highlight .stats-card-label {
  color: rgba(255, 255, 255, 0.85);
}

.stats-card.highlight .stats-card-subvalue {
  color: rgba(255, 255, 255, 0.75);
}

.stats-charts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 16px;
}

@media (max-width: 1100px) {
  .stats-charts-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .stats-charts-row {
    grid-template-columns: 1fr;
  }
}

.stats-chart-container {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px;
  height: 220px;
  display: flex;
  flex-direction: column;
}

.stats-chart-container canvas {
  flex: 1;
  min-height: 0;
}

.stats-chart-container.full-width {
  grid-column: 1 / -1;
  height: 320px;
}

.stats-chart-container h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin: 0 0 12px 0;
}

/* Dark mode stats section */
body.dark-mode .stats-section-title {
  color: var(--text-primary);
  border-bottom-color: var(--border-color);
}

body.dark-mode .stats-card {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color);
}

body.dark-mode .stats-card-label {
  color: var(--text-muted);
}

body.dark-mode .stats-card-value {
  color: var(--accent);
}

body.dark-mode .stats-card-subvalue {
  color: var(--text-muted);
}

body.dark-mode .stats-card.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
  border-color: #10b981;
}

body.dark-mode .stats-card.success .stats-card-value {
  color: #6ee7b7;
}

body.dark-mode .stats-card.warning {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  border-color: #f59e0b;
}

body.dark-mode .stats-card.warning .stats-card-value {
  color: #fcd34d;
}

body.dark-mode .stats-card.danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3));
  border-color: #ef4444;
}

body.dark-mode .stats-card.danger .stats-card-value {
  color: #fca5a5;
}

body.dark-mode .stats-chart-container {
  background: var(--bg-surface-elevated);
  border-color: var(--border-color);
}

body.dark-mode .stats-chart-container h4 {
  color: var(--text-primary);
}

/* ============== Instance Image Preview ============== */
.image-preview-row {
  background: var(--gray-50);
}

.image-preview-cell {
  padding: 16px !important;
  border-top: 2px solid var(--accent);
}

.instance-images-grid {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.image-group {
  flex: 1;
  min-width: 200px;
}

.image-group h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin: 0 0 8px 0;
}

.image-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
}

.thumbnail:hover {
  transform: scale(1.1);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

/* Image Modal */
.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 40px;
}

.image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .image-preview-row {
  background: var(--bg-surface-elevated);
}

body.dark-mode .image-group h4 {
  color: var(--text-secondary);
}

body.dark-mode .thumbnail {
  border-color: var(--border-color);
}

/* ============== Top Clients Grid ============== */
.top-clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.top-client-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.top-client-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.top-client-card.gold {
  border-color: #ffd700;
  border-width: 2px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 237, 74, 0.08));
}

.top-client-card.silver {
  border-color: #a0a0a0;
  border-width: 2px;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.18), rgba(220, 220, 220, 0.08));
}

.top-client-card.bronze {
  border-color: #cd7f32;
  border-width: 2px;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(232, 164, 92, 0.08));
}

.top-client-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-client-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.top-client-card.gold .top-client-rank {
  background: linear-gradient(135deg, #ffd700, #ffed4a);
  color: #856404;
}

.top-client-card.silver .top-client-rank {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
  color: #495057;
}

.top-client-card.bronze .top-client-rank {
  background: linear-gradient(135deg, #cd7f32, #e8a45c);
  color: #5a3b22;
}

.top-client-info {
  flex: 1;
}

.top-client-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.top-client-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.top-client-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.top-client-stat {
  text-align: center;
  padding: 8px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}

.top-client-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.top-client-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.top-client-progress {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.top-client-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--success-light));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.top-client-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

body.dark-mode .top-client-card {
  background: var(--bg-surface-elevated);
}

body.dark-mode .top-client-stat {
  background: var(--bg-secondary);
}

body.dark-mode .top-client-rank {
  background: var(--gray-700);
  color: var(--text-secondary);
}

/* ============== Recent Activity List ============== */
.recent-activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.activity-item:hover {
  background: var(--gray-50);
  transform: translateX(4px);
  border-color: var(--accent);
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-icon.created {
  background: #dbeafe;
}
.activity-icon.approved {
  background: #d1fae5;
}
.activity-icon.rejected {
  background: #fee2e2;
}
.activity-icon.processing {
  background: #fef3c7;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Payments Section */
.payments-controls {
  margin-bottom: 20px;
}

.payments-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.payments-filters .filter-group input[type='date'] {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: var(--transition);
}

.payments-filters .filter-group input[type='date']:hover {
  border-color: var(--accent);
}

.payments-filters .filter-group input[type='date']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.payments-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.payments-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.payments-stat.warning {
  border-color: var(--warning);
  background: rgba(245, 158, 11, 0.05);
}

.payments-stat.success {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.payments-stat.info {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.05);
}

.payments-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.payments-stat.warning .payments-stat-value {
  color: var(--warning);
}

.payments-stat.success .payments-stat-value {
  color: var(--success);
}

.payments-stat.info .payments-stat-value {
  color: var(--accent);
}

.payments-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.chart-container-small {
  height: 180px;
  margin-bottom: 20px;
}

.chart-container-small canvas {
  max-height: 180px;
}

/* Taller chart for payments */
.chart-container-payments {
  height: 280px;
  margin-bottom: 20px;
}

.chart-container-payments canvas {
  max-height: 280px;
}

/* Pricing Grid Styles */
/* Payment table row hover */
.payment-row {
  cursor: pointer;
  transition: background 0.15s ease;
}

.payment-row:hover {
  background: var(--gray-50);
}

.payments-actions {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  flex-wrap: wrap;
}

.payments-table-wrapper {
  max-height: 400px;
  overflow-y: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  position: relative;
}

.payments-table-wrapper table {
  margin-bottom: 0;
}

.payments-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.payments-table thead th.sticky-header {
  background: var(--bg-surface);
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
}

.payments-table .id-cell {
  white-space: nowrap;
}

.payments-table .id-cell .instance-link,
.payments-table .id-cell .instance-id-text {
  display: inline;
  vertical-align: middle;
}

.payments-table .id-cell .copy-id-btn {
  display: inline;
  vertical-align: middle;
  margin-left: 6px;
}

.payments-table .steps-cell {
  text-align: center;
  font-weight: 500;
}

.copy-id-btn {
  background: none;
  border: none;
  padding: 2px 6px;
  cursor: pointer;
  opacity: 0.5;
  font-size: 12px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.copy-id-btn:hover {
  opacity: 1;
  background: var(--gray-100);
}

.status-paid {
  background: #dcfce7;
  color: #166534;
}

.status-unpaid {
  background: #fee2e2;
  color: #991b1b;
}

/* Payment History Modal */
.payment-history-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}

.payment-history-modal {
  background: var(--bg-surface);
  border-radius: 16px;
  width: 520px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.payment-history-header {
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(135deg, var(--bg-surface), var(--gray-50));
}

.payment-history-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--gray-100);
  color: var(--text-primary);
}

.payment-history-designer {
  padding: 12px 24px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
}

.payment-history-designer .designer-label {
  color: var(--text-muted);
  font-size: 13px;
}

.payment-history-designer .designer-name {
  font-weight: 600;
  color: var(--accent);
}

.payment-history-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.payment-history-summary .summary-item {
  background: var(--bg-surface);
  padding: 16px;
  text-align: center;
}

.payment-history-summary .summary-item.highlight {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.payment-history-summary .summary-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.payment-history-summary .summary-item.highlight .summary-value {
  color: #059669;
}

.payment-history-summary .summary-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.payment-history-list {
  max-height: 350px;
  overflow-y: auto;
}

.history-record {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
}

.history-record:hover {
  background: var(--gray-50);
}

.history-record.even {
  background: #fafafa;
}

.history-record-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-date {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 14px;
}

.history-amount {
  font-weight: 700;
  color: #059669;
  font-size: 16px;
}

.history-details {
  margin-top: 6px;
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
}

.history-admin,
.history-count {
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-download-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.history-download-btn:hover {
  background: var(--gray-100);
  border-color: var(--accent);
}

.checkbox-col {
  width: 40px;
  text-align: center;
}

.primary-btn {
  height: var(--control-height);
  padding: 0 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--control-border-radius);
  font-weight: 600;
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.primary-btn.small {
  height: var(--control-height);
  padding: 0 12px;
  font-size: var(--control-font-size);
}

.primary-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  height: var(--control-height);
  padding: 0 16px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  font-weight: 600;
  font-size: var(--control-font-size);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.secondary-btn:hover {
  background: var(--gray-100);
  border-color: var(--accent);
}

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

.payment-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.instance-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.instance-link:hover {
  text-decoration: underline;
}

.difficulty-easy {
  background: #dcfce7;
  color: #166534;
}

.difficulty-medium {
  background: #fef3c7;
  color: #92400e;
}

.difficulty-hard {
  background: #fee2e2;
  color: #991b1b;
}

/* Designer Rankings Section */
.designer-rankings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.ranking-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.ranking-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ranking-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.ranking-item:hover {
  background: var(--gray-100);
}

.ranking-position {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.ranking-position.gold {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: white;
}

.ranking-position.silver {
  background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
  color: white;
}

.ranking-position.bronze {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  color: white;
}

.ranking-position.normal {
  background: var(--gray-200);
  color: var(--text-secondary);
}

.ranking-info {
  flex: 1;
  min-width: 0;
}

.ranking-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ranking-metric {
  font-size: 12px;
  color: var(--text-muted);
}

.ranking-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

/* Stats grid with 5 columns */
.stats-grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 1200px) {
  .stats-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .stats-grid-5 {
    grid-template-columns: repeat(2, 1fr);
  }

  .designer-rankings-grid {
    grid-template-columns: 1fr;
  }

  .payments-summary-grid {
    grid-template-columns: 1fr;
  }
}

/* Chart large body for horizontal charts */
.chart-body.large {
  height: 400px;
}

.chart-body.large canvas {
  max-height: 400px;
}
/* ============== Designer Rankings Card Grid ============== */
.ranking-category {
  margin-bottom: 24px;
}

.ranking-category:last-child {
  margin-bottom: 0;
}

.ranking-category-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ranking-category-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.top-designers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.top-designer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.top-designer-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.top-designer-card.gold {
  border-color: #ffd700;
  border-width: 2px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 237, 74, 0.08));
}

.top-designer-card.silver {
  border-color: #a0a0a0;
  border-width: 2px;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.18), rgba(220, 220, 220, 0.08));
}

.top-designer-card.bronze {
  border-color: #cd7f32;
  border-width: 2px;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.15), rgba(232, 164, 92, 0.08));
}

.top-designer-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-designer-rank {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.top-designer-card.gold .top-designer-rank {
  background: linear-gradient(135deg, #ffd700, #ffed4a);
  color: #856404;
}

.top-designer-card.silver .top-designer-rank {
  background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
  color: #495057;
}

.top-designer-card.bronze .top-designer-rank {
  background: linear-gradient(135deg, #cd7f32, #e8a45c);
  color: #5a3b22;
}

.top-designer-info {
  flex: 1;
}

.top-designer-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.top-designer-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.top-designer-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.top-designer-stat {
  text-align: center;
  padding: 8px 4px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}

.top-designer-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.top-designer-stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.top-designer-highlight {
  text-align: center;
  padding: 10px;
  background: linear-gradient(135deg, var(--accent-light), rgba(99, 102, 241, 0.1));
  border-radius: var(--radius-sm);
}

.top-designer-highlight-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.top-designer-highlight-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

body.dark-mode .top-designer-card {
  background: var(--bg-surface-elevated);
}

body.dark-mode .top-designer-stat {
  background: var(--bg-secondary);
}

body.dark-mode .top-designer-rank {
  background: var(--gray-700);
  color: var(--text-secondary);
}
/* ============== Designer Pricing Form ============== */
.panel-description {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

.pricing-form-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Stats grid with 4 columns */
.stats-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1000px) {
  .stats-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Chart filter inline */
.chart-filter {
  margin-left: auto;
}

.chart-filter select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
}
/* ============== Add Designer Form ============== */
.add-designer-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.add-designer-form .filter-group {
  flex: 0 0 auto;
}

.add-designer-form input,
.add-designer-form select {
  height: var(--control-height);
  padding: 0 var(--control-padding-x);
  border: 1px solid var(--border-color);
  border-radius: var(--control-border-radius);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: var(--control-font-size);
  min-width: 150px;
}

.add-designer-form input:focus,
.add-designer-form select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.add-designer-message {
  margin-top: 12px;
  font-size: 14px;
}

.add-designer-message .success {
  color: var(--success);
}

.add-designer-message .error {
  color: var(--error);
}

/* ============== Chart Legend Custom ============== */
.chart-legend-custom {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ============== Rankings Panel ============== */
.rankings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 1200px) {
  .rankings-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* New Designer Rankings - Category Row Layout */
.ranking-category-row {
  margin-bottom: 24px;
}

.ranking-category-row:last-child {
  margin-bottom: 0;
}

.ranking-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.ranking-category-icon {
  font-size: 20px;
}

.ranking-category-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ranking-category-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.ranking-cards-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 1200px) {
  .ranking-cards-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .ranking-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.designer-ranking-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}

.designer-ranking-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.designer-ranking-rank {
  font-size: 16px;
  flex-shrink: 0;
}

.designer-ranking-info {
  text-align: left;
  min-width: 0;
}

.designer-ranking-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.designer-ranking-type {
  font-size: 11px;
  color: var(--text-muted);
}

.designer-ranking-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.designer-ranking-secondary {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.designer-ranking-progress {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}

.designer-ranking-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light, #818cf8));
  border-radius: 2px;
  transition: width 0.5s ease;
}

body.dark-mode .designer-ranking-card {
  background: var(--bg-surface-elevated);
}

body.dark-mode .designer-ranking-progress {
  background: var(--gray-700);
}

/* Legacy ranking styles - kept for backward compatibility */
.ranking-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.ranking-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.ranking-panel-icon {
  font-size: 24px;
}

.ranking-panel-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ranking-panel-subtitle {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.ranking-item-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.ranking-item-info {
  flex: 1;
  min-width: 0;
}

.ranking-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.ranking-item-type {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.ranking-item-progress {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.ranking-item-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light, #818cf8));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.ranking-item-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
  min-width: 60px;
}

body.dark-mode .ranking-panel {
  background: var(--bg-surface-elevated);
}

body.dark-mode .ranking-item-rank {
  background: var(--gray-700);
}

body.dark-mode .ranking-item-progress {
  background: var(--gray-700);
}

/* Generation Summary Grid */
.generation-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.generation-summary-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  transition: box-shadow 0.15s;
}
.generation-summary-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.generation-summary-card.highlight {
  background: var(--blue-50, #eff6ff);
  border-color: var(--blue-200, #bfdbfe);
}

.gen-pipeline-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: capitalize;
  margin-bottom: 4px;
}

.gen-pipeline-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
}

.gen-pipeline-cost {
  font-size: 13px;
  font-weight: 500;
  color: var(--green-600, #059669);
  margin-top: 2px;
}

body.dark-mode .generation-summary-card {
  background: var(--gray-800);
  border-color: var(--gray-700);
}
body.dark-mode .generation-summary-card.highlight {
  background: var(--gray-750, #1e293b);
  border-color: var(--blue-700, #1d4ed8);
}
body.dark-mode .gen-pipeline-name {
  color: var(--gray-400);
}
body.dark-mode .gen-pipeline-count {
  color: var(--gray-100);
}
body.dark-mode .gen-pipeline-cost {
  color: var(--green-400, #34d399);
}

/* ─── Unified Pricing Grid ─── */
/* ─── Pricing Tables ─── */
.pricing-unified-grid {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.pricing-table-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pricing-table-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pricing-table-wrapper {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.pricing-table thead th {
  background: var(--gray-50);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.pricing-table thead th.price-col {
  width: 120px;
  text-align: center;
}

.pricing-table thead th.action-col {
  width: 70px;
  text-align: center;
}

.pricing-table tbody tr {
  transition: background 0.12s;
}

.pricing-table tbody tr:not(:last-child) td {
  border-bottom: 1px solid var(--border-color);
}

.pricing-table tbody tr:hover {
  background: rgba(8, 145, 178, 0.02);
}

.pricing-name-cell {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: capitalize;
}

.pricing-input-cell {
  padding: 6px 10px;
  text-align: center;
}

.pricing-input-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.pricing-input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(8, 145, 178, 0.1);
}

.pricing-currency {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-input-group input[type='number'] {
  width: 64px;
  padding: 5px 0;
  border: none;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
  color: var(--text-primary);
  text-align: right;
  outline: none;
}

.pricing-input-group input[type='number']::-webkit-inner-spin-button,
.pricing-input-group input[type='number']::-webkit-outer-spin-button {
  opacity: 0.4;
}

.pricing-action-cell {
  padding: 6px 10px;
  text-align: center;
}

.pricing-table-save {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 5px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.15s;
}

.pricing-table-save:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pricing-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.diff-header {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.diff-header.easy {
  background: #dcfce7;
  color: #166534;
}

.diff-header.medium {
  background: #fef3c7;
  color: #92400e;
}

.diff-header.hard {
  background: #fee2e2;
  color: #991b1b;
}
