:root {
    --page: #edf3f7;
    --surface: #ffffff;
    --surface-soft: #f7fafc;
    --header: #111d28;
    --header-soft: #182a38;
    --ink: #172a38;
    --muted: #718493;
    --muted-soft: #98a8b4;
    --border: #d9e3e9;
    --border-soft: #e9eff3;
    --blue: #168bd2;
    --blue-dark: #0875b6;
    --green: #21a769;
    --amber: #e49b17;
    --red: #dc4251;
    --slate: #718696;
    --shadow-sm: 0 5px 18px rgba(21, 49, 68, .055);
    --shadow-md: 0 16px 42px rgba(21, 49, 68, .075);
    color-scheme: light;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--page);
}

body {
    min-height: 100vh;
    margin: 0;
}

button,
input {
    font: inherit;
}

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

.public-monitor-page {
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% -8%, rgba(22, 139, 210, .075), transparent 31rem),
        linear-gradient(180deg, #e8f0f5 0, var(--page) 360px);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

.public-header {
    position: relative;
    z-index: 10;
    border-bottom: 1px solid rgba(255, 255, 255, .075);
    color: #f3f8fb;
    background:
        radial-gradient(circle at 15% -60%, rgba(32, 149, 218, .25), transparent 31rem),
        linear-gradient(110deg, var(--header), #132330 60%, #10202c);
    box-shadow: 0 5px 22px rgba(14, 35, 49, .2);
}

.public-header::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 2px;
    content: "";
    background: linear-gradient(90deg, var(--blue), #22bdca 43%, transparent 80%);
    opacity: .8;
}

.public-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1440px, calc(100% - 48px));
    min-height: 82px;
    margin: 0 auto;
}

.public-brand,
.public-header-meta,
.public-footer > div,
.public-clock {
    display: flex;
    align-items: center;
}

.public-brand {
    min-width: 0;
    gap: 13px;
}

.public-brand img {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 7px 20px rgba(0, 0, 0, .16);
    object-fit: contain;
}

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

.public-brand strong {
    max-width: min(44vw, 520px);
    overflow: hidden;
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -.25px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.public-brand small {
    margin-top: 4px;
    color: #7f9bad;
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1.55px;
}

.brand-mark {
    position: relative;
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(66, 181, 246, .36);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(31, 150, 218, .24), rgba(13, 48, 70, .62));
    box-shadow: inset 0 0 22px rgba(37, 164, 239, .08), 0 7px 20px rgba(0, 0, 0, .16);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span,
.brand-mark i {
    position: absolute;
    height: 2px;
    content: "";
    background: #48bfff;
    box-shadow: 0 0 8px rgba(49, 173, 242, .75);
}

.brand-mark::before {
    left: 8px;
    width: 9px;
}

.brand-mark::after {
    right: 8px;
    width: 9px;
}

.brand-mark span {
    left: 15px;
    width: 8px;
    transform: rotate(-55deg);
}

.brand-mark i {
    right: 15px;
    width: 8px;
    transform: rotate(55deg);
}

.brand-mark--large {
    width: 62px;
    height: 62px;
    margin: 0 auto 20px;
    border-radius: 17px;
    background: linear-gradient(145deg, #1a9adc, #0b638e);
}

.public-header-meta {
    gap: 22px;
}

.public-clock {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    column-gap: 9px;
    padding-right: 22px;
    border-right: 1px solid rgba(255, 255, 255, .1);
    text-align: right;
}

.public-clock span {
    grid-column: 1 / -1;
    color: #7592a4;
    font-size: 7px;
    font-weight: 850;
    letter-spacing: 1.25px;
}

.public-clock strong {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.public-clock small {
    color: #8ca2b1;
    font-size: 9px;
}

.public-login-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(87, 181, 236, .35);
    border-radius: 7px;
    color: #f6fbff;
    background: rgba(17, 126, 190, .4);
    box-shadow: inset 0 1px rgba(255, 255, 255, .05);
    font-size: 10px;
    font-weight: 750;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.public-login-link i {
    font-size: 14px;
    font-style: normal;
}

.public-login-link:hover {
    border-color: rgba(85, 197, 255, .7);
    background: rgba(14, 145, 215, .68);
    transform: translateY(-1px);
}

.public-monitor {
    width: min(1440px, calc(100% - 48px));
    margin: 0 auto;
    padding: 34px 0 48px;
}

.public-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 24px;
}

.public-eyebrow {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 0 7px;
    color: var(--blue-dark);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 1.5px;
}

.public-eyebrow i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow: 0 0 0 4px rgba(22, 139, 210, .11);
}

.public-hero h1,
.public-section-heading h2,
.public-empty h2 {
    margin: 0;
    color: #162936;
    letter-spacing: -.65px;
}

.public-hero h1 {
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.12;
}

.public-hero > div:first-child > p:last-child {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.public-system-state {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 255px;
    padding: 12px 16px;
    border: 1px solid #d5e1e7;
    border-radius: 9px;
    background: rgba(255, 255, 255, .85);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.public-system-state > i {
    flex: 0 0 11px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(33, 167, 105, .12);
}

.public-system-state small,
.public-system-state span {
    display: block;
}

.public-system-state small {
    margin-bottom: 3px;
    color: var(--muted-soft);
    font-size: 7px;
    font-weight: 800;
    letter-spacing: .9px;
}

.public-system-state span {
    color: #405664;
    font-size: 10px;
    font-weight: 780;
}

.public-system-state--warning > i {
    background: var(--amber);
    box-shadow: 0 0 0 5px rgba(228, 155, 23, .14);
}

.public-system-state--down > i {
    background: var(--red);
    box-shadow: 0 0 0 5px rgba(220, 66, 81, .13);
}

.public-system-state--unknown > i {
    background: var(--slate);
    box-shadow: 0 0 0 5px rgba(113, 134, 150, .13);
}

.public-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 35px;
}

.public-summary article {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 112px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.public-summary article:hover {
    border-color: #c7d7e0;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.public-summary article::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    content: "";
    background: var(--blue);
}

.public-summary--up::after {
    background: var(--green) !important;
}

.public-summary--warning::after {
    background: var(--amber) !important;
}

.public-summary--down::after {
    background: var(--red) !important;
}

.public-summary--latency::after {
    background: #6c77d9 !important;
}

.summary-icon {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    margin-right: 13px;
    place-items: center;
    border-radius: 10px;
    color: var(--blue-dark);
    background: rgba(22, 139, 210, .105);
    font-size: 18px;
    font-weight: 800;
}

.public-summary--up .summary-icon {
    color: #168c56;
    background: rgba(33, 167, 105, .11);
}

.public-summary--warning .summary-icon {
    color: #b97500;
    background: rgba(228, 155, 23, .12);
}

.public-summary--down .summary-icon {
    color: #c52f3e;
    background: rgba(220, 66, 81, .1);
}

.public-summary--latency .summary-icon {
    color: #5963c2;
    background: rgba(108, 119, 217, .11);
    font-size: 10px;
    text-transform: uppercase;
}

.public-summary article > div:last-child {
    min-width: 0;
}

.public-summary span,
.public-summary strong,
.public-summary small {
    display: block;
}

.public-summary article > div:last-child > span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .35px;
    text-transform: uppercase;
}

.public-summary strong {
    margin-top: 3px;
    color: #1b303e;
    font-size: 27px;
    font-weight: 740;
    letter-spacing: -.8px;
    line-height: 1.08;
}

.public-summary strong b {
    font: inherit;
}

.public-summary strong em {
    color: var(--muted);
    font-size: 10px;
    font-style: normal;
    font-weight: 650;
    letter-spacing: 0;
}

.public-summary small {
    margin-top: 4px;
    overflow: hidden;
    color: var(--muted-soft);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.public-section-heading h2 {
    font-size: 20px;
}

.public-section-heading h2 span {
    display: inline-flex;
    margin-left: 7px;
    padding: 3px 7px;
    border: 1px solid #d4e2e9;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, .7);
    font-size: 8px;
    font-weight: 750;
    letter-spacing: 0;
    vertical-align: 3px;
}

.public-section-heading > p {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: var(--muted);
    font-size: 9px;
}

.public-section-heading > p i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(33, 167, 105, .1);
    animation: pulse 2.2s ease-in-out infinite;
}

@keyframes pulse {
    50% { opacity: .45; }
}

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

.sensor-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid #d3dee5;
    border-radius: 11px;
    background: var(--surface);
    box-shadow: 0 10px 30px rgba(25, 53, 71, .07);
}

.sensor-card::before {
    position: absolute;
    z-index: 2;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    content: "";
    background: var(--green);
}

.sensor-card--warning::before,
.sensor-card--critical::before {
    background: var(--amber);
}

.sensor-card--down::before {
    background: var(--red);
}

.sensor-card--unknown::before {
    background: var(--slate);
}

.sensor-card > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    min-height: 84px;
    padding: 17px 18px 15px 20px;
    border-bottom: 1px solid var(--border-soft);
}

.sensor-number {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    color: #8194a1;
    font-size: 7px;
    font-weight: 850;
    letter-spacing: 1.05px;
}

.sensor-number i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--green);
}

.sensor-card--warning .sensor-number i,
.sensor-card--critical .sensor-number i {
    background: var(--amber);
}

.sensor-card--down .sensor-number i {
    background: var(--red);
}

.sensor-card--unknown .sensor-number i {
    background: var(--slate);
}

.sensor-card h3,
.sensor-card header p {
    margin: 0;
}

.sensor-card h3 {
    overflow: hidden;
    color: #1b303e;
    font-size: 15px;
    letter-spacing: -.2px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sensor-card header p {
    margin-top: 5px;
    color: #80929e;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 9px;
}

.sensor-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgba(33, 167, 105, .24);
    border-radius: 6px;
    color: #168c56;
    background: rgba(33, 167, 105, .075);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .55px;
}

.sensor-status i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px rgba(33, 167, 105, .09);
}

.sensor-card--warning .sensor-status,
.sensor-card--critical .sensor-status {
    border-color: rgba(228, 155, 23, .28);
    color: #b57600;
    background: rgba(228, 155, 23, .085);
}

.sensor-card--down .sensor-status {
    border-color: rgba(220, 66, 81, .25);
    color: #c63140;
    background: rgba(220, 66, 81, .075);
}

.sensor-card--unknown .sensor-status {
    border-color: #d5dfe5;
    color: #718696;
    background: #f1f5f7;
}

.sensor-chart {
    position: relative;
    height: 238px;
    padding: 9px 13px 0;
    background:
        linear-gradient(180deg, rgba(241, 247, 250, .85), rgba(255, 255, 255, .25)),
        repeating-linear-gradient(90deg, transparent 0, transparent 79px, rgba(55, 92, 120, .025) 80px);
}

.sensor-chart canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.sensor-scale {
    position: absolute;
    top: 13px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 7px;
    border: 1px solid rgba(206, 220, 228, .8);
    border-radius: 5px;
    color: #8a9aa5;
    background: rgba(255, 255, 255, .78);
    font-size: 7px;
}

.sensor-scale i {
    width: 10px;
    height: 2px;
    background: var(--blue);
}

.sensor-scale b {
    color: var(--blue-dark);
}

.sensor-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border-top: 1px solid var(--border-soft);
    background: #fbfdfe;
}

.sensor-stats > div {
    min-width: 0;
    padding: 12px 8px;
    border-right: 1px solid var(--border-soft);
    text-align: center;
}

.sensor-stats > div:last-child {
    border-right: 0;
}

.sensor-stats span,
.sensor-stats strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sensor-stats span {
    margin-bottom: 4px;
    color: #91a0aa;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: uppercase;
}

.sensor-stats strong {
    color: #314a59;
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.sensor-card > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 7px 12px 7px 18px;
    border-top: 1px solid var(--border-soft);
    background: #f6f9fb;
}

.sensor-legend {
    display: flex;
    gap: 14px;
    color: #7f919d;
    font-size: 7px;
}

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

.sensor-legend i {
    width: 13px;
    height: 2px;
    background: var(--blue);
}

.sensor-legend span:last-child i {
    height: 5px;
    background: rgba(220, 66, 81, .52);
}

.sensor-range {
    display: flex;
    gap: 2px;
    padding: 2px;
    border: 1px solid #d3dee5;
    border-radius: 6px;
    background: #eaf0f4;
}

.sensor-range button {
    min-height: 25px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    color: #71838f;
    background: transparent;
    cursor: pointer;
    font-size: 8px;
    font-weight: 750;
}

.sensor-range button:hover {
    color: var(--blue-dark);
}

.sensor-range button.active {
    color: #fff;
    background: var(--blue-dark);
    box-shadow: 0 3px 8px rgba(0, 107, 166, .2);
}

.sensor-range button:disabled {
    cursor: wait;
    opacity: .65;
}

.public-empty {
    padding: 64px 25px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.public-empty h2 {
    margin-top: 12px;
}

.public-empty p {
    margin: 8px auto 18px;
    color: var(--muted);
    font-size: 10px;
}

.public-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 25px;
    min-height: 76px;
    padding: 17px max(24px, calc((100% - 1440px) / 2));
    border-top: 1px solid #d2dee5;
    color: #718593;
    background: #e4ecf1;
    font-size: 9px;
}

.public-footer > div {
    flex-wrap: wrap;
    gap: 8px 15px;
}

.public-footer strong {
    color: #354c5b;
}

.public-footer a {
    color: var(--blue-dark);
}

.public-footer p {
    margin: 0;
    text-align: right;
}

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

    .public-summary article:last-child {
        grid-column: span 2;
    }

    .sensor-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .sensor-stats > div:nth-child(3) {
        border-right: 0;
    }

    .sensor-stats > div:nth-child(-n+3) {
        border-bottom: 1px solid var(--border-soft);
    }
}

@media (max-width: 900px) {
    .public-header__inner,
    .public-monitor {
        width: min(100% - 32px, 1440px);
    }

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

@media (max-width: 720px) {
    .public-header__inner {
        min-height: 74px;
    }

    .public-clock {
        display: none;
    }

    .public-brand strong {
        max-width: 48vw;
        font-size: 14px;
    }

    .public-hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 17px;
    }

    .public-system-state {
        width: 100%;
        min-width: 0;
    }

    .public-summary {
        grid-template-columns: 1fr 1fr;
    }

    .public-summary article:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 540px) {
    .public-header__inner,
    .public-monitor {
        width: min(100% - 24px, 1440px);
    }

    .public-monitor {
        padding-top: 25px;
    }

    .public-brand {
        gap: 9px;
    }

    .public-brand img,
    .public-brand .brand-mark {
        width: 39px;
        height: 39px;
        flex-basis: 39px;
        border-radius: 10px;
    }

    .public-brand strong {
        max-width: 42vw;
        font-size: 12px;
    }

    .public-brand small {
        font-size: 7px;
    }

    .public-login-link {
        min-height: 34px;
        padding: 0 10px;
    }

    .public-login-link span {
        display: none;
    }

    .public-hero h1 {
        font-size: 25px;
    }

    .public-summary {
        gap: 9px;
    }

    .public-summary article {
        display: block;
        min-height: 118px;
        padding: 14px;
    }

    .summary-icon {
        width: 31px;
        height: 31px;
        margin: 0 0 9px;
        border-radius: 8px;
        font-size: 15px;
    }

    .public-summary strong {
        font-size: 23px;
    }

    .public-summary small {
        white-space: normal;
    }

    .public-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .sensor-card > header {
        min-height: 80px;
        padding-right: 13px;
    }

    .sensor-chart {
        height: 205px;
        padding-right: 7px;
        padding-left: 7px;
    }

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

    .sensor-stats > div,
    .sensor-stats > div:nth-child(3) {
        border-right: 1px solid var(--border-soft);
        border-bottom: 1px solid var(--border-soft);
    }

    .sensor-stats > div:nth-child(2n) {
        border-right: 0;
    }

    .sensor-stats > div:nth-last-child(-n+2) {
        border-bottom: 0;
    }

    .sensor-card > footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 9px;
        padding: 11px 14px;
    }

    .public-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 18px 12px;
    }

    .public-footer p {
        text-align: left;
    }
}

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