/* Admin Specific Styles */

.admin-nav {
  border-bottom: 2px solid var(--accent-primary);
}

.filters-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: center;
}

.filters-bar .search-input {
  flex: 1 1 auto;
  min-width: 200px;
}

.filters-bar .status-select {
  flex: 0 0 auto;
  width: 180px;
}

/* Ensure consistent height across action bars */
.header-actions .search-input,
.header-actions .form-select,
.header-actions .btn {
  height: 38px !important;
  box-sizing: border-box !important;
  margin-bottom: 0 !important;
}

.bulk-action-select {
  min-width: 200px;
}

#cveSyncStatus {
  text-align: right;
  font-size: 0.85rem;
}

/* Ensure nav-user buttons (like Logout) have correct specificity/styles */
.nav-user .btn {
  background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
  color: white;
  box-shadow: var(--shadow-md);
}

.nav-user .btn:hover {
  background: linear-gradient(135deg, var(--color-primary-600), var(--color-primary-700));
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.nav-user .btn.btn-logout {
  background: linear-gradient(135deg, var(--color-critical), #dc2626);
  color: white;
  box-shadow: var(--shadow-md);
}

.nav-user .btn.btn-logout:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  box-shadow: var(--shadow-lg);
}

/* =============================================================================
   Dashboard Layout
   ============================================================================= */

.dashboard {
  padding: var(--spacing-8, 2rem) 0;
  min-height: calc(100vh - var(--header-height, 64px));
}

.container-full {
  max-width: 100% !important;
  padding-left: var(--spacing-6, 1.5rem) !important;
  padding-right: var(--spacing-6, 1.5rem) !important;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-8, 2rem);
  flex-shrink: 0;
}

/* =============================================================================
   Full Height Page Layout utility (for users, licenses, probes, payments, database, cve)
   ============================================================================= */

.full-height-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height, 64px));
  /* Override default padding to prevent scroll if possible */
  padding-bottom: 0;
}

.full-height-page .container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 250px;
  padding-bottom: var(--spacing-8, 2rem);
}

.full-height-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 250px;
  /* Important for deeply nested flex children */
  overflow: hidden;
  margin-bottom: var(--spacing-6, 1.5rem);
}

.full-height-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 250px;
  overflow: hidden;
}

.full-height-card .table-scroll-container,
.full-height-card-body .table-scroll-container {
  flex: 1;
  min-height: 250px;
  max-height: none;
  /* override default max-height */
  overflow: auto;
}

/* =============================================================================
   Stats Grid - Dashboard Cards
   ============================================================================= */

.stats-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

.stats-grid-6 {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

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

@media (max-width: 640px) {
  .stats-grid-6 {
    grid-template-columns: 1fr !important;
  }
}

.stats-grid-5 {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

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

@media (max-width: 640px) {
  .stats-grid-5 {
    grid-template-columns: 1fr !important;
  }
}

.stats-grid .stat-card,
.stats-grid-5 .stat-card,
.stats-grid-6 .stat-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
}

.stats-grid .stat-card:has(.card-header),
.stats-grid-5 .stat-card:has(.card-header),
.stats-grid-6 .stat-card:has(.card-header) {
  flex-direction: column !important;
  align-items: stretch;
}

.stats-grid .stat-card:hover {
  box-shadow: var(--shadow-lg, 0 10px 15px rgba(0, 0, 0, 0.1));
}

.stat-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg, 0.5rem);
  flex-shrink: 0;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.stat-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.stat-icon.orange {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.stat-icon.black {
  background: rgba(0, 0, 0, 0.15);
  color: #000000;
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.stat-icon.yellow {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.stat-icon.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: var(--font-size-2xl, 1.5rem);
  font-weight: var(--font-weight-bold, 700);
  color: var(--color-text, #1f2937);
  line-height: 1.2;
}

.stat-label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #6b7280);
}

.stat-critical .stat-label {
  color: var(--color-critical) !important;
  font-weight: 600;
}

.stat-high .stat-label {
  color: var(--color-high) !important;
  font-weight: 600;
}

.stat-medium .stat-label {
  color: var(--color-medium) !important;
  font-weight: 600;
}

.stat-low .stat-label {
  color: var(--color-low) !important;
  font-weight: 600;
}

.stat-recent .stat-label {
  color: var(--color-success) !important;
  font-weight: 600;
}

.stat-total .stat-label {
  color: var(--color-primary-500) !important;
  font-weight: 600;
}

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

/* =============================================================================
   Text
   ============================================================================= */

.text-white {
  color: white !important;
}

.text-red {
  color: red !important;
}

/* =============================================================================
   Charts Section
   ============================================================================= */

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 3fr;
  /* Give even more space to the evolution chart */
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {

  /* Lower breakpoint to keep side-by-side on tablets/laptops */
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

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

.chart-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.grade-container {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.grade-label {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-muted, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.grade-value {
  font-size: 5rem;
  font-weight: 900;
  line-height: 0.9;
  color: var(--color-text);
}

.grade-value-sm {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Specific Grade Colors */
.grade-value.grade-A,
.grade-value.grade-A-plus,
.grade-value.grade-A-minus {
  color: #22c55e !important;
}

.grade-value.grade-B,
.grade-value.grade-B-plus,
.grade-value.grade-B-minus {
  color: #eab308 !important;
}

.grade-value.grade-C,
.grade-value.grade-C-plus,
.grade-value.grade-C-minus {
  color: #f97316 !important;
}

.grade-value.grade-D,
.grade-value.grade-D-plus,
.grade-value.grade-D-minus {
  color: #ef4444 !important;
}

.grade-value.grade-E,
.grade-value.grade-E-plus,
.grade-value.grade-E-minus {
  color: #b91c1c !important;
}

.grade-value.grade-F,
.grade-value.grade-F-plus,
.grade-value.grade-F-minus {
  color: #666666 !important;
}

.chart-container {
  position: relative;
  width: 100%;
  flex: 1;
  /* Allow it to fill space */
  min-height: 0;
  min-width: 0;
  /* Important for grid/flex overflow */
}

.doughnut-container {
  height: 150px;
  flex: 0 0 auto;
  /* Stop it from growing/shrinking */
  /* Removed display: flex to let Chart.js handle the canvas size naturally */
}

.line-container {
  height: 240px;
  flex: 0 0 auto;
  /* Stop it from growing/shrinking */
}

/* =============================================================================
   License Card
   ============================================================================= */

.license-card {
  margin-bottom: var(--spacing-8, 2rem);
}

.license-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-4, 1rem);
}

.license-content {
  margin-bottom: var(--spacing-4, 1rem);
}

.license-progress {
  margin-top: var(--spacing-4, 1rem);
}

.license-actions {
  display: flex;
  justify-content: flex-end;
}

/* =============================================================================
   Recent Scans Section
   ============================================================================= */

.recent-scans {
  margin-top: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-4, 1rem);
}

.section-header h2 {
  font-size: var(--font-size-1xl, 1.25rem);
}

/* =============================================================================
   Settings Grid
   ============================================================================= */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--spacing-6, 1.5rem);
}

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

/* =============================================================================
   Scan Details Page
   ============================================================================= */

.details-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--spacing-6, 1.5rem);
}

.details-header .actions {
  display: flex;
  gap: var(--spacing-3, 0.75rem);
}

.scan-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-4, 1rem);
  margin-bottom: var(--spacing-8, 2rem);
}

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

.meta-item {
  background: var(--glass-bg, rgba(255, 255, 255, 0.05));
  padding: var(--spacing-4, 1rem);
  border-radius: var(--radius-lg, 0.5rem);
  border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
}

.meta-label {
  display: block;
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--color-text-muted, #9ca3af);
  margin-bottom: var(--spacing-1, 0.25rem);
}

.meta-value {
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: var(--font-weight-semibold, 600);
}

/* =============================================================================
   Plugin Scores Section
   ============================================================================= */

.scores-layout-merged {
  display: grid;
  grid-template-columns: 250px 1fr 1fr;
  gap: 1.5rem;
  align-items: stretch;
}

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

.global-score-card {
  display: flex !important;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem !important;
}

.radar-chart-card {
  padding: 1.5rem;
  position: relative;
}

.card-header-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 5;
}

.score-card {
  padding: 1.5rem;
}

.score-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.score-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.score-grade {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.score-subtext {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.score-val-small {
  font-weight: 700;
  color: var(--color-text);
}

/* =============================================================================
   Findings Section
   ============================================================================= */

.findings-section h2 {
  margin-bottom: var(--spacing-4, 1rem);
}

.finding-card {
  margin-bottom: var(--spacing-4, 1rem);
  border-left: 4px solid var(--color-border, #e5e7eb);
}

.finding-card.finding-critical {
  border-left-color: var(--color-critical, #000000);
}

.finding-card.finding-high {
  border-left-color: var(--color-high, #ef4444);
}

.finding-card.finding-medium {
  border-left-color: var(--color-medium, #f97316);
}

.finding-card.finding-low {
  border-left-color: var(--color-low, #eab308);
}

.finding-card.finding-info {
  border-left-color: var(--color-info, #3b82f6);
}

/* Findings Summary Badges */
.findings-summary {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.finding-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

.finding-count.critical {
  background-color: var(--color-critical, #000000);
}

.finding-count.high {
  background-color: var(--color-high, #ef4444);
}

.finding-count.medium {
  background-color: var(--color-medium, #f97316);
}

.finding-count.low {
  background-color: var(--color-low, #eab308);
}

.finding-count.info {
  background-color: var(--color-info, #3b82f6);
}

/* =============================================================================
   Utility Classes
   ============================================================================= */

.hidden {
  display: none !important;
}

.flex-end {
  display: flex;
  justify-content: flex-end;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

/* Notification Badge */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 10px;
  background: var(--color-error, #ef4444);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: super;
  margin-left: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.badge-notification {
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Renewal button pulse */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.6);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(234, 179, 8, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(234, 179, 8, 0);
  }
}

.btn-warning {
  background: linear-gradient(135deg, #eab308, #f59e0b) !important;
  color: #1a1a2e !important;
  border: none;
  font-weight: 600;
}

.btn-warning:hover {
  background: linear-gradient(135deg, #ca8a04, #d97706) !important;
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Renewal page: remove bottom spacing from pricing cards (no CTA buttons) */
.renewal-header~.pricing-grid .pricing-features {
  margin-bottom: 0;
}

.renewal-header~.pricing-grid .pricing-card {
  padding-bottom: var(--spacing-6);
}

/* Info tooltip icon on form labels */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  font-size: 9px;
  font-style: normal;
  line-height: 1;
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  cursor: help;
  vertical-align: super;
  margin-left: 2px;
  transition: all var(--transition-fast);
}

.info-tip:hover {
  background: var(--color-primary-500);
  color: white;
  border-color: var(--color-primary-500);
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

.mt-12 {
  margin-top: 3rem;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mb-12 {
  margin-bottom: 3rem;
}

.text-success {
  color: var(--color-success, #22c55e);
}

.text-warning {
  color: var(--color-warning, #eab308);
}

.text-error {
  color: var(--color-error, #ef4444);
}

.text-info {
  color: var(--color-info, #3b82f6);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2, 0.5rem);
  margin-top: var(--spacing-6, 1.5rem);
}

/* =============================================================================
   Probes Page Styles
   ============================================================================= */

/* Badge and Tag Styles */
.feature-tier {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.tier-minimal {
  background: #e0f2e9;
  color: #0d5132;
}

.tier-selenium {
  background: #e0e7ff;
  color: #3730a3;
}

.tier-aiproxy {
  background: #fef3c7;
  color: #92400e;
}

.plugin-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.plugin-tag {
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  background: #f3f4f6;
  color: #4b5563;
}

.plugin-tag.enabled {
  background: #d1fae5;
  color: #065f46;
}

.plugin-tag.disabled {
  background: #fce7f3;
  color: #9d174d;
  opacity: 0.6;
}

/* Warning Box */
.warning-box {
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
}

.warning-box h4 {
  color: #92400e;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

/* Install Modal Steps */
.install-steps {
  background: #f9fafb;
  border-radius: 6px;
  padding: 1rem;
  margin-top: 1rem;
}

.install-steps ol {
  padding-left: 1.5rem;
  margin-bottom: 0;
}

.install-steps li {
  margin-bottom: 0.5rem;
}

/* Form Elements */
.form-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: #f3f4f6;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.checkbox-group label.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-group input[type="checkbox"] {
  margin: 0;
}

/* =============================================================================
   Refactored Inline Styles
   ============================================================================= */

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

.modal-md {
  max-width: 600px;
}

.modal-lg {
  max-width: 950px;
}

.modal-xl {
  max-width: 1150px;
}

.install-command-container {
  margin-top: 1.5rem;
}

.code-block-display {
  display: block;
  padding: 1rem;
  background: #1f2937;
  color: #f9fafb;
  border-radius: 6px;
  font-size: 0.85rem;
  word-break: break-all;
}

.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.modal-divider {
  margin: 1rem 0;
  border-color: var(--border-color, #e5e7eb);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.text-xs {
  font-size: 0.8rem;
}

.input-sm-width {
  width: 100px;
}

.mr-2 {
  margin-right: 10px;
}

.mr-auto {
  margin-right: auto;
}

.modal-footer-custom {
  display: flex;
  justify-content: flex-end;
}

/* =============================================================================
   Table Sorting and Scrolling
   ============================================================================= */

.table-scroll-container {
  max-height: 500px;
  min-height: 300px;
  overflow-y: auto;
  border-radius: var(--radius-lg, 0.5rem);
  box-shadow: var(--shadow-sm);
  position: relative;
  /* Context for sticky header */
}

/* Ensure the table itself takes full width */
.table-scroll-container table {
  width: 100%;
  border-collapse: separate;
  /* Required for border-radius on headers */
  border-spacing: 0;
}

/* Sticky Header */
.table-scroll-container thead tr {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(90deg, var(--color-primary-900), var(--color-primary-500));
}

.table-scroll-container thead th {
  background: transparent;
  color: white;
  /* Above body content */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  /* Separator shadow */
  padding-top: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

/* Rounded corners for the header row */
.table-scroll-container thead th:first-child {
  border-top-left-radius: var(--radius-lg, 0.5rem);
}

.table-scroll-container thead th:last-child {
  border-top-right-radius: var(--radius-lg, 0.5rem);
}

/* Sortable Headers */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem !important;
  /* Space for icon */
  transition: background-color 0.2s, color 0.2s;
}

/*
th[data-sort]:hover {
  background-color: var(--color-bg-hover, #f3f4f6);
  color: var(--color-primary-600);
}*/

/* Sort Icons */
th[data-sort]::after {
  content: '\2195';
  /* Up/Down arrow */
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.3;
  font-family: system-ui, -apple-system, sans-serif;
}

th[data-sort]:hover::after {
  opacity: 0.7;
}

th[data-sort].asc::after {
  content: '\2191';
  /* Up arrow */
  opacity: 1;
  color: var(--color-primary-50);
}

th[data-sort].desc::after {
  content: '\2193';
  /* Down arrow */
  opacity: 1;
  color: var(--color-primary-50);
}

/* =============================================================================
   Layout Fixes
   ============================================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* =============================================================================
   Modal Overlay (Settings - Ticket Detail Modal)
   ============================================================================= */

.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);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay .modal {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  opacity: 1;
  visibility: visible;
  background: var(--color-bg, #ffffff);
  border-radius: var(--radius-xl, 0.75rem);
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl, 0 25px 50px rgba(0, 0, 0, 0.25));
  padding: 1.5rem;
}

/* Ticket Conversation Styles */
.ticket-conversation {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.message-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  position: relative;
  font-size: 0.9rem;
}

.message-user {
  background: var(--color-bg-secondary);
  align-self: flex-start;
  border-top-left-radius: 0;
}

.message-admin {
  background: rgba(59, 130, 246, 0.1);
  /* Primary color light */
  border: 1px solid rgba(59, 130, 246, 0.2);
  align-self: flex-end;
  border-top-right-radius: 0;
}

.message-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.message-content {
  white-space: pre-wrap;
}

/* Large Badge for Summary Counts */
.badge-lg {
  font-size: 1rem;
  padding: 0.5rem 1rem;
}


.summary-badges {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Team Management */
.team-table-user {
  display: flex;
  align-items: center;
}

.team-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  font-weight: bold;
  color: var(--color-primary);
}

.team-user-info {
  display: flex;
  flex-direction: column;
}

.team-user-name {
  font-weight: 500;
}

.team-user-email {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.team-actions-cell {
  width: 100px;
}

.team-row-me {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Modal and Layout Utilities */
.modal-footer-flex {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.modal-footer-flex .btn:not(:last-child) {
  margin-right: 0.5rem;
}

.mt-1-5 {
  margin-top: 1.5rem;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex {
  display: flex;
}

.gap-small {
  gap: 0.25rem;
}

.gap-medium {
  gap: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

/* =============================================================================
   EASM Layout & Sidebar
   ============================================================================= */

.easm-section-copy {
  min-width: 0;
}

.easm-header {
  margin-left: calc(250px + 2rem);
}

.easm-layout {
  display: flex;
  gap: 2rem;
  align-items: stretch;
  height: calc(100vh - 160px);
}

.easm-sidebar {
  flex: 0 0 250px;
  position: sticky;
  top: 100px;
  align-self: flex-start;
  height: fit-content;
  border-radius: var(--radius-lg, 0.5rem);
  box-shadow: var(--shadow-lg) !important;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.easm-menu-item {
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md, 0.375rem);
  background: transparent;
  border: none;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.easm-menu-item:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text);
}

.easm-menu-item.active {
  background: var(--color-primary-50, #eff6ff);
  color: var(--color-primary-600, #2563eb);
  font-weight: 600;
}

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

@media (max-width: 1280px) {
  .easm-header,
  .easm-content {
    margin-left: 0;
  }
}

@media (max-width: 1024px) {
  .easm-layout {
    flex-direction: column;
  }

  .easm-sidebar {
    flex: none;
    width: 100%;
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }

  .easm-menu-item {
    white-space: nowrap;
    width: auto;
  }
}

.easm-view {
  display: none;
}

.easm-view.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.easm-findings-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.easm-findings-stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 180px;
}

.easm-findings-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted, #6b7280);
}

.easm-findings-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.easm-findings-stat-copy {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted, #6b7280);
  line-height: 1.45;
}

/* Global Table Row Limits */
.table-scroll-container tbody tr {
  height: 60px;
  max-height: 60px;
}
.table-scroll-container tbody td {
  max-height: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.scan-detail-table-container {
  max-height: 600px;
  overflow-y: auto;
}

.table tbody tr {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  white-space: nowrap;
}

.easm-findings-summary-hint {
  margin-bottom: 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md, 0.375rem);
  background: var(--color-surface, rgba(15, 23, 42, 0.03));
}

.easm-section-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.easm-finding-row-muted {
  opacity: 0.78;
}

.easm-finding-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.easm-finding-title-link,
.easm-finding-target-link {
  color: var(--color-primary, #2563eb);
  text-decoration: none;
  font-weight: 600;
}

.easm-finding-title-link:hover,
.easm-finding-target-link:hover {
  text-decoration: underline;
}

.easm-finding-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.easm-finding-preview {
  font-size: 0.84rem;
  color: var(--color-text-muted, #6b7280);
  line-height: 1.4;
  white-space: normal;
}

.easm-finding-target-meta {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--color-text-muted, #6b7280);
}

.easm-finding-surface-component {
  font-weight: 600;
  word-break: break-word;
}

.easm-finding-surface-meta {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--color-text-muted, #6b7280);
}

.easm-finding-cves {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.easm-finding-cve-link,
.easm-finding-cve-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
}

.easm-finding-cve-link {
  background: rgba(37, 99, 235, 0.08);
  color: var(--color-primary, #2563eb);
}

.easm-finding-cve-link:hover {
  background: rgba(37, 99, 235, 0.14);
}

.easm-finding-cve-more {
  background: rgba(107, 114, 128, 0.12);
  color: var(--color-text-muted, #6b7280);
}

.easm-stats-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.easm-card-scan {
  width: 350px;
  flex: 0 0 auto;
}

.easm-overview-card {
  width: 320px;
  flex: 0 0 auto;
  flex-direction: row !important;
}

.easm-vuln-card {
  width: 320px;
  flex: 0 0 auto;
}

.easm-improvement-card {
  flex: 1;
  min-width: 250px;
}

@media (max-width: 1024px) {
  .easm-card-scan,
  .easm-overview-card,
  .easm-vuln-card,
  .easm-improvement-card {
    width: 100%;
    flex: 1 1 auto;
  }
}

.easm-map-card-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.easm-map-container {
  min-height: 500px;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  flex: 1; /* Ensure it stretches in flex containers */
  background-color: var(--color-bg, #ffffff);
}

#easmGraph {
  width: 100%;
  height: 100%;
  flex-grow: 1;
  min-height: 0;
}

/* Fix Fullscreen layout collapse for VisJS */
#easm-view-map:fullscreen {
  background-color: var(--color-bg, #ffffff);
  display: flex !important;
  flex-direction: column !important;
}
#easm-view-map:fullscreen #easmGraph {
  height: 100vh !important;
}

#easm-view-map:-webkit-full-screen {
  background-color: var(--color-bg, #ffffff);
  display: flex !important;
  flex-direction: column !important;
}
#easm-view-map:-webkit-full-screen #easmGraph {
  height: 100vh !important;
}

#easm-view-map:-ms-fullscreen {
  background-color: var(--color-bg, #ffffff);
  display: flex !important;
  flex-direction: column !important;
}
#easm-view-map:-ms-fullscreen #easmGraph {
  height: 100vh !important;
}

.easm-map-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

.easm-map-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.easm-map-stat {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  background: var(--color-surface, rgba(15, 23, 42, 0.04));
}

.easm-map-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.easm-map-stat-label {
  margin-top: 0.25rem;
  color: var(--color-text-muted, #6b7280);
  font-size: 0.875rem;
}

.easm-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.easm-map-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--color-background, #fff);
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.easm-map-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.easm-map-card-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.easm-map-card-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  white-space: nowrap;
}

.easm-map-card-subtitle {
  color: var(--color-text-muted, #6b7280);
  font-size: 0.875rem;
}

.easm-map-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.easm-map-group {
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
}

.easm-map-group h4 {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
}

.easm-map-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.easm-map-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.easm-map-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--color-primary-light, rgba(59, 130, 246, 0.12));
  color: var(--color-primary, #2563eb);
  font-size: 0.75rem;
  font-weight: 600;
}

.easm-map-item-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.easm-map-item-label {
  font-weight: 600;
  word-break: break-word;
}

.easm-map-item-meta {
  color: var(--color-text-muted, #6b7280);
  font-size: 0.82rem;
}

.easm-map-empty {
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: var(--color-text-muted, #6b7280);
}

/* EASM Target Scanning Indicator */
.easm-scanning-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success, #22c55e);
  margin-left: 6px;
  vertical-align: middle;
  animation: easm-pulse 1.5s ease-in-out infinite;
}

@keyframes easm-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

.easm-target-ip {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted, #9ca3af);
  margin-top: 2px;
  font-weight: 400;
}

/* =============================================================================
   Responsive Breakpoints
   Mobile (≤768px) | 15.5" Laptop (base) | 20"+ Monitor (≥1920px)
   ============================================================================= */

/* ----- Large screens (20"+ / ≥1920px) ----- */

@media (min-width: 1920px) {

  /* General layout */
  .dashboard {
    padding: var(--spacing-12, 3rem) 0;
  }
  .container-full {
    padding-left: var(--spacing-10, 2.5rem) !important;
    padding-right: var(--spacing-10, 2.5rem) !important;
  }
  .section-header h2 {
    font-size: var(--font-size-2xl, 1.5rem);
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 2rem;
  }
  .stats-grid-6 {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 2rem;
  }
  .stats-grid-5 {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 2rem;
  }

  /* Charts */
  .charts-grid {
    grid-template-columns: 1fr 4fr;
    gap: 2rem;
  }
  .doughnut-container {
    height: 200px;
  }
  .line-container {
    height: 320px;
  }

  /* Tables */
  .table-scroll-container {
    max-height: 700px;
    min-height: 400px;
  }
  .table-scroll-container tbody tr {
    height: 70px;
    max-height: 70px;
  }
  .table-scroll-container tbody td {
    max-width: 350px;
    font-size: 0.95rem;
  }
  .table-scroll-container thead th {
    padding-top: 1.15rem;
    padding-bottom: 1.15rem;
    font-size: 0.95rem;
  }

  /* EASM layout */
  .easm-sidebar {
    flex: 0 0 300px;
  }
  .easm-layout {
    gap: 2.5rem;
  }
  .easm-card-scan {
    width: 420px;
  }
  .easm-overview-card {
    width: 380px;
  }
  .easm-vuln-card {
    width: 380px;
  }

  /* EASM map */
  .easm-map-container {
    min-height: 700px;
  }
  .easm-map-grid {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }
}

/* ----- Mobile (≤768px) ----- */

@media (max-width: 768px) {

  /* General layout */
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .header-actions {
    flex-wrap: wrap;
    width: 100%;
  }
  .header-actions .search-input {
    width: 100%;
  }

  /* Stats grid */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  .stats-grid-5 {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  .stats-grid-6 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
  }

  /* Charts */
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .doughnut-container {
    height: 120px;
  }
  .line-container {
    height: 180px;
  }

  /* Tables */
  .table-scroll-container {
    max-height: 350px;
    min-height: 200px;
  }
  .table-scroll-container tbody tr {
    height: 50px;
    max-height: 50px;
  }
  .table-scroll-container tbody td {
    max-width: 150px;
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
  }
  .table-scroll-container thead th {
    padding: 0.6rem 0.5rem;
    font-size: 0.8rem;
  }

  /* EASM layout */
  .easm-header {
    margin-left: 0;
    flex-direction: column;
    gap: 1rem;
  }
  .easm-layout {
    flex-direction: column;
    height: auto;
  }
  .easm-sidebar {
    flex: none;
    width: 100%;
    position: static;
    flex-direction: row;
    overflow-x: auto;
  }
  .easm-menu-item {
    white-space: nowrap;
    width: auto;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }
  .easm-stats-container {
    flex-direction: column;
  }
  .easm-card-scan,
  .easm-overview-card,
  .easm-vuln-card,
  .easm-improvement-card {
    width: 100%;
    flex: 1 1 auto;
  }

  /* EASM map */
  .easm-map-container {
    min-height: 300px;
  }
  .easm-map-grid {
    grid-template-columns: 1fr;
  }
  .easm-map-summary {
    grid-template-columns: repeat(2, 1fr);
  }
}
