:root {
    --page-bg: #05070c;
    --panel: rgba(15, 19, 30, 0.78);
    --panel-strong: rgba(18, 24, 38, 0.9);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.2);
    --text: #f7fbff;
    --muted: #a8b4c4;
    --green: #36f6a2;
    --orange: #ff8a3d;
    --cyan: #31d4ff;
    --rose: #ff4e8a;
    --yellow: #f4d35e;
    --red: #ff5b67;
    --shadow: 0 20px 70px rgba(0, 0, 0, 0.4);
    --spectrum-loop: linear-gradient(
        90deg,
        var(--green) 0%,
        var(--cyan) 12.5%,
        var(--orange) 25%,
        var(--rose) 37.5%,
        var(--green) 50%,
        var(--cyan) 62.5%,
        var(--orange) 75%,
        var(--rose) 87.5%,
        var(--green) 100%
    );
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.extra-shell {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--page-bg);
    color: var(--text);
    font-family: "Poppins", sans-serif;
    opacity: 1;
    transition: opacity 500ms ease;
}

body.extra-shell.page-loaded,
body.extra-shell:not(.uses-js) {
    opacity: 1;
}

body.dialog-open {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

body.extra-shell::before,
body.extra-shell::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body.extra-shell::before {
    z-index: -3;
    background:
        radial-gradient(circle at 12% 8%, rgba(54, 246, 162, 0.24), transparent 30rem),
        radial-gradient(circle at 82% 2%, rgba(255, 138, 61, 0.22), transparent 28rem),
        radial-gradient(circle at 86% 72%, rgba(49, 212, 255, 0.2), transparent 30rem),
        radial-gradient(circle at 18% 86%, rgba(255, 78, 138, 0.16), transparent 28rem),
        linear-gradient(145deg, #05070c 0%, #080d16 42%, #0b0f17 100%);
}

body.extra-shell::after {
    z-index: -2;
    opacity: 0.34;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(circle at 50% 18%, black, transparent 72%);
}

.scanline {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.04), transparent);
    background-size: 100% 9px;
    opacity: 0.18;
}

.top-strip {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    min-height: 4.25rem;
    overflow-x: auto;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(5, 7, 12, 0.72);
    backdrop-filter: blur(18px);
    scrollbar-width: none;
}

.top-strip::-webkit-scrollbar {
    display: none;
}

.status-chip,
.command-link,
.service-card,
.stat-card,
.cf-tunnel-card,
.data-panel,
.status-frame {
    border-radius: 8px;
}

.status-chip,
.command-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    color: var(--text);
    text-align: center;
}

.status-chip {
    padding: 0.58rem 0.82rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.command-link {
    gap: 0.45rem;
    padding: 0.78rem 1.08rem;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.top-strip .status-chip,
.top-strip .command-link {
    flex: 0 0 auto;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0.58rem 0.82rem;
    font-size: 0.78rem;
    line-height: 1.15;
}

.command-link::after {
    content: ">";
    color: var(--green);
    font-weight: 800;
}

.back-link::before {
    content: "<";
    color: var(--green);
    font-weight: 800;
}

.back-link::after {
    content: "";
}

.command-link:hover,
.command-link:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(54, 246, 162, 0.55);
    box-shadow: 0 18px 42px rgba(54, 246, 162, 0.16);
}

.page-main {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.hero-zone {
    display: grid;
    justify-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1.4rem 0 1rem;
    text-align: center;
}

.hero-zone > * {
    min-width: 0;
}

.hero-kicker {
    margin: 0;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.mega-title {
    margin: 0;
    max-width: 100%;
    color: var(--text);
    font-size: 4rem;
    line-height: 0.9;
    font-weight: 800;
    letter-spacing: 0;
    text-shadow:
        0 0 22px rgba(54, 246, 162, 0.22),
        0 0 46px rgba(49, 212, 255, 0.18);
}

.mega-title .accent {
    display: inline-block;
    background: var(--spectrum-loop);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: spectrum-loop 12s linear infinite;
}

.is-page-hidden .mega-title .accent {
    animation-play-state: paused;
}

.connection-line {
    width: min(100%, 46rem);
    max-width: 100%;
    min-width: 0;
    min-height: 1.5rem;
    margin: 0;
    padding-inline: 0.35rem;
    color: var(--muted);
    font-size: 0.95rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.connection-line strong {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere !important;
    word-break: break-all !important;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.section-shell {
    width: 100%;
    margin-top: 2.5rem;
    content-visibility: auto;
    contain-intrinsic-size: 520px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: 0;
}

.section-meta,
.helper-note {
    color: var(--muted);
    font-size: 0.82rem;
}

.data-panel,
.status-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035));
    box-shadow: var(--shadow);
}

.reveal-surface {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    contain: paint;
}

.reveal-light {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(
            240px circle at var(--reveal-x, 50%) var(--reveal-y, 50%),
            rgba(255, 255, 255, 0.22),
            rgba(255, 255, 255, 0.1) 24%,
            rgba(255, 255, 255, 0.035) 46%,
            transparent 68%
        );
    transition: opacity 160ms ease;
}

.reveal-surface.is-lit .reveal-light {
    opacity: 1;
}

.reveal-surface > :not(.reveal-light) {
    position: relative;
    z-index: 1;
}

.data-panel::before,
.status-frame::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: var(--spectrum-loop);
    background-size: 200% 100%;
    opacity: 0.68;
    height: 2px;
}

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

.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table thead {
    color: var(--muted);
    background: rgba(0, 0, 0, 0.24);
}

.data-table th,
.data-table td {
    padding: 1rem 1.15rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: middle;
}

.data-table th {
    border-top: 0;
    font-weight: 800;
}

.data-table tbody tr {
    transition: background 200ms ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.055);
}

.server-name,
.mono-value {
    color: var(--text);
    font-weight: 800;
}

.mono-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
}

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

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-weight: 800;
}

.status-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    box-shadow: 0 0 18px currentColor;
}

.status-online {
    color: var(--green);
}

.status-offline {
    color: var(--red);
}

.status-online .status-dot {
    background: var(--green);
    animation: pulse-dot 1.8s ease-in-out infinite;
}

.status-offline .status-dot {
    background: var(--red);
}

.helper-note {
    margin: 0.85rem 0 0;
    text-align: center;
}

.ping-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 1.25rem;
    color: var(--muted);
}

.ping-pill {
    min-height: 2.2rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    overflow-wrap: anywhere;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.85rem;
    isolation: isolate;
}

.service-card {
    --accent: var(--green);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.115), rgba(255, 255, 255, 0.035)),
        radial-gradient(circle at 0 0, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%);
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.26);
    transform: translateZ(0);
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
    animation: card-rise 520ms ease both;
}

.service-direct {
    --accent: var(--green);
    border-color: rgba(54, 246, 162, 0.34);
    background:
        linear-gradient(135deg, rgba(54, 246, 162, 0.2), rgba(54, 246, 162, 0.08) 42%, rgba(255, 255, 255, 0.04)),
        radial-gradient(circle at 0 0, rgba(54, 246, 162, 0.3), transparent 58%);
}

.service-cloudflare {
    --accent: var(--orange);
    border-color: rgba(255, 138, 61, 0.34);
    background:
        linear-gradient(135deg, rgba(255, 138, 61, 0.22), rgba(255, 138, 61, 0.08) 42%, rgba(255, 255, 255, 0.04)),
        radial-gradient(circle at 0 0, rgba(255, 138, 61, 0.28), transparent 58%);
}

.service-card::before {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: var(--accent);
    box-shadow: 0 0 28px var(--accent);
}

.service-card::after {
    content: none;
}

.service-card:hover,
.service-card:focus-visible {
    z-index: 8;
    transform: translateY(-9px) scale(1.026);
    border-color: color-mix(in srgb, var(--accent) 65%, white 10%);
    box-shadow:
        0 28px 72px color-mix(in srgb, var(--accent) 24%, rgba(0, 0, 0, 0.45)),
        0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent),
        0 0 34px color-mix(in srgb, var(--accent) 18%, transparent);
}

.service-name {
    position: relative;
    z-index: 1;
    max-width: 100%;
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.service-badge {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 0.65rem;
    height: 0.65rem;
    margin-left: 0.75rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 22px var(--accent);
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.2rem 1rem 1.8rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.dashboard-main {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.dashboard-grid,
.cf-tunnel-grid {
    display: grid;
    gap: 1rem;
    isolation: isolate;
}

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

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

.stat-card,
.cf-tunnel-card {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
        radial-gradient(circle at 0 0, rgba(54, 246, 162, 0.12), transparent 52%);
    box-shadow: var(--shadow);
    transform: translateZ(0);
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

.stat-card:hover,
.stat-card:focus-within,
.cf-tunnel-card:hover,
.cf-tunnel-card:focus-within {
    z-index: 8;
    transform: translateY(-9px) scale(1.018);
    border-color: rgba(255, 255, 255, 0.26);
    box-shadow:
        0 30px 78px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        0 0 38px rgba(49, 212, 255, 0.12);
}

.stat-card {
    min-height: 228px;
    padding: 1.15rem;
    text-align: left;
    animation: card-rise 560ms ease both;
}

.stat-card:nth-child(2),
.cf-tunnel-card:nth-child(2) {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
        radial-gradient(circle at 0 0, rgba(49, 212, 255, 0.14), transparent 52%);
}

.stat-card:nth-child(3),
.cf-tunnel-card:nth-child(3) {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
        radial-gradient(circle at 0 0, rgba(255, 138, 61, 0.13), transparent 52%);
}

.stat-card:nth-child(4),
.cf-tunnel-card:nth-child(4) {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
        radial-gradient(circle at 0 0, rgba(255, 78, 138, 0.12), transparent 52%);
}

.stat-card::before,
.cf-tunnel-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: var(--spectrum-loop);
    background-size: 200% 100%;
}

.stat-card h3,
.cf-tunnel-card h4 {
    margin: 0 0 1rem;
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0;
}

.stat-card h3 {
    font-size: 1.05rem;
}

.cf-tunnel-card {
    min-height: 154px;
    padding: 1rem;
    text-align: left;
}

.cf-tunnel-card h4 {
    font-size: 1rem;
}

.multi-line-stat-section {
    width: 100%;
}

.small-progress-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.35rem;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.small-progress-label span:first-child {
    overflow-wrap: anywhere;
}

.small-progress-value,
.cf-tunnel-card span {
    color: var(--text);
    font-weight: 800;
}

.small-progress-value {
    font-size: 1.05rem;
    white-space: nowrap;
}

.progress-bar-container {
    width: 100%;
    height: 0.56rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.34);
}

.progress-bar {
    width: 0;
    height: 100%;
    border-radius: 999px;
    transition: width 550ms ease, background 250ms ease, box-shadow 250ms ease;
}

.progress-green {
    background: linear-gradient(90deg, #1ecb78, var(--green));
    box-shadow: 0 0 18px rgba(54, 246, 162, 0.45);
}

.progress-yellow {
    background: linear-gradient(90deg, #d6a91e, var(--yellow));
    box-shadow: 0 0 18px rgba(244, 211, 94, 0.4);
}

.progress-orange {
    background: linear-gradient(90deg, #ff6d1f, var(--orange));
    box-shadow: 0 0 18px rgba(255, 138, 61, 0.4);
}

.progress-red {
    background: linear-gradient(90deg, #ff4250, var(--red));
    box-shadow: 0 0 18px rgba(255, 91, 103, 0.42);
}

.metric-stack {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    width: 100%;
}

.cf-tunnel-card p {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin: 0.38rem 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.status-frame {
    height: clamp(760px, 82vh, 1180px);
    min-height: 640px;
}

.status-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 8px;
    background: #0b0f17;
}

.status-frame.is-auto-sized {
    height: var(--status-frame-height, auto);
}

@keyframes spectrum-loop {
    from {
        background-position: 0% 50%;
    }
    to {
        background-position: 100% 50%;
    }
}

@keyframes card-rise {
    from {
        opacity: 0;
        translate: 0 14px;
    }
    to {
        opacity: 1;
        translate: 0 0;
    }
}

@keyframes pulse-dot {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.55;
        transform: scale(1.55);
    }
}

@media (min-width: 640px) {
    .page-main,
    .dashboard-main {
        padding-inline: 1.5rem;
    }

    .hero-zone {
        padding-top: 2.2rem;
    }

    .mega-title {
        font-size: 5.6rem;
    }

    .section-heading h2 {
        font-size: 1.9rem;
    }
}

@media (min-width: 1024px) {
    .mega-title {
        font-size: 7.8rem;
    }

    .hero-zone {
        padding-top: 3rem;
    }
}

@media (max-width: 980px) {
    .dashboard-grid,
    .cf-tunnel-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .top-strip {
        position: sticky;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0.75rem;
        scrollbar-width: none;
    }

    .top-strip::-webkit-scrollbar {
        display: none;
    }

    .status-chip,
    .command-link {
        width: auto;
        flex: 0 0 auto;
    }

    .mega-title {
        font-size: 2.72rem;
    }

    .site-dashboard .mega-title {
        font-size: 2.38rem;
    }

    .connection-line {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .connection-line strong {
        display: block;
        width: 100%;
        margin-top: 0.15rem;
        font-size: 0.72rem;
        line-height: 1.35;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.35rem;
    }

    .service-grid,
    .dashboard-grid,
    .cf-tunnel-grid {
        grid-template-columns: 1fr;
    }

    .ping-grid {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ping-pill {
        width: 100%;
        text-align: center;
    }

    .service-card {
        min-height: 66px;
    }

    .stat-card {
        min-height: 204px;
    }

    .data-table {
        min-width: 620px;
        font-size: 0.84rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.85rem;
    }

    .status-frame {
        height: clamp(620px, 76vh, 980px);
        min-height: 640px;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 1.25rem;
    }
}

@media (max-width: 390px) {
    .mega-title {
        font-size: 2.5rem;
    }

    .site-dashboard .mega-title {
        font-size: 2.18rem;
    }

    .connection-line strong {
        font-size: 0.68rem;
    }
}

.text-uk-text-light,
.text-white {
    color: var(--text);
}

.text-uk-text-muted {
    color: var(--muted);
}

.text-green-500 {
    color: var(--green);
}

.text-orange-500 {
    color: var(--orange);
}

.text-red-500 {
    color: var(--red);
}

.command-button {
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid var(--line);
    color: var(--text);
}

#logout-button {
    font-weight: 800;
}

button.command-link {
    appearance: none;
    -webkit-appearance: none;
}

.command-button::after {
    content: none;
}

.sites-main {
    padding-bottom: 4rem;
}

.site-sites .hero-zone {
    gap: 0.65rem;
    padding: 1.1rem 0 0;
}

.site-sites .mega-title {
    font-size: 3.7rem;
}

.site-sites .connection-line {
    font-size: 0.88rem;
}

.site-sites .section-shell {
    margin-top: 1.05rem;
}

.site-sites .section-heading {
    margin-bottom: 0.7rem;
}

.site-sites .section-heading h2 {
    font-size: 1.25rem;
}

.sites-form-panel {
    padding: 0.9rem;
}

.site-sites .auth-shell {
    width: min(100%, 700px);
    margin-inline: auto;
}

.auth-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.auth-panel-head h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.15rem;
    line-height: 1.12;
    font-weight: 800;
}

.auth-panel-head p {
    margin: 0.22rem 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.auth-badge {
    flex: 0 0 auto;
    min-height: 1.8rem;
    padding: 0.36rem 0.55rem;
    border: 1px solid rgba(54, 246, 162, 0.28);
    border-radius: 8px;
    background: rgba(54, 246, 162, 0.08);
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.68rem;
}

.field-shell,
.toggle-shell,
.route-toggle {
    display: flex;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.field-shell {
    flex-direction: column;
}

.route-toggle {
    min-width: 0;
    align-self: start;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0;
    border: 0;
    margin: 0;
}

.route-toggle-wide {
    grid-column: span 2;
}

.route-toggle legend {
    padding: 0;
    margin: 0;
}

.route-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.18rem;
    min-width: 0;
    min-height: 2.45rem;
    padding: 0.18rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015)),
        rgba(0, 0, 0, 0.28);
}

.route-toggle label {
    position: relative;
    min-width: 0;
    cursor: pointer;
}

.route-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.route-toggle label span {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 0.55rem;
    align-items: center;
    min-height: 2.38rem;
    padding: 0.48rem 0.58rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    line-height: 1.05;
    transition:
        border-color 160ms ease,
        background 160ms ease,
        color 160ms ease,
        box-shadow 160ms ease;
}

.route-toggle strong,
.route-toggle small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-toggle strong {
    grid-column: 1;
    grid-row: 1;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 800;
}

.route-toggle small {
    grid-column: 1;
    grid-row: 2;
    color: rgba(168, 180, 196, 0.78);
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
}

.route-toggle label span::after {
    content: "";
    grid-column: 2;
    grid-row: 1 / span 2;
    flex: 0 0 auto;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: rgba(168, 180, 196, 0.55);
    box-shadow: none;
}

.route-toggle label:hover span {
    background: rgba(255, 255, 255, 0.045);
}

.route-toggle input[value="cloudflare"]:checked + span {
    border-color: rgba(49, 212, 255, 0.42);
    background:
        linear-gradient(135deg, rgba(49, 212, 255, 0.2), rgba(54, 246, 162, 0.065)),
        rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 0 0 1px rgba(49, 212, 255, 0.08);
}

.route-toggle input[value="direct"]:checked + span {
    border-color: rgba(54, 246, 162, 0.44);
    background:
        linear-gradient(135deg, rgba(54, 246, 162, 0.18), rgba(49, 212, 255, 0.08)),
        rgba(0, 0, 0, 0.2);
    box-shadow: inset 0 0 0 1px rgba(54, 246, 162, 0.08);
}

.route-toggle input[value="cloudflare"]:checked + span::after {
    background: var(--cyan);
    box-shadow: 0 0 14px rgba(49, 212, 255, 0.62);
}

.route-toggle input[value="direct"]:checked + span::after {
    background: var(--green);
    box-shadow: 0 0 14px rgba(54, 246, 162, 0.62);
}

.route-toggle input:checked + span small {
    color: var(--text);
}

.route-toggle input:focus-visible + span {
    box-shadow:
        0 0 0 3px rgba(54, 246, 162, 0.12),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.field-shell span,
.toggle-shell span {
    overflow-wrap: anywhere;
}

.field-shell input,
.field-shell select {
    width: 100%;
    min-height: 2.45rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    color: var(--text);
    padding: 0.58rem 0.72rem;
    font: inherit;
    font-size: 0.88rem;
    outline: none;
}

.field-shell input[type="file"] {
    padding: 0.5rem;
}

.field-shell input[type="file"]::file-selector-button {
    min-height: 1.86rem;
    margin-right: 0.72rem;
    padding: 0.34rem 0.62rem;
    border: 1px solid rgba(54, 246, 162, 0.38);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(54, 246, 162, 0.18), rgba(49, 212, 255, 0.08)),
        rgba(0, 0, 0, 0.28);
    color: var(--text);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
}

.field-shell input[type="file"]::file-selector-button:hover {
    border-color: rgba(54, 246, 162, 0.58);
    box-shadow: 0 0 18px rgba(54, 246, 162, 0.14);
}

.domain-field {
    display: flex;
    align-items: stretch;
    min-width: 0;
}

.domain-field input {
    flex: 1 1 auto;
    min-width: 0;
    border-right: 0;
    border-radius: 8px 0 0 8px;
}

.field-shell .domain-suffix {
    display: inline-flex;
    align-items: center;
    min-height: 2.45rem;
    padding: 0.58rem 0.72rem;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: rgba(54, 246, 162, 0.08);
    color: var(--green);
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.field-shell input:focus,
.field-shell select:focus {
    border-color: rgba(54, 246, 162, 0.62);
    box-shadow: 0 0 0 3px rgba(54, 246, 162, 0.12);
}

.field-shell select option {
    background: #0b0f17;
    color: var(--text);
}

.upload-wide {
    grid-column: 1 / -1;
}

.python-fields {
    margin-top: 0.68rem;
}

.form-actions,
.site-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
}

.form-actions {
    margin-top: 0.78rem;
}

.toggle-shell {
    align-items: center;
    min-height: 2.5rem;
}

.toggle-shell input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--green);
}

.inline-message {
    min-height: 1.4rem;
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.inline-message[data-tone="success"] {
    color: var(--green);
}

.inline-message[data-tone="error"],
.site-error {
    color: var(--red);
}

.site-sites .sites-form-panel .command-button:not(.site-action),
.sites-dialog-panel .command-button:not(.site-action) {
    height: 2.18rem;
    min-height: 2.18rem;
    padding: 0 0.72rem;
    font-size: 0.82rem;
    line-height: 1;
    border-color: rgba(54, 246, 162, 0.38);
    background:
        linear-gradient(135deg, rgba(54, 246, 162, 0.2), rgba(49, 212, 255, 0.08)),
        rgba(0, 0, 0, 0.22);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 14px 30px rgba(54, 246, 162, 0.12);
}

.sites-form-panel .command-link::after,
.sites-dialog-panel .command-link::after {
    content: none;
}

.danger-button {
    border-color: rgba(255, 91, 103, 0.4) !important;
    background:
        linear-gradient(135deg, rgba(255, 91, 103, 0.2), rgba(255, 78, 138, 0.08)),
        rgba(0, 0, 0, 0.24) !important;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 14px 30px rgba(255, 91, 103, 0.12) !important;
}

.update-files-panel {
    margin-top: 0.9rem;
    padding: 0.78rem;
    border: 1px solid rgba(49, 212, 255, 0.22);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(49, 212, 255, 0.08), rgba(54, 246, 162, 0.05)),
        rgba(0, 0, 0, 0.18);
}

.update-files-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.68rem;
}

.update-files-head strong {
    color: var(--text);
    font-size: 0.88rem;
    line-height: 1.2;
}

.update-files-head span {
    color: var(--cyan);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.update-files-actions {
    margin-top: 0.68rem;
}

.upload-progress {
    margin-top: 0.78rem;
}

.upload-progress-label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.38rem;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.upload-progress-label span:first-child {
    overflow-wrap: anywhere;
}

.upload-progress-label span:last-child {
    color: var(--text);
    white-space: nowrap;
}

.upload-progress-track {
    width: 100%;
    height: 0.68rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.32);
}

.upload-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--spectrum-loop);
    background-size: 200% 100%;
    box-shadow: 0 0 18px rgba(54, 246, 162, 0.32);
    transition: width 180ms ease;
    animation: spectrum-loop 10s linear infinite;
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.78rem;
    isolation: isolate;
}

.site-card,
.sites-dialog-panel,
.empty-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035)),
        radial-gradient(circle at 0 0, rgba(49, 212, 255, 0.12), transparent 54%);
    box-shadow: var(--shadow);
}

.site-card {
    min-height: 232px;
    padding: 0.86rem;
    animation: none;
}

.site-card > .reveal-light {
    display: none;
}

.service-card > .reveal-light,
.stat-card > .reveal-light,
.cf-tunnel-card > .reveal-light,
.sites-form-panel > .reveal-light,
.sites-dialog-panel > .reveal-light,
.status-frame > .reveal-light,
.ping-pill > .reveal-light {
    display: none;
}

.site-card::before,
.sites-dialog-panel::before,
.empty-panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: var(--spectrum-loop);
    background-size: 200% 100%;
}

.site-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
}

.site-card h3 {
    margin: 0;
    color: var(--text);
    font-size: 0.98rem;
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.site-card p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 0.84rem;
    overflow-wrap: anywhere;
}

.site-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.72rem 0;
}

.site-facts span {
    min-height: 1.72rem;
    padding: 0.32rem 0.48rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.site-facts .route-chip {
    border-color: rgba(49, 212, 255, 0.3);
    background: rgba(49, 212, 255, 0.08);
    color: var(--cyan);
}

.site-facts .route-direct {
    border-color: rgba(54, 246, 162, 0.3);
    background: rgba(54, 246, 162, 0.08);
    color: var(--green);
}

.site-metrics,
.site-resource-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
}

.site-metrics {
    margin: 0.72rem 0;
}

.site-resource-metrics {
    margin: -0.28rem 0 0.72rem;
}

.site-metrics > span,
.site-metrics > button,
.site-resource-item {
    min-width: 0;
    padding: 0.48rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.18);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.site-metrics button {
    appearance: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.site-metrics button:hover,
.site-metrics button:focus-visible {
    border-color: rgba(49, 212, 255, 0.32);
    background: rgba(49, 212, 255, 0.08);
    color: var(--text);
    outline: none;
}

.site-metric-button > span {
    display: block;
}

.site-resource-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 0.38rem;
    align-items: center;
}

.site-metrics strong,
.site-metrics small,
.site-resource-item strong {
    display: block;
    margin-top: 0.18rem;
}

.site-metrics strong,
.site-resource-item strong {
    color: var(--text);
    font-size: 0.78rem;
}

.site-metrics small {
    color: rgba(168, 180, 196, 0.76);
    font-size: 0.61rem;
    font-weight: 800;
    line-height: 1.15;
}

.site-resource-item strong {
    margin-top: 0;
}

.site-resource-label {
    min-width: 0;
}

.site-resource-item small {
    grid-column: 2;
    margin-top: 0.05rem;
    color: rgba(168, 180, 196, 0.78);
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1.1;
}

.resource-icon {
    grid-row: 1 / span 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.55rem;
    height: 1.55rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--green);
}

.resource-icon svg {
    width: 0.95rem;
    height: 0.95rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.resource-icon-ram {
    color: var(--cyan);
}

.resource-icon-disk {
    color: var(--orange);
}

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

.status-warn .status-dot {
    background: var(--yellow);
}

.site-error {
    margin-top: 0.8rem !important;
    font-size: 0.78rem !important;
    font-weight: 700;
}

.empty-panel {
    padding: 2rem 1rem;
    color: var(--muted);
    text-align: center;
    font-weight: 800;
}

.sites-dialog {
    width: min(92vw, 820px);
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
}

.sites-dialog::backdrop {
    background: rgba(5, 7, 12, 0.78);
    backdrop-filter: blur(8px);
}

.sites-dialog-panel {
    padding: 0.95rem;
}

.visitors-dialog-panel {
    width: min(100%, 620px);
}

.visitor-list {
    display: grid;
    gap: 0.55rem;
    margin-top: 1rem;
}

.visitor-row,
.visitor-empty {
    min-width: 0;
    padding: 0.72rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.visitor-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
}

.visitor-row strong,
.visitor-row span,
.visitor-row time {
    display: block;
}

.visitor-row strong {
    color: var(--text);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.visitor-row span,
.visitor-row time,
.visitor-empty {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.visitor-row time {
    flex: 0 0 auto;
    color: var(--green);
}

.icon-command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.delete-confirmation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-top: 0.85rem;
    padding: 0.78rem;
    border: 1px solid rgba(255, 91, 103, 0.28);
    border-radius: 8px;
    background: rgba(255, 91, 103, 0.08);
}

.delete-confirmation strong {
    color: var(--text);
    font-size: 0.88rem;
}

.delete-confirmation p {
    margin: 0.16rem 0 0;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.delete-confirmation-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.delete-confirmation-actions .command-link {
    min-height: 2.08rem;
    padding: 0.42rem 0.62rem;
    font-size: 0.74rem;
}

.site-actions .command-link {
    min-height: 2.12rem;
    padding: 0.48rem 0.62rem;
    font-size: 0.74rem;
}

.site-sites .command-button:disabled {
    cursor: not-allowed;
    opacity: 0.46;
    transform: none;
    box-shadow: none;
}

.site-action {
    --action-accent: var(--cyan);
    position: relative;
    border-color: color-mix(in srgb, var(--action-accent) 38%, var(--line));
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--action-accent) 18%, transparent), rgba(255, 255, 255, 0.045)),
        rgba(0, 0, 0, 0.18);
    color: var(--text);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.035),
        0 10px 24px rgba(0, 0, 0, 0.24);
}

.site-action::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--action-accent);
    box-shadow: 0 0 14px var(--action-accent);
}

.site-action::after {
    content: none;
}

.site-action:hover,
.site-action:focus-visible {
    border-color: color-mix(in srgb, var(--action-accent) 62%, white 12%);
    box-shadow:
        0 16px 36px color-mix(in srgb, var(--action-accent) 18%, rgba(0, 0, 0, 0.34)),
        0 0 0 1px color-mix(in srgb, var(--action-accent) 26%, transparent);
}

.site-action-start {
    --action-accent: var(--green);
}

.site-action-stop {
    --action-accent: var(--red);
}

.site-action-configure {
    --action-accent: var(--orange);
}

.site-action-open {
    --action-accent: var(--cyan);
}

.site-action-copy {
    --action-accent: var(--yellow);
}

.site-sites #upload-form .form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.site-sites #upload-form .upload-wide {
    grid-column: span 2;
}

@media (min-width: 640px) {
    .site-sites .mega-title {
        font-size: 4.8rem;
    }
}

@media (min-width: 1024px) {
    .site-sites .mega-title {
        font-size: 6.15rem;
    }
}

@media (max-width: 640px) {
    .form-grid,
    .sites-grid {
        grid-template-columns: 1fr;
    }

    .site-card-head {
        flex-direction: column;
    }

    .site-metrics,
    .site-resource-metrics {
        gap: 0.36rem;
    }

    .site-actions .command-link {
        width: 100%;
    }

    .delete-confirmation {
        align-items: stretch;
        flex-direction: column;
    }

    .update-files-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }

    .update-files-head span {
        white-space: normal;
    }

    .delete-confirmation-actions .command-link {
        width: 100%;
    }

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

    .site-sites .mega-title {
        font-size: 2.55rem;
    }

    .site-sites #upload-form .form-grid {
        grid-template-columns: 1fr;
    }

    .site-sites #upload-form .upload-wide {
        grid-column: 1;
    }

    .route-toggle-wide {
        grid-column: 1;
    }

    .auth-panel-head {
        flex-direction: column;
        gap: 0.55rem;
    }
}

@media (max-width: 420px) {
    .site-metrics,
    .site-resource-metrics {
        grid-template-columns: 1fr;
    }
}

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