:root {
    color-scheme: dark;
    --bg: #0a0d12;
    --panel: #12171f;
    --panel-soft: #161c25;
    --panel-hover: #1a212c;
    --text: #e8eef5;
    --muted: #8a97a8;
    --faint: #5b6676;
    --line: #232c38;
    --line-strong: #2e3a48;
    --accent: #2dd4bf;
    --accent-strong: #14b8a6;
    --accent-soft: rgba(45, 212, 191, 0.12);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, 0.13);
    --ok-glow: rgba(52, 211, 153, 0.55);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.13);
    --bad-glow: rgba(248, 113, 113, 0.55);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --shadow: 0 26px 64px -28px rgba(0, 0, 0, 0.85);
    --shadow-soft: 0 14px 40px -24px rgba(0, 0, 0, 0.75);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1100px 560px at 82% -12%, rgba(45, 212, 191, 0.09), transparent 60%),
        radial-gradient(900px 520px at -10% -8%, rgba(56, 189, 248, 0.06), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: "";
    display: block;
    height: 132px;
    background:
        radial-gradient(700px 220px at 16% 120%, rgba(45, 212, 191, 0.16), transparent 70%),
        linear-gradient(120deg, #0e2a30 0%, #0c1620 60%, #0a0f16 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

a {
    color: inherit;
}

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

::selection {
    background: var(--accent-soft);
    color: var(--text);
}

::-webkit-scrollbar {
    width: 11px;
    height: 11px;
}

::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: var(--line-strong);
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a4656;
    background-clip: padding-box;
}

.shell {
    width: min(1180px, calc(100% - 36px));
    margin: -80px auto 0;
    padding-bottom: 56px;
}

.topbar,
.overview,
.service-panel,
.detail-hero,
.detail-panel,
.summary article {
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)) ,
        var(--panel);
    box-shadow: var(--shadow-soft);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 96px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 13px;
    background: linear-gradient(150deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #052420;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    box-shadow:
        0 8px 22px -8px var(--ok-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.eyebrow,
.section-label {
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.eyebrow {
    margin-bottom: 6px;
}

h1 {
    font-size: 1.9rem;
    line-height: 1.08;
    letter-spacing: -0.025em;
    font-weight: 800;
}

h2 {
    font-size: 1.08rem;
    letter-spacing: -0.01em;
    font-weight: 750;
}

h3 {
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    font-weight: 750;
}

.actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.last-check {
    display: grid;
    gap: 4px;
    min-width: 184px;
    color: var(--muted);
    font-size: 0.74rem;
    text-align: right;
    letter-spacing: 0.01em;
}

.last-check strong {
    color: var(--text);
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: linear-gradient(150deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #052420;
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 10px 26px -12px var(--ok-glow);
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.button:hover {
    filter: brightness(1.07);
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -12px var(--ok-glow);
}

.button:active {
    transform: translateY(0);
}

.button.secondary {
    border-color: var(--line-strong);
    background: var(--panel-soft);
    color: var(--text);
    box-shadow: none;
}

.button.secondary:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    filter: none;
}

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 0;
    padding: 13px 16px;
    border: 1px solid rgba(52, 211, 153, 0.32);
    border-radius: 12px;
    background: var(--ok-soft);
    color: var(--ok);
    font-size: 0.9rem;
    font-weight: 700;
}

.notice::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--ok);
    box-shadow: 0 0 0 4px var(--ok-soft);
}

.overview {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) 1fr;
    gap: 28px;
    align-items: center;
    margin-top: 20px;
    padding: 24px;
}

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

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
}

.status-line strong {
    font-size: 2.1rem;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.status-pill.healthy {
    background: var(--ok-soft);
    border-color: rgba(52, 211, 153, 0.3);
    color: var(--ok);
}

.status-pill.degraded {
    background: var(--bad-soft);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--bad);
}

.status-pill.idle {
    background: rgba(138, 151, 168, 0.12);
    border-color: rgba(138, 151, 168, 0.28);
    color: var(--muted);
}

.status-dot,
.dot {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--muted);
    flex: 0 0 auto;
}

.healthy .status-dot,
.online .dot {
    background: var(--ok);
    box-shadow: 0 0 0 3px var(--ok-soft), 0 0 10px var(--ok-glow);
}

.degraded .status-dot,
.offline .dot {
    background: var(--bad);
    box-shadow: 0 0 0 3px var(--bad-soft), 0 0 10px var(--bad-glow);
}

.idle .status-dot,
.stopped .dot {
    background: var(--muted);
    box-shadow: 0 0 0 3px rgba(138, 151, 168, 0.14);
}

/* Pulso "ao vivo" no indicador de estado geral */
.status-pill .status-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    animation: pulse 2.2s ease-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }

    70%,
    100% {
        opacity: 0;
        transform: scale(3.4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .status-pill .status-dot::after {
        animation: none;
    }
}

.health-bar {
    height: 9px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #0c1219;
    box-shadow: inset 0 0 0 1px var(--line);
}

.health-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.health-bar .healthy {
    background: linear-gradient(90deg, var(--accent-strong), var(--ok));
    box-shadow: 0 0 12px var(--ok-glow);
}

.health-bar .degraded {
    background: linear-gradient(90deg, #d4544a, var(--bad));
    box-shadow: 0 0 12px var(--bad-glow);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
}

.metric-strip div {
    padding: 18px 20px;
}

.metric-strip div + div {
    border-left: 1px solid var(--line);
}

.metric-strip span,
.summary span,
.summary small {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.metric-strip strong {
    display: block;
    margin-top: 9px;
    font-size: 1.7rem;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.ok {
    color: var(--ok);
}

.bad {
    color: var(--bad);
}

.idle {
    color: var(--muted);
}

.warn {
    color: var(--warn);
}

.service-panel,
.detail-panel {
    margin-top: 20px;
}

.service-panel {
    padding: 24px;
}

.panel-heading,
.group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.panel-heading {
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
    margin-top: 5px;
}

.panel-heading > span,
.group-heading span {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.service-group {
    padding-top: 22px;
}

.service-group + .service-group {
    margin-top: 22px;
    border-top: 1px solid var(--line);
}

.group-heading h3 {
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}

.service-list {
    display: grid;
    margin-top: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
}

.service-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    min-height: 66px;
    padding: 14px 16px 14px 14px;
    text-decoration: none;
    transition: background 0.18s ease;
}

.service-row::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.18s ease;
}

.service-row + .service-row {
    border-top: 1px solid var(--line);
}

.service-row:hover {
    background: var(--panel-hover);
}

.service-row.online:hover::before {
    background: var(--ok);
    box-shadow: 0 0 12px var(--ok-glow);
}

.service-row.offline:hover::before {
    background: var(--bad);
    box-shadow: 0 0 12px var(--bad-glow);
}

.service-row.stopped:hover::before {
    background: var(--muted);
}

.service-identity {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    min-width: 0;
}

.service-identity strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.service-identity p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}

.service-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.uptime {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.service-status {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 6px 11px;
    background: var(--panel-hover);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.service-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.online .service-status {
    background: var(--ok-soft);
    border-color: rgba(52, 211, 153, 0.28);
    color: var(--ok);
}

.offline .service-status {
    background: var(--bad-soft);
    border-color: rgba(248, 113, 113, 0.28);
    color: var(--bad);
}

.stopped .service-status {
    background: rgba(138, 151, 168, 0.1);
    border-color: rgba(138, 151, 168, 0.24);
    color: var(--muted);
}

.detail-hero {
    display: grid;
    grid-template-columns: minmax(260px, 0.7fr) 1fr;
    gap: 24px;
    align-items: center;
    margin-top: 20px;
    padding: 24px;
}

.external-link {
    justify-self: end;
    max-width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--panel-soft);
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-align: right;
    text-decoration: none;
    transition: border-color 0.18s ease, background 0.18s ease;
}

.external-link:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

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

.summary article {
    padding: 18px;
}

.summary strong {
    display: block;
    margin-top: 10px;
    font-size: 1.55rem;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.summary small {
    margin-top: 10px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--faint);
}

.summary .datetime {
    font-size: 1.02rem;
}

.detail-panel {
    padding: 24px;
}

.uptime-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.uptime-cards article {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-soft);
}

.uptime-cards span {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.uptime-cards strong {
    display: block;
    margin-top: 9px;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.timeline {
    display: flex;
    gap: 3px;
    margin-top: 22px;
}

.timeline .bar {
    flex: 1 1 0;
    height: 34px;
    border-radius: 3px;
    background: var(--line-strong);
    transition: transform 0.12s ease, filter 0.12s ease;
}

.timeline .bar:hover {
    transform: scaleY(1.12);
    filter: brightness(1.2);
}

.timeline .bar.ok {
    background: var(--ok);
}

.timeline .bar.partial {
    background: var(--warn);
}

.timeline .bar.down {
    background: var(--bad);
}

.timeline .bar.idle {
    background: var(--muted);
}

.timeline-legend {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    color: var(--faint);
    font-size: 0.72rem;
    font-weight: 700;
}

.message,
.note,
.empty-state {
    padding: 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.message {
    border: 1px solid rgba(248, 113, 113, 0.3);
    background: var(--bad-soft);
    color: #fca5a5;
}

.note {
    border: 1px solid var(--line-strong);
    background: var(--panel-soft);
    color: var(--muted);
}

.empty-state {
    border: 1px solid rgba(52, 211, 153, 0.3);
    background: var(--ok-soft);
    color: var(--ok);
}

@media (max-width: 820px) {
    body::before {
        height: 104px;
    }

    .shell {
        width: min(100% - 28px, 1180px);
        margin-top: -64px;
    }

    .topbar,
    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .last-check {
        text-align: left;
        min-width: 0;
    }

    .button,
    .topbar form {
        width: 100%;
    }

    .overview,
    .detail-hero,
    .summary {
        grid-template-columns: 1fr;
    }

    .external-link {
        justify-self: start;
        text-align: left;
    }

    h1 {
        font-size: 1.55rem;
    }
}

@media (max-width: 560px) {
    .brand {
        align-items: flex-start;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }

    .metric-strip {
        grid-template-columns: 1fr;
    }

    .metric-strip div + div {
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .service-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

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

    .service-status {
        justify-self: start;
    }
}

/* Login */
body.auth-body::before {
    display: none;
}

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(400px, 100%);
    padding: 36px 32px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0)),
        var(--panel);
    box-shadow: var(--shadow);
    text-align: center;
}

.auth-card .brand-mark {
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    font-size: 1.3rem;
}

.auth-card h1 {
    margin-top: 4px;
    font-size: 1.5rem;
}

.auth-hint {
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.auth-card input {
    width: 100%;
    min-height: 46px;
    margin-top: 22px;
    padding: 0 16px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--panel-soft);
    color: var(--text);
    font: inherit;
    font-size: 0.95rem;
}

.auth-card input::placeholder {
    color: var(--faint);
}

.auth-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-card .button {
    width: 100%;
    min-height: 46px;
    margin-top: 14px;
}

.auth-error {
    width: 100%;
    margin-top: 18px;
    padding: 11px 14px;
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 10px;
    background: var(--bad-soft);
    color: #fca5a5;
    font-size: 0.86rem;
    font-weight: 700;
}
