:root {
    --bg: #08111f;
    --bg-soft: #0f1728;
    --panel: rgba(12, 20, 35, 0.88);
    --panel-strong: #111b30;
    --text: #ecf2ff;
    --muted: #9aa8c7;
    --line: rgba(162, 180, 220, 0.14);
    --primary: #6ee7c8;
    --primary-strong: #24c4a0;
    --danger: #ff6f91;
    --warning: #f6c760;
    --shadow: 0 24px 60px rgba(2, 8, 20, 0.35);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "Plus Jakarta Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(67, 161, 255, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(110, 231, 200, 0.16), transparent 24%),
        linear-gradient(180deg, #08111f 0%, #0b1424 100%);
}

body.status-theme-light {
    --bg: #f3f7fc;
    --bg-soft: #edf2fa;
    --panel: rgba(255, 255, 255, 0.86);
    --panel-strong: #ffffff;
    --text: #102033;
    --muted: #5f708a;
    --line: rgba(100, 122, 153, 0.18);
    --primary: #0ea88a;
    --primary-strong: #087d67;
    --danger: #d74d75;
    --warning: #b8860b;
    --shadow: 0 20px 60px rgba(23, 36, 61, 0.12);
    background:
        radial-gradient(circle at top left, rgba(14, 168, 138, 0.12), transparent 26%),
        radial-gradient(circle at top right, rgba(43, 118, 255, 0.12), transparent 22%),
        linear-gradient(180deg, #f5f8fd 0%, #edf3fb 100%);
}

body.status-theme-dark {
    color-scheme: dark;
}

body.status-theme-light {
    color-scheme: light;
}

@media (prefers-color-scheme: light) {
    body.status-theme-auto {
        --bg: #f3f7fc;
        --bg-soft: #edf2fa;
        --panel: rgba(255, 255, 255, 0.86);
        --panel-strong: #ffffff;
        --text: #102033;
        --muted: #5f708a;
        --line: rgba(100, 122, 153, 0.18);
        --primary: #0ea88a;
        --primary-strong: #087d67;
        --danger: #d74d75;
        --warning: #b8860b;
        --shadow: 0 20px 60px rgba(23, 36, 61, 0.12);
        color-scheme: light;
        background:
            radial-gradient(circle at top left, rgba(14, 168, 138, 0.12), transparent 26%),
            radial-gradient(circle at top right, rgba(43, 118, 255, 0.12), transparent 22%),
            linear-gradient(180deg, #f5f8fd 0%, #edf3fb 100%);
    }
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font: inherit;
}

.shell {
    min-height: 100vh;
}

.shell-auth {
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.shell-status {
    padding: 0 16px 64px;
}

.auth-shell {
    width: min(100%, 520px);
}

.status-layout-shell {
    width: 100%;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 28px 22px;
    border-right: 1px solid var(--line);
    background: rgba(5, 11, 22, 0.48);
    backdrop-filter: blur(16px);
}

.brand-card, .sidebar-card, .panel, .auth-card, .stat-card, .subpanel, .editor-card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: var(--radius-lg);
}

.brand-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    margin-bottom: 18px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, #6fa8ff 100%);
    color: #062235;
    font-weight: 800;
}

.brand-card h1,
.page-head h1,
.auth-card h1,
.panel h2,
.subpanel h3 {
    margin: 0;
    letter-spacing: -0.03em;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.nav-stack {
    display: grid;
    gap: 10px;
}

.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.settings-link {
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
}

.settings-link.active {
    color: var(--text);
    border-color: rgba(110, 231, 200, 0.26);
    background: rgba(110, 231, 200, 0.08);
}

.nav-link {
    padding: 14px 16px;
    border-radius: 16px;
    color: var(--muted);
    transition: 180ms ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: rgba(110, 231, 200, 0.08);
    border: 1px solid rgba(110, 231, 200, 0.18);
}

.sidebar-card {
    margin-top: 18px;
    padding: 18px;
    color: var(--muted);
}

.main-shell {
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px 28px 0;
}

.topbar-actions,
.inline-actions,
.panel-head,
.page-head,
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-content {
    padding: 26px 28px 32px;
}

.page-head {
    align-items: end;
    margin-bottom: 20px;
}

.lede,
.muted,
.sidebar-card p {
    color: var(--muted);
    line-height: 1.65;
}

.stats-grid,
.grid-two,
.panel-subgrid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

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

.stat-card {
    padding: 20px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 34px;
    letter-spacing: -0.04em;
}

.panel,
.auth-card,
.subpanel,
.editor-card {
    padding: 22px;
}

.accent-panel {
    background: linear-gradient(135deg, rgba(110, 231, 200, 0.12), rgba(111, 168, 255, 0.12));
}

.auth-card {
    padding: 34px;
}

.auth-card-narrow {
    max-width: 520px;
}

.stack-sm > * + * { margin-top: 10px; }
.stack-md > * + * { margin-top: 14px; }
.stack-lg > * + * { margin-top: 20px; }

.field {
    display: grid;
    gap: 8px;
}

.field label {
    color: #d6def5;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(167, 186, 230, 0.16);
    background: rgba(9, 15, 28, 0.92);
    color: var(--text);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(110, 231, 200, 0.56);
    box-shadow: 0 0 0 4px rgba(110, 231, 200, 0.12);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

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

.form-actions {
    display: flex;
    align-items: end;
}

.button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

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

.button-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #75b7ff 100%);
    color: #062235;
    font-weight: 800;
}

.button-ghost {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-color: var(--line);
}

.button-danger {
    background: rgba(255, 111, 145, 0.1);
    color: #ffb1c4;
    border-color: rgba(255, 111, 145, 0.22);
}

.button-block {
    width: 100%;
}

.user-chip,
.status-pill,
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
}

.status-pill {
    font-size: 13px;
    font-weight: 700;
}

.status-up,
.status-online {
    background: rgba(110, 231, 200, 0.12);
    color: #86f3d8;
}

.status-down,
.status-dead {
    background: rgba(255, 111, 145, 0.12);
    color: #ffb1c4;
}

.status-stale,
.status-maintenance {
    background: rgba(246, 199, 96, 0.12);
    color: #f8d88e;
}

.status-unknown,
.status-paused {
    background: rgba(154, 168, 199, 0.12);
    color: #c9d4ee;
}

.list-row {
    padding: 15px 0;
    border-bottom: 1px solid var(--line);
}

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

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #d7e1fa;
}

.checkbox input {
    width: auto;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(8, 14, 26, 0.9);
}

.flash-success { border-color: rgba(110, 231, 200, 0.24); }
.flash-error { border-color: rgba(255, 111, 145, 0.24); }
.flash-close {
    background: transparent;
    color: inherit;
    border: 0;
    font-size: 18px;
    cursor: pointer;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tag-pill {
    background: color-mix(in srgb, var(--tag-color) 18%, rgba(13, 19, 33, 0.9));
    border-color: color-mix(in srgb, var(--tag-color) 40%, rgba(255, 255, 255, 0.08));
}

.token-box,
.code-block {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: rgba(5, 10, 20, 0.84);
    border: 1px solid var(--line);
    overflow-x: auto;
}

.status-logo-preview {
    max-width: 220px;
    max-height: 120px;
    object-fit: contain;
    padding: 12px;
    border-radius: var(--radius-md);
    background: rgba(6, 10, 20, 0.72);
    border: 1px solid var(--line);
}

.status-page-builder {
    display: grid;
    gap: 14px;
}

.builder-empty {
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(154, 168, 199, 0.28);
    color: var(--muted);
}

.builder-section {
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(8, 14, 26, 0.8);
}

.builder-section.drag-over,
.builder-item.drag-over,
.builder-items.drag-over {
    border-color: rgba(110, 231, 200, 0.44);
    box-shadow: 0 0 0 3px rgba(110, 231, 200, 0.12);
}

.builder-section-head,
.builder-toolbar,
.builder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.builder-section-head {
    margin-bottom: 14px;
}

.builder-handle {
    color: var(--muted);
    font-size: 13px;
    border: 1px dashed rgba(154, 168, 199, 0.24);
    border-radius: 999px;
    padding: 8px 12px;
    cursor: grab;
}

.builder-items {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.builder-item {
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.builder-item span {
    color: var(--muted);
    font-size: 13px;
}

button.linkish {
    background: transparent;
    border: 0;
    color: #ffb1c4;
    cursor: pointer;
}

code {
    font-family: Consolas, Monaco, monospace;
    color: #bfe7ff;
}

.status-shell {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: 40px 0 80px;
    display: grid;
    gap: 18px;
}

.status-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.status-hero-panel {
    overflow: hidden;
}

.status-brand {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.status-logo-frame {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-radius: 24px;
    background: rgba(7, 12, 24, 0.44);
    border: 1px solid var(--line);
}

.status-summary-card {
    display: grid;
    gap: 10px;
    min-width: 220px;
    justify-items: end;
}

.status-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.status-kpi {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.status-kpi span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
    font-size: 14px;
}

.status-kpi strong {
    font-size: 28px;
    letter-spacing: -0.04em;
}

.status-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.status-range-switch {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.status-maintenance-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(246, 199, 96, 0.18);
    background: rgba(246, 199, 96, 0.08);
}

.status-section-panel {
    gap: 18px;
}

.status-monitor-grid {
    display: grid;
    gap: 14px;
}

.status-monitor-card {
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.status-monitor-head,
.status-history-meta,
.status-monitor-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-monitor-title {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.status-history {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14px, 1fr));
    gap: 6px;
    margin-top: 16px;
}

.history-cell {
    height: 32px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: rgba(154, 168, 199, 0.18);
}

.history-cell.is-up {
    background: rgba(110, 231, 200, 0.18);
    border-color: rgba(110, 231, 200, 0.28);
}

.history-cell.is-down {
    background: rgba(255, 111, 145, 0.18);
    border-color: rgba(255, 111, 145, 0.28);
}

.history-cell.is-maintenance {
    background: rgba(246, 199, 96, 0.2);
    border-color: rgba(246, 199, 96, 0.28);
}

.history-cell.is-unknown,
.history-cell.is-paused {
    background: rgba(154, 168, 199, 0.15);
    border-color: rgba(154, 168, 199, 0.16);
}

.status-history-meta {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.status-footer {
    padding: 8px 4px 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin: 0;
}

.markdown-body > * + * {
    margin-top: 12px;
}

.markdown-body ul {
    padding-left: 20px;
}

.markdown-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.markdown-body code {
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(6, 12, 24, 0.08);
    border: 1px solid var(--line);
}

.mobile-only {
    display: none;
}

@media (max-width: 1080px) {
    .stats-grid,
    .grid-two,
    .grid-form,
    .panel-subgrid,
    .status-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 320px);
        transform: translateX(-105%);
        transition: transform 180ms ease;
        z-index: 20;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-only {
        display: inline-flex;
    }
}

@media (max-width: 720px) {
    .stats-grid,
    .grid-two,
    .grid-form,
    .grid-form-wide,
    .panel-subgrid,
    .page-head,
    .status-hero,
    .status-toolbar,
    .status-monitor-head,
    .status-kpis,
    .topbar {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    .page-content,
    .topbar {
        padding-inline: 16px;
    }

    .auth-card,
    .panel,
    .editor-card,
    .subpanel {
        padding: 18px;
    }

    .status-brand {
        flex-direction: column;
    }

    .status-summary-card {
        justify-items: start;
        min-width: 0;
    }

    .status-range-switch {
        justify-content: flex-start;
    }

    .status-history {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
}
