body {
    margin: 0;
    padding: 0;
    background-color: #111827;
    color: #e5e7eb;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

h1, h2 {
    margin: 0 0 12px 0;
    font-weight: 600;
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 18px;
    margin-top: none;
}

.subtitle {
    color: #9ca3af;
    font-size: 13px;
    margin-bottom: 16px;
}

.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1 1 180px;
    min-width: 0;
    background-color: #020617;
    border-radius: 10px;
    border: 1px solid #1f2937;
    padding: 10px 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

.stat-label {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
}

.stat-sub {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
}

/* NEW: controls above feeds grid */
.feeds-controls {
    margin-top: 8px;
    margin-bottom: 0;
}

.feeds-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.feeds-control {
    display: inline-flex;
    gap: 8px;
    align-items: center;
	background-color: #233545;
    border-radius: 10px;
    padding: 4px 5px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.feeds-control-label {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.feeds-control select {
    background-color: #111827;
    color: #e5e7eb;
    border: 1px solid #1f2937;
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 12px;
    outline: none;
}

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

.card {
    background-color: #111827;
    border-radius: 10px;
    border: 1px solid #1f2937;
    padding: 10px 12px 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.card-elevated {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245,158,11,0.45), 0 0 22px rgba(245,158,11,0.28);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    gap: 8px;
}

.feed-name {
    font-size: 14px;
    font-weight: 600;
}

.feed-meta {
    font-size: 11px;
    color: #9ca3af;
    text-align: right;
}

/* NEW: listener count presentation */
.listener-count {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    margin-top: 2px;
    white-space: nowrap;
}

.listener-num {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: rgb(77, 115, 177);
}

.listener-label {
    font-size: 11px;
    font-weight: 500;
    color: rgb(77, 115, 177);
}

.listener-count.is-elevated .listener-num,
.listener-count.is-elevated .listener-label {
    color: #f59e0b;
}

.listener-count.is-offline .listener-num {
    color: #fca5a5;
}

.listener-count.is-offline .listener-label {
    color: #9ca3af;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
}

.status-online {
    background-color: rgba(22,163,74,0.12);
    color: #4ade80;
}

.status-offline {
    background-color: rgba(220,38,38,0.12);
    color: #fca5a5;
}

/* This class can remain defined, but we do not apply it for Online status */
.status-elevated {
    background-color: rgba(245,158,11,0.16);
    color: #facc15;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background-color: currentColor;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-top: 4px;
}

.label {
    color: #9ca3af;
}

.value {
    font-weight: 500;
}

.sparkline {
    margin-top: 6px;
    height: 32px;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    background: radial-gradient(circle at top left, rgba(96,165,250,0.18), transparent 55%);
    padding: 3px 3px 2px;
    border-radius: 6px;
}

.spark-bar {
    flex: 1;
    min-width: 1px;
    background: rgb(77, 115, 177);
    border-radius: 2px 2px 0 0;
}

.spark-bar-elevated {
    flex: 1;
    min-width: 1px;
    background: #f59e0b;
    border-radius: 2px 2px 0 0;
}

.spark-bar-offline {
    flex: 1;
    min-width: 1px;
    background: #f97373;
    border-radius: 2px 2px 0 0;
}

.spark-bar-empty {
    flex: 1;
    min-width: 1px;
    background: rgba(31,41,55,0.75);
    border-radius: 2px 2px 0 0;
}

.spark-legend {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.spark-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #9ca3af;
}

.spark-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.spark-legend-info {
    cursor: pointer;
    opacity: 0.5;
    position: relative;
    font-size: 11px;
}

.spark-legend-info:hover,
.spark-legend-info.active {
    opacity: 1;
}

.spark-legend-tip {
    display: none;
    position: absolute;
    background: #1f2937;
    color: #e5e7eb;
    font-size: 10px;
    padding: 5px 8px;
    border-radius: 4px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    transform: translateY(-100%);
    white-space: normal;
}

.spark-legend-tip.visible {
    display: block;
}


.events-card {
    margin-top: 24px;
    border-radius: 10px;
    background-color: #020617;
    border: 1px solid #1f2937;
    padding: 14px 16px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
}

table.events {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: fixed;
}

table.events col.col-time   { width: 150px; }
table.events col.col-status { width: auto; }
table.events col.col-events { width: 350px; }

table.events th,
table.events td {
    padding: 7px 8px;
    border-bottom: 1px solid #1f2937;
    vertical-align: top;
}

table.events th {
    text-align: left;
    color: #6b7280;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td.time-cell {
    white-space: nowrap;
    width: 110px;
    color: #e5e7eb;
    font-weight: 500;
}

td.incident-cell {
    padding-left: 6px;
    overflow: hidden;
}

td.status-cell {
    width: 130px;
    white-space: nowrap;
}

.incident-state {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}

.state-current  { background-color: #f04242; }
.state-resolved { background-color: #18ba55; }
.state-partial  { background-color: #f59e0b; }
.state-elevated { background-color: #f59e0b; }

.cell-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cell-primary {
    font-size: 12px;
    font-weight: 600;
    color: #e5e7eb;
    line-height: 1.15;
    margin: 0;
}

.cell-secondary {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
    line-height: 1.15;
    margin: 0;
}

table.events td.status-cell {
    vertical-align: middle;
}

.status-cell-inner {
    height: 100%;
    display: flex;
    align-items: center;
}

.status-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.spark-tooltip {
    position: fixed;
    background-color: #020617;
    color: #e5e7eb;
    border-radius: 6px;
    border: 1px solid #4b5563;
    padding: 4px 8px;
    font-size: 11px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.7);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.08s ease-out;
    z-index: 1000;
    white-space: nowrap;
}

.spark-tooltip.visible {
    opacity: 1;
}

.status-top {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .page {
        padding: 16px 12px 20px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 16px;
    }

    .subtitle {
        font-size: 12px;
    }

    .stats-bar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 14px;
    }

    .stat-card {
        padding: 8px 9px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    }

    .stat-label {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-sub {
        font-size: 10px;
        margin-top: 1px;
    }

    .feeds-control {
        width: 100%;
        justify-content: space-between;
    }

    .feeds-control select {
        width: 55%;
    }

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

    .card {
        padding: 10px 10px 12px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .feed-meta {
        text-align: left;
    }

    .sparkline {
        height: 26px;
    }

    .events-card {
        padding: 12px 10px 14px;
    }

    .events-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.events {
        width: 100%;
        min-width: 600px;
        border-collapse: collapse;
        table-layout: fixed;
    }

    table.events col.col-time   { width: 84px; }
    table.events col.col-status { width: 200px; }
    table.events col.col-events { width: auto; }

    td.time-cell { width: unset; }
    td.status-cell { width: unset; white-space: normal; word-break: break-word; }

    table.events td.time-cell,
    table.events th:nth-child(1) {
        padding-right: 14px;
    }

    table.events td.incident-cell,
    table.events th:nth-child(2) {
        padding-left: 10px;
        padding-right: 14px;
    }

    table.events td.status-cell,
    table.events th:nth-child(3) {
        padding-left: 10px;
    }
}

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

    .stat-card {
        padding: 6px 8px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 15px;
    }

    .stat-sub {
        font-size: 9px;
    }

    .feed-name {
        font-size: 13px;
    }

    .feed-meta {
        font-size: 10px;
    }

    .metric-row {
        font-size: 10px;
    }

    table.events th,
    table.events td {
        padding: 6px 6px;
    }

    tr.events-day-sep td {
        font-size: 8px !important;
        font-weight: 600 !important;
        padding: 3px 6px !important;
        letter-spacing: 0.08em !important;
    }
}
/* ===== Feeds toolbar (controls) ===== */
.feeds-section {
    margin-top: 14px;
}

.feeds-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.feeds-title h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.feeds-controls {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.feeds-control {
    display: inline-flex;
    align-items: center;
}

.feeds-controls select {
    border: none;
    background-color: transparent;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}

.feeds-controls select:focus {
    outline: none;
}

@media (max-width: 820px) {
    .feeds-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .feeds-controls {
        justify-content: stretch;
    }

    .feeds-control {
        width: 100%;
    }

    .feeds-control select {
        width: 100%;
        min-width: 0;
    }
}

/* iOS Safari: restore native select arrow */
@supports (-webkit-touch-callout: none) {
    .feeds-controls select {
        -webkit-appearance: menulist;
        appearance: menulist;
        background-image: none;
    }
}
.page_loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.92);
}

.page_loader.is_hidden {
    display: none;
}

.page_loader_inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(17, 24, 39, 0.85);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

.page_loader_spinner {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: rgba(255, 255, 255, 0.85);
    animation: page_loader_spin 0.9s linear infinite;
}

.page_loader_text {
    font-size: 12px;
    color: #e5e7eb;
    letter-spacing: 0.2px;
}

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

/* ===== Active outage banner ===== */
.outage-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(220, 38, 38, 0.10);
    border: 1px solid rgba(220, 38, 38, 0.30);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.outage-banner--hidden {
    display: none;
}

.outage-banner-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #f04242;
    flex-shrink: 0;
    animation: outage-pulse 2s ease-in-out infinite;
}

@keyframes outage-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240, 66, 66, 0.4); }
    50%       { box-shadow: 0 0 0 5px rgba(240, 66, 66, 0); }
}

.outage-banner-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.outage-banner-label {
    font-size: 13px;
    font-weight: 600;
    color: #fca5a5;
}

.outage-banner-sub {
    font-size: 11px;
    color: #9ca3af;
}

/* ===== Events table improvements ===== */
tr.events-day-sep td {
    padding: 6px 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #9ca3af;
    background: #0f172a;
    border-top: 1px solid #1f2937;
    border-bottom: 1px solid #1f2937;
}

tr.events-day-sep:first-child td {
    border-top: none;
}


.event-time-rel {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
}

.event-detail-list {
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-feed-item {
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
}

.event-feed-item::before {
    content: '';
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.event-feed-item.recovered { color: #4ade80; }
.event-feed-item.offline   { color: #fca5a5; }

.feed-item-dur {
    margin-left: 0.4em;
    opacity: 0.65;
    white-space: nowrap;
}
.event-detail-toggle {
    margin-top: 5px;
}

.event-detail-toggle summary {
    font-size: 10px;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.event-detail-toggle summary::-webkit-details-marker { display: none; }

.event-detail-toggle summary::after {
    content: '▾';
    font-size: 9px;
    transition: transform 0.15s ease;
}

.event-detail-toggle[open] summary::after {
    transform: rotate(-180deg);
}

.event-detail-toggle .event-detail-list {
    margin-top: 4px;
}
