:root {
    --color-bg: #fafafa;
    --color-text: #424761;
    --color-heading: #222b35;
    --color-muted: #8186a2;
    --color-card-bg: #fff;
    --color-card-header: #fafafc;
    --color-card-shadow: rgba(63, 63, 68, 0.15);
    --color-card-shadow-lg: rgba(63, 63, 68, 0.07);
    --color-border: rgba(191, 194, 212, 0.4);
    --color-separator: rgba(191, 194, 212, 0.3);
    --color-tick-empty: #dfe0e1;
    --color-legend-inactive: #dfe3e8;
    --color-tooltip-bg: #222b35;
    --color-tooltip-text: #fff;
}

[data-theme="dark"] {
    --color-bg: #0d1117;
    --color-text: #b3b9c5;
    --color-heading: #e6edf3;
    --color-muted: #7d8590;
    --color-card-bg: #161b22;
    --color-card-header: #1c2129;
    --color-card-shadow: rgba(0, 0, 0, 0.3);
    --color-card-shadow-lg: rgba(0, 0, 0, 0.15);
    --color-border: rgba(110, 118, 129, 0.3);
    --color-separator: rgba(110, 118, 129, 0.2);
    --color-tick-empty: #30363d;
    --color-legend-inactive: #484f58;
    --color-tooltip-bg: #2d333b;
    --color-tooltip-text: #e6edf3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

b { font-weight: 600; }

/* Container */
.container {
    max-width: 800px;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Header */
.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    flex-wrap: nowrap;
}

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

.brand {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--color-heading);
    height: 60px;
    margin-right: 2rem;
    font-size: 1.125rem;
    gap: 10px;
}

.brand-logo {
    height: 28px;
    width: auto;
}

/* Overview */
.overview {
    text-align: center;
    padding: 1rem 0 3rem;
}

.overview-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 8px;
}

.overview-icon--degraded {
    width: 48px;
    height: 46px;
    margin-bottom: 8px;
}

.overview-title {
    color: var(--color-heading);
    font-size: 2rem;
    font-weight: 700;
}

.overview-updated {
    font-size: .875rem;
    color: var(--color-muted);
}

/* Card */
.section {
    margin-bottom: 2rem;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: var(--color-card-bg);
    background-clip: border-box;
    box-shadow: 0 1px 3px var(--color-card-shadow), 0 20px 30px var(--color-card-shadow-lg);
    border-radius: 8px;
    border: 0;
}

.card-header {
    background: var(--color-card-header);
    padding: 16px 20px;
    border-bottom: 0;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.card-title {
    font-weight: 600;
    margin-bottom: 0;
    font-size: 0.9375rem;
}

.card-body {
    padding: 0 20px;
}

/* Legend */
.legend {
    display: flex;
    margin: 0;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    padding: 0 10px;
    color: var(--color-legend-inactive);
    height: 16px;
    gap: 0;
    cursor: default;
    transition: color 0.15s;
}

.legend-item .legend-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.legend-item .legend-label {
    font-size: 0;
    width: 0;
    overflow: hidden;
}

.legend-item--operational { --active-color: #21AF63; }
.legend-item--degraded { --active-color: #f49342; }
.legend-item--downtime { --active-color: #de3618; }

.legend-item:hover {
    color: var(--active-color);
}

/* Resource List */
.resource-list {
    position: relative;
    margin-top: -1px;
}

/* Resource */
.resource {
    margin-left: -20px;
    margin-right: -20px;
    padding: 20px 20px;
    border-top: 1px solid var(--color-border);
}

.resource-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.resource-name {
    display: flex;
    align-items: center;
    font-size: 15px;
    font-weight: 600;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.resource-name::-webkit-scrollbar {
    display: none;
}

.resource-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.resource-status {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.resource-latency {
    color: var(--color-muted);
    font-weight: 500;
}

/* Uptime Ticks */
.resource-ticks {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    font-size: 0;
    margin-top: 12px;
    align-items: flex-end;
}

.resource-tick {
    width: 100%;
    padding: 0 1.5px;
    position: relative;
    cursor: pointer;
}

.resource-tick-inner {
    height: 40px;
    border-radius: 20px;
    background: var(--color-tick-empty);
    transition: transform 0.15s ease, filter 0.15s ease;
    transform-origin: bottom center;
}

.resource-tick:hover .resource-tick-inner {
    transform: scaleY(1.2);
    filter: brightness(1.1);
}

.resource-tick-inner.green { background: #21AF63; }
.resource-tick-inner.red { background: #de3618; }
.resource-tick-inner.yellow { background: #f49342; }
.resource-tick-inner.gray { background: var(--color-tick-empty); }

/* Tooltip */
.resource-ticks {
    position: relative;
}

.resource-tick::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-tooltip-bg);
    color: var(--color-tooltip-text);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: pre-line;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
    min-width: max-content;
}

.resource-tick::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--color-tooltip-bg);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 9999;
}

/* Align tooltip to the right for last ticks */
.resource-tick:nth-last-child(-n+3)::after {
    left: auto;
    right: 0;
    transform: none;
}
.resource-tick:nth-last-child(-n+3)::before {
    left: auto;
    right: 4px;
    transform: none;
}

/* Align tooltip to the left for first ticks */
.resource-tick:nth-child(-n+3)::after {
    left: 0;
    transform: none;
}
.resource-tick:nth-child(-n+3)::before {
    left: 4px;
    transform: none;
}

.resource-tick:hover::after,
.resource-tick:hover::before {
    opacity: 1;
}

.resource-tick:hover {
    z-index: 10000;
}

.resource-tick.omittable {
    display: none;
}

/* Resource footer */
.resource-footer {
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--color-muted);
    margin-top: 6px;
}

.resource-uptime {
    font-weight: 600;
    color: var(--color-text);
}

/* Footer */
.page-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .8rem;
    padding-bottom: 2rem;
}

.footer-copyright {
    color: var(--color-text);
}

.footer-logo {
    width: 130px;
}

/* Theme toggle */
.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-muted);
    transition: color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
    color: var(--color-heading);
    border-color: var(--color-heading);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Desktop: show all ticks */
@media (min-width: 769px) {
    .status-header {
        flex-direction: row;
    }

    .resource-tick.omittable {
        display: block;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .status-header {
        flex-direction: row;
        align-items: center;
    }

    .overview-title {
        font-size: 1.5rem;
    }

    .overview-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 6px;
    }

    .overview-icon--degraded {
        width: 40px;
        height: 38px;
        margin-bottom: 6px;
    }

    .legend {
        margin-top: 10px;
    }

    .resource-tick-inner {
        height: 30px;
        border-radius: 15px;
    }

    .resource-name {
        font-size: 14px;
    }
}
