/* ===== CSS VARIABLES & CUSTOM PROPERTIES ===== */
:root {
  /* Brand Colors */
  --hs-primary: #521b7e;
  --hs-secondary: #ae98fd;
  --hs-accent-purple-light: #f4f0ff;
  --hs-accent-purple-lighter: #f1f2fe;

  /* Gray Palette */
  --hs-gray-50: #f8fafc;
  --hs-gray-100: #f1f5f9;
  --hs-gray-200: #e2e8f0;
  --hs-gray-300: #cbd5e1;
  --hs-gray-400: #94a3b8;
  --hs-gray-500: #64748b;
  --hs-gray-600: #475569;
  --hs-gray-700: #334155;
  --hs-gray-800: #1e293b;
  --hs-gray-900: #0f172a;
  --hs-text-dark: #051d40;
  --hs-text-muted: #7b8086;

  /* Status Colors */
  --hs-success: #10b981;
  --hs-warning: #f59e0b;
  --hs-error: #dc2626;
  --hs-critical: #dc3545;
  --hs-info: #3b82f6;

  /* Spacing Scale */
  --hs-space-1: 4px;
  --hs-space-2: 8px;
  --hs-space-3: 12px;
  --hs-space-4: 16px;
  --hs-space-5: 20px;
  --hs-space-6: 24px;
  --hs-space-7: 32px;
  --hs-space-8: 40px;
  --hs-space-10: 48px;
  --hs-space-12: 60px;

  /* Typography */
  --hs-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --hs-font-size-xs: 0.65rem;
  --hs-font-size-sm: 0.85rem;
  --hs-font-size-base: 1rem;
  --hs-font-size-lg: 1.2rem;
  --hs-font-size-xl: 1.5rem;
  --hs-font-size-2xl: 2.2rem;

  /* Border Radius */
  --hs-radius-sm: 6px;
  --hs-radius-md: 10px;
  --hs-radius-lg: 16px;
  --hs-radius-xl: 20px;
  --hs-radius-full: 9999px;

  /* Shadows */
  --hs-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
  --hs-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
  --hs-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
  --hs-shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
  --hs-shadow-primary: 0 4px 12px rgba(82, 27, 126, 0.2);
  --hs-shadow-primary-lg: 0 12px 20px rgba(82, 27, 126, 0.08);
}

/* ===== TYPOGRAPHY ===== */
.hs-trademark-text {
  color: var(--hs-text-muted);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 4px;
}

.hs-main-title {
  font-size: var(--hs-font-size-2xl);
  font-weight: 800;
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.hs-gradient-section-one {
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-image: linear-gradient(to right, #1a1a1a, #430483);
}

.hs-black-text {
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-image: linear-gradient(90deg, #430483 0%, #ae98fd 80%);
  font-weight: 800;
}

.hs-subtext {
  color: var(--hs-gray-500);
  font-size: var(--hs-font-size-base);
  margin: 8px 0 0 0;
  font-weight: 500;
}

/* ===== LAYOUT COMPONENTS ===== */
.hs-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

.hs-home-header {
  background: linear-gradient(165deg, rgba(67, 4, 131, 0.08) 0%, rgba(174, 152, 253, 0) 70%);
  padding: 60px 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(82, 27, 126, 0.05);
}

.hs-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.hs-welcome-area {
  flex: 1;
  min-width: 300px;
}

.hs-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.hs-btn-primary {
  background: var(--hs-primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--hs-radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  height: 42px;
  box-sizing: border-box;
}

.hs-btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--hs-shadow-primary);
}

.hs-btn-secondary {
  background: white;
  color: var(--hs-primary);
  border: 2px solid var(--hs-primary);
  padding: 10px 18px;
  border-radius: var(--hs-radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  white-space: nowrap;
  height: 42px;
  box-sizing: border-box;
}

.hs-btn-secondary:hover {
  background: var(--hs-accent-purple-light);
  transform: translateY(-1px);
}

.hs-btn-clear {
  flex: 1;
  padding: 9px;
  border: 1px solid var(--hs-gray-200);
  border-radius: var(--hs-radius-sm);
  background: white;
  color: var(--hs-gray-500);
  font-weight: 600;
  font-size: var(--hs-font-size-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.hs-btn-clear:hover {
  background: var(--hs-gray-50);
}

.hs-btn-apply {
  flex: 2;
  padding: 9px;
  border: none;
  border-radius: var(--hs-radius-sm);
  background: var(--hs-primary);
  color: white;
  font-weight: 600;
  font-size: var(--hs-font-size-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.hs-btn-apply:hover {
  opacity: 0.9;
}

/* ===== SEARCH INPUT ===== */
.hs-search-container {
  position: relative;
  width: 280px;
}

.hs-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hs-gray-500);
  font-size: 20px;
  pointer-events: none;
}

#hs-program-search,
#hs_program_search {
  width: 100%;
  padding: 10px 12px 10px 40px;
  border: 1px solid var(--hs-gray-200);
  border-radius: var(--hs-radius-md);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
  background: #ffffff;
}

#hs-program-search:focus,
#hs_program_search:focus {
  border-color: var(--hs-primary);
  box-shadow: 0 0 0 3px rgba(82, 27, 126, 0.1);
}

/* ===== FILTER DROPDOWN (ASANA-STYLE) ===== */
.hs-filter-dropdown-wrapper {
  position: relative;
}

.hs-filter-dropdown {
  position: absolute;
  top: 52px;
  right: 0;
  background: white;
  border: 1px solid var(--hs-gray-200);
  border-radius: var(--hs-radius-lg);
  box-shadow: var(--hs-shadow-lg);
  padding: 20px;
  width: 440px;
  z-index: 1000;
}

.hs-filter-inner-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--hs-gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.hs-quick-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.hs-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--hs-gray-200);
  border-radius: var(--hs-radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--hs-gray-600);
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  user-select: none;
}

.hs-filter-pill:hover {
  background: var(--hs-gray-100);
  border-color: var(--hs-gray-300);
}

.hs-filter-pill.active {
  background-color: var(--hs-accent-purple-light) !important;
  border-color: var(--hs-primary) !important;
  color: var(--hs-primary) !important;
}

.hs-pill-icon {
  font-size: 16px !important;
}

.hs-pill-arrow {
  font-size: 18px !important;
  color: var(--hs-gray-400);
}

.hs-custom-pill-dropdown {
  position: relative;
}

.hs-pill-menu {
  position: absolute;
  top: 110%;
  left: 0;
  background: white;
  border: 1px solid var(--hs-gray-200);
  border-radius: var(--hs-radius-sm);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  min-width: 220px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 1010;
  padding: 8px 0;
}

.hs-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--hs-gray-700);
  cursor: pointer;
  transition: 0.2s;
}

.hs-filter-checkbox:hover {
  background: var(--hs-gray-50);
  color: var(--hs-primary);
}

.hs-filter-checkbox input {
  accent-color: var(--hs-primary);
  width: 16px;
  height: 16px;
}

.hs-filter-actions-footer {
  display: flex;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid var(--hs-gray-100);
  margin-top: 10px;
}

/* ===== CARDS ===== */
.hs-programs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 25px;
  padding-bottom: 40px;
}

.hs-program-card {
  background: #fff;
  border: 1px solid var(--hs-gray-200);
  border-radius: 18px;
  padding: 24px;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  box-shadow: var(--hs-shadow-sm);
  min-height: 280px;
}

.hs-program-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--hs-shadow-primary-lg);
  border-color: var(--hs-secondary);
}

.hs-program-name {
  font-size: var(--hs-font-size-lg);
  font-weight: 800;
  color: var(--hs-gray-900);
  margin: 0 0 10px 0;
}

.hs-program-desc {
  font-size: var(--hs-font-size-sm);
  color: var(--hs-gray-500);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.hs-card-spacer {
  flex-grow: 1;
}

.hs-timeline-container {
  margin-bottom: 12px;
}

.hs-timeline-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--hs-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hs-timeline-track {
  width: 100%;
  height: 6px;
  background: var(--hs-gray-100);
  border-radius: var(--hs-radius-md);
  overflow: hidden;
  position: relative;
}

.hs-timeline-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--hs-primary), var(--hs-secondary));
  border-radius: var(--hs-radius-md);
  transition: width 0.8s ease-in-out;
}

.hs-card-stats {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--hs-gray-100);
  margin-top: auto;
}

.hs-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--hs-primary);
  font-weight: 700;
  font-size: 0.8rem;
}

.hs-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 12px;
}

.hs-metric-icons-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hs-m-icon-pill {
  width: 28px;
  height: 28px;
  background: var(--hs-accent-purple-lighter);
  border-radius: var(--hs-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hs-primary);
  font-size: 12px;
  transition: 0.2s;
}

.hs-created-by-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.hs-created-by-label {
  font-size: var(--hs-font-size-xs);
  color: var(--hs-gray-400);
  font-weight: 600;
  text-align: right;
}

.hs-skeleton-card {
  height: 250px;
  animation: hs-pulse 1.5s infinite;
  border: none;
  background: #eaeff5;
}

/* ===== UTILITY CLASSES ===== */
.hs-d-none {
  display: none !important;
}

.hs-d-flex {
  display: flex !important;
}

.hs-d-block {
  display: block !important;
}

.hs-d-grid {
  display: grid !important;
}

.hs-text-center {
  text-align: center !important;
}

.hs-text-gradient {
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-image: linear-gradient(to right, #1a1a1a, #430483);
}

.hs-text-gradient-purple {
  -webkit-text-fill-color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  background-image: linear-gradient(90deg, #430483 0%, #ae98fd 80%);
}

.hs-text-muted {
  color: var(--hs-gray-500) !important;
}

.hs-text-primary {
  color: var(--hs-primary) !important;
}

.hs-text-critical {
  color: var(--hs-critical) !important;
}

/* ===== ANIMATIONS & KEYFRAMES ===== */
@keyframes hs-pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

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

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

.hs-spinner {
  animation: hs-spin 1s linear infinite;
}

.hs-fade-in {
  animation: hs-fade-in 0.3s ease-out;
}

/* ===== SNAPAPP FRAMEWORK OVERRIDES ===== */
[id*="datatable"] {
  margin: 0 !important;
}

#content > div > main > section > div.card.mb-4 {
  box-shadow: none !important;
}

span.badge.text-shadow.shadow-sm:not(.badge-counter) {
  padding: 6px 10px !important;
  font-weight: normal !important;
  font-size: 10pt;
  border-radius: 20px;
  text-shadow: none;
  margin: 0px 2px;
}

/* Support for both old (hs_) and new (hs-) naming during transition */
#hs_program_count_badge,
#hs-program-count-badge {
  color: var(--hs-primary);
  font-weight: 800;
}

#hs_created_by_me,
#hs-created-by-me {
  display: none;
}

/* ===== PROGRAM DASHBOARD STYLES ===== */
#hs-program-dashboard-wrapper {
  font-family: var(--hs-font-family);
  background-color: #ffffff;
  color: var(--hs-text-dark);
  padding-bottom: 5rem;
  min-height: 100vh;
}

.hs-program-header {
  background-image: linear-gradient(165deg, rgba(67, 4, 131, 0.05) 0%, rgba(174, 152, 253, 0) 80%);
  padding: 40px 0 35px;
  margin-bottom: 3rem;
  border-bottom: 1px solid rgba(0, 102, 252, 0.1);
}

.hs-program-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 15px;
  padding: 25px;
  transition: 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.hs-card-header-v2 {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

.hs-icon-container-v2 {
  background-color: var(--hs-accent-purple-lighter);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

.hs-icon-v2 {
  color: var(--hs-primary);
  font-size: 24px;
}

.hs-title-v2 {
  color: var(--hs-primary);
  font-size: 1.1rem;
  font-weight: 700;
  flex-grow: 1;
}

.hs-edit-trigger-v2 {
  color: var(--hs-gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  opacity: 0.6;
  visibility: visible;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hs-edit-trigger-v2:hover {
  color: var(--hs-primary);
  opacity: 1;
  transform: scale(1.1);
}

.hs-edit-icon-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
}

.hs-date-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

.hs-date-item {
  background: #fcfaff;
  padding: 15px;
  border-radius: 10px;
  border: 1px solid rgba(82, 27, 126, 0.1);
}

.hs-stat-label {
  color: var(--hs-text-dark);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.hs-stat-value-small {
  color: var(--hs-primary);
  font-size: 1.1rem;
  font-weight: 600;
}

/* Metrics Styles */
.hs-metrics-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hs-metric-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.hs-metric-pill span.dot {
  width: 8px;
  height: 8px;
  background: #916def;
  border-radius: 50%;
}

.hs-metric-pill.editable {
  cursor: pointer;
}

.hs-metric-pill.unselected {
  opacity: 0.3;
  filter: grayscale(1);
}

.hs-metric-pill.selected {
  opacity: 1;
  filter: none;
  border-color: var(--hs-primary);
  border-width: 2px;
}

.hs-metric-pill.draggable {
  cursor: move;
}

.hs-metric-pill.dragging {
  opacity: 0.5;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(82, 27, 126, 0.3);
}

.hs-metric-pill.drag-over {
  border-top: 3px solid var(--hs-primary);
}

.hs-metric-pill .drag-handle {
  color: var(--hs-gray-400);
  font-size: 18px;
  margin-right: 5px;
  cursor: move;
  display: none;
}

.hs-metric-pill.draggable .drag-handle {
  display: block;
}

.hs-metric-pill .metric-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hs-metric-pill .info-icon {
  color: var(--hs-gray-400);
  font-size: 18px;
  cursor: pointer;
  transition: color 0.2s;
  margin-left: auto;
}

.hs-metric-pill .info-icon:hover {
  color: var(--hs-primary);
}

/* Device Network Grid */
.hs-device-network-grid {
  padding: 10px 0;
}

.hs-mfr-block {
  margin-bottom: 30px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 20px;
}

.hs-mfr-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.hs-mfr-logo-img {
  height: 24px;
  width: auto;
  opacity: 0.8;
}

.hs-mfr-name {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--hs-text-muted);
}

.hs-device-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
}

.hs-device-item-v2 {
  text-align: center;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #f0f0f0;
  transition: 0.2s;
  position: relative;
}

.hs-device-item-v2.editable {
  cursor: pointer;
}

.hs-device-item-v2.unselected {
  opacity: 0.3;
  filter: grayscale(1);
}

.hs-device-item-v2.selected {
  opacity: 1;
  filter: none;
  border-color: var(--hs-primary);
  border-width: 2px;
}

.hs-device-img-v2 {
  height: 50px;
  object-fit: contain;
  margin-bottom: 10px;
}

.hs-device-name-v2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hs-text-dark);
  display: block;
}

/* Save Button */
.hs-save-btn-v2 {
  background: var(--hs-primary);
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.hs-save-btn-v2:hover {
  background: #430483;
  transform: scale(1.05);
}

.hs-save-btn-v2:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Inline Input */
.hs-inline-input-v2 {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 8px;
  font-family: var(--hs-font-family);
}

/* Threshold Table */
.hs-threshold-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.hs-threshold-table th {
  color: var(--hs-gray-500);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px;
  text-align: left;
}

.hs-threshold-table td {
  background: #fcfaff;
  padding: 12px 10px;
  border-top: 1px solid rgba(82, 27, 126, 0.05);
  border-bottom: 1px solid rgba(82, 27, 126, 0.05);
  transition: all 0.3s ease;
}

.hs-threshold-table td:first-child {
  border-left: 1px solid rgba(82, 27, 126, 0.05);
  border-radius: 10px 0 0 10px;
  font-weight: 700;
  color: var(--hs-primary);
  width: 25%;
}

.hs-threshold-table td:last-child {
  border-right: 1px solid rgba(82, 27, 126, 0.05);
  border-radius: 0 10px 10px 0;
  text-align: right;
}

.hs-badge-decimal {
  background: var(--hs-accent-purple-lighter);
  color: var(--hs-primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
}

.hs-threshold-metric-description {
  margin-top: 12px;
  padding: 12px;
  background: #f0f9ff;
  border-radius: 4px;
  animation: hs-fade-in 0.3s ease;
}

.hs-threshold-metric-description-text {
  color: var(--hs-gray-700);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0;
}

/* Admin Table */
.hs-admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.hs-admin-table th {
  color: var(--hs-gray-500);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px;
  text-align: left;
}

.hs-admin-table td {
  background: #fcfaff;
  padding: 12px 10px;
  border-top: 1px solid rgba(82, 27, 126, 0.05);
  border-bottom: 1px solid rgba(82, 27, 126, 0.05);
  transition: all 0.3s ease;
  vertical-align: middle;
}

.hs-admin-table td:first-child {
  border-left: 1px solid rgba(82, 27, 126, 0.05);
  border-radius: 10px 0 0 10px;
}

.hs-admin-table td:last-child {
  border-right: 1px solid rgba(82, 27, 126, 0.05);
  border-radius: 0 10px 10px 0;
}

.hs-admin-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 12px;
  border: 2px solid var(--hs-primary);
}

.hs-admin-default-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--hs-accent-purple-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  border: 2px solid var(--hs-primary);
}

.hs-admin-default-avatar .material-icons {
  color: var(--hs-primary);
  font-size: 18px;
}

.hs-admin-name-cell {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--hs-text-dark);
}

.hs-admin-email {
  color: var(--hs-gray-500);
  font-size: 0.9rem;
}

.hs-admin-date {
  color: var(--hs-text-muted);
  font-size: 0.85rem;
}

.hs-admin-delete-btn {
  opacity: 0;
  transition: opacity 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--hs-critical);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.hs-admin-delete-btn:hover {
  background: #fee;
}

.hs-admin-table tbody tr:hover .hs-admin-delete-btn {
  opacity: 1;
}

/* Modal Styles */
.hs-modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 20px 0;
}

.hs-modal-overlay.active {
  display: flex !important;
}

.hs-modal-container {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: visible;
  box-shadow: var(--hs-shadow-xl);
  margin: auto;
  position: relative;
}

.hs-modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--hs-gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hs-modal-header h3 {
  margin: 0;
  color: var(--hs-text-dark);
  font-size: 1.5rem;
  font-weight: 700;
}

.hs-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--hs-gray-500);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

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

.hs-modal-body {
  padding: 24px;
  max-height: calc(90vh - 180px);
  overflow-y: auto;
  overflow-x: hidden;
}

.hs-modal-footer {
  padding: 24px;
  border-top: 1px solid var(--hs-gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Form Styles */
.hs-form-group {
  margin-bottom: 20px;
  position: relative;
}

.hs-form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--hs-text-dark);
  font-weight: 600;
  font-size: 0.9rem;
}

.hs-form-group input,
.hs-form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--hs-gray-200);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: var(--hs-font-family);
  box-sizing: border-box;
}

.hs-form-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23521b7e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
  cursor: pointer;
}

.hs-form-group select option {
  padding: 10px;
  font-size: 1rem;
  color: var(--hs-text-dark);
}

.hs-form-group input:focus,
.hs-form-group select:focus {
  outline: none;
  border-color: var(--hs-primary);
  box-shadow: 0 0 0 3px rgba(82, 27, 126, 0.1);
}

.hs-form-group input:disabled {
  background: var(--hs-gray-100);
  cursor: not-allowed;
}

.hs-btn-cancel {
  padding: 12px 24px;
  border: 2px solid var(--hs-gray-200);
  background: #fff;
  color: var(--hs-gray-500);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.hs-btn-cancel:hover {
  background: var(--hs-gray-100);
  border-color: var(--hs-gray-300);
}

.hs-btn-submit {
  padding: 12px 24px;
  border: none;
  background: var(--hs-primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.hs-btn-submit:hover {
  background: #6d2aa3;
}

.hs-btn-submit:disabled {
  background: var(--hs-gray-300);
  cursor: not-allowed;
}

/* Loading & Skeleton States */
.hs-row-updating {
  opacity: 0.5;
  pointer-events: none;
  transition: 0.3s;
}

.hs-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: hs-spin 0.6s linear infinite;
}

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

/* Metric Description Modal Specific */
#hs-metric-description-modal .hs-modal-container {
  max-width: 500px;
}

#hs-metric-description-modal .hs-metric-description-content {
  color: var(--hs-gray-700);
  line-height: 1.6;
  font-size: 0.95rem;
}

#hs-metric-description-modal .hs-metric-icon-display {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--hs-gray-50);
  border-radius: 8px;
}

#hs-metric-description-modal .hs-metric-icon-display i {
  font-size: 24px;
  color: var(--hs-primary);
}

#hs-metric-description-modal .hs-metric-icon-display .metric-name {
  font-weight: 700;
  color: var(--hs-text-dark);
  font-size: 1.1rem;
}

/* ===== METRIC DASHBOARD STYLES ===== */
#hs-dashboard-wrapper {
  font-family: var(--hs-font-family);
  background: linear-gradient(135deg,  #faf8fc 0%, #ffffff 100%);
  min-height: 100vh;
  padding-bottom: 40px;
}

.hs-dashboard-header {
  background: linear-gradient(165deg, rgba(82, 27, 126, 0.05) 0%, rgba(174, 152, 253, 0) 80%);
  border-bottom: 1px solid rgba(82, 27, 126, 0.1);
  padding: 30px 0 25px;
  margin-bottom: 30px;
}

.hs-header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.hs-user-info {
  margin-bottom: 20px;
}

.hs-back-nav {
  margin-bottom: 12px;
}

.hs-back-nav a {
  color: var(--hs-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.hs-back-nav a:hover {
  opacity: 0.7;
}

.hs-user-header h1 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 8px 0;
  line-height: 1.2;
}

.hs-gradient-text {
  background: linear-gradient(90deg, #430483 0%, #ae98fd 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hs-thin {
  font-weight: 300;
  color: var(--hs-gray-700);
}

.hs-subtitle {
  color: var(--hs-gray-500);
  font-size: 0.95rem;
  margin: 0;
}

.hs-time-controls {
  background: white;
  border: 1px solid var(--hs-gray-200);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.hs-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.hs-control-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--hs-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hs-custom-input {
  padding: 10px 14px;
  border: 1px solid var(--hs-gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--hs-gray-700);
  background: white;
  transition: all 0.2s;
}

.hs-custom-input:focus {
  outline: none;
  border-color: var(--hs-primary);
  box-shadow: 0 0 0 3px rgba(82, 27, 126, 0.1);
}

.hs-quick-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.hs-btn-filter {
  background: white;
  border: 1px solid var(--hs-gray-200);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hs-gray-700);
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hs-btn-filter:hover {
  background: var(--hs-accent-purple-light);
  border-color: var(--hs-primary);
  color: var(--hs-primary);
}

.hs-threshold-legend {
  background: white;
  border: 1px solid var(--hs-gray-200);
  border-radius: 8px;
  padding: 12px 18px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.hs-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.hs-legend-label {
  font-weight: 600;
  color: var(--hs-gray-600);
}

.hs-legend-line {
  width: 30px;
  height: 2px;
  border-radius: 1px;
}

.hs-legend-line.critical {
  background: var(--hs-critical);
}

.hs-legend-line.warning {
  background: var(--hs-warning);
}

.hs-legend-arrow {
  font-weight: 700;
  font-size: 1rem;
}

.hs-content-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.hs-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 24px;
}

.hs-loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--hs-gray-500);
}

.hs-loading-state p {
  margin-top: 16px;
  font-size: 1rem;
  font-weight: 500;
}

.hs-dashboard-footer {
  max-width: 1400px;
  margin: 40px auto 0;
  padding: 20px;
  text-align: center;
  color: var(--hs-gray-500);
  font-size: 0.85rem;
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */
@media (max-width: 1024px) {
  .hs-container {
    padding: 0 16px;
  }

  .hs-header-flex {
    flex-direction: column;
    align-items: flex-start;
  }

  .hs-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hs-search-container {
    flex: 1;
    max-width: 100%;
  }

  .hs-filter-dropdown {
    width: 380px;
  }

  .hs-programs-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .hs-home-header {
    padding: 40px 0;
  }

  .hs-main-title {
    font-size: 1.8rem;
  }

  .hs-header-actions {
    flex-direction: column;
    gap: 10px;
  }

  .hs-search-container,
  .hs-btn-primary,
  .hs-btn-secondary {
    width: 100%;
  }

  .hs-filter-dropdown {
    width: calc(100vw - 40px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .hs-programs-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 576px) {
  .hs-home-header {
    padding: 30px 0;
  }

  .hs-main-title {
    font-size: 1.5rem;
  }

  .hs-program-card {
    padding: 20px;
    min-height: 240px;
  }

  .hs-filter-dropdown {
    padding: 16px;
  }

  .hs-quick-filters-row {
    gap: 6px;
  }
}
