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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, monospace;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

header {
    padding: 2rem;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f0f6fc;
}

.subtitle {
    font-size: 0.8rem;
    color: #8b949e;
}

main {
    padding: 2rem;
    max-width: 1800px;
    margin: 0 auto;
}

.empty {
    text-align: center;
    color: #8b949e;
    padding: 4rem 0;
}

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

.card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 6px;
    padding: 1.2rem;
    transition: border-color 0.2s;
    cursor: pointer;
}

.card.up {
    border-left: 3px solid #00d26a;
}

.card.down {
    border-left: 3px solid #ff1744;
}

.card.unknown {
    border-left: 3px solid #8b949e;
}

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

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f0f6fc;
}

.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.up {
    background: rgba(0, 210, 106, 0.15);
    color: #00d26a;
}

.status-badge.down {
    background: rgba(255, 23, 68, 0.15);
    color: #ff1744;
}

.status-badge.unknown {
    background: rgba(139, 148, 158, 0.15);
    color: #8b949e;
}

.url {
    display: block;
    font-size: 0.75rem;
    color: #58a6ff;
    text-decoration: none;
    margin-bottom: 1rem;
    word-break: break-all;
}

.url:hover {
    text-decoration: underline;
}

.health-url {
    margin-top: -0.5rem;
    color: #8b949e;
    font-size: 0.7rem;
}

.stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

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

.stat .label {
    font-size: 0.65rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat .value {
    font-size: 1rem;
    font-weight: 600;
    color: #f0f6fc;
    font-variant-numeric: tabular-nums;
}

.stat .value.up {
    color: #00d26a;
}

.stat .value.down {
    color: #ff1744;
}

.timeline {
    display: flex;
    gap: 2px;
    height: 24px;
    align-items: stretch;
}

.bar {
    flex: 1;
    border-radius: 2px;
    min-width: 3px;
}

.bar.up {
    background: #00d26a;
}

.bar.down {
    background: #ff1744;
}

.bar.unknown {
    background: #21262d;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    font-size: 0.6rem;
    color: #484f58;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 8px;
    width: 90%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #21262d;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: #f0f6fc;
}

.modal-close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.modal-close:hover {
    background: #21262d;
    color: #f0f6fc;
}

.modal-body {
    padding: 1.5rem;
}

.modal-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.modal-stats .stat {
    display: flex;
    flex-direction: column;
}

.modal-stats .label {
    font-size: 0.65rem;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-stats .value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f0f6fc;
    font-variant-numeric: tabular-nums;
}

.modal-stats .value.up {
    color: #00d26a;
}

.modal-stats .value.down {
    color: #ff1744;
}

.chart-container {
    background: #0d1117;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

#latency-chart {
    width: 100%;
    height: 250px;
    display: block;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #484f58;
    margin-bottom: 1rem;
}

.chart-legend {
    display: flex;
    gap: 1.2rem;
    font-size: 0.7rem;
    color: #8b949e;
}

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

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.up {
    background: #00d26a;
}

.legend-dot.down {
    background: #ff1744;
}
