:root {
    --bg: #0f172a;
    --bg-soft: #111f3a;
    --panel: rgba(15, 25, 45, 0.88);
    --panel-border: rgba(148, 163, 184, 0.24);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #2dd4bf;
    --accent-soft: rgba(45, 212, 191, 0.15);
    --danger: #f87171;
    --warn: #fbbf24;
    --ok: #34d399;
    --radius: 16px;
    --shadow: 0 16px 44px rgba(2, 6, 23, 0.42);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: radial-gradient(circle at 20% 0%, #1d3d6a 0%, #0f172a 35%, #091021 100%);
    font-family: "Segoe UI", "Inter", "Helvetica Neue", sans-serif;
    min-height: 100vh;
}

.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 80% 20%, rgba(45, 212, 191, 0.1), transparent 35%),
                radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.12), transparent 32%);
}

.page {
    position: relative;
    max-width: 1080px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(4px);
}

.hero {
    padding: 1.6rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.status-top {
    margin-top: 0.4rem;
    margin-bottom: 0.7rem;
}

.status-top h1 {
    font-size: 1.55rem;
    margin-bottom: 0.35rem;
}

.status-banner {
    margin-top: 0.6rem;
    padding: 0.9rem 1rem;
    text-align: center;
    font-size: 1.45rem;
}

.status-banner.status-up {
    background: #2cc45b;
    color: #ffffff;
}

.status-banner.status-degraded {
    background: #f3b635;
    color: #1f2937;
}

.status-banner.status-down {
    background: #ef4444;
    color: #ffffff;
}

.status-board {
    margin-top: 1rem;
}

.category-block {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 10px;
    margin-bottom: 0.8rem;
    overflow: hidden;
}

.category-block > summary {
    cursor: pointer;
    padding: 0.85rem 0.95rem;
    font-weight: 700;
    list-style: none;
}

.category-block > summary::-webkit-details-marker {
    display: none;
}

.category-block > summary::before {
    content: '+';
    color: var(--accent);
    margin-right: 0.45rem;
}

.category-block[open] > summary::before {
    content: '-';
}

.category-services {
    border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.timeline-service {
    padding: 0.95rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.timeline-service:last-child {
    border-bottom: 0;
}

.timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
}

.service-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.info-dot {
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: help;
}

.service-state {
    font-size: 1rem;
}

.service-state.status-up,
.service-state.status-degraded,
.service-state.status-down,
.service-state.status-unknown {
    background: transparent;
    padding: 0;
}

.timeline-bars {
    display: grid;
    grid-template-columns: repeat(var(--bar-count, 90), minmax(0, 1fr));
    gap: 0.21rem;
    align-items: end;
}

.bar {
    display: inline-block;
    width: 100%;
    height: 2.05rem;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.52);
}

.bar-up {
    background: #00ef8b;
}

.bar-degraded {
    background: #f6c54f;
}

.bar-down {
    background: #ef4444;
}

.bar-unknown {
    background: #9ca3af;
}

.timeline-meta {
    margin-top: 0.5rem;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 0.8rem;
}

.hero.compact {
    align-items: flex-start;
}

h1, h2, h3, h4, p {
    margin: 0;
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.4rem;
}

h2 {
    font-size: 1.25rem;
}

h3 {
    font-size: 1rem;
}

.eyebrow {
    color: var(--accent);
    letter-spacing: 0.15em;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.meta {
    margin-top: 0.65rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.global-pill {
    border-radius: 12px;
    padding: 0.8rem 1rem;
    min-width: 215px;
    text-align: right;
}

.global-pill strong {
    display: block;
    margin-bottom: 0.2rem;
}

.global-pill span {
    color: var(--muted);
    font-size: 0.85rem;
}

.status-up {
    background: rgba(52, 211, 153, 0.15);
    color: #6ee7b7;
}

.status-degraded {
    background: rgba(251, 191, 36, 0.16);
    color: #fcd34d;
}

.status-down {
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
}

.status-unknown {
    background: rgba(148, 163, 184, 0.15);
    color: #cbd5e1;
}

.status-investigating,
.status-identified {
    background: transparent;
    color: #fcd34d;
}

.status-monitoring {
    background: transparent;
    color: #67e8f9;
}

.status-resolved {
    background: transparent;
    color: #6ee7b7;
}

.meta a {
    color: var(--accent);
    text-decoration: none;
}

.meta a:hover {
    text-decoration: underline;
}

.summary-grid {
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat {
    padding: 1rem;
}

.stat span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.35rem;
}

.stat strong {
    font-size: 1.3rem;
}

.section {
    margin-top: 1rem;
    padding: 1.2rem;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.7rem;
}

.section-head span {
    color: var(--muted);
    font-size: 0.86rem;
}

.category-title {
    margin: 1.2rem 0 0.6rem;
    color: var(--muted);
}

.service-list {
    display: grid;
    gap: 0.6rem;
}

.service-row {
    display: block;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    padding: 0.85rem;
}

.service-row h4 {
    margin-bottom: 0.25rem;
}

.service-row p {
    color: var(--muted);
    font-size: 0.9rem;
}

.service-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.service-meta small {
    color: var(--muted);
    font-size: 0.82rem;
}

.badge {
    border-radius: 999px;
    padding: 0.28rem 0.68rem;
    font-size: 0.76rem;
    font-weight: 700;
}

.callout {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
}

.callout.warning {
    border-color: rgba(251, 191, 36, 0.45);
    background: rgba(251, 191, 36, 0.1);
}

.subscribe-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    padding: 0.9rem;
}

.subscribe-cta p {
    color: var(--muted);
}

.subscribe-form,
.stack-form,
.grid-form {
    display: grid;
    gap: 0.8rem;
}

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

.full-width {
    grid-column: 1 / -1;
}

label {
    display: grid;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.9rem;
}

input,
select,
textarea,
button {
    font: inherit;
    color: var(--text);
}

input,
select,
textarea {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 10px;
    padding: 0.62rem 0.72rem;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

fieldset {
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    padding: 0.65rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

legend {
    color: var(--muted);
    font-size: 0.86rem;
    padding: 0 0.35rem;
}

button,
.button {
    background: var(--accent);
    color: #042f2e;
    border: 0;
    border-radius: 10px;
    padding: 0.62rem 0.9rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    filter: brightness(1.08);
}

.button.ghost,
button.danger {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(148, 163, 184, 0.26);
}

button.danger {
    border-color: rgba(248, 113, 113, 0.6);
    color: #fca5a5;
}

.history-table-wrap,
.admin-table-wrap {
    overflow-x: auto;
}

.history-table,
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td,
.admin-table th,
.admin-table td {
    padding: 0.6rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    text-align: left;
    font-size: 0.9rem;
}

.history-table th,
.admin-table th {
    color: var(--muted);
    font-size: 0.82rem;
}

.incident-list {
    display: grid;
    gap: 0.75rem;
}

.incident-item {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    padding: 0.85rem;
}

.incident-item header {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.45rem;
}

.incident-item p {
    margin-bottom: 0.45rem;
    color: var(--muted);
}

.incident-item small {
    color: var(--muted);
}

.incident-timeline {
    display: grid;
    gap: 0.6rem;
}

.incident-update-item {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    padding: 0.75rem;
    background: rgba(10, 18, 33, 0.5);
}

.incident-update-item header {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: baseline;
    margin-bottom: 0.35rem;
}

.incident-update-item header span {
    color: var(--muted);
    font-size: 0.84rem;
}

.incident-update-item p {
    margin: 0;
    color: var(--text);
}

.footer {
    margin-top: 1rem;
    padding: 0.7rem 0;
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.footer a {
    color: var(--accent);
    text-decoration: none;
}

.admin-page {
    max-width: 1180px;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    align-items: stretch;
    min-width: 200px;
}

.admin-toolbar {
    margin-top: 1rem;
    padding: 0.75rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.admin-tabs .tab-btn {
    background: transparent;
    color: var(--muted);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
}

.admin-tabs .tab-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.admin-tabs .tab-btn.active {
    background: var(--accent);
    color: #042f2e;
    border-color: transparent;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.collapsible-section details > summary {
    list-style: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
}

.collapsible-section details > summary::-webkit-details-marker {
    display: none;
}

.collapsible-section details > summary::before {
    content: '+';
    display: inline-block;
    width: 1.2rem;
    color: var(--accent);
}

.collapsible-section details[open] > summary::before {
    content: '-';
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.patch-note-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.service-filter-input {
    width: 100%;
    max-width: 560px;
}

.admin-table .action-row select,
.admin-table .action-row button {
    min-height: 38px;
}

.incident-cta {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 10px;
    padding: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
}

.incident-cta p {
    color: var(--muted);
}

.action-row {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.inline-check {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chip-list {
    margin-top: 0.8rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.chip-item {
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 999px;
    padding: 0.2rem 0.4rem 0.2rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.danger-outline {
    border-color: rgba(248, 113, 113, 0.35);
}

.mini-input {
    min-width: 120px;
    max-width: 220px;
}

.mini-input.short {
    min-width: 64px;
    max-width: 90px;
}

details > summary {
    cursor: pointer;
    color: var(--accent);
}

.top-gap {
    margin-top: 0.65rem;
}

.admin-login {
    max-width: 420px;
    margin: 5rem auto;
    padding: 1.3rem;
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 30;
}

.modal.open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.7);
}

.modal-panel {
    position: relative;
    max-width: 620px;
    margin: 8vh auto 0;
    padding: 1rem;
    z-index: 31;
}

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

.modal-close {
    background: transparent;
    color: var(--muted);
    border: 1px solid rgba(148, 163, 184, 0.3);
    padding: 0.35rem 0.55rem;
}

.modal-divider {
    margin: 0.5rem 0 0.7rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .global-pill {
        text-align: left;
    }

    .subscribe-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-panel {
        margin: 5vh 0.8rem 0;
    }

    .admin-toolbar {
        position: static;
    }

    .status-banner {
        font-size: 1.15rem;
    }

    .timeline-bars {
        gap: 0.16rem;
    }

    .bar {
        height: 1.6rem;
    }

    .table-tools,
    .incident-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-actions {
        width: 100%;
    }

    .admin-actions form,
    .admin-actions .button {
        width: 100%;
    }

    .admin-actions button {
        width: 100%;
        min-height: 42px;
    }

    .admin-tabs .tab-btn {
        min-height: 40px;
    }

    .chip-item {
        width: 100%;
        justify-content: space-between;
        border-radius: 12px;
        padding: 0.55rem 0.65rem;
    }
}

@media (max-width: 560px) {
    .summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .service-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .service-meta {
        justify-content: flex-start;
    }

    .footer {
        flex-direction: column;
    }

    .page.admin-page {
        padding: 1rem 0.6rem 2.2rem;
    }

    .section {
        padding: 0.95rem;
    }

    .section-head {
        margin-bottom: 0.75rem;
    }

    .admin-toolbar {
        padding: 0.6rem;
        gap: 0.45rem;
    }

    .admin-tabs .tab-btn {
        flex: 1 1 calc(50% - 0.45rem);
        text-align: center;
        font-size: 0.8rem;
    }

    .inline-form {
        width: 100%;
    }

    .inline-form input,
    .inline-form select,
    .inline-form button {
        width: 100%;
        min-height: 40px;
    }

    .action-row {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .action-row form {
        width: 100%;
    }

    .action-row select,
    .action-row button {
        width: 100%;
        min-height: 42px;
    }

    .service-row,
    .incident-item {
        padding: 0.75rem;
    }

    .history-table th,
    .history-table td,
    .admin-table th,
    .admin-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.84rem;
    }
}
