:root {
    --bg: #070b12;
    --bg-soft: #0b111d;
    --panel: rgba(15, 23, 37, 0.88);
    --panel-strong: #111a2a;
    --line: rgba(148, 163, 184, 0.16);
    --line-strong: rgba(148, 163, 184, 0.28);
    --text: #f4f7fb;
    --muted: #95a3b8;
    --faint: #65758d;
    --green: #33d69f;
    --green-soft: rgba(51, 214, 159, 0.14);
    --red: #ff5f73;
    --red-soft: rgba(255, 95, 115, 0.13);
    --amber: #f8c35b;
    --amber-soft: rgba(248, 195, 91, 0.13);
    --blue: #64a6ff;
    --violet: #9d7cff;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 14% 8%, rgba(100, 166, 255, 0.18), transparent 28%),
        radial-gradient(circle at 82% 0%, rgba(51, 214, 159, 0.12), transparent 28%),
        linear-gradient(180deg, #060910 0%, #0a101b 50%, #070b12 100%);
}

button {
    font: inherit;
}

.page-shell {
    width: min(1440px, 100%);
    margin: 0 auto;
    padding: 24px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 0 22px;
    backdrop-filter: blur(18px);
}

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

.brand-logo {
    display: block;
    width: 162px;
    height: auto;
    max-height: 40px;
    object-fit: contain;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 15px;
    letter-spacing: 0;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
}

.topbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(15, 23, 37, 0.7);
    color: var(--muted);
    font-size: 13px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
    gap: 24px;
    align-items: stretch;
    padding: 54px 0 24px;
}

.hero-copy {
    min-height: 360px;
    padding: clamp(28px, 5vw, 58px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(17, 26, 42, 0.94), rgba(9, 14, 24, 0.88)),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 80px);
    box-shadow: var(--shadow);
}

.hero-copy h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(28px, 3vw, 36px);
    line-height: 1.1;
    letter-spacing: 0;
}

.hero-copy p {
    max-width: 680px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.7;
}

.hero-copy strong {
    color: var(--text);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 34px;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--green), #76e6ff);
    color: #041016;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 16px 38px rgba(51, 214, 159, 0.22);
}

.primary-button:hover {
    filter: brightness(1.05);
}

.icon-refresh {
    width: 15px;
    height: 15px;
    border: 2px solid currentColor;
    border-left-color: transparent;
    border-radius: 50%;
}

.last-check {
    color: var(--muted);
    font-size: 13px;
}

.last-check strong {
    color: var(--text);
}

.system-card,
.validation-band,
.metric-panel,
.services-panel,
.history-panel,
.logs-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.system-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 360px;
    padding: clamp(28px, 5vw, 58px);
}

.summary-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.summary-head h2 {
    margin: 0;
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.05;
}

.summary-head p {
    margin: 10px 0 0;
    color: var(--muted);
}

.status-orb {
    position: relative;
    display: inline-block;
    width: 12px;
    height: 12px;
    flex: 0 0 12px;
    margin-top: 4px;
    border-radius: 999px;
    background: var(--amber);
    box-shadow: 0 0 0 5px var(--amber-soft);
}

.status-orb.online {
    background: var(--green);
    box-shadow: 0 0 0 5px var(--green-soft), 0 0 28px rgba(51, 214, 159, 0.52);
}

.status-orb.offline {
    background: var(--red);
    box-shadow: 0 0 0 5px var(--red-soft), 0 0 28px rgba(255, 95, 115, 0.42);
}

.status-orb.unknown,
.status-orb.checking {
    background: var(--amber);
    box-shadow: 0 0 0 5px var(--amber-soft);
}

.pulse-dot.online::after,
.status-orb.online::after {
    position: absolute;
    inset: -8px;
    border: 1px solid rgba(51, 214, 159, 0.35);
    border-radius: inherit;
    content: "";
    animation: pulse 1.8s ease-out infinite;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
    margin-top: 34px;
}

.summary-metrics div {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.summary-metrics span,
.panel-title span,
.metric-panel small {
    color: var(--muted);
    font-size: 12px;
}

.summary-metrics strong,
.panel-title strong {
    display: block;
    overflow-wrap: anywhere;
    margin-top: 7px;
    font-size: 18px;
}

.summary-metrics strong {
    overflow-wrap: normal;
    white-space: nowrap;
    font-size: 16px;
}

.validation-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 0 0 24px;
    padding: 24px;
    background:
        linear-gradient(90deg, rgba(51, 214, 159, 0.13), transparent 48%),
        rgba(15, 23, 37, 0.88);
}

.validation-band h2,
.section-head h2,
.history-panel h2,
.logs-panel h2 {
    margin: 0;
    font-size: 22px;
}

.validation-band p,
.section-head p {
    margin: 8px 0 0;
    color: var(--muted);
}

.validation-result {
    display: flex;
    align-items: center;
    min-width: min(440px, 100%);
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(51, 214, 159, 0.24);
    border-radius: 8px;
    background: rgba(51, 214, 159, 0.07);
}

.validation-result strong,
.validation-result span {
    display: block;
}

.validation-result span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.metric-panel {
    min-height: 156px;
    padding: 20px;
}

.panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.mini-chart {
    display: grid;
    grid-template-columns: repeat(18, 1fr);
    align-items: end;
    gap: 5px;
    height: 72px;
    margin-top: 26px;
}

.mini-chart span {
    display: block;
    min-height: 8px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--blue), var(--green));
    animation: barIn 420ms ease both;
}

.meter {
    overflow: hidden;
    height: 11px;
    margin: 28px 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.meter span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green), var(--blue));
    transition: width 480ms ease;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
    gap: 24px;
    align-items: start;
}

.services-panel,
.history-panel,
.logs-panel {
    padding: 24px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.refresh-note {
    color: var(--faint);
    font-size: 12px;
    white-space: nowrap;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.service-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-height: 98px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
}

.service-card.online {
    border-color: rgba(51, 214, 159, 0.2);
}

.service-card.offline {
    border-color: rgba(255, 95, 115, 0.28);
}

.service-card.unknown {
    border-color: rgba(248, 195, 91, 0.22);
}

.service-row {
    display: flex;
    min-width: 0;
    gap: 12px;
}

.service-card h3 {
    margin: 0;
    font-size: 15px;
}

.service-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.service-card > span {
    color: var(--faint);
    font-size: 12px;
    white-space: nowrap;
}

.side-stack {
    display: grid;
    gap: 24px;
}

.history-panel ol {
    display: grid;
    gap: 13px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.history-panel li {
    display: grid;
    grid-template-columns: 10px 1fr;
    gap: 12px;
}

.history-panel li > span {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--amber);
}

.history-panel li.online > span,
.history-panel li.operational > span {
    background: var(--green);
}

.history-panel li.offline > span,
.history-panel li.degraded > span {
    background: var(--red);
}

.history-panel strong,
.history-panel small {
    display: block;
}

.history-panel strong {
    font-size: 13px;
}

.history-panel small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.log-stream {
    display: grid;
    gap: 10px;
    max-height: 430px;
    overflow: auto;
    margin-top: 18px;
    padding-right: 4px;
}

.log-line {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
}

.log-line span {
    color: var(--faint);
    font-size: 11px;
}

.log-line p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.log-line.success {
    border-color: rgba(51, 214, 159, 0.18);
}

.log-line.error {
    border-color: rgba(255, 95, 115, 0.22);
}

.log-line.warning {
    border-color: rgba(248, 195, 91, 0.2);
}

.notice-line {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

@keyframes pulse {
    from {
        opacity: 0.8;
        transform: scale(0.72);
    }
    to {
        opacity: 0;
        transform: scale(1.55);
    }
}

@keyframes barIn {
    from {
        opacity: 0;
        transform: scaleY(0.3);
        transform-origin: bottom;
    }
    to {
        opacity: 1;
        transform: scaleY(1);
        transform-origin: bottom;
    }
}

@media (max-width: 1080px) {
    .hero-grid,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .system-card {
        min-height: 260px;
    }
}

@media (max-width: 820px) {
    .page-shell {
        padding: 16px;
    }

    .topbar,
    .validation-band,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .topbar-meta,
    .refresh-note {
        align-self: flex-start;
    }

    .hero-grid {
        padding-top: 22px;
    }

    .hero-copy {
        min-height: auto;
    }

    .summary-metrics,
    .metrics-grid,
    .services-grid {
        grid-template-columns: 1fr;
    }

    .validation-result {
        min-width: 0;
    }
}

@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;
    }
}
