:root {
    --primary-color: #ff8c00;
    --primary-dark: #e67e00;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #333333;
    --light-text: #666666;
    --border-color: #e0e0e0;
    --hover-color: #f0f0f0;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --unknown-color: #9e9e9e;
    --font-main: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

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

body {
    min-height: 100vh;
    font-family: var(--font-main);
    background: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
}

header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-left,
.header-right {
    flex: 1;
}

.header-center {
    text-align: center;
}

.header-right {
    text-align: right;
}

.logo {
    height: 40px;
}

.home-link,
.refresh-button {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    color: var(--light-text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.home-link:hover,
.refresh-button:hover {
    background: var(--hover-color);
    color: var(--primary-dark);
    border-color: #d4d4d4;
}

.refresh-button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.refresh-button.loading .refresh-symbol {
    animation: spin 0.8s linear infinite;
}

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

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

.status-header {
    text-align: center;
    margin-bottom: 30px;
}

.status-header h1 {
    margin: 12px 0 8px;
    font-size: 2rem;
}

.status-description,
.last-updated,
.service-description,
.muted-count {
    color: var(--light-text);
}

.last-updated {
    font-size: 0.9rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 6px 12px;
    color: #fff;
    background: var(--unknown-color);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.operational .status-indicator,
.status-indicator.operational {
    background: var(--success-color);
}

.degraded .status-indicator,
.status-indicator.degraded {
    background: var(--warning-color);
}

.down .status-indicator,
.status-indicator.down {
    background: var(--danger-color);
}

.unknown .status-indicator,
.status-indicator.unknown {
    background: var(--unknown-color);
}

.services {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 850px) {
    .services {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.service-card,
.incidents-section {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 20px;
}

.service-header,
.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.service-header {
    margin-bottom: 15px;
}

.service-name {
    font-size: 1.2rem;
    font-weight: 600;
}

.service-description {
    max-width: 34rem;
    margin-top: 4px;
    font-size: 0.9rem;
}

.service-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.service-detail {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.service-detail-label {
    margin-bottom: 5px;
    color: var(--light-text);
    font-size: 0.8rem;
}

.service-detail-value {
    overflow-wrap: anywhere;
    font-size: 0.9rem;
    font-weight: 500;
}

.uptime-history {
    margin-top: 20px;
}

.uptime-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

.uptime-history-title {
    margin: 0;
    font-size: 1.05rem;
}

.time-period-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 5px;
}

.time-period-button {
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--light-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    padding: 5px 10px;
    transition: background-color 0.2s, color 0.2s;
}

.time-period-button:hover {
    background: var(--hover-color);
}

.time-period-button.active {
    background: var(--primary-color);
    color: #fff;
}

.uptime-bars {
    display: flex;
    height: 30px;
    overflow: visible;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #f0f0f0;
}

.uptime-bar {
    position: relative;
    flex: 1;
    min-width: 3px;
    height: 100%;
    margin: 0 1px;
    background: var(--unknown-color);
}

.uptime-bar:first-child {
    margin-left: 0;
}

.uptime-bar:last-child {
    margin-right: 0;
}

.uptime-bar.operational {
    background: #2ecc71;
}

.uptime-bar.degraded {
    background: #f1c40f;
}

.uptime-bar.down {
    background: #e74c3c;
}

.uptime-bar.unknown {
    background: #95a5a6;
}

.uptime-bar-tooltip {
    position: absolute;
    z-index: 10;
    bottom: calc(100% + 6px);
    left: 50%;
    width: max-content;
    max-width: 220px;
    transform: translateX(-50%);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.3;
    opacity: 0;
    padding: 5px 8px;
    pointer-events: none;
    transition: opacity 0.2s;
    visibility: hidden;
}

.uptime-bar:hover .uptime-bar-tooltip {
    opacity: 1;
    visibility: visible;
}

.incidents-section {
    margin-bottom: 30px;
}

.incidents-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.incidents-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.incident-card {
    border-left: 4px solid var(--danger-color);
    border-radius: 6px;
    background: #f9f9f9;
    padding: 15px;
}

.incident-card.resolved {
    border-left-color: var(--success-color);
}

.incident-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.incident-service {
    font-size: 1rem;
    font-weight: 600;
}

.incident-status {
    display: inline-block;
    border-radius: 4px;
    background: var(--danger-color);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 4px 8px;
}

.incident-status.resolved {
    background: var(--success-color);
}

.incident-time {
    margin-bottom: 10px;
    color: var(--light-text);
    font-size: 0.85rem;
}

.incident-description {
    font-size: 0.9rem;
}

.loading-text,
.no-incidents {
    text-align: center;
    color: var(--light-text);
    font-size: 0.9rem;
    padding: 20px;
}

footer {
    border-top: 1px solid var(--border-color);
    background: #fff;
    color: var(--light-text);
    font-size: 0.9rem;
    padding: 20px;
    text-align: center;
}

@media (max-width: 700px) {
    .header-container {
        padding: 0 14px;
    }

    .home-link,
    .refresh-button {
        padding: 7px 9px;
    }

    .logo {
        height: 34px;
    }

    main {
        padding: 24px 14px;
    }

    .service-header,
    .section-header,
    .uptime-history-header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .time-period-selector {
        justify-content: flex-start;
    }
}
