:root {
    color-scheme: dark;
    --bg: #080b10;
    --surface: #10151d;
    --surface-raised: #151c26;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.14);
    --text: #f4f7fb;
    --muted: #8e9aaa;
    --red: #ff5f6d;
    --green: #39d98a;
    --amber: #f6bd58;
    --blue: #5b9dff;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 12% -10%, rgba(91, 157, 255, 0.14), transparent 34rem),
        radial-gradient(circle at 88% 10%, rgba(255, 95, 109, 0.10), transparent 30rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.topbar {
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}

.brand,
.header-actions,
.panel-heading {
    display: flex;
    align-items: center;
}

.brand {
    gap: 14px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 95, 109, 0.45);
    border-radius: 13px;
    color: #fff;
    background: linear-gradient(145deg, rgba(255, 95, 109, 0.32), rgba(255, 95, 109, 0.08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
    font-size: 19px;
    font-weight: 800;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    margin-top: 3px;
    font-size: 19px;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 22px;
    letter-spacing: -0.025em;
}

.eyebrow {
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.16em;
}

.header-actions {
    gap: 12px;
}

.service-badge,
.count-pill,
.state-pill {
    display: inline-flex;
    align-items: center;
    width: max-content;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.035);
    font-size: 12px;
    font-weight: 700;
}

.service-badge {
    gap: 8px;
    padding: 9px 13px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(246, 189, 88, 0.10);
}

.service-badge.is-online {
    color: #a9f4ce;
    border-color: rgba(57, 217, 138, 0.25);
    background: rgba(57, 217, 138, 0.07);
}

.service-badge.is-online .status-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(57, 217, 138, 0.11);
}

.service-badge.is-offline {
    color: #ffacb3;
    border-color: rgba(255, 95, 109, 0.28);
    background: rgba(255, 95, 109, 0.07);
}

.service-badge.is-offline .status-dot {
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(255, 95, 109, 0.11);
}

.refresh-button {
    min-height: 36px;
    padding: 0 15px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.055);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.refresh-button:hover {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.09);
}

.refresh-button:active {
    transform: translateY(1px);
}

.refresh-button:disabled {
    cursor: wait;
    opacity: 0.55;
}

.hero {
    min-height: 215px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    padding: 50px 0 36px;
}

.hero h2 {
    max-width: 680px;
    margin-top: 11px;
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1.05;
}

.hero-copy {
    max-width: 650px;
    margin-top: 18px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

.updated-block {
    min-width: 210px;
    padding: 18px 20px;
    border-left: 2px solid rgba(91, 157, 255, 0.7);
    color: var(--muted);
    background: linear-gradient(90deg, rgba(91, 157, 255, 0.08), transparent);
}

.updated-block span,
.updated-block small {
    display: block;
    font-size: 11px;
}

.updated-block strong {
    display: block;
    margin: 7px 0 5px;
    color: var(--text);
    font-size: 14px;
}

.notice {
    margin-bottom: 18px;
    padding: 13px 16px;
    border: 1px solid rgba(255, 95, 109, 0.24);
    border-radius: 11px;
    color: #ffc1c6;
    background: rgba(255, 95, 109, 0.07);
    font-size: 13px;
}

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

.summary-card,
.panel {
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent 42%), var(--surface);
    box-shadow: var(--shadow);
}

.summary-card {
    position: relative;
    min-height: 154px;
    padding: 22px;
    overflow: hidden;
    border-radius: 14px;
}

.summary-card::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 90px;
    height: 2px;
    content: "";
    background: var(--card-accent);
    box-shadow: 0 0 24px var(--card-accent);
}

.accent-red { --card-accent: var(--red); }
.accent-green { --card-accent: var(--green); }
.accent-amber { --card-accent: var(--amber); }
.accent-blue { --card-accent: var(--blue); }

.summary-label,
.summary-hint {
    display: block;
    color: var(--muted);
}

.summary-label {
    font-size: 12px;
    font-weight: 650;
}

.summary-value {
    display: block;
    margin: 15px 0 8px;
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.summary-hint {
    font-size: 11px;
}

.panel {
    margin-top: 18px;
    overflow: hidden;
    border-radius: 16px;
}

.panel-heading {
    justify-content: space-between;
    gap: 20px;
    min-height: 88px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
}

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

.count-pill {
    padding: 7px 11px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--line);
}

th {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.018);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

td {
    color: #d7dee8;
    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.ip-address {
    color: #fff;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    font-weight: 650;
}

.state-pill {
    padding: 5px 9px;
    color: #ffacb3;
    border-color: rgba(255, 95, 109, 0.25);
    background: rgba(255, 95, 109, 0.08);
}

.empty-state {
    padding: 34px 24px;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

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

.jail-card {
    min-width: 0;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-raised);
}

.jail-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.jail-name {
    overflow: hidden;
    color: #f5f7fb;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jail-active {
    color: var(--green);
    font-size: 11px;
    font-weight: 700;
}

.jail-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 18px;
}

.jail-metric {
    min-width: 0;
}

.jail-metric strong,
.jail-metric span {
    display: block;
}

.jail-metric strong {
    color: #fff;
    font-size: 18px;
}

.jail-metric span {
    margin-top: 5px;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.jail-rule {
    margin-top: 17px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

footer {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667181;
    font-size: 11px;
}

.footer-separator {
    margin: 0 8px;
}

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

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

    .updated-block {
        width: 100%;
    }
}

@media (max-width: 680px) {
    .page-shell {
        width: min(100% - 24px, 1180px);
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 20px 0;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .hero {
        padding-top: 38px;
    }

    .hero h2 {
        font-size: 34px;
    }

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

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

    .summary-card {
        min-height: 132px;
        padding: 17px;
    }

    .summary-value {
        margin-top: 13px;
        font-size: 31px;
    }

    .panel-heading,
    th,
    td {
        padding-left: 18px;
        padding-right: 18px;
    }

    .jail-grid {
        padding: 12px;
    }

    .table-wrap {
        overflow: visible;
    }

    table,
    tbody {
        display: block;
        width: 100%;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .ban-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 17px 24px;
        padding: 20px 18px;
        border-bottom: 1px solid var(--line);
    }

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

    .ban-row td {
        display: flex;
        min-width: 0;
        padding: 0;
        border: 0;
        flex-direction: column;
        gap: 7px;
    }

    .ban-row td::before {
        color: var(--muted);
        content: attr(data-label);
        font-family: Inter, ui-sans-serif, system-ui, sans-serif;
        font-size: 9px;
        font-weight: 750;
        letter-spacing: 0.08em;
    }

    .ban-row td:nth-child(1),
    .ban-row td:nth-child(2) {
        grid-column: 1 / -1;
    }

    .ban-row td:nth-child(4) {
        align-items: flex-end;
        text-align: right;
    }

    .empty-row {
        display: block;
    }

    .empty-row td {
        display: block;
        width: 100%;
        border: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
