:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --text: #1d2430;
    --muted: #677180;
    --border: #e2e5ea;
    --on-accent: #ffffff;

    --ok: #2fb465;
    --degraded: #dcae00;
    --partial: #ee7a2a;
    --major: #de4141;
    --maint: #3b82d8;
    --nodata: #c9ced6;

    --radius: 8px;
    --shadow: 0 1px 2px rgb(16 24 40 / 6%);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1a1e26;
        --surface-2: #20252f;
        --text: #e6e9ee;
        --muted: #9aa3b0;
        --border: #2d333f;
        --nodata: #3d4452;
        --shadow: none;
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font:
        15px/1.55 -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        'Helvetica Neue',
        Arial,
        sans-serif;
    -webkit-text-size-adjust: 100%;
}
a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
h1,
h2,
h3 {
    line-height: 1.25;
    margin: 0;
}

.wrap {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Buttons and forms */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover {
    background: var(--surface-2);
    text-decoration: none;
}
.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}
.btn.primary:hover {
    filter: brightness(1.07);
}
.btn.small {
    min-height: 30px;
    padding: 0 10px;
    font-size: 13px;
}
.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
input[type='radio'] {
    width: auto;
    min-height: 0;
}
input:focus,
.btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
    outline-offset: 1px;
}
label.field {
    display: block;
    margin-bottom: 12px;
}
label.field > span {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
}
.hint {
    color: var(--muted);
    font-size: 13px;
    margin: 0;
}
.msg {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 14px;
}
.msg.error {
    background: color-mix(in srgb, var(--major) 12%, transparent);
    color: var(--major);
}
.msg.success {
    background: color-mix(in srgb, var(--ok) 14%, transparent);
    color: color-mix(in srgb, var(--ok) 70%, var(--text));
}

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    min-height: 72px;
    padding-top: 12px;
    padding-bottom: 12px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.brand:hover {
    text-decoration: none;
}
.brand-logo {
    height: 30px;
    width: auto;
    display: block;
}
.brand-logo-dark {
    display: none;
}
@media (prefers-color-scheme: dark) {
    .brand-logo-light {
        display: none;
    }
    .brand-logo-dark {
        display: block;
    }
}
.brand-label {
    padding-left: 12px;
    border-left: 1px solid var(--border);
    color: var(--muted);
    font-size: 15px;
    font-weight: 500;
}
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent);
    box-shadow: inset 0 0 0 6px
        color-mix(in srgb, var(--surface) 35%, transparent);
}

main.wrap {
    padding-top: 32px;
    padding-bottom: 24px;
}
.page-desc {
    color: var(--muted);
    margin: 0 0 20px;
}
.empty {
    color: var(--muted);
    padding: 24px 0;
    text-align: center;
    margin: 0;
}

/* Colors */
.bg-ok {
    background: var(--ok);
}
.bg-degraded {
    background: var(--degraded);
}
.bg-partial {
    background: var(--partial);
}
.bg-major {
    background: var(--major);
}
.bg-maint {
    background: var(--maint);
}
.t-ok {
    color: var(--ok);
}
.t-degraded {
    color: var(--degraded);
}
.t-partial {
    color: var(--partial);
}
.t-major {
    color: var(--major);
}
.t-maint {
    color: var(--maint);
}

/* Overall status banner */
.banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-radius: var(--radius);
    color: #fff;
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}
.banner.bg-degraded {
    color: #2b2300;
}
.banner-icon {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgb(255 255 255 / 25%);
    font-size: 16px;
    flex: none;
}
.banner small {
    margin-left: auto;
    font-size: 12px;
    font-weight: 400;
    opacity: 0.85;
}

/* Incident cards */
.incident-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.incident-card > header {
    padding: 12px 18px;
    color: #fff;
    font-weight: 600;
    font-size: 17px;
}
.incident-card > header a {
    color: inherit;
}
.incident-card > header .when {
    display: block;
    font-weight: 400;
    font-size: 13px;
    opacity: 0.9;
}
.incident-card.c-degraded > header {
    background: var(--degraded);
    color: #2b2300;
}
.incident-card.c-partial > header {
    background: var(--partial);
}
.incident-card.c-major > header {
    background: var(--major);
}
.incident-card.c-maint > header {
    background: var(--maint);
}
.incident-card .updates {
    padding: 4px 18px;
}
.update {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.update:last-child {
    border-bottom: 0;
}
.update p {
    margin: 0 0 4px;
}
.update small {
    color: var(--muted);
}

/* Components */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.components-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}
.component {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.card > .component:last-child {
    border-bottom: 0;
}
.component-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}
.component-name {
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.component-status {
    font-size: 14px;
    white-space: nowrap;
}
.help {
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--muted);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: help;
    flex: none;
}

details.group > summary {
    list-style: none;
    cursor: pointer;
}
details.group > summary::-webkit-details-marker {
    display: none;
}
.plus {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
}
.plus::before {
    content: '+';
}
details[open] .plus::before {
    content: '−';
}
.group-children {
    margin: 14px -18px -16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}
.group-children .component {
    padding-left: 34px;
}
.group-children .component:last-child {
    border-bottom: 0;
}

/* Uptime bars */
.bars {
    display: flex;
    gap: 2px;
    height: 34px;
}
.bar {
    flex: 1;
    min-width: 0;
    border-radius: 1px;
    cursor: pointer;
    transition: opacity 0.15s;
}
.bar:hover,
.bar.active {
    opacity: 0.7;
}
.b-ok {
    background: var(--ok);
}
.b-degraded {
    background: var(--degraded);
}
.b-partial {
    background: var(--partial);
}
.b-major {
    background: var(--major);
}
.b-maint {
    background: var(--maint);
}
.b-nodata {
    background: var(--nodata);
}
.bar-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}
.bar-legend .line {
    flex: 1;
    height: 1px;
    background: var(--border);
}
.l60,
.l30 {
    display: none;
}

@media (max-width: 720px) {
    .bar.d90 {
        display: none;
    }
    .l90,
    .l30 {
        display: none;
    }
    .l60 {
        display: inline;
    }
}
@media (max-width: 480px) {
    .bar.d60 {
        display: none;
    }
    .l90,
    .l60 {
        display: none;
    }
    .l30 {
        display: inline;
    }
}

/* Tooltip */
.tooltip {
    position: fixed;
    z-index: 50;
    width: 300px;
    max-width: calc(100vw - 24px);
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
}
.tooltip h4 {
    margin: 0 0 8px;
    font-size: 14px;
}
.tooltip .row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
}
.tooltip .row b {
    margin-left: auto;
}
.tooltip .related {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.tooltip .related div {
    margin-top: 4px;
}
.tooltip .muted {
    color: var(--muted);
}
.dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
}

/* Sections */
.section-title {
    font-size: 20px;
    margin: 36px 0 12px;
}
.day {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.day:last-child {
    border-bottom: 0;
}
.day h3 {
    font-size: 16px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.day .none {
    color: var(--muted);
    margin: 0;
}
.past-incident {
    margin: 10px 0 16px;
}
.past-incident > a {
    font-weight: 600;
    font-size: 16px;
}
.past-incident p {
    margin: 4px 0;
}
.past-incident small {
    color: var(--muted);
}

/* Incident detail */
.back {
    display: inline-block;
    margin-bottom: 18px;
}
.incident-detail h1 {
    font-size: 28px;
    margin-bottom: 8px;
}
.incident-detail .meta {
    color: var(--muted);
    margin: 0 0 24px;
}
.timeline {
    border-top: 1px solid var(--border);
}
.timeline-item {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}
.timeline-item .tl-status {
    font-weight: 700;
}
.timeline-item p {
    margin: 0 0 6px;
}
.timeline-item small {
    color: var(--muted);
}

/* History */
.history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.history-head h1 {
    font-size: 26px;
}
.pager {
    display: flex;
    gap: 8px;
}
.month {
    margin: 28px 0;
}
.month h2 {
    font-size: 18px;
    margin-bottom: 8px;
}
.month-card {
    padding: 4px 18px;
}

.message-page {
    text-align: center;
    padding: 48px 0;
}
.message-page h1 {
    font-size: 26px;
    margin-bottom: 10px;
}

.site-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 16px;
    padding-bottom: 40px;
    color: var(--muted);
    font-size: 14px;
}

/* Subscription dialog */
dialog {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
}
dialog::backdrop {
    background: rgb(10 14 20 / 45%);
}
.dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.dialog-head h2 {
    font-size: 17px;
}
.dialog-body {
    padding: 20px;
}
.dialog-foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}
.close-x {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
}
.tab:has(input:checked) {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

@media (max-width: 600px) {
    .brand {
        font-size: 19px;
    }
    .header-inner .btn {
        width: 100%;
    }
    .banner {
        font-size: 17px;
        padding: 14px 16px;
    }
    .banner small {
        display: none;
    }
    .timeline-item {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .incident-detail h1 {
        font-size: 23px;
    }
}

/* Language selector (footer) */
.lang-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.lang-form select {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    padding: 2px 6px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}
