:root {
    color-scheme: dark;
    --bg: #070a12;
    --bg-elevated: #0d111d;
    --surface: rgba(16, 20, 32, 0.86);
    --surface-strong: #111624;
    --surface-soft: rgba(255, 255, 255, 0.035);
    --surface-hover: rgba(255, 255, 255, 0.055);
    --border: rgba(148, 163, 184, 0.15);
    --border-strong: rgba(148, 163, 184, 0.24);
    --text: #f7f8fb;
    --text-soft: #a5adbd;
    --text-faint: #697386;
    --green: #2ed573;
    --green-soft: rgba(46, 213, 115, 0.12);
    --red: #ff4d57;
    --red-soft: rgba(255, 77, 87, 0.12);
    --amber: #ffbd3d;
    --amber-soft: rgba(255, 189, 61, 0.12);
    --blue: #6ca8ff;
    --blue-soft: rgba(108, 168, 255, 0.12);
    --shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
    --radius-lg: 18px;
    --radius-md: 13px;
    --radius-sm: 9px;
    --max-width: 1120px;
    --topbar-height: 72px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f7fb;
    --bg-elevated: #ffffff;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --surface-soft: rgba(15, 23, 42, 0.035);
    --surface-hover: rgba(15, 23, 42, 0.06);
    --border: rgba(15, 23, 42, 0.11);
    --border-strong: rgba(15, 23, 42, 0.2);
    --text: #111827;
    --text-soft: #536074;
    --text-faint: #8490a3;
    --green: #0aa95b;
    --green-soft: rgba(10, 169, 91, 0.1);
    --red: #e43441;
    --red-soft: rgba(228, 52, 65, 0.1);
    --amber: #d78b00;
    --amber-soft: rgba(215, 139, 0, 0.1);
    --blue: #377dd8;
    --blue-soft: rgba(55, 125, 216, 0.1);
    --shadow: 0 20px 55px rgba(37, 48, 70, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 0%, rgba(35, 93, 174, 0.13), transparent 34rem),
        radial-gradient(circle at 88% 30%, rgba(89, 44, 145, 0.09), transparent 32rem),
        linear-gradient(145deg, var(--bg), #090b15 62%, var(--bg));
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

html[data-theme="light"] body {
    background:
        radial-gradient(circle at 10% 0%, rgba(55, 125, 216, 0.09), transparent 34rem),
        radial-gradient(circle at 90% 25%, rgba(126, 87, 194, 0.07), transparent 32rem),
        var(--bg);
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
}

svg {
    display: block;
    fill: currentColor;
}

.ambient {
    position: fixed;
    z-index: -1;
    border-radius: 999px;
    filter: blur(90px);
    pointer-events: none;
    opacity: 0.18;
}

.ambient-one {
    width: 300px;
    height: 300px;
    left: -160px;
    top: 170px;
    background: #155fbd;
}

.ambient-two {
    width: 260px;
    height: 260px;
    right: -130px;
    top: 390px;
    background: #5a2b8f;
}

.shell {
    width: min(var(--max-width), calc(100% - 40px));
    margin-inline: auto;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-elevated) 84%, transparent);
    backdrop-filter: blur(18px);
}

.topbar-inner {
    width: min(1280px, calc(100% - 32px));
    height: 100%;
    margin-inline: auto;
    display: flex;
    align-items: center;
    gap: 26px;
}

.brand {
    color: var(--text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(108, 168, 255, 0.26);
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: var(--blue);
    background: var(--blue-soft);
    box-shadow: inset 0 0 16px rgba(108, 168, 255, 0.08);
}

.brand-mark svg {
    width: 21px;
    height: 21px;
}

.brand-copy {
    display: grid;
    line-height: 1.15;
}

.brand-copy strong {
    font-size: 0.91rem;
    letter-spacing: -0.01em;
}

.brand-copy small {
    margin-top: 4px;
    color: var(--text-faint);
    font-size: 0.69rem;
}

.nav-tabs {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-soft);
    padding: 8px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.nav-tab:hover,
.nav-tab.is-active {
    color: var(--text);
    background: var(--surface-hover);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
}

.icon-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--text-soft);
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.icon-button:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.icon-button:active {
    transform: translateY(1px);
}

.icon-button svg {
    width: 17px;
    height: 17px;
}

.icon-button.is-spinning svg {
    animation: spin 900ms linear infinite;
}

.theme-sun {
    display: none;
}

html[data-theme="light"] .theme-sun {
    display: block;
}

html[data-theme="light"] .theme-moon {
    display: none;
}

.language-picker {
    position: relative;
}

.language-menu {
    position: absolute;
    top: calc(100% + 9px);
    right: 0;
    width: 132px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.language-menu button {
    width: 100%;
    border: 0;
    border-radius: 7px;
    padding: 8px 9px;
    text-align: left;
    color: var(--text-soft);
    background: transparent;
    cursor: pointer;
}

.language-menu button:hover,
.language-menu button.is-active {
    color: var(--text);
    background: var(--surface-hover);
}

.hero-copy {
    padding: 48px 0 25px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    color: var(--blue);
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.eyebrow::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 14px currentColor;
    content: "";
}

.hero-copy h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    letter-spacing: -0.045em;
    line-height: 1.05;
}

.hero-copy p {
    margin: 9px 0 0;
    color: var(--text-soft);
    font-size: 0.94rem;
}

.last-updated {
    display: grid;
    justify-items: end;
    color: var(--text-faint);
    font-size: 0.7rem;
    white-space: nowrap;
}

.last-updated strong {
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 0.78rem;
    font-weight: 600;
}

.system-banner {
    min-height: 86px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 17px;
    display: flex;
    align-items: center;
    gap: 13px;
    background: linear-gradient(120deg, var(--surface), color-mix(in srgb, var(--surface) 90%, var(--blue-soft)));
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.system-banner::after {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(100deg, transparent 25%, rgba(255, 255, 255, 0.035), transparent 75%);
    transform: translateX(-100%);
    content: "";
}

.system-banner.is-loading::after {
    animation: sweep 1.6s infinite;
}

.banner-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--blue);
    background: var(--blue-soft);
    border: 1px solid color-mix(in srgb, var(--blue) 32%, transparent);
}

.banner-icon svg {
    width: 21px;
    height: 21px;
}

.system-banner.is-operational .banner-icon {
    color: var(--green);
    background: var(--green-soft);
    border-color: color-mix(in srgb, var(--green) 35%, transparent);
}

.system-banner.is-disruption .banner-icon {
    color: var(--red);
    background: var(--red-soft);
    border-color: color-mix(in srgb, var(--red) 35%, transparent);
}

.system-banner.is-degraded .banner-icon {
    color: var(--amber);
    background: var(--amber-soft);
    border-color: color-mix(in srgb, var(--amber) 35%, transparent);
}

.banner-copy {
    min-width: 0;
    display: grid;
    flex: 1 1 auto;
}

.banner-copy strong {
    font-size: 0.88rem;
    letter-spacing: -0.01em;
}

.banner-copy span {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.73rem;
}

.summary-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 0.67rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--surface-soft);
}

.summary-pill i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.summary-pill.online { color: var(--green); }
.summary-pill.degraded { color: var(--amber); }
.summary-pill.offline { color: var(--red); }

.service-section,
.history-section,
.subscription-section {
    padding-top: 28px;
}

.section-heading {
    margin-bottom: 12px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
}

.section-heading h2,
.subscription-copy h2 {
    margin: 0;
    font-size: 0.92rem;
    letter-spacing: -0.015em;
}

.section-heading p,
.subscription-copy p {
    margin: 4px 0 0;
    color: var(--text-faint);
    font-size: 0.69rem;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px;
}

.service-card,
.skeleton-card {
    min-height: 236px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 100% 100%, color-mix(in srgb, var(--blue-soft) 52%, transparent), transparent 45%),
        linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--surface) 94%, transparent));
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
}

.service-card {
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.service-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.service-card.status-online { --status-color: var(--green); --status-soft: var(--green-soft); }
.service-card.status-offline { --status-color: var(--red); --status-soft: var(--red-soft); }
.service-card.status-degraded { --status-color: var(--amber); --status-soft: var(--amber-soft); }
.service-card.status-misconfigured { --status-color: var(--red); --status-soft: var(--red-soft); }

.service-card::before {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--status-color) 70%, transparent), transparent);
    opacity: 0.65;
    content: "";
}

.service-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid color-mix(in srgb, var(--status-color) 35%, transparent);
    border-radius: 999px;
    padding: 4px 7px;
    color: var(--status-color);
    background: var(--status-soft);
    font-size: 0.59rem;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-badge i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}

.current-latency {
    color: var(--status-color);
    font-size: 0.66rem;
    font-weight: 700;
}

.service-title {
    margin: 15px 0 0;
    font-size: 0.88rem;
    letter-spacing: -0.015em;
}

.service-endpoint {
    min-height: 18px;
    margin: 4px 0 0;
    color: var(--text-faint);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.59rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.service-message {
    min-height: 17px;
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 0.64rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.metric-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border: 1px solid rgba(0, 0, 0, 0.18);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg) 68%, transparent);
    overflow: hidden;
}

html[data-theme="light"] .metric-grid {
    border-color: var(--border);
    background: rgba(15, 23, 42, 0.025);
}

.metric {
    min-width: 0;
    padding: 9px 6px 8px;
    display: grid;
    place-items: center;
    border-right: 1px solid var(--border);
}

.metric:last-child {
    border-right: 0;
}

.metric strong {
    font-size: 0.71rem;
    line-height: 1;
}

.metric span {
    margin-top: 5px;
    color: var(--text-faint);
    font-size: 0.48rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sparkline-label {
    margin-top: 12px;
    color: var(--text-faint);
    font-size: 0.49rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sparkline {
    width: 100%;
    height: 50px;
    margin-top: auto;
    color: var(--status-color);
    overflow: visible;
}

.sparkline .baseline {
    stroke: var(--border);
    stroke-width: 1;
}

.sparkline .line {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.sparkline .area {
    fill: color-mix(in srgb, currentColor 8%, transparent);
    stroke: none;
}

.skeleton-card,
.history-skeleton {
    position: relative;
    overflow: hidden;
}

.skeleton-card::after,
.history-skeleton::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(95deg, transparent 25%, rgba(255, 255, 255, 0.045), transparent 70%);
    transform: translateX(-100%);
    animation: sweep 1.5s infinite;
    content: "";
}

.empty-state {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 44px 24px;
    text-align: center;
    color: var(--text-soft);
    background: var(--surface-soft);
}

.empty-state strong,
.empty-state span {
    display: block;
}

.empty-state span {
    margin-top: 5px;
    color: var(--text-faint);
    font-size: 0.78rem;
}

.history-legend {
    display: flex;
    align-items: center;
    gap: 13px;
    color: var(--text-faint);
    font-size: 0.63rem;
}

.history-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.history-legend i {
    width: 6px;
    height: 6px;
    border-radius: 2px;
}

.legend-online { background: var(--green); }
.legend-degraded { background: var(--amber); }
.legend-offline { background: var(--red); }

.history-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 13px;
    background: var(--surface);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.13);
}

.history-row {
    min-height: 43px;
    display: grid;
    grid-template-columns: 142px minmax(0, 1fr) 58px;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.history-row:last-child {
    border-bottom: 0;
}

.history-name {
    min-width: 0;
    font-size: 0.66rem;
    font-weight: 650;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.history-bars {
    min-width: 0;
    height: 18px;
    display: flex;
    align-items: stretch;
    gap: 2px;
    overflow: hidden;
}

.history-bar {
    min-width: 2px;
    flex: 1 1 3px;
    max-width: 6px;
    border-radius: 2px;
    background: var(--border);
}

.history-bar.online { background: var(--green); }
.history-bar.degraded { background: var(--amber); }
.history-bar.offline,
.history-bar.misconfigured { background: var(--red); }
.history-bar.empty { background: var(--surface-hover); }

.history-percent {
    text-align: right;
    font-size: 0.65rem;
    font-weight: 750;
}

.history-skeleton {
    height: 43px;
    border-bottom: 1px solid var(--border);
}

.history-skeleton:last-child {
    border-bottom: 0;
}

.subscription-section {
    margin-top: 8px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.78fr);
    align-items: center;
    gap: 34px;
    background:
        radial-gradient(circle at 0 100%, var(--blue-soft), transparent 50%),
        var(--surface);
}

.subscription-copy h2 {
    font-size: 1.05rem;
}

.subscription-copy p {
    max-width: 560px;
    font-size: 0.76rem;
}

.subscription-form label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-soft);
    font-size: 0.65rem;
    font-weight: 650;
}

.input-row {
    display: flex;
    gap: 8px;
}

.input-row input[type="email"] {
    min-width: 0;
    flex: 1 1 auto;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0 12px;
    color: var(--text);
    background: color-mix(in srgb, var(--bg) 64%, transparent);
}

.input-row input[type="email"]::placeholder {
    color: var(--text-faint);
}

.input-row button {
    height: 42px;
    border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent);
    border-radius: 10px;
    padding: 0 16px;
    color: #fff;
    background: #357fdc;
    cursor: pointer;
    font-size: 0.73rem;
    font-weight: 700;
    transition: filter 160ms ease, transform 160ms ease;
}

.input-row button:hover {
    filter: brightness(1.08);
}

.input-row button:active {
    transform: translateY(1px);
}

.input-row button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.form-message {
    min-height: 18px;
    margin: 7px 0 0;
    color: var(--text-faint);
    font-size: 0.65rem;
}

.form-message.is-success { color: var(--green); }
.form-message.is-error { color: var(--red); }

.footer {
    min-height: 100px;
    padding-top: 28px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    color: var(--text-faint);
    font-size: 0.65rem;
}

noscript {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 50;
    padding: 12px;
    border-radius: 10px;
    color: #fff;
    background: #9b2730;
    text-align: center;
}

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

@keyframes sweep {
    to { transform: translateX(100%); }
}

@media (max-width: 980px) {
    .brand-copy small {
        display: none;
    }

    .topbar-inner {
        gap: 14px;
    }

    .service-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .subscription-section {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

@media (max-width: 720px) {
    :root {
        --topbar-height: auto;
    }

    .topbar {
        position: sticky;
    }

    .topbar-inner {
        width: min(100% - 24px, 1280px);
        min-height: 64px;
        padding: 10px 0;
        flex-wrap: wrap;
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        flex-basis: 100%;
    }

    .header-actions {
        margin-left: auto;
    }

    .hero-copy {
        padding-top: 34px;
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .last-updated {
        justify-items: start;
    }

    .system-banner {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .summary-pills {
        width: 100%;
        padding-left: 55px;
        flex-wrap: wrap;
    }

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

    .history-row {
        grid-template-columns: 105px minmax(0, 1fr) 50px;
        gap: 8px;
    }

    .history-legend {
        display: none;
    }

    .footer {
        flex-direction: column;
        gap: 7px;
    }
}

@media (max-width: 480px) {
    .shell {
        width: min(100% - 24px, var(--max-width));
    }

    .brand-copy {
        display: none;
    }

    .summary-pills {
        padding-left: 0;
    }

    .summary-pill {
        flex: 1 1 auto;
        justify-content: center;
    }

    .history-panel {
        padding-inline: 9px;
    }

    .history-row {
        grid-template-columns: 86px minmax(0, 1fr) 46px;
    }

    .history-bars {
        gap: 1px;
    }

    .subscription-section {
        padding: 18px;
    }

    .input-row {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
