
    /* ========================================
       CSS VARIABLES
       ======================================== */
:root {
    --status-healthy: #28a745;
    --status-healthy-bg: rgba(40, 167, 69, 0.1);
    --status-caution: #ffc107;
    --status-caution-bg: rgba(255, 193, 7, 0.15);
    --status-at-risk: #dc3545;
    --status-at-risk-bg: rgba(220, 53, 69, 0.15);
    --status-degraded: #ffc107;
    --status-degraded-bg: rgba(255, 193, 7, 0.1);
    --status-warning: #fd7e14;
    --status-warning-bg: rgba(253, 126, 20, 0.1);
    --status-critical: #dc3545;
    --status-critical-bg: rgba(220, 53, 69, 0.1);
    --status-info: #0dcaf0;
    --status-info-bg: rgba(13, 202, 240, 0.1);
    --chart-primary: #0d6efd;
    --chart-secondary: #6c757d;
    --bg-page: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --gauge-track: #e9ecef;
    --gauge-size: 180px;
    --gauge-stroke-width: 14px;
    --transition-base: 300ms ease-in-out;
}

    .dark-mode {
      --bg-page: #121212;
      --bg-card: #1e1e1e;
      --text-primary: #f8f9fa;
      --text-muted: #adb5bd;
      --border-color: #495057;
    }

    /* ========================================
       PAGE LAYOUT
       ======================================== */
    body {
      background-color: var(--bg-page);
      color: var(--text-primary);
      transition: background-color var(--transition-base), color var(--transition-base);
    }

    .demo-header {
      background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
      color: white;
      padding: 2rem 0;
      margin-bottom: 2rem;
    }

    .demo-header .badge {
      font-size: 0.7rem;
      vertical-align: middle;
    }

    .theme-toggle {
      cursor: pointer;
      padding: 0.5rem;
      border-radius: 0.375rem;
      transition: background-color var(--transition-base);
    }

    .theme-toggle:hover {
      background: rgba(255, 255, 255, 0.1);
    }

    /* ========================================
       KPI CARD
       ======================================== */
    .kpi-card {
      background: var(--bg-card);
      border: 1px solid var(--border-color);
      border-radius: 0.5rem;
      overflow: hidden;
      transition: box-shadow var(--transition-base);
      height: 100%;
    }

    .kpi-card:hover {
      box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
    }

    .kpi-card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.75rem 1rem;
      border-bottom: 1px solid var(--border-color);
      background: rgba(0, 0, 0, 0.02);
    }

    .dark-mode .kpi-card-header {
      background: rgba(255, 255, 255, 0.02);
    }

    .kpi-title {
      font-weight: 600;
      font-size: 0.9rem;
      color: var(--text-primary);
    }

    .kpi-card-body {
      padding: 1.5rem;
    }

    .kpi-card-footer {
      padding: 0.75rem 1rem;
      border-top: 1px solid var(--border-color);
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    /* ========================================
       PERIOD SELECTOR
       ======================================== */
    .period-selector .dropdown-toggle {
      font-size: 0.75rem;
      padding: 0.25rem 0.5rem;
      background: var(--bg-page);
      border: 1px solid var(--border-color);
      border-radius: 0.25rem;
      color: var(--text-muted);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      transition: all var(--transition-base);
    }

    .period-selector .dropdown-toggle:hover {
      background: var(--border-color);
      color: var(--text-primary);
    }

    .period-selector .dropdown-menu {
      font-size: 0.8rem;
      min-width: 140px;
      background: var(--bg-card);
      border-color: var(--border-color);
    }

    .period-selector .dropdown-item {
      padding: 0.5rem 0.75rem;
      color: var(--text-primary);
    }

    .period-selector .dropdown-item:hover {
      background: var(--bg-page);
    }

    .period-selector .dropdown-item.active {
      background: #0d6efd;
      color: white;
    }

    .period-selector .dropdown-item i {
      width: 1rem;
      margin-right: 0.5rem;
      opacity: 0.6;
    }

    /* ========================================
       NUMERIC CARD SPECIFIC
       ======================================== */
    .kpi-card-numeric .kpi-card-body {
      text-align: center;
    }

    .kpi-value {
      font-size: 3.5rem;
      font-weight: 700;
      line-height: 1.2;
      color: var(--text-primary);
    }

    .kpi-label {
      font-size: 0.875rem;
      color: var(--text-muted);
      margin-top: 0.25rem;
    }

    /* ========================================
       TREND INDICATOR
       ======================================== */
    .kpi-trend {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      font-size: 0.9rem;
      margin-top: 0.5rem;
      padding: 0.35rem 0.75rem;
      border-radius: 0.25rem;
    }

    .kpi-trend.trend-up {
      color: var(--status-healthy);
      background: var(--status-healthy-bg);
    }

    .kpi-trend.trend-down {
      color: var(--status-critical);
      background: var(--status-critical-bg);
    }

    .kpi-trend.trend-stable {
      color: var(--text-muted);
      background: rgba(108, 117, 125, 0.1);
    }

.trend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.trend-up {
    color: var(--status-healthy);
}

.trend-down {
    color: var(--status-critical);
}

.trend-flat {
    color: var(--text-muted);
}

    /* ========================================
       COMPARISON VALUE
       ======================================== */
    .kpi-comparison {
      display: flex;
      justify-content: center;
      gap: 2rem;
      margin-top: 1rem;
      font-size: 0.85rem;
    }

    .kpi-comparison-item {
      text-align: center;
    }

    .kpi-comparison-value {
      font-weight: 600;
      font-size: 2.0rem;
      color: var(--text-primary);
    }

    .kpi-comparison-label {
      color: var(--text-muted);
      font-size: 0.75rem;
    }

    /* ========================================
       SPARKLINE CARD
       ======================================== */
    .sparkline-container {
      position: relative;
      height: 120px;
      margin-top: 1rem;
    }

    /* ========================================
       BREAKDOWN GRID
       ======================================== */
    .breakdown-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1rem;
      margin-top: 1rem;
    }

    .breakdown-item {
      text-align: center;
      padding: 1rem;
      background: var(--bg-page);
      border-radius: 0.5rem;
    }

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

    .breakdown-label {
      font-size: 0.75rem;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    /* ========================================
       DATA TABLE
       ======================================== */
    .data-table {
      font-size: 0.85rem;
    }

    .data-table th {
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      font-size: 0.7rem;
      letter-spacing: 0.05em;
      border-bottom: 2px solid var(--border-color);
      white-space: nowrap;
    }

    .data-table td {
      vertical-align: middle;
      border-color: var(--border-color);
    }

    .collector-name {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      font-weight: 500;
    }

    .collector-dot {
      width: 10px;
      height: 10px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.25rem 0.5rem;
      border-radius: 0.25rem;
      font-size: 0.7rem;
      font-weight: 500;
    }

    .status-badge.active {
      background: var(--status-healthy-bg);
      color: var(--status-healthy);
    }

    .status-badge.inactive {
      background: var(--status-critical-bg);
      color: var(--status-critical);
    }

    .status-badge.new {
      background: rgba(13, 110, 253, 0.15);
      color: #0d6efd;
    }

    /* ========================================
       TIMELINE
       ======================================== */
    .timeline {
      position: relative;
      padding-left: 2rem;
    }

    .timeline::before {
      content: '';
      position: absolute;
      left: 0.5rem;
      top: 0;
      bottom: 0;
      width: 2px;
      background: var(--border-color);
    }

    .timeline-item {
      position: relative;
      padding-bottom: 1rem;
    }

    .timeline-item::before {
      content: '';
      position: absolute;
      left: -1.5rem;
      top: 0.25rem;
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: var(--chart-primary);
      border: 2px solid var(--bg-card);
    }

    .timeline-item.new::before {
      background: var(--status-healthy);
    }

    .timeline-date {
      font-size: 0.7rem;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .timeline-content {
      font-size: 0.85rem;
      font-weight: 500;
    }

/* ========================================
       Data Collectors
       ======================================== */

.collector-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.collector-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    display: inline-block;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 500;
}

    .status-badge.active {
        background: rgba(25, 135, 84, 0.12);
        color: #198754;
    }

    .status-badge.new {
        background: rgba(13, 110, 253, 0.12);
        color: #0d6efd;
    }

    .status-badge.inactive {
        background: rgba(220, 53, 69, 0.12);
        color: #dc3545;
    }

/* ========================================
       THRESHOLD LEGEND
       ======================================== */
.threshold-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.threshold-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.threshold-line {
    width: 20px;
    height: 2px;
}

    .threshold-line.healthy {
        background: var(--status-healthy);
    }

    .threshold-line.critical {
        background: var(--status-critical);
    }

/* ========================================
       METRICS ROW
       ======================================== */
.metrics-row {
    display: flex;
    justify-content: space-around;
    
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 1rem;
}

.metric-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ========================================
       CHART CONTAINER
       ======================================== */
.chart-container {
    position: relative;
    height: 200px;
    width: 100%;
}

/* ========================================
       STATUS BADGE
       ======================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

    .status-badge.healthy {
        background: var(--status-healthy-bg);
        color: var(--status-healthy);
    }

    .status-badge.info {
        background: var(--status-info-bg);
        color: var(--status-info);
    }

    .status-badge.warning {
        background: var(--status-warning-bg);
        color: var(--status-warning);
    }

    .status-badge.caution {
        background: var(--status-caution-bg);
        color: var(--status-caution);
    }

    .status-badge.at-risk {
        background: var(--status-at-risk-bg);
        color: var(--status-at-risk);
    }

    .status-badge.degraded {
        background: var(--status-degraded-bg);
        color: var(--status-degraded);
    }

    .status-badge.critical {
        background: var(--status-critical-bg);
        color: var(--status-critical);
    }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* ========================================
       GAUGE COMPONENT
       ======================================== */
.gauge-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-svg {
    width: var(--gauge-size);
    height: var(--gauge-size);
    transform: rotate(-90deg);
}

.gauge-track {
    fill: none;
    stroke: var(--gauge-track);
}

.gauge-progress {
    fill: none;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out, stroke 0.3s ease;
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gauge-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.gauge-unit {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-muted);
}

.gauge-status {
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

    .gauge-status.healthy {
        color: var(--status-healthy);
    }

    .gauge-status.degraded {
        color: var(--status-degraded);
    }

    .gauge-status.critical {
        color: var(--status-critical);
    }

.gauge-scale {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: var(--gauge-size);
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ========================================
       BULLET CHART
       ======================================== */
.bullet-chart-container {
    margin-bottom: 1rem;
}

    .bullet-chart-container:last-child {
        margin-bottom: 0;
    }

.bullet-chart-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}

.bullet-chart-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

    .bullet-chart-name .color-dot {
        width: 8px;
        height: 8px;
        border-radius: 2px;
    }

.bullet-chart-value {
    font-weight: 600;
    font-size: 0.75rem;
}

.bullet-chart {
    position: relative;
    height: 20px;
    border-radius: 3px;
    overflow: hidden;
}

.bullet-ranges {
    position: absolute;
    inset: 0;
    display: flex;
}

.bullet-range {
    height: 100%;
}

    .bullet-range.critical {
        background: var(--status-critical-bg);
    }

    .bullet-range.degraded {
        background: var(--status-degraded-bg);
    }

    .bullet-range.healthy {
        background: var(--status-healthy-bg);
    }

.bullet-bar {
    position: absolute;
    top: 5px;
    left: 0;
    height: 10px;
    border-radius: 2px;
    transition: width 0.5s ease-out;
}

    .bullet-bar.healthy {
        background: var(--status-healthy);
    }

    .bullet-bar.degraded {
        background: var(--status-degraded);
    }

    .bullet-bar.critical {
        background: var(--status-critical);
    }

.bullet-target {
    position: absolute;
    top: 2px;
    width: 2px;
    height: 16px;
    background: var(--text-primary);
    border-radius: 1px;
}

.chart-legend-line {
    width: 2px;
    height: 12px;
    background: var(--text-primary);
}

/* ========================================
       LEGEND
       ======================================== */
.chart-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.chart-legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.chart-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-marker {
    width: 14px;
    height: 8px;
    border-radius: 2px;
}

.legend-line {
    width: 20px;
    height: 2px;
    border-radius: 1px;
}
.deviation-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.deviation-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.deviation-legend-marker {
    width: 16px;
    height: 10px;
    border-radius: 2px;
}


    /* ========================================
       Custom Styles for Specific Components
       ======================================== */
#request-outcomes.kpi-card {
    height: 100%;
}

#uptime-trend.kpi-card{
    height: 90%;
}



    #api-uptime.kpi-card {
        height: 88%;
    }

#api-uptime .kpi-card-body {
    padding: 0.5rem;
}   

/* Card title */
#api-uptime .kpi-title {
    font-size: 0.9rem;
}

    /* Dropdown text */
    #api-uptime .uptime-period-text {
        font-size: 0.8rem;
    }

    /* Dropdown button */
    #api-uptime .dropdown-toggle {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* Gauge */
    #api-uptime .gauge-container {
        width: 170px;
        height: 170px;
        margin: 0 auto;
    }

    /* Gauge value (e.g. 99.8%) */
    #api-uptime .gauge-value {
        font-size: 1.8rem;
        font-weight: 700;
    }

    /* Gauge status (e.g. Excellent) */
    #api-uptime .gauge-status {
        font-size: 0.8rem;
    }

    /* Status badge */
    #api-uptime .status-badge {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* Metrics */
    #api-uptime .metric-value {
        font-size: 1rem;
    }

    #api-uptime .metric-label {
        font-size: 0.7rem;
    }

    /* Header spacing */
    #api-uptime .kpi-card-header {
        padding-bottom: 8px;
    }

    /* Metrics spacing */
#api-uptime .metrics-row {
    margin-top: 8px;
    padding-top: 0.75rem;
}

.chart-info-panel {
    margin: 0 1.5rem 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.chart-info-btn {
    color: #6c757d;
    text-decoration: none;
    vertical-align: middle;
    font-size: 0.75rem;
}

    .chart-info-btn:hover {
        color: var(--bs-primary);
    }

.chart-info-panel table {
    margin-bottom: 0;
}

.chart-info-btn i {
    display: inline-block;
    transition: transform .25s ease;
}

.chart-info-btn:not(.collapsed) i {
    transform: rotate(90deg);
}

.kpi-card-footer {
    display: flex;
    flex-wrap: wrap;
}

    .kpi-card-footer .chart-legend {
        display: flex;
        align-items: center;
        gap: 1rem;
        flex-wrap: nowrap;
        width: 100%;
    }

    .kpi-card-footer .collapse {
        width: 100%;
        margin-top: 1rem;
    }

/* Make the popover much wider */
.growth-threshold-popover {
    --bs-popover-max-width: 900px;
}

    /* Remove Bootstrap's grid layout */
    .growth-threshold-popover .popover-body {
        display: block;
        padding: 8px;
        overflow: hidden;
    }

    /* Remove the extra border/background around the card */
    .growth-threshold-popover .kpi-card {
        margin: 0;
        border: none;
        box-shadow: none;
    }

    /* Optional: keep the header styling */
    .growth-threshold-popover .kpi-card-header {
        border-radius: 0;
    }

/* Making one column stretched while another one stay put */
.uptime-row, .collectors-row, .api-response-row {
    align-items: flex-start;
}

/*Active data collectors*/

.active-collectors-card .kpi-card-header {
    padding: 0.70rem 1rem;
}

    .active-collectors-card .kpi-card-header#ACPlatformsheader {
        padding: 1rem;
    }

.active-collectors-card .kpi-card-body > kpi-card-footer > .kpi-card-body {
    padding: 0.75rem 1rem;
}

.active-collectors-card > .kpi-card-body {
    padding: 0.50rem;
    text-align: center;
}
.active-collectors-card .kpi-value {
    font-size: 3.0rem;
    margin-top: 0.3rem;
}

.active-collectors-card .sparkline-container {
    margin: 0.5rem 0;
    height: 168px;
}

.active-collectors-card .kpi-comparison {
    margin-top: 2.8rem;
}

/*Loading spinner for charts*/
.kpi-card {
    position: relative;
}

.chart-loading {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255,255,255,.45);
    backdrop-filter: blur(2px);
    z-index: 1000;
    border-radius: inherit;
}

    .chart-loading.d-none {
        display: none !important;
    }

.kpi-card.loading > :not(.chart-loading) {
    opacity: .45;
    transition: opacity .2s ease;
}

/*Extrata API Uptime About this KPI*/
.kpi-info-link {
    display: flex;
    justify-content: left;
    margin-top: 3px;
}

#apiUptimeInfo .kpi-card-body {
    font-size: 0.75rem;
    text-align: left;
    padding: 1.5rem;
}

    .kpi-info-link .btn-link {
        font-size: 0.75rem;
        color: #6c757d;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
    }

        .kpi-info-link .btn-link:hover {
            color: var(--bs-primary);
            text-decoration: none;
        }

    .kpi-info-link .bi {
        transition: transform 0.2s ease;
    }

    .kpi-info-link .btn-link:not(.collapsed) .bi {
        transform: rotate(90deg);
    }

.kpi-card-body p.text-muted.small, .kpi-card-body ul li, .kpi-card-body table td {
    font-weight: 400;
}